Gmsh grid import failed due to version incompatibility

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Gmsh grid import failed due to version incompatibility

randress
This post was updated on .
When importing .msh, created by Gmsh from STEP file, using the FEATool mesh import option (Grid->Import Grid->Gmsh Format),  the import fails with message: "Grid import failed."

Windows OS, Gmsh 4.5.4, FEATool 1.11 standalone.

Following the directions from https://www.featool.com/tutorial/2017/11/06/gmsh-cad-step-file-import-and-mesh-generation-tutorial, I ran Gmsh, I merged the STEP file https://www.featool.com/download/spanner.step, set the MAX element size to "6", generated the 3D mesh and saved it to the file "spanner.msh".

Then I ran FEATool (standalone, v 1.11, 19.07.210) and attempted to import the "spanner.msh". It failed with "Grid import failed".

In a previous thread {Windows version of FEATool expects <CR><LF> in .msh import} I reported that this problem could be solved by stripping <CR>(\r) from the .msh file.  However, I was mistaken.  The stripped file also fails to import.

I have attached the Gmsh 4.5.4 output file "spanner.msh".                 [Edit: added Gmsh version]
spanner.msh

[Edit: Mar 23, 2020, ~23:30Z]
I noticed that the spinner.msh file from the featool.com site began with:

$MeshFormat
2.2 0 8
$EndMeshFormat

The first lines of the .msh files I was producing wiht Gmsn 4.5.4 was:

$MeshFormat
4.1 0 8
$EndMeshFormat

I began replacing my Gmsh with earlier and earlier versions. When I tried 3.0.6 [Edit: correct version]
the import worked and the first 3 lines in the .msh file were the same as the spinner.msh from the featool.com site.

My conclusion is that somewhere between 3.0.6 and 4.5.4 the .msh file format interface (from Gmsh to FEATool was broken).

I would hate to have to use Gmsh 3.0.6.  Perhaps there is a .msh file conversion possible that would allow using a later version of Gmsh (later than 3.06) and FEATool  standalone 1.11.

-Randal


Reply | Threaded
Open this post in threaded view
|

Re: Gmsh grid import failed due to version incompatibility

Precise Simulation
Administrator
randress wrote
My conclusion is that somewhere between 3.0.6 and 4.5.4 the .msh file format interface (from Gmsh to FEATool was broken).
I wouldn't say FEATool is broken as it works as it should, but yes Gmsh significantly changed their default mesh format from version 4, and FEATool currently only supports the version 2 Gmsh ASCII file format. If you use FEATool to generate your mesh this will be handled manually, if you wish to use Gmsh externally you have to make sure Gmsh saves/export the file in version 2 format. There is to my knowledge no way of doing this in the Gmsh GUI. But I belive starting Gmsh with the flag

    gmsh -format msh2

should probably work. Alternatively, you can save a Gmsh options (opt) file and edit the:

    Mesh.MshFileVersion = 2;

option. If there still are issues you might have to also use

    -save_all / Mesh.SaveAll = 1;


randress wrote
I would hate to have to use Gmsh 3.0.6.  Perhaps there is a .msh file conversion possible that would allow using a later version of Gmsh (later than 3.06) and FEATool  standalone 1.11.
If there are no particular reason or features you need in a newer version there is really no reason to continue use an older one. For example I personally use and recommend Matlab R2011b as the GUI is significantly more responsive and in general faster to use than later versions. Unfortunately, I don't have any control over how the Gmsh software evolves and since it and the API changes quite fast and a lot there is no guarantee that a specific newer Gmsh version will work correctly that has not been tested for (currently versions 3.0.6, 4.3.0, and 4.5.2). Using other versions is not recommended since some versions have significant bugs that affect meshing.
Reply | Threaded
Open this post in threaded view
|

Re: Gmsh grid import failed due to version incompatibility

randress
This post was updated on .
Precise Simulation wrote
    gmsh -format msh2

should probably work. Alternatively, you can save a Gmsh options (opt) file and edit the:

    Mesh.MshFileVersion = 2;

option. If there still are issues you might have to also use

    -save_all / Mesh.SaveAll = 1;
Very helpful!  I hope to be able to resolve my issue with one or more of your suggestions.

Precise Simulation wrote

randress wrote
My conclusion is that somewhere between 3.0.6 and 4.5.4 the .msh file format interface (from Gmsh to FEATool was broken).

I wouldn't say FEATool is broken as it works as it should...
Sorry ... bad choice of words (on my part).  Certainly FEATool is self consistent... just my ignorant way of stating the obvious "something changed" :-)...

Precise Simulation wrote
... no guarantee that a specific newer Gmsh version will work correctly that has not been tested for (currently versions 3.0.6, 4.3.0, and 4.5.2)...
This too, is very helpful.

This is important (working out a Gmsh-FEATool .msh interface) for my use-case because I want to be able to import .STEP files and to use Gmsh to generate partial views of meshes.  I am also hoping to export .msh from FEATool and use Gmsh to bisect a sub-domain creating two sub-domains (and then import back to FEATool) to expose the connecting face/surface at the places where I need to measure current flow in a cross section that is not already an exposed face/surface. I hope this works.

Kind regards,
Randal

[Edit: ~18:00z 24 Mar, 2020: Added the following:]
Also see FAQ 17 in http://gmsh.info/doc/texinfo/gmsh.html#Mesh-module-questions

How can I save a mesh file with a given (e.g. older) MSH file format version?
 - In the GUI: open ‘File->Export’, enter your filename.msh and then pick the version in the dropdown menu.
 - On the command line: use the -format option (e.g. gmsh file.geo -format msh2 -2).
 - In a .geo script: add the line Mesh.MshFileVersion = x.y; for any version number x.y. You can also save this in your default options.
 - In the API: gmsh::option::setNumber("Mesh.MshFileVersion", x.y).

As an alternative method, you can also not specify the format explicitely, and just choose a filename with the .msh2 or .msh4 extension.

Reply | Threaded
Open this post in threaded view
|

Re: Gmsh grid import failed due to version incompatibility

Precise Simulation
Administrator
randress wrote
This is important (working out a Gmsh-FEATool .msh interface) for my use-case because I want to be able to import .STEP files and to use Gmsh to generate partial views of meshes. I am also hoping to export .msh from FEATool and use Gmsh to bisect a sub-domain creating two sub-domains (and then import back to FEATool) to expose the connecting face/surface at the places where I need to measure current flow in a cross section that is not already an exposed face/surface. I hope this works.
I'm not sure that first creating a mesh, and then splitting it is the right approach here. I would guess it would be better to first split your geometry (with for example a CAD program such as FreeCAD, or FEATool v1.12 which supports importing and combining STEP, IGES, and BREP CAD geometries) along the planes you want to have internal boundaries, and then mesh it in one step.
Reply | Threaded
Open this post in threaded view
|

Re: Gmsh grid import failed due to version incompatibility

randress
Precise Simulation wrote
I'm not sure that first creating a mesh, and then splitting it is the right approach here. I would guess it would be better to first split your geometry (with for example a CAD program such as FreeCAD, or FEATool v1.12 which supports importing and combining STEP, IGES, and BREP CAD geometries) along the planes you want to have internal boundaries, and then mesh it in one step.
Ok. I'm convinced. I just need to purchase Matlab and FEATool toolkit.

I do appreciate your doing more than just answering my questions ... but also trying to help me figure out how to accomplish my goals.

I am looking forward to working with you very soon as a licensed user!

Regards,
Randal