Gmsh and adaptation

Hi,

I wonder if someone has some experience using gmsh to generate an adapted mesh inside a Fenics script. Gmsh is more suitable for generating complicated meshes than the mesh generator provided with Fenics.
At this moment I know how to create a new mesh using gmsh and how to import it in a Fenics script, but I do not know how to refine this mesh, keeping all the physical references.

Any examples in this direction?

Many thanks for considering my request.

Rodolfo

FEniCS has mesh refinement as described in: Bitbucket and in turn you can use adapt to pass on cell and facet markers to the refined mesh: Bitbucket

Thanks a lot for your answer!! Only a small question: this will work with a mesh generated by gmsh?
Now I use this to read a xdmf mesh generated by gmsh


mesh = Mesh()
with XDMFFile("../mesh/square_domain.xdmf") as infile:
     infile.read(mesh)
#
mvc  = MeshValueCollection("size_t", mesh, dim-1)
with XDMFFile("../mesh/square_boundaries.xdmf") as infile:
     infile.read(mvc, 'boundaries')
boundaries = cpp.mesh.MeshFunctionSizet(mesh, mvc)
#
mvc2 = MeshValueCollection("size_t", mesh, dim)
with XDMFFile("../mesh/square_domain.xdmf") as infile:
     infile.read(mvc2, 'subdomains')
domains = cpp.mesh.MeshFunctionSizet(mesh, mvc2)

Regards,

Rodolfo

Yes, as a Mesh read from GMSH is no different than a built in mesh once it has been read into dolfin.

Thanks a lot!!

Regards,

Rodolfo