load "Element_P4"; load "Element_P3"; /* Resolution de Poisson ou je sais pas encore quoi sur un maillage zarbi */ real R=2; int NbSeg=10; /* defini le bord 'cercle' */ border cercle (t=0,2*pi){x=R*cos(t); y=R*sin(t);label=1;}; /* defini le bord y=R */ border xaxis(t=-R,R){x=t;y=0;label=2;}; border cercleL(t=0,2*pi){x=-R/4+R/10*cos(t);y=R/2+R/10*sin(t);label=3;}; border cercleR(t=0,2*pi){x=+R/4+R/10*cos(t);y=R/2+R/10*sin(t);label=3;}; /* Représentation graphique */ //plot(cercle(NbSeg)+xaxis(2*NbSeg)+cercleL(NbSeg)+cercleR(NbSeg)); border mouthT(t=-R/2,R/2){x=t;y=0.0;label=5;}; border mouthB(t=0,-pi){x=R/2*cos(t);y=R/2*sin(t);label=5;}; /* Integer for Labels */ int iOut = 1,iEyes=3,iMouth=5; mesh Th = buildmesh( cercle(2*NbSeg*pi*R)+ // xaxis(2*NbSeg*R)+ cercleL(-2*NbSeg)+ cercleR(-2*NbSeg)+ mouthT(2*NbSeg)+mouthB(pi*NbSeg) ); plot(Th); macro grad(w) [dx(w),dy(w)] // EOM: End Of Macro. Column Vector fespace Vh(Th,P3); Vh u,v; // Definition des fonctions f et g (-Delta u = f on \Omega, u = g on \Gamma.) func f = -1.0; func gOut = 0.0; func gEyes = 0.0; func gMouth = 0.0; // Implement Solver solve Poisson(u,v) = int2d(Th)(grad(u)'*grad(v)) - int2d(Th)(f*v) + on(1, u=gOut) + on(iEyes,u=gEyes) + on(iMouth,u=gMouth); // Graphical Representation plot(u,fill=1,value=1,cmm="Min Val. = "+u[].min); //plot(u,dim=3,fill=1,value=1,cmm="Min Val. = "+u[].min); /* Radial function */ //v = x*x+y*y; //plot(v); //cout<<"Integral of x^2+y^2 over the mesh: "<< int2d(Th)(v)<