- Thank you received: 0
adjusted mesh size in particular direction
5 years 11 months ago - 5 years 11 months ago #1331
by asilalahi
adjusted mesh size in particular direction was created by asilalahi
Hi,
I want to generate triangular mesh for concentric cylinder with a thin membrane between inner and outer region:
My input file :
algebraic3d
solid cube1 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl1 = cylinder (700, 700, 0; 700, 700, 800; 200.0);
solid dom1=cyl1 and cube1;
solid cube2 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl2 = cylinder (700, 700, 0; 700, 700, 800; 210);
solid gab2= cyl2 and cube2;
solid dom2= gab2 and not dom1;
solid cube3 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl3 = cylinder (700, 700, 0; 700, 700, 800; 700);
solid gab3= cyl3 and cube3;
solid dom3= gab3 and not dom1 and not dom2;
tlo dom1 -col=[1,0,0];
tlo dom2 -col=[0,1,0];
tlo dom3 -col=[0,1,0]- transparent;
The coarse mesh looks like this:
drive.google.com/open?id=1FX0AJ71svwhZC9cd4WlG-6dURP6enVe5
and to simulate the "physics" that iam interested in, i need to refine the mesh near the membrane, so it looks like this:
drive.google.com/open?id=1LISFB0zoEPibIXDX4y57ZOZ7urS03UeG
The number of mesh is too large and i know the change of physics quantity iam interested is signifiicant only in radial direction. Is there a way to refine mesh only in particular direction, in my case in radial direction? This way i can save lots of computational time and resource.
(Edited :
I could make more multiple regions and mesh them later to look like this :
drive.google.com/open?id=10nY9n2CtW4su6HPLca9BJ32DmEZ659Qr
But when i tried to increase the length of cylinder, the mesh generation took forever)
Thanks,
Alex
[attachment=undefined]coarse.png[/attachment]
I want to generate triangular mesh for concentric cylinder with a thin membrane between inner and outer region:
My input file :
algebraic3d
solid cube1 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl1 = cylinder (700, 700, 0; 700, 700, 800; 200.0);
solid dom1=cyl1 and cube1;
solid cube2 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl2 = cylinder (700, 700, 0; 700, 700, 800; 210);
solid gab2= cyl2 and cube2;
solid dom2= gab2 and not dom1;
solid cube3 = orthobrick (0, 0, 0; 1400, 1400, 800);
solid cyl3 = cylinder (700, 700, 0; 700, 700, 800; 700);
solid gab3= cyl3 and cube3;
solid dom3= gab3 and not dom1 and not dom2;
tlo dom1 -col=[1,0,0];
tlo dom2 -col=[0,1,0];
tlo dom3 -col=[0,1,0]- transparent;
The coarse mesh looks like this:
drive.google.com/open?id=1FX0AJ71svwhZC9cd4WlG-6dURP6enVe5
and to simulate the "physics" that iam interested in, i need to refine the mesh near the membrane, so it looks like this:
drive.google.com/open?id=1LISFB0zoEPibIXDX4y57ZOZ7urS03UeG
The number of mesh is too large and i know the change of physics quantity iam interested is signifiicant only in radial direction. Is there a way to refine mesh only in particular direction, in my case in radial direction? This way i can save lots of computational time and resource.
(Edited :
I could make more multiple regions and mesh them later to look like this :
drive.google.com/open?id=10nY9n2CtW4su6HPLca9BJ32DmEZ659Qr
But when i tried to increase the length of cylinder, the mesh generation took forever)
Thanks,
Alex
[attachment=undefined]coarse.png[/attachment]
Attachment not found
Last edit: 5 years 11 months ago by asilalahi.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 11 months ago - 5 years 11 months ago #1333
by christopher
Replied by christopher on topic adjusted mesh size in particular direction
Hi Alex,
You should use prismatic elements for that, so you can use the CloseSurface and ZRefinement features. With this you can slice the prismatic elements to get a refinement only in radial direction. This is a python script for that:
You should use prismatic elements for that, so you can use the CloseSurface and ZRefinement features. With this you can slice the prismatic elements to get a refinement only in radial direction. This is a python script for that:
Code:
from netgen.csg import *
geo = CSGeometry()
cube1 = OrthoBrick(Pnt(0,0,0), Pnt(1400,1400,800))
cyl1 = Cylinder(Pnt(700,700,0), Pnt(700,700,800),200)
dom1 = cyl1 * cube1
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,800),210)
gab2 = cyl2 * cube1
dom2 = gab2 - cyl1
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,800),700)
gab3 = cyl3 * cube1
dom3 = gab3 - cyl2
geo.Add(dom1)
geo.Add(dom2)
geo.Add(dom3)
n = 4
slices = [i/n for i in range(1,n)]
geo.CloseSurfaces(cyl1,cyl2,slices)
ngmesh = geo.GenerateMesh(maxh=100)
ZRefinement(ngmesh, geo)
from ngsolve import *
mesh = Mesh(ngmesh)
Draw(mesh)
Last edit: 5 years 11 months ago by christopher.
5 years 11 months ago #1334
by joachim
Replied by joachim on topic adjusted mesh size in particular direction
Hi,
be careful here with the z-refinement, it does not go together with curved elements well. But you can use a couple of cylinders for the shell, if needed.
Joachim
be careful here with the z-refinement, it does not go together with curved elements well. But you can use a couple of cylinders for the shell, if needed.
Joachim
5 years 11 months ago #1336
by asilalahi
Replied by asilalahi on topic adjusted mesh size in particular direction
Hi christopher,
Thanks for your help with the info of slicing feature, it works well for the previously quoted parameters. I tried to play and double the cylinder length from 800 to 1600, it generated mesh with "too large" zmax
drive.google.com/open?id=1uNvneVM9qF8_ds8Avv4h-ae5x8tZoakw
The modifed part of input:
cube1 = OrthoBrick(Pnt(0,0,0), Pnt(1400,1400,1600))
cyl1 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),200)
dom1 = cyl1 * cube1
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),210)
gab2 = cyl2 * cube1
dom2 = gab2 - cyl1
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),700)
gab3 = cyl3 * cube1
dom3 = gab3 - cyl2
i must have done something wrong here, would you please help to take a look at this?
Thanks,
Alex
Thanks for your help with the info of slicing feature, it works well for the previously quoted parameters. I tried to play and double the cylinder length from 800 to 1600, it generated mesh with "too large" zmax
drive.google.com/open?id=1uNvneVM9qF8_ds8Avv4h-ae5x8tZoakw
The modifed part of input:
cube1 = OrthoBrick(Pnt(0,0,0), Pnt(1400,1400,1600))
cyl1 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),200)
dom1 = cyl1 * cube1
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),210)
gab2 = cyl2 * cube1
dom2 = gab2 - cyl1
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),700)
gab3 = cyl3 * cube1
dom3 = gab3 - cyl2
i must have done something wrong here, would you please help to take a look at this?
Thanks,
Alex
Attachments:
5 years 11 months ago #1337
by joachim
Replied by joachim on topic adjusted mesh size in particular direction
you have to set a bounding-box for the geometry as follows. Default values are +/-1000
...
geo.CloseSurfaces(cyl1,cyl2,slices)
geo.SetBoundingBox(Pnt (-2000, -2000, -2000), Pnt(2000, 2000, 2000))
ngmesh = geo.GenerateMesh(maxh=100)
...
geo.CloseSurfaces(cyl1,cyl2,slices)
geo.SetBoundingBox(Pnt (-2000, -2000, -2000), Pnt(2000, 2000, 2000))
ngmesh = geo.GenerateMesh(maxh=100)
Time to create page: 0.108 seconds