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