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