-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathLaplace3d.edp
63 lines (52 loc) · 1.62 KB
/
Laplace3d.edp
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
51
52
53
54
55
56
57
58
59
60
61
62
/*
Warning in before version 3.2-1 the nomarl are interal normal
after the signe is correct and now the noral was exterior normal.
*/
verbosity=2;
load "msh3"
int nn=20;
mesh Th2=square(nn,nn);
fespace Vh2(Th2,P2);
Vh2 ux,uz,p2;
int[int] rup=[0,2], rdown=[0,1], rmid=[1,1,2,1,3,1,4,1];
real zmin=0,zmax=1;
mesh3 Th=buildlayers(Th2,nn,
zbound=[zmin,zmax],
labelmid=rmid,
labelup = rup,
labeldown = rdown);
fespace Vh(Th,P2);
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; //
cout << " uhe min: " << uhe[].min << " max:" << uhe[].max << endl;
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)) //') for emacs
+ int2d(Th,2)(u*v)
- int3d(Th)(f*v)
- int2d(Th,2) ( ue*v + (uex*N.x +uey*N.y +uez*N.z)*v )
+ on(1,u=ue);
Lap3d;
cout << " u min:: " << u[]. min << " max: " << u[].max << endl;
real err= int3d(Th)( square(u-ue) );
real aa1= int3d(Th,qfV=qfV1)(u) ;
real aa2= int3d(Th,qfV=qfV1lump)(u) ;
cout << " aa1 = " << aa1 << endl;
cout << " aa2 = " << aa2 << endl;
cout << int3d(Th)(1.) << " = " << Th.mesure << endl;
cout << int3d(Th,qfV=qfV1)(1.) << " = " << Th.mesure << endl;
cout << int3d(Th,qfV=qfV1lump)(1.) << " = " << Th.mesure << endl;
Vh d= ue-u;
cout << " err = " << err << " diff l^\intfy = " << d[].linfty << endl;
real aire2=int2d(Th,2)(1.); // bug correct in version 3.0-4
cout << " aire2 = " << aire2 << endl;
func uuu= 2.+x;
cout << uuu(1,1,1) << endl;
assert( abs(aire2-1.) < 1e-6);
plot(u,wait=1);
assert( err < 1e-6);