Generate 1D mesh from user-defined coordinates

Hi all,

I’d like to know if there’s any way of generating a 1D mesh with user-defined coordinates/points ?

Thanks for your help!

Rem

You can use either mshr (an FEniCS module) or external software such as Gmsh /pygmsh, see Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio for plenty of examples on how to use Gmsh.

1 Like

Hi thanks for the answer. I’d rather not use GMSH: do you know where I could find up-to-date documentation on mshr ?
Cheers

Mshr is not actively developed any longer. The up to date source code with some examples can be found at https://bitbucket.org/fenics-project/mshr/src/master/

Hi ! it appears that mshr is not suitable for 1D meshes, do you confirm this ?

“mshr generates meshes in 2D and 3D for Dolfin. The meshes are generated from CSG, ie. boolean combinations of geometric primitives or triangulated surfaces loaded form files. The two can also be combined.”

Indeed, it looks like mshr only handles 2D and 3D domains. Then I would suggest gmsh/pygmsh.

Maybe you can use the MeshEditor: https://fenicsproject.org/docs/dolfin/2019.1.0/python/_autogenerated/dolfin.cpp.mesh.html?highlight=mesheditor#dolfin.cpp.mesh.MeshEditor