-- 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 square [0,1]x[0,1]; 4 : // u = g on boundary. 5 : // 6 : // f = -gxx-gyy 7 : // g = 2^(4p) x^p (1-x)^p y^p (1-y)^p 8 : // 9 : // Location: 10 : // 11 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/mitchell_01/mitchell_01.edp 12 : // 13 : // Licensing: 14 : // 15 : // This code is distributed under the GNU LGPL license. 16 : // 17 : // Modified: 18 : // 19 : // 24 May 2020 20 : // 21 : // Author: 22 : // 23 : // John Burkardt 24 : // 25 : // Reference: 26 : // 27 : // Frederic Hecht, 28 : // Freefem++, 29 : // Third Edition, version 3.22 30 : // 31 : // William Mitchell, 32 : // A collection of 2D elliptic problems for testing adaptive 33 : // grid refinement algorithms, 34 : // Applied Mathematics and Computation, 35 : // Volume 220, 1 September 2013, pages 350-364. 36 : // 37 : cout << "\n"; 38 : cout << "mitchell_01\n"; 39 : cout << " FreeFem++ version\n"; 40 : cout << " Analytic solution problem.\n"; 41 : 42 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; } 43 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; } 44 : border top ( t = 1.0, 0.0 ) { x = t; y = +1.0; } 45 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; } 46 : // 47 : // Define Th, the triangulation of the "left" side of the boundaries. 48 : // 49 : int n = 10; 50 : mesh Th = buildmesh ( bottom ( n ) + right ( n ) + top ( n ) + left ( n ) ); 51 : // 52 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 53 : // 54 : fespace Vh ( Th, P1 ); 55 : // 56 : // Define U, V, and F, piecewise continuous functions over Th. 57 : // 58 : Vh u; 59 : Vh v; 60 : // 61 : // Define function F. 62 : // 63 : int p = 10; 64 : func f = - 2 ^ ( 4 * p ) * 65 : ( 66 : ( p * ( p - 1 ) * x ^ ( p - 2 ) * ( 1 - x ) ^ ( p ) 67 : - 2 * p * p * x ^ ( p - 1 ) * ( 1 - x ) ^ ( p - 1 ) 68 : + p * ( p - 1 ) * x ^ ( p ) * ( 1 - x ) ^ ( p - 2 ) ) 69 : * y ^ ( p ) * ( 1 - y ) ^ ( p ) 70 : + 71 : ( p * ( p - 1 ) * y ^ ( p - 2 ) * ( 1 - y ) ^ ( p ) 72 : - 2 * p * p * y ^ ( p - 1 ) * ( 1 - y ) ^ ( p - 1 ) 73 : + p * ( p - 1 ) * y ^ ( p ) * ( 1 - y ) ^ ( p - 2 ) ) 74 : * x ^ ( p ) * ( 1 - x ) ^ ( p ) 75 : ); 76 : // 77 : // Define the variational problem. 78 : // Solve the variational problem. 79 : // 80 : solve Laplace ( u, v ) 81 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 82 : - int2d ( Th ) ( f * v ) 83 : + on ( bottom, u = 0.0 ) 84 : + on ( right, u = 0.0 ) 85 : + on ( top, u = 0.0 ) 86 : + on ( left, u = 0.0 ); 87 : // 88 : // Plot the solution. 89 : // 90 : plot ( u, wait = 1, fill = true, ps = "mitchell_01_u.eps" ); 91 : // 92 : // Plot the mesh. 93 : // 94 : plot ( Th, wait = 1, ps = "mitchell_01_mesh.eps" ); 95 : // 96 : // Save the mesh file. 97 : // 98 : savemesh ( Th, "mitchell_01.msh" ); 99 : // 100 : // Terminate. 101 : // 102 : cout << "\n"; 103 : cout << "mitchell_01\n"; 104 : cout << " Normal end of execution.\n"; 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. times: compile 0.004687s, execution 0.00851s, mpirank:0 CodeAlloc : nb ptr 3804, size :483264 mpirank: 0 Ok: Normal End