-- 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 : // The Laplacian operator is applied on a square with a reentrant corner. 4 : // 5 : // The geometry is defined by an internal angle PI < OMEGA <= 2PI. 6 : // 7 : // ALPHA = PI / OMEGA 8 : // R = sqrt ( X^2 + Y^2 ) 9 : // THETA = arctan ( Y / X ) 10 : // U(X,Y) = R^ALPHA * SIN ( ALPHA * THETA) 11 : // 12 : // Dirichlet boundary conditions. 13 : // 14 : // Surprisingly, U(X,Y) satisfies the equation: 15 : // 16 : // - Uxx - Uyy = 0 17 : // 18 : // Location: 19 : // 20 : // http://people.sc.fsu.edu/~jburkardt/examples/mitchell_freefem++/test02c.edp 21 : // 22 : // Licensing: 23 : // 24 : // This code is distributed under the GNU LGPL license. 25 : // 26 : // Modified: 27 : // 28 : // 17 December 2014 29 : // 30 : // Author: 31 : // 32 : // John Burkardt 33 : // 34 : // Reference: 35 : // 36 : // Frederic Hecht, 37 : // Freefem++, 38 : // Third Edition, version 3.22 39 : // 40 : // William Mitchell, 41 : // A collection of 2D elliptic problems for testing adaptive 42 : // grid refinement algorithms, 43 : // Applied Mathematics and Computation, 44 : // Volume 220, 1 September 2013, pages 350-364. 45 : // 46 : real omega = 6.0 * pi / 4.0; 47 : 48 : cout << " Omega = " << omega << "\n"; 49 : int p = 5; 50 : 51 : border b1 ( t = 0.0, +1.0 ) { x = t; y = 0.0; label = 1; } 52 : real l1 = 1.0; 53 : int n1 = ( round ) ( l1 * p + 1 ); 54 : cout << " N1 = " << n1 << "\n"; 55 : border b2 ( t = 0.0, +1.0 ) { x = +1.0; y = t; label = 1; } 56 : real l2 = 1.0; 57 : int n2 = ( round ) ( l2 * p + 1 ); 58 : cout << " N2 = " << n2 << "\n"; 59 : border b3 ( t = 1.0, -1.0 ) { x = t; y = 1.0; label = 1; } 60 : real l3 = 2.0; 61 : int n3 = ( round ) ( l3 * p + 1 ); 62 : cout << " N3 = " << n3 << "\n"; 63 : // 64 : // What we do depends on OMEGA! 65 : // 66 : real xc = - cos ( omega ) / sin ( omega ); 67 : real yc = -1.0; 68 : real rc = -1.0 / sin ( omega ); 69 : 70 : border b4 ( t = 1.0, -1.0 ) { x = -1.0; y = t; label = 1; } 71 : real l4 = 2.0; 72 : int n4 = ( round ) ( l4 * p + 1 ); 73 : border b5 ( t = -1.0, xc ) { x = t; y = yc; label = 1; } 74 : real l5 = xc + 1.0; 75 : int n5 = ( round ) ( l5 * p + 1 ); 76 : border b7 ( t = rc, 0.0 ) { x = t * cos ( omega ); y = t * sin ( omega ); label = 1; } 77 : real l7 = rc; 78 : int n7 = ( round ) ( l7 * p + 1 ); 79 : 80 : mesh Th = buildmesh ( b1 ( n1 ) + b2 ( n2 ) + b3 ( n3 ) + b4 ( n4 ) 81 : + b5 ( n5 ) + b7 ( n7 ) ); 82 : // 83 : // Define Vh, the finite element space defined over Th, using P1 basis functions. 84 : // 85 : fespace Vh ( Th, P1 ); 86 : // 87 : // Define U, V, and F, piecewise continuous functions over Th. 88 : // 89 : Vh u; 90 : Vh v; 91 : // 92 : // Define the right hand side function F. 93 : // 94 : func f = 0.0; 95 : // 96 : // Define the boundary condition function G. 97 : // 98 : real alpha = pi / omega; 99 : func g = pow ( x * x + y * y, alpha / 2.0 ) * sin ( alpha * atan2 ( y, x ) ); 100 : // 101 : // Solve the variational problem. 102 : // 103 : solve Laplace ( u, v ) 104 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 105 : - int2d ( Th ) ( f * v ) 106 : + on ( 1, u = g ); 107 : // 108 : // Plot the solution. 109 : // 110 : plot ( u, wait = 1, fill = true, ps = "test02c_u.eps" ); 111 : // 112 : // Plot the mesh. 113 : // 114 : plot ( Th, wait = 1, ps = "test02c_mesh.eps" ); 115 : // 116 : // Save the mesh file. 117 : // 118 : savemesh ( Th, "test02c.msh" ); 119 : 120 : sizestack + 1024 =1976 ( 952 ) Omega = 4.71239 N1 = 6 N2 = 6 N3 = 11 -- mesh: Nb of Triangles = 224, Nb of Vertices 136 -- Solve : min -1.25992 max 1.25992 number of required edges : 0 times: compile 0s, execution 0.01s, mpirank:0 CodeAlloc : nb ptr 2829, size :347376 mpirank: 0 Ok: Normal End