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.

System call from fortran . . .

More
6 years 8 months ago - 6 years 8 months ago #108 by christopher
Hi Tim,
If you use the .vol/.vol.gz mesh format this can be done easily with a python script:
Code:
import netgen.meshing as meshing mesh = meshing.Mesh() mesh.Load("surfaceMesh.vol.gz") mesh.GenerateVolumeMesh(meshing.MeshingParameters(maxh=...)) mesh.Save("volumeMesh.vol.gz")

I don't think that the export/import of other mesh formats is currently exported to python, but I guess we could do that. Since noone of the core developers is using these mesh formats, the export/import may be broken. I'll have a look at it and let you know.

Best
Christopher
Last edit: 6 years 8 months ago by christopher.
More
6 years 8 months ago - 6 years 8 months ago #109 by christopher
Some updates:
I pushed a merge request to fix the
Code:
has no facedecoding: fd.size = 1, ind = 2
stuff. This was just in the import of neutral files but wasn't about the corrupt .mesh file. I can't reproduce your huge boundary condition numbers... Could you attach a geo file (or mail it to me if you don't want to have it in public) that produces these?
Nevertheless I think if you want to create a volume mesh from a surface mesh you should provide a .vol/.vol.gz file, since they provide additional information on the surface (like inner domain and outer domain) which I think is needed for the volume mesher.

Best
Christopher
Last edit: 6 years 8 months ago by christopher.
More
6 years 8 months ago #110 by DrTSPC
Christoph:

WRT to your last note. I may have miscommunicated. The corrupt bc numbers arise when I tried to remesh a .mesh file. So, starting from cube.geo, using the install of yesterday (from installer):

1. Successfully meshed cube.geo tp create out.vol:

netgen -batchmode -geofile=/usr/share/netgen/cube.geo -fine -meshfile=out.vol

2. Successfully translated from out.vol to out.mesh; though I wanted a finer mesh as well. (I have not checked every number, and nothing is shown when importing .mesh files to the gui.)

netgen -batchmode -inputmeshfile=out.vol -veryfine -meshfile=out.mesh -meshfiletype="Neutral Format"

3. Created the .mesh file with "corrupt" bc numbers using:

netgen -batchmode -inputmeshfile=out.mesh -veryfine -meshfile=out_out.mesh -meshfiletype="Neutral Format"

Regards,
Tim
More
6 years 8 months ago #111 by christopher
I see, in that case my fix does the trick ;) It has already been merged into Netgen, the fix should be in the nightly build within the next 2 days.
Best
Christopher
More
6 years 8 months ago #112 by cwinters
Hi Tim,

as Christopher said, the issue with the bc will be fixed in a nightly build within the next days (we have to wait until the fix is merged to ngsolve).

though I wanted a finer mesh as well

The flag "-veryfine" has no effect when you import a mesh. I just tested your command line call in 2. and it doesn't matter if I define a "fine", "veryfine" or leave it away.
I would have the check the source code for more details but as far as I know these flags for the mesh granularity are meant to be used together with a geometry.

This means your command in 3. just loads and saves a mesh. So in the best case you get the same mesh as you had as input (will work in the fixed nightly ;) ). There is no remeshing when you already load a mesh file.

Best
Christoph
More
6 years 8 months ago #113 by DrTSPC
Christoph:

I did notice that the effect was "translation" between .vol and .mesh - at best.

WRT using a python script: Promising!

1. I edited the out.vol file, created from cube.geo as in my last post, and set the volumeelements to 0 and stripped out the edgesegmentsi2 section; to create "in.vol".

2. I then ran:
netgen script_1.py

Where script_1.py is based on the script you sent (thank you!):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import netgen.meshing as meshing

mesh = meshing.Mesh()
mesh.Load("in.vol")
mesh.GenerateVolumeMesh(meshing.MeshingParameters(maxh=0.01))
mesh.Save("out_in.vol")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A gui popped up, so I verified that "out_in.vol" had volume elements: It was meshed.

Now:
1. The "h=" in the MeshParameters had no apparent effect.
2. When I attempted to refine in the gui (Refine Uniform in the Refinement menu), the gui, 'went away'.

So, promise - but I want control of the mesh density, etc. (I also don't want guis popping up, after I get this lined out.)

More generally: I have spent about an hour looking for info about the python commands for netgen. Can you point me to some info? (The netgen py_tutorials directory is rather 'Spartan'.)

Thanks!
Tim
Time to create page: 0.180 seconds