File: meditddm.edp

package info (click to toggle)
freefem%2B%2B 3.61.1%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 17,108 kB
  • sloc: cpp: 141,214; ansic: 28,664; sh: 4,925; makefile: 3,142; fortran: 1,171; perl: 844; awk: 290; php: 199; pascal: 41; f90: 32
file content (50 lines) | stat: -rw-r--r-- 1,857 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// meditddm.edp
load "medit"

/********************************************
 Initial Problem:
Resolution of the following EDP:
$- \Delta u = f$ on   $\Omega =\{ (x,y) |  1 \leq sqrt(x^2+y^2) \geq 2}$
$- \Delta u = f1$ on  $\Omega_{1} =\{ (x,y) |  0.5 \leq sqrt(x^2+y^2) \geq 1.}$
$u = 1$ on $\Gamma$  +  Null Neumman condition on $\Gamma_{1}$ and on $\Gamma_{2}$	
We find the solution $u$ in solving two EDP defined on domain $\Omega$ and $\Omega_{1}$
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 $\Omega$
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 $\Omega$
// $- \Delta u = f$ on $\Omega$ 
//      $u = 1$  on $\Gamma
//   + Null Neumann condition on $\Gamma_{1}$
Lap2dOmega;

// construction of mesh of domain $\Omega1 =\{ (x,y) |  0.5 \leq sqrt(x^2+y^2) \geq 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 $\Omega_{1}$
// $- \Delta u = f1$ on $\Omega_{1}$ 
//      $u = 1$ on $\Gamma$
//   + Null Neumann condition on $\Gamma_{2}$
Lap2dOmega1; 

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