-- FreeFem++ v 3.320001 (date Ven 7 nov 2014 14:28:55 CET) Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // Discussion: 2 : // 3 : // Boundary line singularity 4 : // -Laplace(u) = f on the unit square. 5 : // u = u0 on the boundary. 6 : // u0 = x^alpha 7 : // f = - alpha * ( alpha - 1 ) * x^(alpha-2) 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/examples/mitchell_freefem++/test07.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 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; label = 1; } 41 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; label = 1; } 42 : border top ( t = 1.0, 0.0 ) { x = t; y = 1.0; label = 1; } 43 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; label = 1; } 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 parameter. 60 : // 61 : real alpha = 0.6; 62 : // 63 : // Define function F. 64 : // 65 : func f = - alpha * ( alpha - 1.0 ) * pow ( x, alpha - 2 ); 66 : // 67 : // Define function G. 68 : // 69 : func g = pow ( x, alpha ); 70 : // 71 : // Solve the variational problem. 72 : // 73 : solve Laplace ( u, v ) 74 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 75 : - int2d ( Th ) ( f * v ) 76 : + on ( 1, u = g ); 77 : // 78 : // Plot the solution. 79 : // 80 : plot ( u, wait = 1, fill = true, ps = "test07_u.eps" ); 81 : // 82 : // Plot the mesh. 83 : // 84 : plot ( Th, wait = 1, ps = "test07_mesh.eps" ); 85 : // 86 : // Save the mesh file. 87 : // 88 : savemesh ( Th, "test07.msh" ); 89 : 90 : sizestack + 1024 =2616 ( 1592 ) -- mesh: Nb of Triangles = 240, Nb of Vertices 141 -- Solve : min 1.25594e-31 max 1 number of required edges : 0 times: compile 0s, execution 0.02s, mpirank:0 CodeAlloc : nb ptr 2640, size :342064 mpirank: 0 Ok: Normal End