Thanks @fotios.kasolis for your useful example,
first of all I had to change in every line you use movemesh23, mesh3
to meshS
, otherwise I get an error.
Doing so, I don’t obtain the sphere, but just the coil inside it. I tried to build my sphere following your script and others and it is the following one.
load "tetgen"
load "medit"
real R = 1;
mesh Th=square(10,20,[x*pi-pi/2,2*y*pi]);
// a parametrization of a sphere
func f1 =cos(x)*cos(y);
func f2 =cos(x)*sin(y);
func f3 = sin(x);
func f1x=sin(x)*cos(y);
func f1y=-cos(x)*sin(y);
func f2x=-sin(x)*sin(y);
func f2y=cos(x)*cos(y);
func f3x=cos(x);
func f3y=0;
// $ M = DF^t DF $
func m11=f1x^2+f2x^2+f3x^2;
func m21=f1x*f1y+f2x*f2y+f3x*f3y;
func m22=f1y^2+f2y^2+f3y^2;
func perio=[[4,y],[2,y],[1,x],[3,x]];
real hh=0.05;
real vv= 1/square(hh);
verbosity=2;
Th=adaptmesh(Th,m11*vv,m21*vv,m22*vv,IsMetric=1,periodic=perio);
Th=adaptmesh(Th,m11*vv,m21*vv,m22*vv,IsMetric=1,periodic=perio);
verbosity=2;
real[int] domain =[0.,0.,0.,1,0.01];
mesh3 Th3=tetgtransfo(Th,transfo=[R*f1,R*f2,R*f3],nbofregions=1,regionlist=domain);
plot(Th3);
savemesh(Th3,"sphere.meshb");
It builds the surface, but my question is: do I get also the discretization of the interior?
If not, what should I add/change (probably in tetgen
)?