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 #114 by christopher
If you want to call the python script without a gui just execute it with python3
Code:
python3 script.py

A growing (not complete) documentation on how to work with NGSolve in Python can be found in the documentation section
ngsolve.org/docu/latest/
I think for you the Netgen tutorials at the bottom are of interest. There you can see how you can define the geometries in Python as well instead of a geo file (this is especially helpful if you want to create more complex geometries - you have the Python functionality then for that).
The problem with the mesh size can be caused by a too coarse surface mesh. You could either try a finer surface mesh or manipulate the "grading" meshing parameter.
If you want to create surface meshes only, there is no need to remove the volume elements manually. You can set the meshingparameter perfstepsend to meshing.MeshingStep.MESHSURFACE, i.e. when you have a CSGeometry as described here
ngsolve.org/docu/latest/netgen_tutorials...e_3d_geometries.html
you can do
Code:
geo.GenerateMesh(maxh=0.3,perfstepsend=meshing.MeshingStep.MESHSURFACE)
to generate a surface mesh only.

Best
Christopher
More
6 years 8 months ago #115 by cwinters
Hi Tim,

2. When I attempted to refine in the gui (Refine Uniform in the Refinement menu), the gui, 'went away'.

Netgen needs a geometry to refine the mesh. It seems like this geometry information is not loaded properly when you load and refine with the gui.
If you use the python interface you can refine as well.
Code:
import netgen.meshing as meshing ngmesh = meshing.Mesh() ngmesh.Load("surfmesh.vol") ngmesh.Refine() ngmesh.GenerateVolumeMesh(meshing.MeshingParameters(maxh=0.2)) ngmesh.Save("volmesh.vol")
I generated the surface mesh with the following code:
Code:
from netgen.csg import CSGeometry import netgen.meshing as meshing geo = CSGeometry('cube.geo') ngmesh = geo.GenerateMesh(maxh=0.2,perfstepsend=meshing.MeshingStep.MESHSURFACE) ngmesh.Save('surfmesh.vol')

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

Thank you for the info. I will indeed have a look today.

But, I may have a misunderstanding about how geo files can be used (and created).

I am developing a software tool to deal with extracted isosurfaces (several in typical simulations). I don't construct surfaces. I know I can (and do) save those surfaces in different formats, in general.

Is there a (potential) relationship between such a surface, and a geo surface? A smallish extracted surface will have 10^4 faces.

A side issue that is common in what I am doing: Extracted surfaces that cannot be meshed w/o being cleaned up.
Indeed, yesterday, I tried to mesh a surface using the script approach to which you introduced me, and it didn't work. Netgen read and displayed the input surface, which is a start. But netgen didn't tell me anything - about why it did not create a volume mesh.

Are there flags that can be set provide verbose messages from netgen, to keep the user informed as to progress, and issues? That might help automate minimal cleanups.

Thanks,
Tim
More
6 years 8 months ago #117 by DrTSPC
Christoph:

I just copied, edited (for locality) and executed the scripts you put in your last post. Very nice.

Thank you,
Tim
More
6 years 8 months ago #119 by DrTSPC
Christoph:

Success!

Netgen has meshed an input surface mesh - from a system call in a fortran program. I attach (I think.) the output .vol file for your info; as a representative (but smallish) surface mesh with which I need to deal. The input file is the surface of the mesh, which I converted from a .ply file to a .vol file. Then I ran basically the script you sent me.

The mesh had a few missing faces/tris (6 or 7), and I had to correct that issue. Note that netgen did not id the issue as missing faces, as it 'crashed' . . . I suspected that was the issue: It is common in the types of surface meshes I am processing. I wanted to know if netgen could deal with a few missing faces. Perhaps, but not as I ran it.

One ESSENTIAL feature of the meshing needs to be that the surface (or specific parts of it) cannot have its vertices/faces moved. Is that possible to specify in netgen?

Thank you:
Tim

File Attachment:

File Name: out_in.vol.zip
File Size:767 KB
Attachments:
More
6 years 8 months ago #120 by christopher
If you create the volume mesh with that script, the surfaces should remain untouched. Did you see any moved vertices?
Best
Christopher
Time to create page: 0.115 seconds