File: LaplaceP1bis.edp

package info (click to toggle)
freefem%2B%2B 3.47%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 132,088 kB
  • ctags: 19,726
  • sloc: cpp: 138,951; ansic: 22,605; sh: 4,951; makefile: 2,935; fortran: 1,147; perl: 768; awk: 282; php: 182
file content (28 lines) | stat: -rw-r--r-- 1,171 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
 mesh Th=square(10,10);
 fespace Vh(Th,P1);     // P1 FE space
 Vh uh,vh,u;              // unkown and test function. 
 func f=1;                 //  right hand side function 
 func g=0.;                 //  boundary condition function
 
 problem laplace(uh,vh,solver=GMRES,tgv=1e5) =                    //  definion of  the problem 
  - int2d(Th)( -dx(uh)*dx(vh) - dy(uh)*dy(vh) ) //  bilinear form
  - int1d(Th,1)( -uh*vh) 
  - int1d(Th,1)(  vh)
  - int2d(Th)( f*vh )                          //  linear form
  + on(2,3,4,uh=g) ;                      //  boundary condition form

 problem laplacep(uh,vh,solver=CG,tgv=1e5) =                    //  definion of  the problem 
    int2d(Th)( dx(uh)*dx(vh) + dy(uh)*dy(vh) ) //  bilinear form
  + int1d(Th,1)( uh*vh) 
  + int1d(Th,1)( - vh)
  + int2d(Th)( -f*vh )                          //  linear form
  + on(2,3,4,uh=g) ;                      //  boundary condition form

  
  laplace; // solve the problem plot(uh); // to see the result
  u=uh;
  laplacep; // solve the problem plot(uh); // to see the result
  
  plot(uh,u,value=true);
  u[] -= uh[];
  cout << "Diff min = "<< u[].min << " max=" << u[].max << endl ;