Finite Element Method, 2D, Boundary Value Problem, Piecewise Quadratic Elements

**FEM2D_BVP_QUADRATIC**
is a MATLAB program which
applies the finite element method, with piecewise quadratic 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.

To compute a finite element approximation, the X and Y extents of R are gridded with NX and NY equally spaced values, respectively, where both NX and NY must be odd. This defines NX*NY nodes, and divides R into ((NX-1)/2)*((NY-1)/2) rectangular elements. At the K-th node, (X(I),Y(J)), a piecewise quadratic basis function PHI(K)(X,Y) is defined. The solution will be represented as a linear combination of these basis functions. An integral form of the BVP is written, in which the differential equation is multiplied by each basis function, and integration by parts is used to simplify the integrand.

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

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

FEM1D_BVP_QUADRATIC, a MATLAB program which applies the finite element method (FEM), with piecewise quadratic elements, to a two point boundary value problem (BVP) in one spatial dimension, and compares the computed and exact solutions with the L2 and seminorm errors.

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_SERENE, a MATLAB program which applies the finite element method (FEM), with serendipity elements, to a 2D boundary value problem (BVP) in a rectangle, and compares the computed and exact solutions with the L2 and seminorm errors.

- fem2d_bvp_quadratic.m, sets up and solves the finite element problem.
- fem2d_h1s_error_quadratic.m, estimates the seminorm of the error, given the piecewise quadratic solution of the finite element problem, and a function that evaluates the derivative of the exact solution.
- fem2d_l1_error.m, estimates the little l1 norm of the error, given the solution of the finite element problem, and a function that evaluates the exact solution.
- fem2d_l2_error_quadratic.m, estimates the L2 norm of the error, given the piecewise quadratic solution of the finite element problem, and a function that evaluates the exact solution.

- fem2d_bvp_quadratic_test.m, a program which calls fem_bvp_quadratic with some test cases.
- fem2d_bvp_quadratic_test_output.txt, the output file.
- fem2d_bvp_quadratic_test01.m, a simple test in which the exact solution is a quadratic function.

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