# Remeshing (using gmsh?)

**URL:** <https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713>\
**Category:** mesh\
**Created:** [May 2, 2019, 9:02am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713 "2019-05-02T09:02:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![plugged](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/plugged/32/5115_2.png) [@plugged](https://fenicsproject.discourse.group/u/plugged)\
**Post date:** [May 2, 2019, 9:02am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/1 "2019-05-02T09:02:41Z")

</div>

Hi,

I’ve got a question regarding remeshing in fenics. I generate my mesh using gmsh (and meshio), and solve a shape optimization problem where I want to be able to remesh my geometry (using whatever conditions) after it has been deformed.

I wanted to ask whether there is a “simple” way of converting my deformed mesh / geometry into a mesh or geometry file for gmsh so that I can remesh the whole thing there. Of course, I can use meshio again to generate, e.g., an .xdmf file of my mesh and convert this to a .msh file, but gmsh cannot really work with a mesh file as input, and the CreateGeometry command (which is available in newer versions) does not do the trick.

Maybe someone has had similar issues and can give me a hint how to do this remeshing in a simple manner. Thank you.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [July 23, 2019, 6:55pm UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/2 "2019-07-23T18:55:15Z")

</div>

Hi,  
Please consider the answer i gave here: [Re-meshing in fluid structure interaction](https://fenicsproject.discourse.group/t/re-meshing-in-fluid-structure-interaction/1190/2)

I must have missed this question earlier on.

---

<div class="post-metadata">

**Author:** ![plugged](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/plugged/32/5115_2.png) [@plugged](https://fenicsproject.discourse.group/u/plugged)\
**Post date:** [July 25, 2019, 5:33am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/3 "2019-07-25T05:33:31Z")

</div>

Thanks a lot. I already discovered FEMorph, but I will take a look at this again soon.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [July 25, 2019, 5:54am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/4 "2019-07-25T05:54:42Z")

</div>

@plugged , just curious, Since in working on shape optimization problems myself, what kind of problems do you want to solve? If you want the discretely consistent shape gradient, there is support for this in dolfin-adjoint, see for instance this example: [http://www.dolfin-adjoint.org/en/release/documentation/stokes-shape-opt/stokes\_problem.html](http://www.dolfin-adjoint.org/en/release/documentation/stokes-shape-opt/stokes_problem.html)

---

<div class="post-metadata">

**Author:** ![plugged](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/plugged/32/5115_2.png) [@plugged](https://fenicsproject.discourse.group/u/plugged)\
**Post date:** [July 25, 2019, 7:25am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/5 "2019-07-25T07:25:24Z")

</div>

@dokken I’m working on the optimization of a continuous flow reactor, so I have a mixture of transport and fluid equations as constraints.  
I knew that there exist certain possibilities for computing gradients of optimal control problems with dolfin-adjoint, but I wasn’t aware that it can also be used for shape optimization. Anyway, I’m considering a optimize then discretize approach, so I don’t think I’d use this for the computation, but I may use this as a validation tool.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [July 25, 2019, 7:37am UTC](https://fenicsproject.discourse.group/t/remeshing-using-gmsh/713/6 "2019-07-25T07:37:53Z")

</div>

I started working on the shape optimization implementation in dolfin-adjoint ~1.5 years ago. We released it to master in february. Currently wrapping up a paper on the subject.
