Hi,
I would like to ask on how to save .vol mesh to gmsh native .msh either using any available python script or calling netgen in batchmode on terminal.
Regards
Hi,
I would like to ask on how to save .vol mesh to gmsh native .msh either using any available python script or calling netgen in batchmode on terminal.
Regards
Hi,
the Netgen mesh has an Export() function.
from netgen.geom2d import unit_square
mesh = unit_square.GenerateMesh(maxh=0.1)
mesh.Export("export.msh","Gmsh Format")
There is a second implementation (according to the comment, gmsh v2.xx format) which can be used with
mesh.Export("export.msh","Gmsh2 Format")
Regards,
Christoph
I tried exporting this way and got the following error message:
Traceback (most recent call last):
File “merge.py”, line 69, in
mesh.Export (“newmesh.gmesh”)
TypeError: Export(): incompatible function arguments. The following argument types are supported:
1. (self: netgen.libngpy._meshing.Mesh, filename: str, format: str) → None
Invoked with: <netgen.libngpy._meshing.Mesh object at 0x10dc2c8b0>, ‘newmesh.gmesh’
Maybe it’s a syntax issue, but I could not discover where the Export() command is explained.
As said by Christoph, you need to specify either “Gmsh Format” or “Gmsh2 Format” as second argument.
Best
Christopher
Sorry - I discovered I was editing a copy of the file in question. python3 now runs to completion.
That said, when I load the .msh file into GLVis (GLVis.org) to view it, I get an error message about missing boundary attributes (using either Gmsh or Gmsh2). Is there an easy way to fix this in the merge.py file?
Ultimately I’m looking to generate a mesh that has 1-2 solids with different material attributes embedded into a third solid, in such a way that the mesh is concentrated at the material borders.