morphogen.optimization.cell

Homogenized properties of a periodic voxel cell with graded moduli, and their sensitivities.

Every voxel e is a trilinear element of the base material with its stiffness (or conductance) scaled by s_e: K = sum_e s_e K0_e. For each unit macroscopic strain E^i (temperature gradient in conduction), the periodic fluctuation w^i solves K w^i = -sum_e s_e K0_e u_aff^i (FFT-preconditioned conjugate gradients, see morphogen.homogenization.fft; previous solutions are reused as initial guesses). With u^i = u_aff^i + w^i, the homogenized tensor and its derivatives are the mutual energies

C_ij = (1 / V) sum_e s_e u^i_e . K0 u^j_e, dC_ij / ds_e = (1 / V) u^i_e . K0 u^j_e

(the problem is self-adjoint: no adjoint solve is needed; Sigmund 1994, Andreassen and Andreasen 2014). Elastic tensors use the Voigt order 11, 22, 33, 23, 31, 12 with engineering shear strains.

morphogen.optimization.cell.apply_scaled(nx, ny, nz, nd, scale, mat, w, out)[source]

out = sum_e scale_e K0 w_e on the periodic node grid (loop over nodes).

morphogen.optimization.cell.scaled_load(nx, ny, nz, nd, scale, v, out)[source]

out = -sum_e scale_e v (v: element vector K0 u_aff, the same in every voxel).

morphogen.optimization.cell.element_energies(nx, ny, nz, nd, mat, w, uaff, out)[source]

out[p, e] = u^i_e . K0 u^j_e for the pairs p = (i, j) of load cases (upper triangle, row by row); w[i] are the fluctuations, uaff[i] the affine element vectors.

class morphogen.optimization.cell.PeriodicCell(shape, spacing=(1.0, 1.0, 1.0), *, physics: str = 'elastic', material: Material | None = None, cases=None, tol: float = 1e-07, maxiter: int | None = None)[source]

Bases: object

Periodic cell of shape voxels of edge spacing made of a base material whose moduli are scaled voxel by voxel.

physics is elastic (stiffness tensor 6 x 6) or thermal (conductivity tensor 3 x 3). cases selects the unit loadings solved (default: all); the tensor entries between unsolved cases are NaN.

property n_cases: int
pairs() → list[tuple[int, int]][source]

Pairs of solved cases, in the order of the energies (upper triangle).

solve(scale) → tuple[ndarray, ndarray][source]

Homogenized tensor and the mutual energies (n_pairs, n_voxels), whose products with 1 / V are the derivatives dC_ij / ds_e.

derivative(energies: ndarray, i: int, j: int) → ndarray[source]

dC_ij / ds_e for all voxels (i, j: case indices of the full tensor).