-- 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 : // -eps * Laplace(u) + 2 du/dx + du/dy = f on [-1,+1]x[-1,+1] 4 : // u = g on the boundary. 5 : // 6 : // f = -eps*(g'')+2 dg/dx+dg/dy 7 : // g = (1-exp(-(1-x)/eps)*(1-exp(-(1-y)/eps)*cos(pi(x+y)) 8 : // 9 : // Suggested parameter values: 10 : // * eps = 0.1 11 : // * eps = 0.001 12 : // 13 : // Location: 14 : // 15 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/mitchell_06a/mitchell_06a.edp 16 : // 17 : // Licensing: 18 : // 19 : // This code is distributed under the GNU LGPL license. 20 : // 21 : // Modified: 22 : // 23 : // 18 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_06a\n"; 43 : cout << " FreeFem++ version\n"; 44 : cout << " Solve Mitchell problem 6, the boundary layer.\n ... : "; 45 : 46 : border bottom ( t = -1.0, +1.0 ) { x = t; y = -1.0; label = 1; } 47 : border right ( t = -1.0, +1.0 ) { x = +1.0; y = t; label = 1; } 48 : border top ( t = +1.0, -1.0 ) { x = t; y = +1.0; label = 1; } 49 : border left ( t = +1.0, -1.0 ) { x = -1.0; y = t; label = 1; } 50 : // 51 : // Define Th, the triangulation of the "left" side of the boundaries. 52 : // 53 : int n = 40; 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 the problem parameter. 66 : // 67 : real eps = 0.1; 68 : // 69 : // Define the right hand side function F. 70 : // 71 : func f = exp ( - 2.0 / eps ) / pow ( eps, 2 ) * 72 : ( 73 : - exp ( ( 1.0 - y ) / eps ) * 74 : ( 75 : -2.0 * exp ( 1.0 / eps ) * pow ( pi * eps, 2 ) 76 : + exp ( x / eps ) * ( 1.0 + 2.0 * pow ( pi * eps, 2 ) ) 77 : ) 78 : * cos ( pi * ( x + y ) ) - 79 : ( 80 : 3.0 * exp ( 2.0 / eps ) - exp ( ( 1.0 - x ) / eps ) 81 : - exp ( ( 1.0 - y ) / eps ) - exp ( ( x + y ) / eps ) 82 : ) 83 : * eps * pi * sin ( pi * ( x + y ) ) 84 : ); 85 : // 86 : // Define the Dirichlet boundary condition function G. 87 : // 88 : func g = ( 1.0 - exp ( - ( 1.0 - x ) / eps ) ) * 89 : ( 1.0 - exp ( - ( 1.0 - y ) / eps ) ) * 90 : cos ( pi * ( x + y ) ); 91 : // 92 : // Solve the variational problem. 93 : // 94 : solve Laplace ( u, v ) 95 : = int2d ( Th ) ( eps*dx(u)*dx(v) + eps*dy(u)*dy(v) + 2*dx(u)*v + dy(u)*v ) 96 : - int2d ( Th ) ( f * v ) 97 : + on ( 1, u = g ); 98 : // 99 : // Plot the solution. 100 : // 101 : plot ( u, wait = 1, fill = true, ps = "mitchell_06a_u.ps" ); 102 : // 103 : // Plot the mesh. 104 : // 105 : plot ( Th, wait = 1, ps = "mitchell_06a_mesh.ps" ); 106 : // 107 : // Save the mesh file. 108 : // 109 : savemesh ( Th, "mitchell_06a.msh" ); 110 : // 111 : // Terminate. 112 : // 113 : cout << "\n"; 114 : cout << "mitchell_06a\n"; 115 : cout << " Normal end of execution.\n"; 116 : 117 : sizestack + 1024 =7416 ( 6392 ) mitchell_06a FreeFem++ version Solve Mitchell problem 6, the boundary layer. -- mesh: Nb of Triangles = 3782, Nb of Vertices 1972 -- Solve : min -12052.4 max 5729.13 number of required edges : 0 mitchell_06a Normal end of execution. times: compile 0.004745s, execution 0.858407s, mpirank:0 CodeAlloc : nb ptr 3785, size :483000 mpirank: 0 Ok: Normal End