[Gmsh] How to have a non constant carachteristic length between to spherical surfaces
Jan Domurath
jan.domurath at gmail.com
Mon Jul 8 18:39:50 CEST 2013
Am 07.07.2013 um 11:49 schrieb moritz braun <moritz.braun at gmail.com>:
> Dear All
>
> The geo file below
>
>
>
> ====================================================
> lcar = 0.05;
>
> Function Mysphere;
>
> // In the following commands we use the reserved variable name
> // `newp', which automatically selects a new point number. This
> // number is chosen as the highest current point number, plus
> // one. (Note that, analogously to `newp', the variables `newc',
> // `news', `newv' and `newreg' select the highest number amongst
> // currently defined curves, surfaces, volumes and `any entities
> // other than points', respectively.)
>
> p1 = newp; Point(p1) = {x, y, z, lcar} ;
> p2 = newp; Point(p2) = {x+r,y, z, lcar} ;
> p3 = newp; Point(p3) = {x, y+r,z, lcar} ;
> p4 = newp; Point(p4) = {x, y, z+r,lcar} ;
> p5 = newp; Point(p5) = {x-r,y, z, lcar} ;
> p6 = newp; Point(p6) = {x, y-r,z, lcar} ;
> p7 = newp; Point(p7) = {x, y, z-r,lcar} ;
>
> c1 = newreg; Circle(c1) = {p2,p1,p7};
> c2 = newreg; Circle(c2) = {p7,p1,p5};
> c3 = newreg; Circle(c3) = {p5,p1,p4};
> c4 = newreg; Circle(c4) = {p4,p1,p2};
> c5 = newreg; Circle(c5) = {p2,p1,p3};
> c6 = newreg; Circle(c6) = {p3,p1,p5};
> c7 = newreg; Circle(c7) = {p5,p1,p6};
> c8 = newreg; Circle(c8) = {p6,p1,p2};
> c9 = newreg; Circle(c9) = {p7,p1,p3};
> c10 = newreg; Circle(c10) = {p3,p1,p4};
> c11 = newreg; Circle(c11) = {p4,p1,p6};
> c12 = newreg; Circle(c12) = {p6,p1,p7};
>
> // We need non-plane surfaces to define the spherical holes. Here we
> // use ruled surfaces, which can have 3 or 4 sides:
>
> l1 = newreg; Line Loop(l1) = {c5,c10,c4}; Ruled Surface(newreg) = {l1};
> l2 = newreg; Line Loop(l2) = {c9,-c5,c1}; Ruled Surface(newreg) = {l2};
> l3 = newreg; Line Loop(l3) = {c12,-c8,-c1}; Ruled Surface(newreg) = {l3};
> l4 = newreg; Line Loop(l4) = {c8,-c4,c11}; Ruled Surface(newreg) = {l4};
> l5 = newreg; Line Loop(l5) = {-c10,c6,c3}; Ruled Surface(newreg) = {l5};
> l6 = newreg; Line Loop(l6) = {-c11,-c3,c7}; Ruled Surface(newreg) = {l6};
> l7 = newreg; Line Loop(l7) = {-c2,-c7,-c12};Ruled Surface(newreg) = {l7};
> l8 = newreg; Line Loop(l8) = {-c6,-c9,c2}; Ruled Surface(newreg) = {l8};
> theloops[t] = newreg;
> Surface Loop(theloops[t]) = {l8+1,l5+1,l1+1,l2+1,l3+1,l7+1,l6+1,l4+1};
>
> Return
>
> x = 0.0 ; y = 0.0 ; z = 0 ; r = 2.0 ; t=0;
> Call Mysphere ;
> x = 0 ; y = 0.0 ; z = 0 ; r = 1.0 ; t=1;
> Call Mysphere ;
>
> Volume (186)={theloops[]};
> Physical Volume(999)= 186;
> ===============================
>
> creates a mesh with constant lc=0.05
> between r=1 and r=2
> I would like to have the lc value increase with growing r.
> However, if I use different lc values for the two calls to Mysphere
> the result is a sphere of radius 2 instead of the mesh for the desired shell!
> Any ideas how to fix this would be appreciated!
>
Hi Moritz,
if I change the calls to Mysphere like this:
x = 0.0 ; y = 0.0 ; z = 0 ; r = 2.0 ; t=0; lcar = 0.2;
Call Mysphere ;
x = 0 ; y = 0.0 ; z = 0 ; r = 1.0 ; t=1; lcar = 0.05;
Call Mysphere ;
it works for me.
Cheers,
Jan