morphogen.homogenization.fft

FFT-based homogenization of periodic voxel images.

Each voxel is a trilinear hexahedron and the fluctuation w of u = E x + w (T = G . x + w) is periodic on the grid. The equilibrium equations K w = f are solved by conjugate gradients without assembling K (each product loops over the voxels), preconditioned by the inverse of the stiffness K0 of a homogeneous reference medium. K0 is a circulant operator: it is diagonal (3 x 3 blocks in elasticity) in Fourier space, and its inverse costs a few FFTs (Schneider, Merkert & Kabel 2017, “FFT-based homogenization for microstructures discretized by linear hexahedral elements”, Int. J. Numer. Meth. Engng 109, 1461-1489). This is a Lippmann-Schwinger scheme whose discrete Green operator is that of trilinear elements: the fields have no ringing artefacts, and pores (zero stiffness) are handled without an ersatz material.

The number of iterations grows with the contrast between the phases (as its square root, at worst); the memory is a few vectors of the size of the grid. With device="gpu" the conjugate gradients run on the GPU (morphogen.homogenization. gpu); the solutions are those of the CPU to the tolerance of the iterations.

morphogen.homogenization.fft.apply_operator(nx, ny, nz, nd, group, mats, w, out)[source]

out = K w on the periodic grid; mats[g] is the element matrix of material g of the voxels with group g (-1: no stiffness). Loops over nodes, so no atomics are needed.

class morphogen.homogenization.fft.FourierPreconditioner(shape, ka, kb, coef_a: float, coef_b: float, nd: int)[source]

Bases: object

Inverse of a homogeneous reference operator, applied in Fourier space: the element matrix coef_a * ka + coef_b * kb (see from_element()).

classmethod from_element(shape, k_ref, nd: int) → FourierPreconditioner[source]

Preconditioner of the homogeneous medium of element matrix k_ref.

morphogen.homogenization.fft.reference_moduli(matrices, isotropic: bool) → tuple[float, float][source]

Lame coefficients of the isotropic reference medium of the FFT preconditioner: the mean of the extreme moduli of the materials (bulk moduli and shear stiffnesses of the crystals).

class morphogen.homogenization.fft.FFTElasticProblem(image: VoxelImage, materials: dict[int, Material], bc: str = 'periodic', *, tol: float = 1e-08, maxiter: int | None = None, reference: tuple[float, float] | None = None, grains=None, orientations=None, device: str = 'cpu', physics: str | None = None)[source]

Bases: _FFTProblem

Periodic linear elasticity of a voxel image (FFT-preconditioned CG); crystals are turned by the orientations of their grains (grains: label image).

class morphogen.homogenization.fft.FFTThermalProblem(image: VoxelImage, materials: dict[int, Material], bc: str = 'periodic', *, tol: float = 1e-08, maxiter: int | None = None, reference: tuple[float, float] | None = None, grains=None, orientations=None, device: str = 'cpu', physics: str | None = None)[source]

Bases: _FFTProblem

Periodic steady heat conduction of a voxel image (FFT-preconditioned CG), or with physics any other transport phenomenon of a scalar potential (TRANSPORT: "electrical", "dielectric", "magnetic", "diffusion"), with the coefficient of the materials for it; the phases whose coefficient is zero (insulators) are voids.