How to describe the surface of a sphere

Hello guys.I am trying to solve a pde on a sphere3.
And now I want to describe the surface of a sphere3.


Here are some parts of the code.

solve lame([u1, u2, u3], [v1, v2, v3])
= int3d(Th3)(
lambda * div(u1, u2, u3) * div(v1, v2, v3)
+ 2.*mu *  epsilon(u1, u2, u3)' * epsilon(v1, v2, v3)
)
- int3d(Th3)(omega*omega*(u1*v1+u2*v2+u3*v3))
+ on(_________, u1=0, u2=0, u3=0)
;

Th3 is the sphere I constructed,then the underscore part should fill in the surface of that sphere,but I do not know how to describe it .

They are some exemple to build a mesh of a sphere

thank you for replying me and maybe I didn’t make it clear enough.
Actually I’ve built a sphere3.

// sphere3
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);
Th3=buildBdMesh(Th3);


Th3 is the omega and now how can I describe the sphere surface with the above code ,namely
2

Just use the meshS Thb of my script or the meshS Th of your script

That’s it. Thanks a lot. :pray:

Sorry to bother you again. Could you help me take a look at the following code and tell me if there is a mistake.

load "msh3"
load "medit" 
load "tetgen"
load "mmg"
include "MeshSurface.idp"

// parameters
real E = 21.5;
real nu = 0.28;
real omega = 15;

// matrix functions
func p11 = 1/(0.7+100*(x-0.1)*(x-0.1)+10*y*y+z*z)-1/(1.3+100*(x+0.1)*(x+0.1)+10*y*y+z*z);
func p22 = -1/(0.7+100*x*x+10*(y-0.2)*(y-0.2)+z*z)+1/(1.3+100*x*x+10*(y+0.2)*(y+0.2)+z*z);
func p33 = 1/(0.7+100*x*x+10*y*y+(z-0.3)*(z-0.3))-1/(1.3+100*x*x+10*y*y+(z+0.3)*(z+0.3));
func p12 = (1/(0.7+100*(x-0.1)*(y-0.1))-1/(1.3+100*(x+0.1)*(y+0.1)))/(1+x*x);
func p13 = (1/(0.7+100*(x-0.2)*(z-0.2))-1/(1.3+100*(x+0.2)*(z+0.2)))/(1+y*y);
func p23 = (1/(0.7+100*(y-0.3)*(z-0.3))-1/(1.3+100*(y+0.3)*(z+0.3)))/(1+z*z);

// sphere3
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;
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);
Th3=buildBdMesh(Th3);
savemesh(Th3,"sphere.meshb");

// sphere2
real hsize= 0.1; 
real areaT = hsize*hsize*sqrt(3)/2.;
real areaS= 4*pi*R*R;
real nn = sqrt(areaS/areaT/20.); 
cout << nn << endl; 
meshS Thb=Sphere20(1,nn,1,0);

//fespace
fespace Vh(Th3,[P1,P1,P1]);
Vh<complex> [u1,u2,u3], [v1,v2,v3];
fespace Uh(Thb,[P1,P1,P1]);

// Macro
real sqrt2=sqrt(2.);
macro epsilon(u1,u2,u3) [dx(u1),dy(u2),dz(u3),(dy(u1)+dx(u2))/sqrt2,(dz(u1)+dx(u3))/sqrt2,(dz(u2)+dy(u3))/sqrt2] //
// The sqrt2 is because we want: epsilon(u1,u2,u3)'* epsilon(v1,v2,v3) = epsilon(u): epsilon(v)
macro div(u,v,w) ( dx(u)+dy(v)+dz(w)) //

// Problem
real phi = 5;
func test1 = exp(1i*(sqrt(omega*omega-phi*phi/4)*y+phi*z/2));
func test2 = exp(1i*(-sqrt(omega*omega-phi*phi/4)*y+phi*z/2));
real mu= E/(2*(1+nu));
real lambda = E*nu/((1+nu)*(1-2*nu));

solve lame([u1, u2, u3], [v1, v2, v3])
= int3d(Th3)(
lambda * div(u1, u2, u3) * div(v1, v2, v3)
+ 2.*mu *  epsilon(u1, u2, u3)' * epsilon(v1, v2, v3)
)
- int3d(Th3)(omega*omega*(u1*v1+u2*v2+u3*v3))
- int3d(Th3)((p11*v1+p12*v2+p13*v3)*test1)
+ on(Thb, u1=0, u2=0, u3=0)
;

complex mm;
mm = int2d(ThS)(u1+u2+u3);
cout<<mm<<endl;

The error message is as follows:

+ on(Thb, u1=0, u2=0, u3=0)Impossible to cast <PPKN5Fem2D5MeshSE> in <l>
Compile error