-- 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 = - alpha * ( alpha - 1 ) * x^(alpha-2) 7 : // g = x^alpha 8 : // 9 : // The parameter alpha should be 0.5 or greater. It determines the 10 : // strength of the singularity. The suggested value is alpha = 0.6 11 : // 12 : // Location: 13 : // 14 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/mitchell_07/mitchell_07.edp 15 : // 16 : // Licensing: 17 : // 18 : // This code is distributed under the GNU LGPL license. 19 : // 20 : // Modified: 21 : // 22 : // 19 December 2014 23 : // 24 : // Author: 25 : // 26 : // John Burkardt 27 : // 28 : // Reference: 29 : // 30 : // Frederic Hecht, 31 : // Freefem++, 32 : // Third Edition, version 3.22 33 : // 34 : // William Mitchell, 35 : // A collection of 2D elliptic problems for testing adaptive 36 : // grid refinement algorithms, 37 : // Applied Mathematics and Computation, 38 : // Volume 220, 1 September 2013, pages 350-364. 39 : // 40 : cout << "\n"; 41 : cout << "mitchell_07\n"; 42 : cout << " FreeFem++ version\n"; 43 : cout << " Solve the boundary line singularity problem.\n"; 44 : 45 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; label = 1; } 46 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; label = 1; } 47 : border top ( t = 1.0, 0.0 ) { x = t; y = 1.0; label = 1; } 48 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; label = 1; } 49 : // 50 : // Define Th, the triangulation of the "left" side of the boundaries. 51 : // 52 : int n = 10; 53 : mesh Th = buildmesh ( bottom ( n ) + right ( n ) + top ( n ) + left ( n ) ); 54 : // 55 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 56 : // 57 : fespace Vh ( Th, P1 ); 58 : // 59 : // Define U, V, and F, piecewise continuous functions over Th. 60 : // 61 : Vh u; 62 : Vh v; 63 : // 64 : // Define parameter. 65 : // 66 : real alpha = 0.6; 67 : // 68 : // Define function F. 69 : // 70 : func f = - alpha * ( alpha - 1.0 ) * pow ( x, alpha - 2 ); 71 : // 72 : // Define function G. 73 : // 74 : func g = pow ( x, alpha ); 75 : // 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 ( 1, u = g ); 82 : // 83 : // Plot the solution. 84 : // 85 : plot ( u, wait = 1, fill = true, ps = "mitchell_07_u.eps" ); 86 : // 87 : // Plot the mesh. 88 : // 89 : plot ( Th, wait = 1, ps = "mitchell_07_mesh.eps" ); 90 : // 91 : // Save the mesh file. 92 : // 93 : savemesh ( Th, "mitchell_07.msh" ); 94 : // 95 : // Terminate. 96 : // 97 : cout << "\n"; 98 : cout << "mitchell_07\n"; 99 : cout << " Normal end of execution.\n"; 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. times: compile 0.009903s, execution 0.011953s, mpirank:0 CodeAlloc : nb ptr 3619, size :477800 mpirank: 0 Ok: Normal End