meditddm.edp

// meditddm.edp 
load "medit" 

/********************************************  Initial Problem: Resolution of the following EDP: - Δu = f on   W=\{ (x,y) |  1 sqrt(x2+y2) 2} - Δu = f1 on  W1 =\{ (x,y) |  0.5 sqrt(x2+y2) 1.} u = 1 on Γ  +  Null Neumman condition on Γ1 and on Γ2 We find the solution u in solving two EDP defined on domain W and W1 This solution is vizualize with ffmedit *********************************************/ 
verbosity=3; 

border Gamma(t=0,2*pi){x=cos(t); y=sin(t); label=1;}; 
border Gamma1(t=0,2*pi){x=2*cos(t); y=2*sin(t); label=2;}; 
border Gamma2(t=0,2*pi){x=0.5*cos(t); y=0.5*sin(t); label=3;}; 

// construction of mesh of domain W 
mesh Th=buildmesh(Gamma1(40)+Gamma(-40)); 

fespace Vh(Th,P2); 
func f=sqrt(x*x+y*y); 
Vh us,v; 
macro Grad2(us) [dx(us),dy(us)]  // EOM 

problem Lap2dOmega(us,v,init=false)=int2d(Th)(Grad2(v)' *Grad2(us)) - int2d(Th)(f*v)+on(Gamma,us=1) ; 
//  Resolution of EDP defined on the domain W 
// - Δu = f on W 
//      u = 1  on Γ}//   + Null Neumann condition on Γ1 
Lap2dOmega; 

// construction of mesh of domain W1 =\{ (x,y) |  0.5 sqrt(x2+y2) 1.} 
mesh Th1=buildmesh(Gamma(40)+Gamma2(-40)); 

fespace Vh1(Th1,P2); 
func f1=10*sqrt(x*x+y*y); 
Vh1 u1,v1; 
macro Grad21(u1) [dx(u1),dy(u1)]  // EOM 

problem Lap2dOmega1(u1,v1,init=false)=int2d(Th1)(Grad21(v1)' *Grad21(u1)) - int2d(Th1)(f1*v1)+on(Gamma,u1=1) ; 
//   Resolution of EDP defined on the domain W1 
// - Δu = f1 on W1 
//      u = 1 on Γ 
//   + Null Neumann condition on Γ2 
Lap2dOmega1; 

// vizualisation of solution of the initial problem 
medit("solution",Th,us,Th1,u1,order=1,meditff="ffmedit",save="testsavemedit.solb");