Skip to content

Latest commit

 

History

History
executable file
·
267 lines (173 loc) · 9.84 KB

README.rst

File metadata and controls

executable file
·
267 lines (173 loc) · 9.84 KB
https://raw.githubusercontent.com/sblauth/cashocs/main/logos/cashocs_banner.jpg https://img.shields.io/pypi/v/cashocs?style=flat-square https://img.shields.io/conda/vn/conda-forge/cashocs?style=flat-square https://img.shields.io/pypi/pyversions/cashocs?style=flat-square https://img.shields.io/badge/DOI-10.5281%2Fzenodo.4035939-informational?style=flat-square https://img.shields.io/pypi/l/cashocs?color=informational&style=flat-square https://img.shields.io/pypi/dm/cashocs?color=informational&style=flat-square

https://img.shields.io/github/actions/workflow/status/sblauth/cashocs/tests.yml?branch=main&label=tests&style=flat-square https://img.shields.io/codecov/c/gh/sblauth/cashocs?color=brightgreen&style=flat-square https://img.shields.io/codacy/grade/4debea4be12c495391e1310025851e55?style=flat-square https://readthedocs.org/projects/cashocs/badge/?version=latest&style=flat-square https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square

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.

cashocs is based on the finite element package FEniCS and 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 website Fluid 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 textbooks

However, the cashocs tutorial also 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 in Blauth - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software and Blauth - Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software. Moreover, note that the full cashocs documentation is available at https://cashocs.readthedocs.io.

cashocs is available via the anaconda package manager, and you can install it with

conda install -c conda-forge cashocs

Alternatively, you might want to create a new, clean conda environment with the command

conda create -n <ENV_NAME> -c conda-forge cashocs

where <ENV_NAME> is the desired name of the new environment.

Note

Gmsh is automatically installed with anaconda.

  • First, install FEniCS, version 2019.1. Note that FEniCS should be compiled with PETSc and petsc4py.
  • Then, install meshio, with a h5py version that matches the HDF5 version used in FEniCS, and matplotlib. 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 install Gmsh, version 4.8 or later. cashocs does not necessarily need this to work properly, but it is required for the remeshing functionality.

Note

If 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 from this thread, i.e., you should try to install meshio using the command

pip3 install meshio[all] --no-binary=h5py
  • You can install cashocs via the PYPI as follows

    pip3 install cashocs
  • You can install the newest (development) version of cashocs with

    pip3 install git+https://github.com/sblauth/cashocs.git
  • To get the latest (development) version of cashocs, clone this repository with git and install it with pip

    git clone https://github.com/sblauth/cashocs.git
    cd cashocs
    pip3 install .

Note

To verify that the installation was successful, run the tests for cashocs with

python3 -m pytest tests/

or simply

pytest tests/

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.

The complete cashocs documentation is available here https://cashocs.readthedocs.io. For a detailed introduction, see the cashocs tutorial. The python source code for the demo programs is located inside the "demos" folder.

If you use cashocs for your research, please cite the following paper

cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software
Sebastian Blauth
SoftwareX, Volume 13, 2021
https://doi.org/10.1016/j.softx.2020.100646

or use the following bibtex entry

@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},
}

For more details on how to cite cashocs please take a look at https://cashocs.readthedocs.io/en/stable/about/citing/.

cashocs 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, see https://www.gnu.org/licenses/.

I'm Sebastian Blauth, a researcher at Fraunhofer ITWM. I started developing cashocs during my PhD studies and have further developed and refined it as part of my employment at Fraunhofer ITWM. If you have any questions / suggestions / feedback, etc., you can contact me via sebastian.blauth@itwm.fraunhofer.de. For more information, visit my website at https://sblauth.github.io/.