// Discussion: // // Example_2.1a solves the Poisson equation in a domain C // which is a circle C1 with an elliptical hole C2. // // - uxx - uyy = x * y in the interior of C // u(x,y) = 0 on the boundary of C1. // u(x,y) = 1 on the boundary of C2. // // Location: // // http://people.sc.fsu.edu/~jburkardt/examples/freefem++/example_2.1a.edp // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 04 December 2014 // // Reference: // // Frederic Hecht, // Freefem++, // Third Edition, version 3.22 // // Define C1 and C2, the boundaries. // border C1 ( t = 0, 2 * pi ) { x = cos ( t ); y = sin ( t ); } border C2 ( t = 2 * pi, 0 ) { x = 0.1+0.3*cos ( t ); y = 0.5*sin ( t ); } // // Define Th, the triangulation of the "left" side of the boundaries. // mesh Th = buildmesh ( C1(50) + C2(20) ); // // Define Vh, the finite element space defined over Th, using P1 basis functions. // fespace Vh ( Th, P1 ); // // Define u and v, piecewise P1 continuous functions over Th. // Vh u, v; // // Define f, the right hand side function. // func f = x * y; // // Request the current CPU time in seconds. // real cpu1 = clock ( ); // // Request a solution of the discrete weak system. // Note that the boundary condition is included, // defined "on C1" and "on C2", the boundaries. // solve Poisson ( u, v, solver = LU ) = int2d(Th) ( dx(u)*dx(v) + dy(u)*dy(v) ) - int2d(Th) ( f*v ) + on(C1,u=0.0) + on(C2,u=1.0); // // Plot the solution. // plot ( u ); // // Get final CPU clock reading. // real cpu2 = clock ( ); cout << " CPU time = " << cpu2 - cpu1 << endl;