The Problem class contains all information of the underlying topology optimization (TO) problem one intends to solve. We focus on isotropic materials that are linearly elastic. This comprises most common materials, e.g., including steel and aluminum. Since we perform optimization on structured grids, all information is either in scalar or in tensor form. This makes data compatible with DL applications since it allows for a shape-consistent tensor representation. Let $(n_x, n_y, n_z)$ be the number of voxels in each spacial direction, i.e. the shape of the TO problem.

We can create unique problem objects characterized by the following inputs:

  • Scalar material properties that define the physical proporties of the underlying material. These include:

    • Young's modulus $E>0$
    • Poisson's ratio $\nu\in [0, 0.5]$
    • The yield stress $\sigma_{ys}>0$
  • A three-dimensional vector $h$ that defines the voxel sizes in meters in each direction.

  • A binary ($3\times n_x \times n_y \times n_z$)-tensor called $\Omega_\text{dirichlet}$ which we use to encode the presence of directional homogeneous Dirichlet boundary conditions for every voxel. These boundary conditions determine where the structure is "locked" in place, i.e. where the displacements are fixed at 0. $1$s indicate the presence, and $0$s the absence of homogeneous Dirichlet boundary conditions. Currently, we do not support non-homogeneous Dirichlet boundary conditions (i.e. voxels that have displacements fixed at some value $\neq 0$) since we believe that they are not required for most TO tasks.

  • A ($1\times n_x \times n_y \times n_z$)-tensor called $\Omega_\text{design}$ containing values $\in \left\lbrace 0,1,-1\right\rbrace$ that we use to encode design space information. We use $0$s and $1$s to constrain voxel densities to be $0$ or $1$, respectively. Entries of $-1$ indicate a lack of density constraints, which signifies that the density in that voxel can be freely optimized.

  • A ($3\times n_x \times n_y \times n_z$)-tensor called $F$, which encodes external forces given in $\text{N}/\text{m}^3$. The three channels correspond to the force magnitudes in each spacial dimension. For voxels that have external loads assigned to them we automatically enforce the corresponding density value to be $1$.

class Problem[source]

Problem(E:float, ν:float, σ_ys:float, h:Union[float, list], Ω_dirichlet:Tensor, Ω_design:Tensor, F:Tensor, pde_solver:dl4to.pde.PDESolver=None, name:str=None, device:str='cpu', dtype:dtype=torch.float32, restrict_density_for_voxels_with_applied_forces:bool=True)

A class containing all parameters for defining a topology optimization problem.

Type Default Details
E float The Young's modulus of the material. Given in Pa.
ν float The Poisson's ratio of the material. Dimensionless.
σ_ys float The yield stress σ_ys denotes the critical von Mises stress at which the material starts yielding. Given in Pa.
h typing.Union[float, list] The length of the edges of the cuboid voxels. Equal to the discretisation step size in each coordinate direction.
Ω_dirichlet Tensor A tensor denoting the presence of homogeneous Dirichlet boundary conditions in each voxel in each coordinate direction.
Ω_design Tensor A tensor denoting the kind of design space assigned to each voxel. Values of "0" and "1" indicate a material density fixed at 0 or 1, respectively. "-1" indicates the absence of constraints, i.e., the voxel density can be freely optimized.
F Tensor A tensor denoting the forces applied to each voxel in each coordinate direction. Given in N/m^3.
pde_solver dl4to.pde.PDESolver None A dl4to PDE Solver object that is attached to this problem.
name str None The name of the problem
device str cpu The device that this problem is to be stored on. Possible options are "cpu" and "cuda".
dtype dtype torch.float32 The datatype of the problem.
restrict_density_for_voxels_with_applied_forces bool True Determines whether Ω_design should be set to "1" for voxels that have forces applied to them. Should be turned of in case of volumetric forces like gravity that are applied to all voxels.

Methods

Problem.clone[source]

Problem.clone()

Returns a deepcopy of the Problem object.

Problem.plot[source]

Problem.plot(display:bool=True, file_path:str=None, camera_position:Union[list, tuple]=(0, 0.1, 0.12), use_pyvista:bool=False, window_size:Union[tuple, list]=(800, 800), smooth_iters:int=0, show_colorbar:bool=True, show_axislabels:bool=False, show_ticklabels:bool=False, export_png:bool=False)

Renders 3D figures that display the location of Dirichlet boundaries, design space and forces.

Type Default Details
display bool True Whether the figure is displayed.
file_path str None Path where the figure is saved.
camera_position typing.Union[list, tuple] (0, 0.1, 0.12) x, y, and z coordinates of the camera position.
use_pyvista bool False Whether to use pyvista for plotting. If False, then plotly is used. Pyvista generates better looking visualizations, but does not support basic features like colorbars, title display and saving.
window_size typing.Union[tuple, list] (800, 800) The size of the window that displays the plot. Only has an effect if use_pyvista=True.
smooth_iters int 0 The number of smoothing iterations for better looking visualizations. Only has an effect if use_pyvista=True.
show_colorbar bool True Determines whether a reference colorbar is displayed for the plotted voxel color values.
show_axislabels bool False Whether the 3d axes are labelled with their dimensions.
show_ticklabels bool False Whether the 3d axes ticks are displayed and labeled.
export_png bool False Whether the figure is exported and saved as a png file, in addition to the standard html format.

Examples

import torch

# scalar material properties
E = 7e10 # Young's modulus (in Pascal)
ν = .3 # Poisson's ratio
σ_ys = 4.5e8 # Yield stress (in Pascal)

shape = [40, 4, 8] # number of voxels in x, y and z direction
h = [0.0250, 0.0250, 0.0250] # spacial dimensions of each voxel in x, y and direction (in meters)

# define external forces
F = torch.zeros(3, *shape)
F[-1, :, :, -1] = -4e7 # external forces (in Newton)

# define locations of homogeneous Dirichlet conditions
Ω_dirichlet = torch.zeros(3, *shape)
Ω_dirichlet[:, 0, :, :] = 1

# define design space
Ω_design = -torch.ones(1, *shape) # -1s indicate that these voxels can be freely optimized
Ω_design[:,:2,:,:] = 1. # we set densities to 1 where there are Dirichlet boundary conditions
Ω_design[:,:,:,-2:] = 1. # we set densities to 1 where there are external forces

problem = Problem(E, ν, σ_ys, h, Ω_dirichlet, Ω_design, F)
camera_position = (0, 0.35, 0.2)
problem.plot(camera_position=camera_position,
             show_axislabels=True,
             show_ticklabels=True,
             display=False)

dirichlet design force_loc force_dir