Finite Element Method, 2D, Boundary Value Problem, Serendipity Elements

**FEM2D_BVP_SERENE**
is a MATLAB program which
applies the finite element method, with serendipity elements,
to a 2D boundary value problem over a rectangle.

The boundary value problem (BVP) that is to be solved has the form:

- d/dx ( a(x,y) * du/dx ) - d/dy ( a(x,y) * du/dy ) + c(x,y) * u(x,y) = f(x,y)This equation holds in the interior of some rectangle R. The functions a(x,y), c(x,y), and f(x,y) are given.

Zero boundary conditions are imposed on the boundary of R.

The MATLAB "gallery()" command can produce a copy of the Wathen matrix, which arises as a weighted sum of elementary mass matrices associated with a grid of serendipity elements.

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**FEM2D_BVP_SERENE** is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.

FEM2D_BVP_LINEAR, a MATLAB program which applies the finite element method (FEM), with piecewise linear elements, to a 2D boundary value problem (BVP) over a rectangle, and compares the computed and exact solutions with the L2 and seminorm errors.

FEM2D_BVP_QUADRATIC, a MATLAB program which applies the finite element method (FEM), with piecewise quadratic elements, to a 2D boundary value problem (BVP) over a rectangle, and compares the computed and exact solutions with the L2 and seminorm errors.

WATHEN, a MATLAB library which compares storage schemes (full, banded, sparse triplet, sparse) and solution strategies (A\x, Linpack, conjugate gradient (CG)) for linear systems involving the Wathen matrix, which can arise when solving a problem using the finite element method (FEM).

- basis_serene.m, evaluates the basis functions for the serendipity element.
- basisd_serene.m, evaluates the X and Y derivatives of the basis functions for the serendipity element.
- fem2d_bvp_serene.m, sets up and solves the finite element problem.
- fem2d_bvp_serene_extend.m, extends a solution from the serendipity grid to a regular grid.
- fem2d_bvp_serene_node_num.m, returns the number of nodes in a grid made of serendipity elements.
- fem2d_h1s_error_serene.m, evaluates the H1S seminorm error for a serendipity finite element solution.
- fem2d_l1_error_serene.m, evaluates the l1 error for a serendipity finite element solution.
- fem2d_l2_error_serene.m, evaluates the L2 error for a serendipity finite element solution.
- not1.m, evaluates a one-term factor for serendipity basis functions.
- not1d.m, differentiates a one-term factor for serendipity basis functions.
- not2.m, evaluates a two-term factor for serendipity basis functions.
- not2dx.m, differentiates a two-term factor for serendipity basis functions with respect to X.
- not2dy.m, differentiates a two-term factor for serendipity basis functions with respect to Y.

- fem2d_bvp_serene_test.m, a program which calls fem_bvp_serene with some test cases.
- fem2d_bvp_serene_test_output.txt, the output file.
- fem2d_bvp_serene_test01.m, a simple test in which the exact solution is a quadratic function.
- fem2d_bvp_serene_test02.m, makes some checks on the serendipity basis functions.
- fem2d_bvp_serene_test03.m, sets up a contrived problem so that the system matrix is formed using the Wathen matrix. It prints out one copy of the (scaled) element mass matrix, and compares it to a (scaled and permuted) copy of the Wathen matrix returned by Matlab's gallery('wathen',1,1) command.
- fem2d_bvp_serene_test04.m, repeats the calculation in fem2d_bvp_serene_test01(), but now uses the fem2d_bvp_serene_extend() function to extend the solution from the irregular serendipity grid to a matrix grid, which can then be plotted with the surf() command.
- fem2d_bvp_serene_test04.png, an image of the solution after extension.

You can go up one level to the MATLAB source codes.