- Thank you received: 0
Volume Mesh and Mesh Import
7 years 1 month ago #199
by Nils
Volume Mesh and Mesh Import was created by Nils
Hi Again,
I am trying to build 3D meshes manually. Unfortunately, I dont know how to create volume elements.
Is there any command for this?
Another question is (which would also solve my primal problem), in which format is it possible to import meshes in Netgen? I have tried to Export a simple mesh from netgen (in neutral format) and then imported it again. Unfortunately, this does not work. I have attached the code for the simple mesh.
It would be great if you could help me, with at least one of the problems.
Code for Volume mesh:
Mesh Import:
I am trying to build 3D meshes manually. Unfortunately, I dont know how to create volume elements.
Is there any command for this?
Another question is (which would also solve my primal problem), in which format is it possible to import meshes in Netgen? I have tried to Export a simple mesh from netgen (in neutral format) and then imported it again. Unfortunately, this does not work. I have attached the code for the simple mesh.
It would be great if you could help me, with at least one of the problems.
Code for Volume mesh:
Code:
import ngsolve as ngs
from netgen.geom2d import unit_square, MakeCircle, SplineGeometry
from netgen.meshing import Element0D, Element1D, Element2D, MeshPoint, FaceDescriptor, Mesh
from netgen.csg import Pnt
mesh = Mesh(dim=3)
pnums = []
pnums.append(mesh.Add(MeshPoint(Pnt(0, 0, 0))))
pnums.append(mesh.Add(MeshPoint(Pnt(1, 0, 0))))
pnums.append(mesh.Add(MeshPoint(Pnt(0, 1, 0))))
pnums.append(mesh.Add(MeshPoint(Pnt(0, 0, 1))))
mesh.SetMaterial(1, "mat")
mesh.Add (FaceDescriptor(surfnr=1,domin=1,bc=1))
mesh.Add(Element2D(1, [pnums[0], pnums[1], pnums[2]]))
mesh.Add(Element2D(1, [pnums[0], pnums[1], pnums[3]]))
mesh.Add(Element2D(1, [pnums[0], pnums[2], pnums[3]]))
mesh.Add(Element2D(1, [pnums[1], pnums[2], pnums[3]]))
mesh=ngs.Mesh(mesh)
Mesh Import:
Code:
8
0.000000 0.000000 0.000000
0.000000 0.000000 1.000000
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
1.000000 0.000000 1.000000
0.000000 1.000000 1.000000
1.000000 1.000000 0.000000
1.000000 1.000000 1.000000
6
1 2 4 8 6
1 2 5 8 7
1 1 2 7 3
1 2 3 5 7
1 1 2 4 7
1 2 4 7 8
12
1 1 4 7
1 1 7 3
2 1 2 4
2 2 6 4
3 4 8 7
3 4 6 8
4 5 7 8
4 3 7 5
5 2 8 6
5 2 5 8
6 2 3 5
6 1 3 2
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
7 years 1 month ago #200
by christopher
Replied by christopher on topic Volume Mesh and Mesh Import
Hi Nils,
there is some help in the documentation:
ngsolve.org/docu/latest/netgen_tutorials...mesh_generation.html
You can as well use this code, which converts gmsh meshes to Netgen ones as guidance
github.com/etromme/netgen/blob/6a26d5234.../python/read_gmsh.py
About importing neutral file formats. From where do you want to import them? They may not be compatible... How do you import them?
Best
Christopher
there is some help in the documentation:
ngsolve.org/docu/latest/netgen_tutorials...mesh_generation.html
You can as well use this code, which converts gmsh meshes to Netgen ones as guidance
github.com/etromme/netgen/blob/6a26d5234.../python/read_gmsh.py
About importing neutral file formats. From where do you want to import them? They may not be compatible... How do you import them?
Best
Christopher
Time to create page: 0.100 seconds