Interface for implementing topology optimization with the simulation from OpenFOAM® and the automatically derived adjoint model from FEniCS/dolfin-adjoint. The FEniCS TopOpt Foam library is able to automatically generate the meshes and degree-of-freedom mapping between OpenFOAM® and FEniCS/dolfin-adjoint.

?️ How to use

1. Enter the OpenFOAM® environment, which depends on where OpenFOAM® is installed. For example,

[]$ source /opt/OpenFOAM-7/etc/bashrc

2. Import FEniCS TopOpt Foam in your Python code:

import fenics_topopt_foam

3. There is an "examples" folder alongside the source code.

│ Observations

Parallelism is implemented in two completely independent levels. This independency is necessary when considering that the mesh partitioning may be different in each platform.

OpenFOAM® level: Parallelism in the OpenFOAM® level can be achieved by setting  "fenics_foam_solver.foam_solver.setToRunInParallel([...])" inside the code.

FEniCS level: Parallelism in the FEniCS level can be achieved by changing the way the code is called, by, for example,

[]$ mpiexec -n 2 python my_code.py
  • FEniCS TopOpt Foam is developed for the "openfoam.org" version of OpenFOAM®, which means that it may possibly not work in other OpenFOAM® versions (although there is some preliminary work in "fenics_topopt_foam/utils/foam_information.py").
  • Setting "surfaceVectorField", "surfaceScalarField", and "TensorField" from FEniCS to OpenFOAM® is currently not supported (i.e., only "volVectorField" and "volScalarField" are supported).
  • FEniCS TopOpt Foam currently supports only triangular/tetrahedral meshes.

?️ Download

1. FEniCS TopOpt Foam is based on Python 3, relies on the installation in a Linux environment, and requires the installation of the following packages:

2. After installing the dependencies, FEniCS TopOpt Foam may be installed through pip:

[]$ pip install --user git+https://github.com/diego-hayashi/[email protected]

? Citation

Please cite the following paper in any publication in which you find FEniCS TopOpt Foam to be useful.

Alonso, D. H., Garcia Rodriguez, L. F., Silva, E. C. N. (2021) Flexible framework for fluid topology optimization with OpenFOAM® and finite element-based high-level discrete adjoint method (FEniCS/dolfin-adjoint). Structural and Multidisciplinary Optimization. Accepted for publication.

?️ License

FEniCS TopOpt Foam is licensed under the GNU General Public License (GPL), version 3.

GitHub - diego-hayashi/fenics_topopt_foam: Topology optimization combining OpenFOAM® and FEniCS/dolfin-adjoint.
Topology optimization combining OpenFOAM® and FEniCS/dolfin-adjoint. - GitHub - diego-hayashi/fenics_topopt_foam: Topology optimization combining OpenFOAM® and FEniCS/dolfin-adjoint.