File: Poisson.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 (48 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download | duplicates (3)
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
verbosity=2;

mesh3 Th("dodecaedre01");
fespace Vh(Th,P23d);
func ue =   2*x*x + 3*y*y + 4*z*z + 5*x*y+6*x*z+1;
func uex=   4*x+  5*y+6*z;
func uey=   6*y + 5*x;
func uez=   8*z +6*x;
func f= -18. ;
Vh uhe = ue; // bug ..
cout << " uhe min:  " << uhe[]. min << " max:" << uhe[].max << endl;

border cc(t=0,2*pi){x=cos(t);y=sin(t);label=1;}
mesh Th2=buildmesh(cc(50));
fespace Vh2(Th2,P2);


Vh u,v;

macro Grad3(u) [dx(u),dy(u),dz(u)]  // EOM

problem Lap3d(u,v,solver=CG)=int3d(Th)(Grad3(v)' *Grad3(u)) - int3d(Th)(f*v) 
+ on(0,1,u=ue);
Lap3d;
cout << " u min::   " << u[]. min << "  max: " << u[].max << endl;
real err= int3d(Th)( square(u-ue) );
cout << int3d(Th)(1.) << " = " << Th.measure << endl;
plot(u,wait=1);
Vh d= ue-u;
cout <<  " err = " << err <<  " diff l^\intfy = " << d[].linfty << endl;
Vh2 u2=u,u2e=ue;
plot(u2,wait=1);
plot(u2,u2e,wait=1);

// test new plot ... 
plot(Th,wait=1);
plot(u,wait=1);

/*
	{
 ofstream file("dd.bb"); 
	file << "3 1 1 "<< u[].n << " 2 \n";
	int j;
	for (j=0;j<u[].n ; j++)  
	  file << d[][j] << endl; 
    }
*/  
assert(err < 1e-9);