This repository implements a 3D level-set based topology optimisation framework for metamaterial design. The overall idea is to combine:
- a periodic homogenisation procedure to compute the effective stiffness tensor of a unit-cell microstructure;
- a material objective defined from the homogenised stiffness, which drives the design toward a target mechanical response;
- a topological-derivative / level-set update scheme that iteratively modifies the material distribution.
The implementation is organised around three core files:
- main_3d_UTI.py: the main optimisation loop and the outer update logic;
- definition_3d_UTI.py: PDE definitions, homogenisation, material modelling, and the cost function / gradient;
- init_3d_UTI.py: numerical parameters, optimisation settings, and material / solver configuration.
The workflow can be summarised as follows:
- Initialise a 3D periodic unit cell and a level-set field.
- Convert the level-set field into a two-phase material distribution (solid / void).
- Solve periodic cell problems for several macroscopic strain loading cases to obtain the homogenised stiffness tensor
$C_{\mathrm{hom}}$ . - Evaluate a scalar cost function from
$C_{\mathrm{hom}}$ and compute its gradient with respect to the stiffness tensor. - Use the chain-rule-based topological derivative to obtain a sensitivity field on the design domain.
- Update the level-set field through a level-set / line-search based optimisation step.
- Repeat until convergence, optionally with mesh refinement and volume-control continuation.
In other words, the method is a topology optimisation loop in which the design variable is the level-set field, while the physical response is evaluated through periodical homogenisation.
In definition_3d_UTI.py, the code builds a periodic 3D unit-cell setting and solves representative cell problems under different macroscopic strain states. The resulting homogenised stiffness tensor is then used as the basis for the objective evaluation.
In main_3d_UTI.py, the optimisation loop uses the sensitivities obtained from the cost function, updates the level-set field, and performs a line-search / step-size control strategy to improve stability.
In init_3d_UTI.py, the user can tune:
- material properties such as Young's modulus and Poisson ratio;
- optimisation and line-search settings;
- volume-continuation / stage-control behaviour;
- mesh resolution and refinement strategy.
The current implementation is specifically set up for an uncoupled transverse isotropic (UTI) design objective.
The objective is constructed from representative stiffness components in a tetragonal / z-rot4 design space, including quantities such as:
-
$C_{11}^{t}$ ,$C_{12}^{t}$ ,$C_{13}^{t}$ ,$C_{33}^{t}$ ,$C_{44}^{t}$ ,$C_{66}^{t}$ ; - the UTI-related invariants
$h_b$ ,$h_a$ ,$H$ ; - a transverse-isotropy penalty term based on the residual
$R_{TI}$ .
The current objective is implemented in definition_3d_UTI.py through functions such as:
uti_ratio_termgrad_uti_ratio_termti_penalty_termgrad_ti_penalty_termPhi_utigrad_Phi_uti
In its current form, the total cost is approximately:
where
and
This framework is currently configured for the UTI objective. If you want to optimise for a different material class or a different target property, the main optimisation machinery does not need to be rewritten. Instead, you should replace the cost function and its gradient in definition_3d_UTI.py, especially the functions listed above.
In practice, for a new case you would:
- define the new scalar objective from the homogenised stiffness tensor;
- derive or implement the corresponding gradient with respect to the stiffness components;
- replace the current UTI-related functions in definition_3d_UTI.py;
- keep the rest of the level-set update and homogenisation pipeline unchanged.
The main entry point is main_3d_UTI.py. After installing the required dependencies (especially FEniCS), run the script to start the optimisation loop.
This project provides a 3D topology optimisation framework for metamaterial design based on:
- periodic homogenisation;
- topological derivative / level-set update;
- a currently implemented UTI-specific cost function.
It is therefore well suited for UTI-type design targets, while remaining extensible to other material objectives by replacing the cost function module.