Loading .vol files

More
4 years 7 months ago - 4 years 7 months 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 7 months ago by grinver.
More
4 years 7 months 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.099 seconds