Escolar Documentos
Profissional Documentos
Cultura Documentos
2016 14:23:55)
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : border aaa(t=0,1){x=t;y=0;label=1;};
2 : border bbb(t=0,0.5){x=1;y=t;label=2;};
3 : border ccc(t=0,0.5){x=1-t;y=0.5;label=3;};
4 : border ddd(t=0.5,1){x=0.5;y=t;label=4;};
5 : border eee(t=0.5,1){x=1-t;y=1;label=5;};
6 : border fff(t=0,1){x=0;y=1-t;label=6;};
7 : mesh Th = buildmesh (aaa(6) + bbb(4) + ccc(4) +ddd(4) + eee(4) + fff(6));
8 : mesh Th2 = movemesh(Th,[x+1.1,y]);
9 : fespace Vh(Th,P1);
10 : fespace Vh2(Th2,P2);
11 : fespace Vh21(Th2,P1);
12 :
13 : Vh u,v,zero;
14 : Vh2 u2,v2;
15 : Vh21 dxu2,dyu2;
16 : u=0;
17 : u2=0;
18 : zero=0;
19 : func f= 1;
20 : func g= 0;
21 : int i=0;
22 : real error=0.1, coef= 0.1^(1./5.);
23 : problem Probem1(u,v,solver=CG,init=i,eps=-1.0e-6) =
24 : int2d(Th)( dx(u)*dx(v) + dy(u)*dy(v))
25 : + int2d(Th) ( v*f )
26 : + on(1,2,3,4,5,6,u=g) ;
27 :
28 : problem Probem2(u2,v2,solver=CG,init=i,eps=-1.0e-6) =
29 : int2d(Th2)( dx(u2)*dx(v2) + dy(u2)*dy(v2))
30 : + int2d(Th2) ( v2*f )
31 : + on(1,2,3,4,5,6,u2=g) ;
32 :
33 : real cpu=clock();
34 :
35 : for (i=0;i< 10;i++)
36 : {
37 :
38 : real d = clock();
39 : Probem1;
40 : Probem2;
41 : plot(Th,u,Th2,u2,wait=1);
42 : Th=adaptmesh(Th,u,inquire=1,err=error);
43 : dxu2=dx(u2);
44 : dyu2=dy(u2);
45 : Th2=adaptmesh(Th2,dxu2,dyu2,inquire=1,err=error,ratio=1.5,hmin=1e-5);
46 :
47 : cout << " CPU = " << clock()-d << endl;
48 : error = error * coef;
49 : } ;
50 :
51 : cout << " CPU = " << clock()-cpu << endl;
52 : sizestack + 1024 =2744 ( 1720 )