.. image:: https://raw.githubusercontent.com/sblauth/cashocs/main/logos/cashocs_banner.jpg
:width: 800
:align: center
:target: https://github.com/sblauth/cashocs
.. image:: https://img.shields.io/pypi/v/cashocs?style=flat-square
:target: https://pypi.org/project/cashocs/
.. image:: https://img.shields.io/conda/vn/conda-forge/cashocs?style=flat-square
:target: https://anaconda.org/conda-forge/cashocs
.. image:: https://img.shields.io/pypi/pyversions/cashocs?style=flat-square
:target: https://pypi.org/project/cashocs/
.. image:: https://img.shields.io/badge/DOI-10.5281%2Fzenodo.4035939-informational?style=flat-square
:target: https://doi.org/10.5281/zenodo.4035939
.. image:: https://img.shields.io/pypi/l/cashocs?color=informational&style=flat-square
:target: https://pypi.org/project/cashocs/
.. image:: https://img.shields.io/pypi/dm/cashocs?color=informational&style=flat-square
:target: https://pypistats.org/packages/cashocs
|
.. image:: https://img.shields.io/github/actions/workflow/status/sblauth/cashocs/tests.yml?branch=main&label=tests&style=flat-square
:target: https://github.com/sblauth/cashocs/actions/workflows/tests.yml
.. image:: https://img.shields.io/codecov/c/gh/sblauth/cashocs?color=brightgreen&style=flat-square
:target: https://codecov.io/gh/sblauth/cashocs
.. image:: https://img.shields.io/codacy/grade/4debea4be12c495391e1310025851e55?style=flat-square
:target: https://app.codacy.com/gh/sblauth/cashocs/dashboard?branch=main
.. image:: https://readthedocs.org/projects/cashocs/badge/?version=latest&style=flat-square
:target: https://cashocs.readthedocs.io/en/latest/?badge=latest
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square
:target: https://github.com/psf/black
|
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.
.. contents:: :local:
Introduction
============
cashocs is based on the finite element package `FEniCS
<https://fenicsproject.org>`__ 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 <https://www.itwm.fraunhofer.de/en/departments/tv/products-and-services/shape-optimization-cashocs-software.html>`_.
.. readme_start_disclaimer
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
- Optimal Control and general PDE constrained optimization
- `Hinze, Ulbrich, Ulbrich, and Pinnau - Optimization with PDE Constraints <https://doi.org/10.1007/978-1-4020-8839-1>`_
- `Tröltzsch - Optimal Control of Partial Differential Equations <https://doi.org/10.1090/gsm/112>`_
- Shape Optimization
- `Delfour and Zolesio - Shapes and Geometries <https://doi.org/10.1137/1.9780898719826>`_
- `Sokolowski and Zolesio - Introduction to Shape Optimization <https://doi.org/10.1007/978-3-642-58106-9>`_
- Topology Optimization
- `Sokolowski and Novotny - Topological Derivatives in Shape Optimization <https://doi.org/10.1007/978-3-642-35245-4>`_
- `Amstutz - An Introduction to the Topological Derivative <https://doi.org/10.1108/EC-07-2021-0433>`_
- FEniCS
- `Logg, Mardal, and Wells - Automated Solution of Differential Equations by the Finite Element Method <https://doi.org/10.1007/978-3-642-23099-8>`_
- `The FEniCS demos <https://fenicsproject.org/olddocs/dolfin/2019.1.0/python/demos.html>`_
.. readme_end_disclaimer
However, the `cashocs tutorial <https://cashocs.readthedocs.io/en/stable/user>`_ 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 <https://doi.org/10.1016/j.softx.2020.100646>`_ and `Blauth - Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software <https://doi.org/10.1016/j.softx.2023.101577>`_. Moreover, note that
the full cashocs documentation is available at `<https://cashocs.readthedocs.io>`_.
.. readme_start_installation
Installation
============
Via conda-forge
---------------
cashocs is available via the anaconda package manager, and you can install it
with
.. code-block:: bash
conda install -c conda-forge cashocs
Alternatively, you might want to create a new, clean conda environment with the
command
.. code-block:: bash
conda create -n <ENV_NAME> -c conda-forge cashocs
where `<ENV_NAME>` is the desired name of the new environment.
.. note::
`Gmsh <https://gmsh.info/>`_ is automatically installed with anaconda.
Manual Installation
-------------------
- First, install `FEniCS <https://fenicsproject.org/download/>`_, version 2019.1.
Note that FEniCS should be compiled with PETSc and petsc4py.
- Then, install `meshio <https://github.com/nschloe/meshio>`_, with a `h5py <https://www.h5py.org>`_
version that matches the HDF5 version used in FEniCS, and `matplotlib <https://matplotlib.org/>`_.
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 <https://gmsh.info/>`_, 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
<https://fenicsproject.discourse.group/t/meshio-convert-to-xdmf-from-abaqus-raises-version-error-for-h5py/1480>`_,
i.e., you should try to install `meshio <https://github.com/nschloe/meshio>`_
using the command
.. code-block:: bash
pip3 install meshio[all] --no-binary=h5py
- You can install cashocs via the `PYPI <https://pypi.org/>`_ as follows
.. code-block:: bash
pip3 install cashocs
- You can install the newest (development) version of cashocs with
.. code-block:: bash
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
.. code-block:: bash
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
.. code-block:: bash
python3 -m pytest tests/
or simply
.. code-block:: bash
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.
.. readme_end_installation
Usage
=====
The complete cashocs documentation is available here `<https://cashocs.readthedocs.io>`_. For a detailed
introduction, see the `cashocs tutorial <https://cashocs.readthedocs.io/en/stable/user>`_. The python source code
for the demo programs is located inside the "demos" folder.
.. _citing:
Citing
======
If you use cashocs for your research, please cite the following paper
.. code-block:: text
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
.. code-block:: bibtex
@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/>`_.
.. readme_start_license
.. _license:
License
=======
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/>`_.
.. readme_end_license
.. readme_start_about
Contact / About
===============
I'm `Sebastian Blauth <https://sblauth.github.io/>`_, a researcher at `Fraunhofer ITWM
<https://www.itwm.fraunhofer.de/en.html>`_. 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
<mailto:sebastian.blauth@itwm.fraunhofer.de>`_. For more information, visit my website at `<https://sblauth.github.io/>`_.
.. readme_end_about
Raw data
{
"_id": null,
"home_page": null,
"name": "cashocs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Shape Optimization, Optimal Control, FEniCS, Optimization, PDE, Adjoint, Finite Element Method",
"author": "Sebastian Blauth",
"author_email": "sebastian.blauth@itwm.fraunhofer.de",
"download_url": "https://files.pythonhosted.org/packages/49/1a/d371e5763284cb14cbe04692d6a5b39124377f72680c63a65752f5b5d5d8/cashocs-2.3.1.tar.gz",
"platform": null,
"description": ".. image:: https://raw.githubusercontent.com/sblauth/cashocs/main/logos/cashocs_banner.jpg\n :width: 800\n :align: center\n :target: https://github.com/sblauth/cashocs\n\n.. image:: https://img.shields.io/pypi/v/cashocs?style=flat-square\n :target: https://pypi.org/project/cashocs/\n\n.. image:: https://img.shields.io/conda/vn/conda-forge/cashocs?style=flat-square\n :target: https://anaconda.org/conda-forge/cashocs\n\n.. image:: https://img.shields.io/pypi/pyversions/cashocs?style=flat-square\n :target: https://pypi.org/project/cashocs/\n\n.. image:: https://img.shields.io/badge/DOI-10.5281%2Fzenodo.4035939-informational?style=flat-square\n :target: https://doi.org/10.5281/zenodo.4035939\n\n.. image:: https://img.shields.io/pypi/l/cashocs?color=informational&style=flat-square\n :target: https://pypi.org/project/cashocs/\n\n.. image:: https://img.shields.io/pypi/dm/cashocs?color=informational&style=flat-square\n :target: https://pypistats.org/packages/cashocs\n\n|\n\n.. image:: https://img.shields.io/github/actions/workflow/status/sblauth/cashocs/tests.yml?branch=main&label=tests&style=flat-square\n :target: https://github.com/sblauth/cashocs/actions/workflows/tests.yml\n\n.. image:: https://img.shields.io/codecov/c/gh/sblauth/cashocs?color=brightgreen&style=flat-square\n :target: https://codecov.io/gh/sblauth/cashocs\n\n.. image:: https://img.shields.io/codacy/grade/4debea4be12c495391e1310025851e55?style=flat-square\n :target: https://app.codacy.com/gh/sblauth/cashocs/dashboard?branch=main\n\n.. image:: https://readthedocs.org/projects/cashocs/badge/?version=latest&style=flat-square\n :target: https://cashocs.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square\n :target: https://github.com/psf/black\n\n|\n\ncashocs 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.\u2003Its name is an acronym for computational adjoint-based shape optimization and optimal control software and the software is written in Python.\n\n\n.. contents:: :local:\n\nIntroduction\n============\n\ncashocs is based on the finite element package `FEniCS\n<https://fenicsproject.org>`__ and uses its high-level unified form language UFL\nto treat general PDE constrained optimization problems, in particular, shape\noptimization and optimal control problems.\n\nFor some applications and further information about cashocs, we also refer to the website `Fluid Dynamical Shape Optimization with cashocs <https://www.itwm.fraunhofer.de/en/departments/tv/products-and-services/shape-optimization-cashocs-software.html>`_.\n\n.. readme_start_disclaimer\n\nNote, that we assume that you are (at least somewhat) familiar with PDE\nconstrained optimization and FEniCS. For a introduction to these topics,\nwe can recommend the textbooks\n\n- Optimal Control and general PDE constrained optimization\n - `Hinze, Ulbrich, Ulbrich, and Pinnau - Optimization with PDE Constraints <https://doi.org/10.1007/978-1-4020-8839-1>`_\n - `Tr\u00f6ltzsch - Optimal Control of Partial Differential Equations <https://doi.org/10.1090/gsm/112>`_\n- Shape Optimization\n - `Delfour and Zolesio - Shapes and Geometries <https://doi.org/10.1137/1.9780898719826>`_\n - `Sokolowski and Zolesio - Introduction to Shape Optimization <https://doi.org/10.1007/978-3-642-58106-9>`_\n- Topology Optimization\n - `Sokolowski and Novotny - Topological Derivatives in Shape Optimization <https://doi.org/10.1007/978-3-642-35245-4>`_\n - `Amstutz - An Introduction to the Topological Derivative <https://doi.org/10.1108/EC-07-2021-0433>`_\n- FEniCS\n - `Logg, Mardal, and Wells - Automated Solution of Differential Equations by the Finite Element Method <https://doi.org/10.1007/978-3-642-23099-8>`_\n - `The FEniCS demos <https://fenicsproject.org/olddocs/dolfin/2019.1.0/python/demos.html>`_\n\n.. readme_end_disclaimer\n\nHowever, the `cashocs tutorial <https://cashocs.readthedocs.io/en/stable/user>`_ also gives many references either\nto the underlying theory of PDE constrained optimization or to relevant demos\nand documentation of FEniCS.\n\nAn overview over cashocs and its capabilities can be found in `Blauth - cashocs: A Computational, Adjoint-Based\nShape Optimization and Optimal Control Software <https://doi.org/10.1016/j.softx.2020.100646>`_ and `Blauth - Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software <https://doi.org/10.1016/j.softx.2023.101577>`_. Moreover, note that\nthe full cashocs documentation is available at `<https://cashocs.readthedocs.io>`_.\n\n\n.. readme_start_installation\n\nInstallation\n============\n\nVia conda-forge\n---------------\n\ncashocs is available via the anaconda package manager, and you can install it\nwith\n\n.. code-block:: bash\n\n conda install -c conda-forge cashocs\n\nAlternatively, you might want to create a new, clean conda environment with the\ncommand\n\n.. code-block:: bash\n\n conda create -n <ENV_NAME> -c conda-forge cashocs\n\nwhere `<ENV_NAME>` is the desired name of the new environment.\n\n.. note::\n\n `Gmsh <https://gmsh.info/>`_ is automatically installed with anaconda.\n\n\n\nManual Installation\n-------------------\n\n- First, install `FEniCS <https://fenicsproject.org/download/>`_, version 2019.1.\n Note that FEniCS should be compiled with PETSc and petsc4py.\n\n- Then, install `meshio <https://github.com/nschloe/meshio>`_, with a `h5py <https://www.h5py.org>`_\n version that matches the HDF5 version used in FEniCS, and `matplotlib <https://matplotlib.org/>`_.\n The version of meshio should be at least 4, but for compatibility it is recommended to use meshio 4.4.\n\n- You might also want to install `Gmsh <https://gmsh.info/>`_, version 4.8 or later.\n cashocs does not necessarily need this to work properly,\n but it is required for the remeshing functionality.\n\n.. note::\n\n If you are having trouble with using the conversion tool cashocs-convert from\n the command line, then you most likely encountered a problem with hdf5 and h5py.\n This can (hopefully) be resolved by following the suggestions from `this thread\n <https://fenicsproject.discourse.group/t/meshio-convert-to-xdmf-from-abaqus-raises-version-error-for-h5py/1480>`_,\n i.e., you should try to install `meshio <https://github.com/nschloe/meshio>`_\n using the command\n\n .. code-block:: bash\n\n pip3 install meshio[all] --no-binary=h5py\n\n- You can install cashocs via the `PYPI <https://pypi.org/>`_ as follows\n\n .. code-block:: bash\n\n pip3 install cashocs\n\n- You can install the newest (development) version of cashocs with\n\n .. code-block:: bash\n\n pip3 install git+https://github.com/sblauth/cashocs.git\n\n- To get the latest (development) version of cashocs, clone this repository with git and install it with pip\n\n .. code-block:: bash\n\n git clone https://github.com/sblauth/cashocs.git\n cd cashocs\n pip3 install .\n\n\n.. note::\n\n To verify that the installation was successful, run the tests for cashocs\n with\n\n .. code-block:: bash\n\n python3 -m pytest tests/\n\n or simply\n\n .. code-block:: bash\n\n pytest tests/\n\n from the source / repository root directory. Note that it might take some\n time to perform all of these tests for the very first time, as FEniCS\n compiles the necessary code. However, on subsequent iterations the\n compiled code is retrieved from a cache, so that the tests are singificantly\n faster.\n\n\n.. readme_end_installation\n\n\nUsage\n=====\n\nThe complete cashocs documentation is available here `<https://cashocs.readthedocs.io>`_. For a detailed\nintroduction, see the `cashocs tutorial <https://cashocs.readthedocs.io/en/stable/user>`_. The python source code\nfor the demo programs is located inside the \"demos\" folder.\n\n\n.. _citing:\n\nCiting\n======\n\nIf you use cashocs for your research, please cite the following paper\n\n.. code-block:: text\n\n\tcashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software\n\tSebastian Blauth\n\tSoftwareX, Volume 13, 2021\n\thttps://doi.org/10.1016/j.softx.2020.100646\n\nor use the following bibtex entry\n\n.. code-block:: bibtex\n\t\n\t@Article{Blauth2021cashocs,\n\t author = {Sebastian Blauth},\n\t journal = {SoftwareX},\n\t title = {{cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software}},\n\t year = {2021},\n\t issn = {2352-7110},\n\t pages = {100646},\n\t volume = {13},\n\t doi = {https://doi.org/10.1016/j.softx.2020.100646},\n\t keywords = {PDE constrained optimization, Adjoint approach, Shape optimization, Optimal control},\n\t}\n\t\nFor more details on how to cite cashocs please take a look at `<https://cashocs.readthedocs.io/en/stable/about/citing/>`_.\n\n\n.. readme_start_license\n.. _license:\n\nLicense\n=======\n\ncashocs is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\ncashocs is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with cashocs. If not, see `<https://www.gnu.org/licenses/>`_.\n\n\n.. readme_end_license\n\n\n.. readme_start_about\n\nContact / About\n===============\n\nI'm `Sebastian Blauth <https://sblauth.github.io/>`_, a researcher at `Fraunhofer ITWM\n<https://www.itwm.fraunhofer.de/en.html>`_. I started developing cashocs during my PhD studies and have\nfurther developed and refined it as part of my employment at Fraunhofer ITWM.\nIf you have any questions / suggestions / feedback, etc., you can contact me\nvia `sebastian.blauth@itwm.fraunhofer.de\n<mailto:sebastian.blauth@itwm.fraunhofer.de>`_. For more information, visit my website at `<https://sblauth.github.io/>`_.\n\n.. readme_end_about\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 or later (GPLv3+)",
"summary": "Computational Adjoint-Based Shape Optimization and Optimal Control Software",
"version": "2.3.1",
"project_urls": {
"Documentation": "https://cashocs.readthedocs.io/en/stable",
"Source": "https://github.com/sblauth/cashocs",
"Tracker": "https://github.com/sblauth/cashocs/issues",
"Tutorial": "https://cashocs.readthedocs.io/en/stable/user"
},
"split_keywords": [
"shape optimization",
" optimal control",
" fenics",
" optimization",
" pde",
" adjoint",
" finite element method"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c2c16152ba519690a74b263fbce224172f0c5f6d67374db1c718febcd072909d",
"md5": "5de462a4b25976357432b5dfccb717b3",
"sha256": "14dd0ccfadcd39b1f68f09e2e49550289e3eb4bd7a4b12f7f98a0bb910ded1e7"
},
"downloads": -1,
"filename": "cashocs-2.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5de462a4b25976357432b5dfccb717b3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 428872,
"upload_time": "2024-11-13T08:17:57",
"upload_time_iso_8601": "2024-11-13T08:17:57.571354Z",
"url": "https://files.pythonhosted.org/packages/c2/c1/6152ba519690a74b263fbce224172f0c5f6d67374db1c718febcd072909d/cashocs-2.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "491ad371e5763284cb14cbe04692d6a5b39124377f72680c63a65752f5b5d5d8",
"md5": "bbdd4b0643caab1b932035125abeac70",
"sha256": "34c2cd9e6805e7d1c964876b51ff959db10ad586b2c61c53591d8b473ff5516c"
},
"downloads": -1,
"filename": "cashocs-2.3.1.tar.gz",
"has_sig": false,
"md5_digest": "bbdd4b0643caab1b932035125abeac70",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 278227,
"upload_time": "2024-11-13T08:18:00",
"upload_time_iso_8601": "2024-11-13T08:18:00.010101Z",
"url": "https://files.pythonhosted.org/packages/49/1a/d371e5763284cb14cbe04692d6a5b39124377f72680c63a65752f5b5d5d8/cashocs-2.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 08:18:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sblauth",
"github_project": "cashocs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cashocs"
}