morphogen.optimization.run

Configuration files of topology optimizations (morphogen optimize).

Example:

optimization:
  objective: poisson_ratio      # bulk_modulus, shear_modulus, conductivity, target
  volume_fraction: 0.35
  grid: [64, 64, 1]             # voxels of the cell (nz = 1: planar, prismatic cell)
  cell_size: 1.0                # edge of the cell along x
  material: {young: 1.0, poisson: 0.3}
  method: mma                   # oc, mma, beso, hca
  filter_radius: 3.0            # voxels
  projection: 8.0               # final sharpness of the Heaviside projection
  symmetry: cubic               # none, orthotropic, cubic (square in 2D)
  iterations: 300
seed: 1
outputs:
  directory: out/auxetic
  name: cell
  image: [vti]                  # thresholded design
  density: [vti]                # density field
  geometry: [json]              # lattice microstructure: re-voxelize, mesh, homogenize
  check_refinement: 2           # re-evaluate the design on a grid twice as fine (0: no)

Results: optimization.json (settings, homogenized tensors of the density and of the thresholded designs, tensor and binary_tensor, with their compliances compliance and binary_compliance for the elastic designs, S = C^-1 in the notation stated, engineering constants, convergence, hinges, and the constants of the design on the finer grid) and history.csv.

class morphogen.optimization.run.OptimizationConfig(optimization: 'CellOptimization', seed: 'int | None', directory: 'Path', name: 'str', image: 'list[str]', density: 'list[str]', geometry: 'list[str]', source: 'dict', check_refinement: 'int' = 2)[source]

Bases: object

morphogen.optimization.run.load_optimization_config(source, *, base_dir=None) → OptimizationConfig[source]

Validate an optimization configuration (file path or mapping).

morphogen.optimization.run.write_results(design: CellDesign, cfg: OptimizationConfig) → Path[source]

Write the design files, optimization.json and history.csv.

morphogen.optimization.run.run_optimization(cfg: OptimizationConfig, callback=None) → tuple[CellDesign, Path][source]

The topology optimization of a configuration: the optimized cell (checked on a refined grid with check_refinement) and the folder of its results; callback follows the iterations.