Package: cashocs
cashocs is a finite element software for the automated solution of shape optimization and optimal control problems. It is used to solve problems in fluid dynamics and multiphysics contexts. Its name is an acronym for computational adjoint-based shape optimization and optimal control software and the software is written in Python.IntroductionInstallationVia conda-forgeManual InstallationUsageCitingLicenseContact / AboutIntroductioncashocs is based on the finite element packageFEniCSand uses its high-level unified form language UFL
to treat general PDE constrained optimization problems, in particular, shape
optimization and optimal control problems.For some applications and further information about cashocs, we also refer to the websiteFluid Dynamical Shape Optimization with cashocs.Note, that we assume that you are (at least somewhat) familiar with PDE
constrained optimization and FEniCS. For a introduction to these topics,
we can recommend the textbooksOptimal Control and general PDE constrained optimizationHinze, Ulbrich, Ulbrich, and Pinnau - Optimization with PDE ConstraintsTröltzsch - Optimal Control of Partial Differential EquationsShape OptimizationDelfour and Zolesio - Shapes and GeometriesSokolowski and Zolesio - Introduction to Shape OptimizationTopology OptimizationSokolowski and Novotny - Topological Derivatives in Shape OptimizationAmstutz - An Introduction to the Topological DerivativeFEniCSLogg, Mardal, and Wells - Automated Solution of Differential Equations by the Finite Element MethodThe FEniCS demosHowever, thecashocs tutorialalso gives many references either
to the underlying theory of PDE constrained optimization or to relevant demos
and documentation of FEniCS.An overview over cashocs and its capabilities can be found inBlauth - cashocs: A Computational, Adjoint-Based
Shape Optimization and Optimal Control Software. Moreover, note that
the full cashocs documentation is available athttps://cashocs.readthedocs.io/en/latest.InstallationVia conda-forgecashocs is available via the anaconda package manager, and you can install it
withcondainstall-cconda-forgecashocsAlternatively, you might want to create a new, clean conda environment with the
commandcondacreate-n<ENV_NAME>-cconda-forgecashocswhere<ENV_NAME>is the desired name of the new environment.NoteGmshis now (starting with release 1.3.2) automatically installed with anaconda.Manual InstallationFirst, installFEniCS, version 2019.1.
Note that FEniCS should be compiled with PETSc and petsc4py.Then, installmeshio, with ah5pyversion that matches the HDF5 version used in FEniCS, andmatplotlib.
The version of meshio should be at least 4, but for compatibility it is recommended to use meshio 4.4.You might also want to installGmsh, version 4.8.
cashocs does not necessarily need this to work properly,
but it is required for the remeshing functionality.NoteIf you are having trouble with using the conversion tool cashocs-convert from
the command line, then you most likely encountered a problem with hdf5 and h5py.
This can (hopefully) be resolved by following the suggestions fromthis thread,
i.e., you should try to installmeshiousing the commandpip3installmeshio[all]--no-binary=h5pyYou can install cashocs via thePYPIas followspip3installcashocsYou can install the newest (development) version of cashocs withpip3installgit+https://github.com/sblauth/cashocs.gitTo get the latest (development) version of cashocs, clone this repository with git and install it with pipgitclonehttps://github.com/sblauth/cashocs.gitcdcashocspip3install.NoteTo verify that the installation was successful, run the tests for cashocs
withpython3-mpytesttests/or simplypytesttests/from the source / repository root directory. Note that it might take some
time to perform all of these tests for the very first time, as FEniCS
compiles the necessary code. However, on subsequent iterations the
compiled code is retrieved from a cache, so that the tests are singificantly
faster.UsageThe complete cashocs documentation is available herehttps://cashocs.readthedocs.io/en/latest. For a detailed
introduction, see thecashocs tutorial. The python source code
for the demo programs is located inside the “demos” folder.CitingIf you use cashocs for your research, please cite the following paperscashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software
Sebastian Blauth
SoftwareX, Volume 13, 2021
https://doi.org/10.1016/j.softx.2020.100646as well asVersion 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software
Sebastian Blauth
SoftwareX, Volume 24, 2023
https://doi.org/10.1016/j.softx.2023.101577Additionally, if you are using the nonlinear conjugate gradient methods for shape optimization implemented in cashocs, please cite the following paperNonlinear Conjugate Gradient Methods for PDE Constrained Shape Optimization Based on Steklov--Poincaré-Type Metrics
Sebastian Blauth
SIAM Journal on Optimization, Volume 31, Issue 3, 2021
https://doi.org/10.1137/20M1367738If you are using the space mapping methods for shape optimization, please cite the paperSpace Mapping for PDE Constrained Shape Optimization
Sebastian Blauth
SIAM Journal on Optimization, Volume 33, Issue 3, 2023
https://doi.org/10.1137/22M1515665and if you are using the topology optimization methods implemented in cashocs, please cite the paperQuasi-Newton Methods for Topology Optimization Using a Level-Set Method
Sebastian Blauth and Kevin Sturm
Structural and Multidisciplinary Optimization, Volume 66, 2023
https://doi.org/10.1007/s00158-023-03653-2If you are using BibTeX, you can use the following entries@Article{Blauth2021cashocs,author={Sebastian Blauth},journal={SoftwareX},title={{cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software}},year={2021},issn={2352-7110},pages={100646},volume={13},doi={https://doi.org/10.1016/j.softx.2020.100646},keywords={PDE constrained optimization, Adjoint approach, Shape optimization, Optimal control},}@Article{Blauth2023Version,author={Sebastian Blauth},journal={SoftwareX},title={{Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software}},year={2023},issn={2352-7110},pages={101577},volume={24},doi={https://doi.org/10.1016/j.softx.2023.101577},keywords={PDE constrained optimization, Shape optimization, Topology optimization, Space mapping},}@Article{Blauth2021Nonlinear,author={Sebastian Blauth},journal={SIAM J. Optim.},title={{Nonlinear Conjugate Gradient Methods for PDE Constrained Shape Optimization Based on Steklov-Poincaré-Type Metrics}},year={2021},number={3},pages={1658--1689},volume={31},doi={10.1137/20M1367738},fjournal={SIAM Journal on Optimization},}@Article{Blauth2023Space,author={Blauth, Sebastian},journal={SIAM J. Optim.},title={{Space Mapping for PDE Constrained Shape Optimization}},year={2023},issn={1052-6234,1095-7189},number={3},pages={1707--1733},volume={33},doi={10.1137/22M1515665},fjournal={SIAM Journal on Optimization},mrclass={49Q10 (35Q93 49M41 65K05)},mrnumber={4622415},}@Article{Blauth2023Quasi,author={Blauth, Sebastian and Sturm, Kevin},journal={Struct. Multidiscip. Optim.},title={{Quasi-Newton methods for topology optimization using a level-set method}},year={2023},issn={1615-147X,1615-1488},number={9},pages={203},volume={66},doi={10.1007/s00158-023-03653-2},fjournal={Structural and Multidisciplinary Optimization},mrclass={99-06},mrnumber={4635978},}Licensecashocs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.cashocs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with cashocs.  If not, seehttps://www.gnu.org/licenses/.Contact / AboutI’mSebastian Blauth, a scientific employee atFraunhofer ITWM. I have developed this project as part of my PhD thesis.
If you have any questions / suggestions / feedback, etc., you can contact me
viasebastian.blauth@itwm.fraunhofer.de. For more information, visit my website athttps://sblauth.github.io/.