- Thank you received: 0
add delaunay mesh region on the top of prism(slice) surface
5 years 10 months ago - 5 years 10 months ago #1382
by asilalahi
Hi,
I was able to generate a 3-region cylindrical shells with parameters:
490<r<500 , Region 1
500<r<505 , Region 2 (membrane)
505<r<515 , Region 3
Here, the Region 1 and 3 are separated by a 5nm width membrane.
The code is as bellow :
==================================================================================
from netgen.csg import *
geo = CSGeometry()
cube = OrthoBrick(Pnt(-5700,-5700,0), Pnt(7100,7100,6300))
cyl1_in=Cylinder(Pnt(700,700,0), Pnt(700,700,200),490)
cyl1=Cylinder(Pnt(700,700,0), Pnt(700,700,200),500)
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),505)
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),515)
dom1=cyl1 * cube - cyl1_in
dom2=cyl2 * cube - cyl1
dom3=cyl3 * cube - cyl2
geo.Add(dom1)
geo.Add(dom2)
geo.Add(dom3)
n =10
slices1x = [i/n for i in range(1,n)]
slices2 = [i/2 for i in range(1,2)]
geo.CloseSurfaces(cyl1,cyl1_in,slices1x)
geo.CloseSurfaces(cyl1,cyl2,slices2)
geo.CloseSurfaces(cyl2,cyl3,slices1x)
geo.SetBoundingBox(Pnt (-12000, -12000, -12000), Pnt(12000, 12000, 12000))
ngmesh = geo.GenerateMesh(maxh=100)
ZRefinement(ngmesh, geo)
from ngsolve import *
mesh = Mesh(ngmesh)
Draw(mesh)
===============================================================================
The most important & signifficant physics occur in these 3 regions, but i still need to put correct boundary, especially outside Region 3.
For this purpose, I would like to add another region/domain using delaunay mesh outside Region 3 , maybe up to r=3000nm. How to do this without my mesh being constrained by maxh=100( as in above code) ? I would like to make it coarse in this region, maybe maxh=700.
Best,
Alex
I was able to generate a 3-region cylindrical shells with parameters:
490<r<500 , Region 1
500<r<505 , Region 2 (membrane)
505<r<515 , Region 3
Here, the Region 1 and 3 are separated by a 5nm width membrane.
The code is as bellow :
==================================================================================
from netgen.csg import *
geo = CSGeometry()
cube = OrthoBrick(Pnt(-5700,-5700,0), Pnt(7100,7100,6300))
cyl1_in=Cylinder(Pnt(700,700,0), Pnt(700,700,200),490)
cyl1=Cylinder(Pnt(700,700,0), Pnt(700,700,200),500)
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),505)
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),515)
dom1=cyl1 * cube - cyl1_in
dom2=cyl2 * cube - cyl1
dom3=cyl3 * cube - cyl2
geo.Add(dom1)
geo.Add(dom2)
geo.Add(dom3)
n =10
slices1x = [i/n for i in range(1,n)]
slices2 = [i/2 for i in range(1,2)]
geo.CloseSurfaces(cyl1,cyl1_in,slices1x)
geo.CloseSurfaces(cyl1,cyl2,slices2)
geo.CloseSurfaces(cyl2,cyl3,slices1x)
geo.SetBoundingBox(Pnt (-12000, -12000, -12000), Pnt(12000, 12000, 12000))
ngmesh = geo.GenerateMesh(maxh=100)
ZRefinement(ngmesh, geo)
from ngsolve import *
mesh = Mesh(ngmesh)
Draw(mesh)
===============================================================================
The most important & signifficant physics occur in these 3 regions, but i still need to put correct boundary, especially outside Region 3.
For this purpose, I would like to add another region/domain using delaunay mesh outside Region 3 , maybe up to r=3000nm. How to do this without my mesh being constrained by maxh=100( as in above code) ? I would like to make it coarse in this region, maybe maxh=700.
Best,
Alex
Last edit: 5 years 10 months ago by asilalahi. Reason: typo
5 years 10 months ago - 5 years 10 months ago #1383
by cwinters
Replied by cwinters on topic add delaunay mesh region on the top of prism(slice) surface
Hi,
you can define the maxh right when you add your domains to the geometry
If you add another cylinder on the outside without adding CloseSurfaces you get a tetrahedral mesh in this domain.
should then give you a courser mesh on the outside domain.
Best,
Christoph
you can define the maxh right when you add your domains to the geometry
Code:
geo.Add(dom1,maxh=100)
geo.Add(dom2,maxh=100)
geo.Add(dom3,maxh=100)
Code:
ngmesh = geo.GenerateMesh(maxh=700)
Best,
Christoph
Attachments:
Last edit: 5 years 10 months ago by cwinters.
5 years 10 months ago #1385
by asilalahi
Replied by asilalahi on topic add delaunay mesh region on the top of prism(slice) surface
Hi Christopher,
Thanks alot, i didnt know that.
I have another setup that i want to do, in which i want to add a pillar (cylindrical geometry) to the previous geometry. This pillar is located right outside Region 2. And because we also have region 3 outside Region 2, there will be overlapping between Region 3 and pillar.
So here is the code that i tried:
===================================================================================
from netgen.csg import *
geo = CSGeometry()
cube = OrthoBrick(Pnt(-5700,-5700,0), Pnt(7100,7100,1300))
cube_b = OrthoBrick(Pnt(-5700,-100,0), Pnt(7100,195,2000))
cyl1_in=Cylinder(Pnt(700,700,0), Pnt(700,700,200),490)
cyl1=Cylinder(Pnt(700,700,0), Pnt(700,700,200),500)
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),505)
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),550)
cyl4=Cylinder(Pnt(700,0,650), Pnt(700,-700,650),200)
dom1=cyl1 * cube - cyl1_in
dom2=cyl2 * cube - cyl1
dom3=cyl3 * cube - cyl2
dom4=cyl4* cube_b
geo.Add(dom1.maxh(100))
geo.Add(dom2.maxh(100))
geo.Add(dom3.maxh(100))
geo.Add(dom4.maxh(50))
n =10
slices1x = [i/n for i in range(1,n)]
slices2 = [i/2 for i in range(1,2)]
geo.CloseSurfaces(cyl1,cyl1_in,slices1x)
geo.CloseSurfaces(cyl1,cyl2,slices2)
geo.CloseSurfaces(cyl2,cyl3,slices1x)
geo.SetBoundingBox(Pnt (-12000, -12000, -12000), Pnt(12000, 12000, 12000))
ngmesh = geo.GenerateMesh(maxh=100)
ZRefinement(ngmesh, geo)
from ngsolve import *
mesh = Mesh(ngmesh)
Draw(mesh)
==============================================================================
the geometry roughly looks like :
drive.google.com/open?id=1w3RL2Yir4gy03-Q1r4W1G7otT10bhQ2N
Obviously Region 3 (exterior) and Region 4( the pillar) overlap, as shown below:
drive.google.com/open?id=1h0to7DiSxPxJlDycY5JAkvD6wmoYVj8A
I want to first try the easier way to get around this problem, which is to delete region 3 that intersects with region 4, while maintaining the parallel prism cell in region 3. How to do this?
Thanks,
Alex
Thanks alot, i didnt know that.
I have another setup that i want to do, in which i want to add a pillar (cylindrical geometry) to the previous geometry. This pillar is located right outside Region 2. And because we also have region 3 outside Region 2, there will be overlapping between Region 3 and pillar.
So here is the code that i tried:
===================================================================================
from netgen.csg import *
geo = CSGeometry()
cube = OrthoBrick(Pnt(-5700,-5700,0), Pnt(7100,7100,1300))
cube_b = OrthoBrick(Pnt(-5700,-100,0), Pnt(7100,195,2000))
cyl1_in=Cylinder(Pnt(700,700,0), Pnt(700,700,200),490)
cyl1=Cylinder(Pnt(700,700,0), Pnt(700,700,200),500)
cyl2 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),505)
cyl3 = Cylinder(Pnt(700,700,0), Pnt(700,700,200),550)
cyl4=Cylinder(Pnt(700,0,650), Pnt(700,-700,650),200)
dom1=cyl1 * cube - cyl1_in
dom2=cyl2 * cube - cyl1
dom3=cyl3 * cube - cyl2
dom4=cyl4* cube_b
geo.Add(dom1.maxh(100))
geo.Add(dom2.maxh(100))
geo.Add(dom3.maxh(100))
geo.Add(dom4.maxh(50))
n =10
slices1x = [i/n for i in range(1,n)]
slices2 = [i/2 for i in range(1,2)]
geo.CloseSurfaces(cyl1,cyl1_in,slices1x)
geo.CloseSurfaces(cyl1,cyl2,slices2)
geo.CloseSurfaces(cyl2,cyl3,slices1x)
geo.SetBoundingBox(Pnt (-12000, -12000, -12000), Pnt(12000, 12000, 12000))
ngmesh = geo.GenerateMesh(maxh=100)
ZRefinement(ngmesh, geo)
from ngsolve import *
mesh = Mesh(ngmesh)
Draw(mesh)
==============================================================================
the geometry roughly looks like :
drive.google.com/open?id=1w3RL2Yir4gy03-Q1r4W1G7otT10bhQ2N
Obviously Region 3 (exterior) and Region 4( the pillar) overlap, as shown below:
drive.google.com/open?id=1h0to7DiSxPxJlDycY5JAkvD6wmoYVj8A
I want to first try the easier way to get around this problem, which is to delete region 3 that intersects with region 4, while maintaining the parallel prism cell in region 3. How to do this?
Thanks,
Alex
Attachments:
5 years 10 months ago #1387
by cwinters
Replied by cwinters on topic add delaunay mesh region on the top of prism(slice) surface
Hi,
you have two tell the mesher how the two parts are "connected". In your case you have to cut out "cyl3":
Best,
Christoph
you have two tell the mesher how the two parts are "connected". In your case you have to cut out "cyl3":
Code:
dom4=cyl4* cube_b - cyl3
Best,
Christoph
5 years 10 months ago #1388
by cwinters
Replied by cwinters on topic add delaunay mesh region on the top of prism(slice) surface
Hi,
I forgot to add that you can not connect your pillar (cyl4) to cyl3 when the volume between cyl2 and cyl3 consists of prisms. The intersection of the cylinders has to be resolved in the surface mesh.To add the prisms between two layers, the meshes on these layer must be identical. This is not the case if one intersects with another cylinder while the other one does not.
Best,
Christoph
I forgot to add that you can not connect your pillar (cyl4) to cyl3 when the volume between cyl2 and cyl3 consists of prisms. The intersection of the cylinders has to be resolved in the surface mesh.To add the prisms between two layers, the meshes on these layer must be identical. This is not the case if one intersects with another cylinder while the other one does not.
Best,
Christoph
5 years 10 months ago #1389
by asilalahi
Replied by asilalahi on topic add delaunay mesh region on the top of prism(slice) surface
Hi Christopher,
Thanks for your reply, yes it is the challenge with my setup.
To resolve the important physics around membrane boundary, i need to have resolution around ~ 0.5 nm in radial direction near the membrane. Thus if i dont use prism cell, i will need too many number of tetrahedral cells in Region 3. because region 3 range from 505 to 515 nm and with length of 1300nm.
I thought that if i could delete some of the prism cells in region 3 that intersect with pillar, then it maybe good enough for my first try.
FYI:
Region 2: membrane (physical)
Region 4: pillar (pyhsical)
Region 1 and 3 represent mixture of ions that can freely move.
Best,
Alex
Thanks for your reply, yes it is the challenge with my setup.
To resolve the important physics around membrane boundary, i need to have resolution around ~ 0.5 nm in radial direction near the membrane. Thus if i dont use prism cell, i will need too many number of tetrahedral cells in Region 3. because region 3 range from 505 to 515 nm and with length of 1300nm.
I thought that if i could delete some of the prism cells in region 3 that intersect with pillar, then it maybe good enough for my first try.
FYI:
Region 2: membrane (physical)
Region 4: pillar (pyhsical)
Region 1 and 3 represent mixture of ions that can freely move.
Best,
Alex
Time to create page: 0.116 seconds