- Thank you received: 0
saving .vol format into .msh format
6 years 9 months ago #379
by alex_sch
saving .vol format into .msh format was created by alex_sch
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
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
6 years 9 months ago #383
by cwinters
Replied by cwinters on topic saving .vol format into .msh format
Hi,
the Netgen mesh has an Export() function.
There is a second implementation (according to the comment, gmsh v2.xx format) which can be used with
Regards,
Christoph
the Netgen mesh has an Export() function.
Code:
from netgen.geom2d import unit_square
mesh = unit_square.GenerateMesh(maxh=0.1)
mesh.Export("export.msh","Gmsh Format")
Code:
mesh.Export("export.msh","Gmsh2 Format")
Regards,
Christoph
5 years 3 weeks ago #2034
by BKFC
Replied by BKFC on topic saving .vol format into .msh format
I tried exporting this way and got the following error message:
Traceback (most recent call last):
File "merge.py", line 69, in <module>
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.
Traceback (most recent call last):
File "merge.py", line 69, in <module>
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.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 3 weeks ago #2035
by christopher
Replied by christopher on topic saving .vol format into .msh format
As said by Christoph, you need to specify either "Gmsh Format" or "Gmsh2 Format" as second argument.
Best
Christopher
Best
Christopher
5 years 3 weeks ago #2036
by BKFC
Replied by BKFC on topic saving .vol format into .msh format
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.
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.
Time to create page: 0.118 seconds