Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

saving .vol format into .msh format

More
6 years 2 months ago #379 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
More
6 years 2 months ago #383 by cwinters
Hi,

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")
There is a second implementation (according to the comment, gmsh v2.xx format) which can be used with
Code:
mesh.Export("export.msh","Gmsh2 Format")

Regards,
Christoph
More
4 years 5 months ago #2034 by BKFC
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.
More
4 years 5 months ago #2035 by christopher
As said by Christoph, you need to specify either "Gmsh Format" or "Gmsh2 Format" as second argument.
Best
Christopher
More
4 years 5 months ago #2036 by BKFC
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.
Time to create page: 0.145 seconds