← Back to team overview

dolfin team mailing list archive

Re: Re: Mesh generators

 

On Fri, Mar 24, 2006 at 10:41:09PM +0100, Garth N. Wells wrote:
> On Fri, 2006-03-24 at 14:02 -0600, Anders Logg wrote:
> > On Fri, Mar 24, 2006 at 07:17:28PM +0100, Jensen, Stian wrote:
> > 
> > > Hello,
> > > 
> > > I have downloaded and installed DOLFIN, FFC and FIAT and it looks very impressive.
> > > 
> > > I have tried to run the mesh generator Gmesh. However, in contrast to how I understand the information on the web site (http://www.fenics.org/) the Python conversion script following DOLFIN does not seem to be able to convert meshes (with suffix .msh) from Gmsh to the DOLFIN file format with suffix .xml. Is it any remedy for this problem?
> > > 
> > > My question is then: Do you have any mesh generators to recommend? 
> > > 
> > > best regards,
> > > Stian
> > > 
> > > ----------------------------------------
> > > Stian Jensen
> > > PhD kandidat
> > > NTNU
> > > Institutt for energi- og prosessteknikk
> > > Telefon: 73593755
> > > Mobil: 92859178
> > > E-post: stian.jensen@xxxxxxx
> > 
> > The dolfin-convert script does support gmsh, but there may be a couple
> > of minor issues that we should be able to fix. I didn't implement the
> > gmsh conversion myself, so I'll post some questions here for further
> > discussion. (Garth did the gmsh conversion.)
> > 
> > 1. When I run gmsh, the default suffix for the files it generates
> > seems to be .msh, rather than .gmsh. Should we change to .msh?
> > 
> 
> I made it .gmsh for two reasons. One was to differentiate it from the
> Medit format (which I see now is .mesh, or has it always been .mesh?),
> and beacuse it seems that 90% of generators produce .msh files. 

I think it's always been .mesh. See also

    http://tetgen.berlios.de/fformats.medit.html

> I think that the best approach will be forget about the extension, and
> make the file type an option
>   dolfin-convert -format gmsh mesh.msh mesh.xml

I think dolfin-convert should work as much as possible like the
standard convert command from ImageMagick:

    convert file.jpg file.png

We can add --input-format and --output-format flags do disambiguate
at the point when we actually have some ambiguity. Right now we only
have three formats anyway so as long as it's clear which format we
mean, we don't need to add the flags.

Could we just put in

    if (isuffix == "gmsh" or isuffix == "msh") and osuffix == "xml":

?

> > 2. When I generate a mesh with gmsh, for example from the demo example
> > cube.geo, I get errors when I convert it with dolfin-convert (after
> > having renamed the mesh file to cube.gmsh from cube.msh):
> > 
> > Traceback (most recent call last):
> >   File "./dolfin-convert", line 364, in ?
> >     main(sys.argv[1:])
> >   File "./dolfin-convert", line 52, in main
> >     gmsh2xml(ifilename, ofilename)
> >   File "./dolfin-convert", line 282, in gmsh2xml
> >     n1 = nodelist[int(element[6])]
> > IndexError: list index out of range
> > 
> > The problem seems to be that the file contains both the surface mesh
> > and the volume mesh. Right after $NOD, the number of vertices is
> > claimed to be 94, but these are only the surface nodes, so when
> > dolfin-convert starts reading the vertices for the volume mesh it runs
> > in to trouble.
> > 
> gmsh output is a little tricky. They define a "mesh" and a "physical
> mesh". Mesh will output the surface mesh and the volume mesh, whereas
> exporting the physical will output the volume mesh only. To complicate
> things further, there is gmsh format version 1 and gmsh format version
> 2.
> 
> Once you get used to gmsh, it's very nice.

Aha...

/Anders



References