I wanted to make a small announcement regarding a package I released recently: CASHOCS.
CASHOCS is a package based on FEniCS, designed to solve shape optimization and optimal control problems in an automated fashion. In that sense, it is somewhat similar to dolfin-adjoint, but follows more of a first optimize, then discretize approach, as it only uses automatic differentiation to derive the adjoint and gradient equations. The user can then specify how each of these should be solved, and can, e.g., even use different finite element approximations for the state and adjoint systems.
You can find the software on github: https://github.com/sblauth/cashocs
and on pypi: https://pypi.org/project/cashocs/
and the documentation is available here: https://cashocs.readthedocs.io
Finally, let me remark that this project might be still be of interest for you, even if you do not want to solve any PDE constrained optimization problems: It automates the mesh conversion from gmsh to fenics, including physical groups etc. If you have a mesh file with physical tags, say
mesh.msh its usage is as simple as calling
cashocs-convert mesh.msh mesh.xdmf
from the command line. And in your script, you can import this mesh using
import cashocs mesh, subdomains, boundaries, dx, ds, dS = cashocs.import_mesh(mesh.xdmf)
and it directly generates the MeshFunctions for the subdomains and boundaries, and initializes the corresponding measures, too.
I hope you find this package helpful, and if you have any questions, suggestions, or feedback, please contact me.