-- 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 : // -uxx=uyy=0 on the square [0,1]x[0,1]; 4 : // u = f on boundary. 5 : // exact = 2^(4p) x^p (1-x)^p y^p (1-y)^p 6 : // 7 : // Location: 8 : // 9 : // http://people.sc.fsu.edu/~jburkardt/examples/mitchell_freefem++/test01.edp 10 : // 11 : // Licensing: 12 : // 13 : // This code is distributed under the GNU LGPL license. 14 : // 15 : // Modified: 16 : // 17 : // 19 December 2014 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 : border bottom ( t = 0.0, 1.0 ) { x = t; y = 0.0; } 36 : border right ( t = 0.0, 1.0 ) { x = 1.0; y = t; } 37 : border top ( t = 1.0, 0.0 ) { x = t; y = +1.0; } 38 : border left ( t = 1.0, 0.0 ) { x = 0.0; y = t; } 39 : // 40 : // Define Th, the triangulation of the "left" side of the boundaries. 41 : // 42 : int n = 10; 43 : mesh Th = buildmesh ( bottom ( n ) + right ( n ) + top ( n ) + left ( n ) ); 44 : // 45 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 46 : // 47 : fespace Vh ( Th, P1 ); 48 : // 49 : // Define U, V, and F, piecewise continuous functions over Th. 50 : // 51 : Vh u; 52 : Vh v; 53 : // 54 : // Define function F. 55 : // 56 : int p = 10; 57 : func f = - 2 ^ ( 4 * p ) * 58 : ( 59 : ( p * ( p - 1 ) * x ^ ( p - 2 ) * ( 1 - x ) ^ ( p ) 60 : - 2 * p * p * x ^ ( p - 1 ) * ( 1 - x ) ^ ( p - 1 ) 61 : + p * ( p - 1 ) * x ^ ( p ) * ( 1 - x ) ^ ( p - 2 ) ) 62 : * y ^ ( p ) * ( 1 - y ) ^ ( p ) 63 : + 64 : ( p * ( p - 1 ) * y ^ ( p - 2 ) * ( 1 - y ) ^ ( p ) 65 : - 2 * p * p * y ^ ( p - 1 ) * ( 1 - y ) ^ ( p - 1 ) 66 : + p * ( p - 1 ) * y ^ ( p ) * ( 1 - y ) ^ ( p - 2 ) ) 67 : * x ^ ( p ) * ( 1 - x ) ^ ( p ) 68 : ); 69 : // 70 : // Solve the variational problem. 71 : // 72 : solve Laplace ( u, v ) 73 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 74 : - int2d ( Th ) ( f * v ) 75 : + on ( bottom, u = 0.0 ) 76 : + on ( right, u = 0.0 ) 77 : + on ( top, u = 0.0 ) 78 : + on ( left, u = 0.0 ); 79 : // 80 : // Plot the solution. 81 : // 82 : plot ( u, wait = 1, fill = true, ps = "test01_u.eps" ); 83 : // 84 : // Plot the mesh. 85 : // 86 : plot ( Th, wait = 1, ps = "test01_mesh.eps" ); 87 : // 88 : // Save the mesh file. 89 : // 90 : savemesh ( Th, "test01.msh" ); 91 : 92 : sizestack + 1024 =8696 ( 7672 ) -- mesh: Nb of Triangles = 240, Nb of Vertices 141 -- Solve : min -0.00210608 max 0.986701 number of required edges : 0 times: compile 0.01s, execution 0.02s, mpirank:0 CodeAlloc : nb ptr 2825, size :347504 mpirank: 0 Ok: Normal End