-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : mitchell_01.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // mitchell_01.edp 2 : // 3 : // Discussion: 4 : // 5 : // -uxx-uyy=f on the square [0,1]x[0,1]; 6 : // u = g on boundary. 7 : // 8 : // f = -gxx-gyy 9 : // g = 2^(4p) x^p (1-x)^p y^p (1-y)^p 10 : // 11 : // Licensing: 12 : // 13 : // This code is distributed under the MIT license. 14 : // 15 : // Modified: 16 : // 17 : // 24 May 2020 18 : // 19 : // Author: 20 : // 21 : // John Burkardt 22 : // 23 : // Reference: 24 : // 25 : // Frederic Hecht, 26 : // Freefem++, 27 : // Third Edition, version 3.22 28 : // 29 : // William Mitchell, 30 : // A collection of 2D elliptic problems for testing adaptive 31 : // grid refinement algorithms, 32 : // Applied Mathematics and Computation, 33 : // Volume 220, 1 September 2013, pages 350-364. 34 : // 35 : cout << "\n"; 36 : cout << "mitchell_01():\n"; 37 : cout << " FreeFem++ version\n"; 38 : cout << " Analytic solution problem.\n"; 39 : 40 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; } 41 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; } 42 : border top ( t = 1.0, 0.0 ) { x = t; y = +1.0; } 43 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; } 44 : // 45 : // Define Th, the triangulation of the "left" side of the boundaries. 46 : // 47 : int n = 10; 48 : mesh Th = buildmesh ( bottom ( n ) + right ( n ) + top ( n ) + left ( n ) ); 49 : // 50 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 51 : // 52 : fespace Vh ( Th, P1 ); 53 : // 54 : // Define U, V, and F, piecewise continuous functions over Th. 55 : // 56 : Vh u; 57 : Vh v; 58 : // 59 : // Define function F. 60 : // 61 : int p = 10; 62 : func f = - 2 ^ ( 4 * p ) * 63 : ( 64 : ( p * ( p - 1 ) * x ^ ( p - 2 ) * ( 1 - x ) ^ ( p ) 65 : - 2 * p * p * x ^ ( p - 1 ) * ( 1 - x ) ^ ( p - 1 ) 66 : + p * ( p - 1 ) * x ^ ( p ) * ( 1 - x ) ^ ( p - 2 ) ) 67 : * y ^ ( p ) * ( 1 - y ) ^ ( p ) 68 : + 69 : ( p * ( p - 1 ) * y ^ ( p - 2 ) * ( 1 - y ) ^ ( p ) 70 : - 2 * p * p * y ^ ( p - 1 ) * ( 1 - y ) ^ ( p - 1 ) 71 : + p * ( p - 1 ) * y ^ ( p ) * ( 1 - y ) ^ ( p - 2 ) ) 72 : * x ^ ( p ) * ( 1 - x ) ^ ( p ) 73 : ); 74 : // 75 : // Define the variational problem. 76 : // Solve the variational problem. 77 : // 78 : solve Laplace ( u, v ) 79 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 80 : - int2d ( Th ) ( f * v ) 81 : + on ( bottom, u = 0.0 ) 82 : + on ( right, u = 0.0 ) 83 : + on ( top, u = 0.0 ) 84 : + on ( left, u = 0.0 ); 85 : // 86 : // Plot the solution. 87 : // 88 : plot ( u, wait = true, fill = true, ps = "mitchell_01_u.ps" ); 89 : // 90 : // Plot the mesh. 91 : // 92 : plot ( Th, wait = true, ps = "mitchell_01_mesh.ps" ); 93 : // 94 : // Save the mesh file. 95 : // 96 : savemesh ( Th, "mitchell_01.msh" ); 97 : // 98 : // Terminate. 99 : // 100 : cout << "\n"; 101 : cout << "mitchell_01():\n"; 102 : cout << " Normal end of execution.\n"; 103 : 104 : exit ( 0 ); 105 : 106 : sizestack + 1024 =8696 ( 7672 ) mitchell_01(): FreeFem++ version Analytic solution problem. -- mesh: Nb of Triangles = 240, Nb of Vertices 141 -- Solve : min -0.00210608 max 0.986701 number of required edges : 0 mitchell_01(): Normal end of execution. current line = 104 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 4172, size :531328 mpirank: 0 Ok: Normal End