-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : membrane.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // membrane.edp 2 : // 3 : // Discussion: 4 : // 5 : // Let an ellipse have semimajor axis 2 and semiminor axis 1: 6 : // (x/2)^2 + (y/1)^2 = 1. 7 : // Let Gamma1 be the ellipse boundary from 0 to 4pi/3, and 8 : // Gamm2 the boundary from 4pi/3 to 2pi. 9 : // 10 : // Solve: 11 : // -uxx - uyy = f in Gamma1 + Gamma2, 12 : // u = x on Gamma1. 13 : // du/dn = 0, natural boundary condition on Gamma2. 14 : // 15 : // Licensing: 16 : // 17 : // This code is distributed under the MIT license. 18 : // 19 : // Modified: 20 : // 21 : // 18 June 2015 22 : // 23 : // Reference: 24 : // 25 : // Frederic Hecht, 26 : // Freefem++, 27 : // Third Edition, version 3.22 28 : // 29 : cout << "\n"; 30 : cout << "membrane():\n"; 31 : cout << " freefem++ version\n"; 32 : cout << " Model the deflection of an elastic membrane ins ... : ide an ellipse..\n"; 33 : // 34 : // Define Gamma1 and Gamma2, the boundaries. 35 : // A and B are the lengths of the semimajor and semiminor axes: 36 : // THETA specifies the angle at which we switch from GAMMA1 to GAMMA2. 37 : // 38 : real a = 2.0; 39 : real b = 1.0; 40 : real theta = 4.0 * pi / 3.0; 41 : border Gamma1 ( t = 0, theta ) { x = a * cos(t); y = b*sin(t); } 42 : border Gamma2 ( t = theta, 2*pi ) { x = a * cos(t); y = b*sin(t); } 43 : // 44 : // Th: the triangulation of the "left" side of the boundaries. 45 : // 46 : mesh Th = buildmesh ( Gamma1(100) + Gamma2(50) ); 47 : // 48 : // Plot the mesh. 49 : // 50 : plot ( Th, wait = true, ps = "membrane_mesh.ps", cmm = "membrane mesh" ); 51 : // 52 : // Define Vh, the finite element space defined over Th, using P2 basis functions. 53 : // 54 : fespace Vh ( Th, P2 ); 55 : // 56 : // Define U, V, and F, piecewise P2 continuous functions over Th. 57 : // F is a constant function. 58 : // 59 : Vh u; 60 : Vh v; 61 : Vh f = 1.0; 62 : // 63 : // Define G, a function for the Dirichlet boundary conditions. 64 : // 65 : func g = x; 66 : // 67 : // Define the weak form of the PDE. 68 : // 69 : problem poisson ( u, v ) 70 : = int2d ( Th ) ( dx(u)*dx(v) + dy(u)*dy(v) ) 71 : - int2d ( Th ) ( f * v ) 72 : + on ( Gamma1, u = g ); 73 : // 74 : // Solve the PDE. 75 : // 76 : poisson; 77 : // 78 : // Plot the solution. 79 : // 80 : plot ( u, fill = true, wait = true, 81 : ps = "membrane_u.ps", cmm = "membrane solution" ); 82 : // 83 : // Save the mesh file. 84 : // 85 : savemesh ( Th, "membrane.msh" ); 86 : // 87 : // Terminate. 88 : // 89 : cout << "\n"; 90 : cout << "membrane():\n"; 91 : cout << " Normal end of execution.\n"; 92 : 93 : exit ( 0 ); 94 : sizestack + 1024 =1896 ( 872 ) membrane(): freefem++ version Model the deflection of an elastic membrane inside an ellipse.. -- mesh: Nb of Triangles = 2568, Nb of Vertices 1360 -- Solve : min -2 max 2 number of required edges : 0 membrane(): Normal end of execution. current line = 93 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 3951, size :523960 mpirank: 0 Ok: Normal End