# cashocs Tutorial#

Welcome to the cashocs tutorial. In the following, we present several example programs that showcase how cashocs can be used to solve optimal control, shape optimization, and topology optimization problems.

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

However, we will also provide links to either the underlying theory of PDE constrained optimization or to the relevant documentation of FEniCS in this tutorial.

Note, that an overview over cashocs and its capabilities can be found in Blauth, cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software.

Note

We recommend that you start with the introductory demos for optimal control problems, i.e., Distributed Control of a Poisson Problem and Documentation of the Config Files for Optimal Control Problems, as these demonstrate the basic ideas of cashocs. Additionally, they are a bit simpler than the introductory tutorials for shape optimization problems, i.e., Shape Optimization with a Poisson Problem and Documentation of the Config Files for Shape Optimization Problems.

Moreover, we note that some of cashocs functionality is explained only for optimal control, but not for shape optimization problems. This includes the contents of Coupled Problems - Monolithic Approach, Coupled Problems - Picard Iteration, Distributed Control for Time Dependent Problems, Optimal Control with Nonlinear PDE Constraints, Iterative Solvers for State and Adjoint Systems, Optimal Control with State Constraints, Tracking of Scalar Functionals for Optimal Control Problems, and Treatment of additional constraints. However, the corresponding functionalities only deal with either the definition of the state system, its (numerical) solution, or the definition of suitable cost functionals. Therefore, they are straightforward to adapt to the case of shape optimization.

On the contrary, the possibility to scale individual terms of a cost functional is only explained in Scaling of the Cost Functional for shape optimization problems, but works completely analogous for optimal control problems. Moreover, the space mapping capabilities of cashocs are only documented for shape optimization in Space Mapping Shape Optimization - Semilinear Transmission Problem and Space Mapping Shape Optimization - Uniform Flow Distribution. Again, space mapping works the same for both optimal control and shape optimization.