- Thank you received: 101
adjusted mesh size in particular direction
- christopher
-
- Offline
- Administrator
-
Less
More
6 years 8 months ago - 6 years 8 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: 6 years 8 months ago by christopher.
6 years 8 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
6 years 8 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:
6 years 8 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)
6 years 8 months ago #1339
by asilalahi
Replied by asilalahi on topic adjusted mesh size in particular direction
Hi Joachim,
that works, thank you.
Alex
that works, thank you.
Alex
6 years 8 months ago - 6 years 7 months ago #1358
by asilalahi
Replied by asilalahi on topic adjusted mesh size in particular direction
Hi,
Lets say i want to refine the mesh in the region 1 and/or 3 near the membrane(region 2), I can do this by creating 4 cylindrical surfaces:
geo = CSGeometry()
cube1 = OrthoBrick(Pnt(0,0,0), Pnt(1400,1400,1600))
cyl1 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),180)
dom1 = cyl1 * cube1
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),200)
gab2 = cyl2 * cube1
dom2 = gab2 - cyl1
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),210)
gab3 = cyl3 * cube1
dom3 = gab3 - cyl2
cyl4 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),700)
gab4 = cyl4 * cube1
dom4 = gab4 - cyl3
geo.Add(dom1)
geo.Add(dom2)
geo.Add(dom3)
geo.Add(dom4)
n = 4
slices = [i/n for i in range(1,n)]
geo.CloseSurfaces(cyl1,cyl2,slices)
geo.CloseSurfaces(cyl2,cyl3,slices)
geo.SetBoundingBox(Pnt (-6000, -6000, -6000), Pnt(6000, 6000, 6000))
ngmesh = geo.GenerateMesh(maxh=500)
ZRefinement(ngmesh, geo)
But the above script will create 4 regions, instead of 3.
Is it possible to create an imaginary cylindrical surface (not part of physical region) and slices/refine between that surface and another surface? Or am i better off with modifying the 4 region indices in output "*.vol" file to be 3 region indices ?
Another question is related to the prism constructed between the two surfaces. If the cyl1 and cyl2 facing surfaces are quite paralel (lets say r1=200 and r2=205), then i will get nice parallel triangular prisms between the two surfaces like below:
However if the r1=200 and r2=230, then the two facing tetrahedral surfaces are not quite paralel, then the prisms between look quite funny. like bellow:
[attachment=undefined]not_paralel.jpg[/attachment]
For my research, i need to have parallel prisms between the surfaces. Is there a way to modify such that we have all parallel triangular prisms. I dont mind if there is small void of volume created by doing so, because in my project, the most important things occur near this membrane and it decays exponentially outward.
Best,
Alex
Lets say i want to refine the mesh in the region 1 and/or 3 near the membrane(region 2), I can do this by creating 4 cylindrical surfaces:
geo = CSGeometry()
cube1 = OrthoBrick(Pnt(0,0,0), Pnt(1400,1400,1600))
cyl1 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),180)
dom1 = cyl1 * cube1
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),200)
gab2 = cyl2 * cube1
dom2 = gab2 - cyl1
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),210)
gab3 = cyl3 * cube1
dom3 = gab3 - cyl2
cyl4 = Cylinder(Pnt(700,700,0), Pnt(700,700,1600),700)
gab4 = cyl4 * cube1
dom4 = gab4 - cyl3
geo.Add(dom1)
geo.Add(dom2)
geo.Add(dom3)
geo.Add(dom4)
n = 4
slices = [i/n for i in range(1,n)]
geo.CloseSurfaces(cyl1,cyl2,slices)
geo.CloseSurfaces(cyl2,cyl3,slices)
geo.SetBoundingBox(Pnt (-6000, -6000, -6000), Pnt(6000, 6000, 6000))
ngmesh = geo.GenerateMesh(maxh=500)
ZRefinement(ngmesh, geo)
But the above script will create 4 regions, instead of 3.
Is it possible to create an imaginary cylindrical surface (not part of physical region) and slices/refine between that surface and another surface? Or am i better off with modifying the 4 region indices in output "*.vol" file to be 3 region indices ?
Another question is related to the prism constructed between the two surfaces. If the cyl1 and cyl2 facing surfaces are quite paralel (lets say r1=200 and r2=205), then i will get nice parallel triangular prisms between the two surfaces like below:
Attachment not found
However if the r1=200 and r2=230, then the two facing tetrahedral surfaces are not quite paralel, then the prisms between look quite funny. like bellow:
[attachment=undefined]not_paralel.jpg[/attachment]
For my research, i need to have parallel prisms between the surfaces. Is there a way to modify such that we have all parallel triangular prisms. I dont mind if there is small void of volume created by doing so, because in my project, the most important things occur near this membrane and it decays exponentially outward.
Best,
Alex
Last edit: 6 years 7 months ago by asilalahi. Reason: additional questions
Time to create page: 0.153 seconds