morphogen.optimization.topology¶
Topology optimization of periodic cells by inverse homogenization.
The cell is a grid of voxels of relative density rho (SIMP: stiffness
eps + (1 - eps) rho^p times the base material, Bendsøe 1989). Its homogenized tensor
(FFT solver, morphogen.optimization.cell) and the exact derivatives give the
objective and its gradient (Sigmund 1994). Objectives:
bulk_modulus,shear_modulusmaximize the mean of the normal block of the stiffness tensor (bulk modulus of a cubic material) or of its shear moduli;
poisson_ratiominimize
mean(C_ij, i != j) / mean(C_ii)over the normal block (C_12 / C_11for square or cubic symmetry: the Poisson’s ratio under uniaxial strain), with the mean normal stiffness kept abovemin_stiffnesstimes the Young’s modulus of the base material (a second constraint, mma only): negative Poisson’s ratios (auxetics);conductivitymaximize the mean of the diagonal of the conductivity tensor;
targetreach a target stiffness tensor (least squares, NaN entries ignored).
Planar cells (one voxel through the thickness, prismatic microstructures) use the in-plane components. The design is constrained to a volume fraction, regularized by a density filter, a Heaviside projection with continuation and a symmetry group.
Methods: oc (optimality criteria, monotone objectives), mma (method of moving
asymptotes, any objective), beso (bi-directional evolutionary structural
optimization: solid or void voxels, the volume decreasing to the target, Huang and Xie
2010) and hca (hybrid cellular automaton, Tovar et al. 2006: every voxel adjusts its
density to bring the mean stimulus of its Moore neighbourhood to a common set point).
- morphogen.optimization.topology.MONOTONE = ('bulk_modulus', 'shear_modulus', 'conductivity')¶
Monotone objectives (negative sensitivities), as needed by oc, beso and hca.
- class morphogen.optimization.topology.CellDesign(density: ndarray, design: ndarray, tensor: ndarray, binary_tensor: ndarray, objective: float, volume_fraction: float, binary_fraction: float, iterations: int, converged: bool, history: dict[str, list]=<factory>, settings: dict = <factory>, time_s: float = 0.0, check: dict = <factory>)[source]¶
Bases:
objectResult of a topology optimization.
- check: dict¶
Constants on a finer grid (
refinement,properties), when checked.
- property planar: bool¶
- property binary: ndarray¶
voxels of density above 1/2.
- Type:
Black-and-white design
- property hinges: int¶
Hinges of the black-and-white design (see
count_hinges()).
- properties(tensor: ndarray | None = None) dict[str, float][source]¶
Engineering constants of the thresholded design (or of
tensor).
- refined_properties(factor: int = 2, *, tol: float = 1e-06) dict[str, float][source]¶
Engineering constants of the design voxelized
factortimes finer from the level set of its densities, with true voids. Trilinear voxels overestimate thin members and hinges: moduli that drop on refinement call for a finer grid, a larger filter radius or a softer projection.
- to_microstructure(domain=None, *, smoothing: float = 0.0)[source]¶
The design as a lattice microstructure of the periodic cell: phase 1 where the density exceeds 1/2, the density field giving smooth interfaces (level set), optionally smoothed by a Gaussian of
smoothingvoxels (rounding the staircases of nearly black-and-white designs, for conforming meshes and sections).
- morphogen.optimization.topology.count_hinges(binary) int[source]¶
Number of 2 x 2 blocks (2 x 2 x 2 in 3D) of a periodic black-and-white design whose solid voxels touch only along an edge or at a corner. Trilinear voxels make such contacts stiff hinges, which a continuum does not have (planar designs: one voxel through the thickness).
- morphogen.optimization.topology.tensor_properties(c: ndarray, *, planar: bool = False) dict[str, float][source]¶
Moduli of a stiffness (6 x 6) or conductivity (3 x 3) tensor.
Elastic: bulk modulus (mean of the normal block), shear modulus (mean of the shear diagonal), Young’s moduli and Poisson’s ratio
nu_12from the compliance of the normal block (the full compliance for orthotropic cells); planar cells use the in-plane block (plane strain).
- morphogen.optimization.topology.initial_density(micro, shape, *, phase: int = 1, supersampling: int = 4) ndarray[source]¶
The densities of a microstructure on the grid of a cell optimization (
shape;nz = 1: its middle section, a slab one voxel thick): the fraction ofphasein each voxel (supersampling**3samples), to start an optimization from it (theinitialofCellOptimization).
- class morphogen.optimization.topology.CellOptimization(shape, volume_fraction: float, *, objective: str = 'bulk_modulus', material: Material | None = None, voxel_size: float = 1.0, method: str = 'mma', penalty: float = 3.0, filter_radius: float = 1.5, projection: float = 0.0, symmetry: str = 'cubic', stiffness_floor: float = 0.001, iterations: int = 200, tolerance: float = 0.01, move: float = 0.2, target=None, min_stiffness: float = 0.05, evolution_rate: float = 0.02, initial='centered_void', solver_tol: float = 0.0001)[source]¶
Bases:
objectSettings of the optimization of a periodic cell of
shapevoxels (nz = 1for planar cells), andrun().- objective_value(tensor, cell: PeriodicCell, energies, iteration: int)[source]¶
Objective (to minimize), its derivatives with respect to the voxel scales, and the extra constraints
g <= 0as (value, derivatives) pairs.
- initial_design(rng: Generator) ndarray[source]¶
centered_void: a void ball (disc) of radius 0.3 cell edges in a uniform matrix of the target volume;random: noise around the volume fraction;uniform: the volume fraction everywhere (a stationary point: only useful with asymmetric objectives); or the densities given (e.g.initial_density()of a microstructure), which the symmetry of the design then averages.
- run(rng: Generator | None = None, callback=None) CellDesign[source]¶
Optimize;
callback(iteration, density, objective)is called every iteration, and stops the optimization there when it returns True (the design so far, not converged).