fem2d_poisson_rectangle_linear, a FORTRAN90 code which solves the 2D Poisson equation using the finite element method over a rectangular region using a uniform mesh of linear triangular elements.
The computational region is a rectangle, with Dirichlet boundary conditions applied along the boundary. The state variable U(X,Y) is then constrained by:
- ( Uxx + Uyy ) = F(x,y) in the region U(x,y) = G(x,y) on the region boundary
The computational region is first covered with an NX by NY rectangular array of points, creating (NX-1)*(NY-1) subrectangles. Each subrectangle is divided into two triangles, creating a total of 2*(NX-1)*(NY-1) geometric "elements".
We now assume that the unknown function U(x,y) can be represented as a linear combination of the basis functions associated with each node. For each node I, we determine a basis function PHI(I)(x,y), and evaluate the following finite element integral:
Integral ( Ux(x,y) * PHIx(I)(x,y) + Uy(x,y) * PHIy(I)(x,y) ) = Integral ( F(x,y) * PHI(I)(x,y)The set of all such equations yields a linear system for the coefficients of the representation of U.
The computer code and data files described and made available on this web page are distributed under the MIT license
fem2d_poisson_rectangle_linear is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.
FEM2D, a data directory which contains examples of 2D FEM files, text files that describe a 2D finite element geometry and associated nodal values;
FEM2D_HEAT_RECTANGLE, a FORTRAN90 code which solves the 2D time dependent heat equation on the unit square.
FEM2D_POISSON_RECTANGLE, a FORTRAN90 code which solves the 2D Poisson equation on a rectangle, using the finite element method, and piecewise quadratic triangular elements.
fem2d_poisson_rectangle_linear_test