class FDM[source]

FDM(θ_min:float=1e-06, use_forward_differences:bool=True, assemble_tensors_when_passed_to_problem:bool=True, padding_depth:int=0) :: UnpaddedFDM

A PDE solver for linear elasticity that uses the finite differences method (FDM) with padding.

Type Default Details
θ_min float 1e-06 The minimal value in the stiffness matrix. For numerical reasons we can not allow 0s, since they may lead to singular matrices.
use_forward_differences bool True Whether to use forward differences or central differences.
assemble_tensors_when_passed_to_problem bool True Whether the PDE solver methods pre-assembles any tensors or arrays before solving the PDE for a concrete problem.
padding_depth int 0 The depth of the padding surrounding the design space. In some cases, it is recommended to increase the padding depth to 2 to improve results but also increase running time.
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [1], in <cell line: 2>()
      1 #export
----> 2 class FDM(UnpaddedFDM):
      3     """
      4     A PDE solver for linear elasticity that uses the finite differences method (FDM) with padding.
      5     """
      6     def __init__(self, θ_min:float=1e-6, # The minimal value in the stiffness matrix. For numerical reasons we can not allow 0s, since they may lead to singular matrices.
      7                  use_forward_differences:bool=True, # Whether to use forward differences or central differences.
      8                  assemble_tensors_when_passed_to_problem:bool=True, # Whether the PDE solver methods pre-assembles any tensors or arrays before solving the PDE for a concrete problem.
      9                  padding_depth:int=0 # The depth of the padding surrounding the design space. In some cases, it is recommended to increase the padding depth to 2 to improve results but also increase running time.
     10                 ):

NameError: name 'UnpaddedFDM' is not defined

UnpaddedFDM.assemble_tensors[source]

UnpaddedFDM.assemble_tensors(problem:dl4to.problem.Problem)

Assembles all FDM tensors from the problem object that can be pre-built without knowledge of the density distribution θ. This may take some time but makes future PDE evaluations for this problem much faster.

Type Default Details
problem dl4to.problem.Problem The problem for which the tensors should be assembled.

FDM.solve_pde[source]

FDM.solve_pde(solution:dl4to.solution.Solution, p:float=1.0, binary:bool=False, get_padded:bool=False)

Solves the pde for solution and SIMP exponent p. Returns three torch.Tensor objects: displacements u, stresses σ and von Mises stresses σ_vm.

Type Default Details
solution dl4to.solution.Solution The solution for which the PDE should be solved.
p float 1.0 The SIMP exponent when solving the PDE. Should usually be left at its default value of 1..
binary bool False Whether the densities in the solution should be binarized before solving the PDE.
get_padded bool False Whether the density should be padded before the PDE is solved. Takes a bit longer to solve, but is more accurate.