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