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.

Loading .vol files

More
4 years 3 weeks ago - 4 years 3 weeks ago #2540 by grinver
Loading .vol files was created by grinver
Hello,

What is the proper way to load .vol files on NGSolve and then create a mesh? I built a geometry from scratch using CSG but when I save it and try to load it and mesh, it crashes. I even tried loading and meshing with the sample geometries from the documentation, but it still crashes.

Can somebody explain why it crashes or what the proper python code should be?

Thank you very much,
Irving
Last edit: 4 years 3 weeks ago by grinver.
More
4 years 3 weeks ago #2544 by valhan
Replied by valhan on topic Loading .vol files
Hey Irving,

the following code creates an arbitrary geometry and saves it. Further, it deletes all according variables and loads it again. Works fine for me.

I hope that answers your question!

Cheers,
val
Code:
from ngsolve import * from netgen.csg import * cube = OrthoBrick( Pnt(0,0,0), Pnt(1,1,1) ) hole = Cylinder ( Pnt(0.5, 0.5, 0), Pnt(0.5, 0.5, 1), 0.2) geo = CSGeometry() geo.Add (cube-hole) mesh = geo.GenerateMesh(maxh=0.1) mesh.Save("cube_hole.vol") del geo, mesh, hole, cube mesh = Mesh("cube_hole.vol") import netgen.gui Draw(mesh) input()
Time to create page: 0.103 seconds