LeToP implements the level set method in topology optimization. It combines the automated calculation of shape derivatives in Firedrake and pyadjoint with the Null space optimizer to find the optimal design. The level set in advected with a Hamilton-Jacobi equation and properly reinitialized to maintain the signed distance property.
The user interface is very close to pyadjoint to allow for easy compatibility.
Install with
pip3 install .
at the project's root directory and with the Firedrake's virtual environment activated.
LeTop depends on the 10.5281/zenodo.7017917, which can be simply installed by passing the flag --doi 10.5281/zenodo.7017917
to firedrake-install
.
src/C/umfpack.c:23:10: fatal error: 'umfpack.h' file not found
The package cvxopt
cannot find the suitesparse library, which should be within PETSc (check the option --download-suitesparse
was passed). Create the following environment variables before installing letop
:
export CVXOPT_SUITESPARSE_LIB_DIR=$PETSC_DIR/$PETSC_ARCH/lib
export CVXOPT_SUITESPARSE_INC_DIR=$PETSC_DIR/$PETSC_ARCH/include
LLNL Release Number: LLNL-CODE-817098
Make use of the pyadjoint context manager stop_annotating()
and the decorator no_annotations
for:
- When using
interpolate()
orproject
from Firedrake as they might annotate unnecessary operations and result in wrong the shape derivatives. - Similarly, when extending LeToP routines, make sure you are not annotating additional operations as Firedrake annotates everything by default when importing
firedrake_adjoint
. - The shape velocities should be zeroed on the Dirichlet and Neumann boundaries. Use the
RegularizationSolver
boundary conditions to this effect. - Add fd.parameters["form_compiler"]["quadrature_degree"] = 4 to ensure quadrature does not go too high due to the heaviside function (used to mark the subdomains)
- The isocontours of the level set must have enough mesh resolution, otherwise the reinitialization solver might fail.