// file nl-elliptic-fp.edp // // solution of $-a\Delta u + b\partial_1 u + cu = F(u) + f_0$ // together with $u = u_0$ on $\Gamma$ // // fixed-point iterates // // $a$, $b$, $c$ are positive constants // $F = F(s)$, $u_0 = u_0(x,y)$ are functions // // NUMERICAL VALUES AND FUNCTIONS TO PROVIDE // int C0=100, C1=99, C2=98; // the labels real a=.1, b=5., bt2 = 2.*b, c=10.; // the values on the boundaries real errmesh=1.e-2; int itermax=100, itermm1=itermax-1, kiter, kiter1, nmesh=1, jiter; real[int] Uerror(1000); real errFP=1.e-15, error, aux; func f00=0.; func u00=x*x - y*y; // the function u_0 // // DESCRIPTION OF THE BOUNDARY AND THE INTERFACE // // outer boundary ($\Gamma_0$): border C00(t=0,2*pi){x=5*cos(t); y=5*sin(t); label=C0;} // inner boundary ($\Gamma_1$): border C11(t=0,1){ x=1+t; y=3; label=C1;} border C12(t=0,1){ x=2; y=3-6*t; label=C1;} border C13(t=0,1){ x=2-t; y=-3; label=C1;} border C14(t=0,1){ x=1; y=-3+6*t; label=C1;} // // FIGURES (I) // // boundary and interface: plot ( C00(50) + C11(5)+C12(20)+C13(5)+C14(20), wait=true); // // MESH // mesh Th=buildmesh( C00(50) + C11(5)+C12(20)+C13(5)+C14(20)); // // FIGURES (II) // // mesh: plot(Th, cmm=" FIRST MESH", wait=true); // // THE FINITE ELEMENT SPACE AND FUNCTIONS // fespace Vh(Th,P1); Vh u,v,fff,f0=f00,u0=u00,uold,udif; // ------------------------------------- // THE NONLINEAR FUNCTION // ------------------------------------- func real[int] FFF(real[int] & uvec) { real[int] F(uvec.n); for(int i=0;i> u[] ; // } // close reading file (end block) kiter1 = kiter+1; for (int k=0;k 1) { aux = log(Uerror[kiter-1]/Uerror[kiter])/log(2.); cout << " FIXED-POINT RATE = " << aux << endl; } // // FIGURES (III) // // the solution: plot(u, wait=true, value=true, fill=true, ps="nonsymsol.eps");