-- FreeFem++ v4.6 (Thu Apr 2 15:47:38 CEST 2020 - git v4.6) Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // Discussion: 2 : // 3 : // -uxx-uyy = f on the unit square. 4 : // u = g on the boundary. 5 : // 6 : // f = - gxx - gyy 7 : // g = exp(-alpha*(x-xc)^2+(y-yc)^2) 8 : // 9 : // Suggested parameter values: 10 : // * alpha = 1000, (xc,yc) = (0.5,0.5) 11 : // * alpha = 100000, (xc,yc) = (0.51,0.117) 12 : // 13 : // Location: 14 : // 15 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/mitchell_04/mitchell_04b.edp 16 : // 17 : // Licensing: 18 : // 19 : // This code is distributed under the GNU LGPL license. 20 : // 21 : // Modified: 22 : // 23 : // 17 December 2014 24 : // 25 : // Author: 26 : // 27 : // John Burkardt 28 : // 29 : // Reference: 30 : // 31 : // Frederic Hecht, 32 : // Freefem++, 33 : // Third Edition, version 3.22 34 : // 35 : // William Mitchell, 36 : // A collection of 2D elliptic problems for testing adaptive 37 : // grid refinement algorithms, 38 : // Applied Mathematics and Computation, 39 : // Volume 220, 1 September 2013, pages 350-364. 40 : // 41 : cout << "\n"; 42 : cout << "mitchell_04a\n"; 43 : cout << " FreeFem++ version\n"; 44 : cout << " The Peak problem\n"; 45 : 46 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; label = 1; } 47 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; label = 1; } 48 : border top ( t = 1.0, 0.0 ) { x = t; y = 1.0; label = 1; } 49 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; label = 1; } 50 : // 51 : // Define Th, the triangulation of the "left" side of the boundaries. 52 : // 53 : int n = 20; 54 : mesh Th = buildmesh ( bottom ( n ) + right ( n ) + top ( n ) + left ( n ) ); 55 : // 56 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 57 : // 58 : fespace Vh ( Th, P1 ); 59 : // 60 : // Define U, V, and F, piecewise continuous functions over Th. 61 : // 62 : Vh u; 63 : Vh v; 64 : // 65 : // Define problem parameters. 66 : // 67 : real xc = 0.51; 68 : real yc = 0.117; 69 : real alpha = 100000.0; 70 : // 71 : // Define the right hand side function F. 72 : // 73 : func f = 4.0 * alpha * ( 1.0 - alpha * ( pow ( x - xc, 2 ) + pow ( y - yc, 2 ) ) ) 74 : * exp ( - alpha * ( pow ( x - xc, 2 ) + pow ( y - yc, 2 ) ) ); 75 : // 76 : // Define the boundary function G. 77 : // 78 : func g = exp ( - alpha * ( pow ( x - xc, 2 ) + pow ( y - yc, 2 ) ) ); 79 : // 80 : // Solve the variational problem. 81 : // 82 : solve Laplace ( u, v ) 83 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 84 : - int2d ( Th ) ( f * v ) 85 : + on ( 1, u = g ); 86 : // 87 : // Plot the solution. 88 : // 89 : plot ( u, wait = 1, fill = true, ps = "mitchell_04b_u.eps" ); 90 : // 91 : // Plot the mesh. 92 : // 93 : plot ( Th, wait = 1, ps = "mitchell_04b_mesh.eps" ); 94 : // 95 : // Save the mesh file. 96 : // 97 : savemesh ( Th, "mitchell_04b.msh" ); 98 : // 99 : // Terminate. 100 : // 101 : cout << "\n"; 102 : cout << "mitchell_04b\n"; 103 : cout << " Normal end of execution.\n"; 104 : 105 : cout << "mitchell_04a\n"; 106 : cout << " Normal end of execution.\n"; 107 : sizestack + 1024 =3672 ( 2648 ) mitchell_04a FreeFem++ version The Peak problem -- mesh: Nb of Triangles = 952, Nb of Vertices 517 -- Solve : min -0.012953 max -1.62203e-65 number of required edges : 0 mitchell_04b Normal end of execution. mitchell_04a Normal end of execution. times: compile 0.005856s, execution 0.320936s, mpirank:0 CodeAlloc : nb ptr 3682, size :479440 mpirank: 0 Ok: Normal End