Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

adjusted mesh size in particular direction

More
5 years 4 months ago - 5 years 4 months ago #1331 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]

Attachment not found

Last edit: 5 years 4 months ago by asilalahi.
More
5 years 4 months ago - 5 years 4 months ago #1333 by christopher
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:
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 4 months ago by christopher.
More
5 years 4 months ago #1334 by joachim
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
More
5 years 4 months ago #1336 by asilalahi
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
Attachments:
More
5 years 4 months ago #1337 by joachim
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)
More
5 years 4 months ago #1339 by asilalahi
Hi Joachim,

that works, thank you.

Alex
Time to create page: 0.162 seconds