fem1d_bvp_linear, a MATLAB code which applies the finite element method, with piecewise linear elements, to a two point boundary value problem in one spatial dimension, and compares the computed and exact solutions with the L2 and seminorm errors.
The boundary value problem (BVP) that is to be solved has the form:
- d/dx ( a(x) * du/dx ) + c(x) * u(x) = f(x)in the interval 0 < x < 1. The functions a(x), c(x), and f(x) are given.
Boundary conditions are applied at the endpoints, and in this case, these are assumed to have the form:
u(0.0) = 0.0; u(1.0) = 0.0.
To compute a finite element approximation, a set of n equally spaced nodes is defined from 0.0 to 1.0, a set of piecewise linear basis functions is set up, with one basis function associated with each node, and then an integral form of the BVP is used, in which the differential equation is multiplied by each basis function, and integration by parts is used to simplify the integrand.
A simple two point Gauss quadrature formula is used to estimate the resulting integrals over each interval.
u = fem1d_bvp_linear ( n, @a, @c, @f, x )where
The computer code and data files described and made available on this web page are distributed under the MIT license
fem1d_bvp_linear is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
bvp4c_test, a MATLAB code which illustrates how to use the MATLAB command bvp4c(), which can solve boundary value problems (bvp's) in one spatial dimension.
fd1d_bvp, a MATLAB code which applies the finite difference method to a two point boundary value problem in one spatial dimension.
fem_neumann, a MATLAB code which sets up a time-dependent reaction-diffusion equation in 1d, with neumann boundary conditions, discretized using the finite element method.
fem1d, a MATLAB code which applies the finite element method to a linear two point boundary value problem in a 1d region.
fem1d_adaptive, a MATLAB code which applies the finite element method to a linear two point boundary value problem in a 1d region, using adaptive refinement to improve the solution.
fem1d_bvp_quadratic, a MATLAB code 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.
fem1d_display, a MATLAB code which reads three files defining a 1d arbitrary degree finite element function, and displays a plot.
fem1d_function_10_display, a MATLAB code which reads a prefix defining three finite element data files, reads the data, samples the finite element function, and displays a plot.
fem1d_lagrange, a MATLAB code which sets up the matrices and vectors associated with the finite element method (fem) solution of a boundary value problem (bvp) -u''+u=f(x), using lagrange basis polynomials.
fem1d_nonlinear, a MATLAB code which applies the finite element method to a nonlinear two point boundary value problem in a 1d region.
fem1d_pmethod, a MATLAB code which applies the p-method version of the finite element method to a linear two point boundary value problem in a 1d region.
fem2d_bvp_linear, a MATLAB code which applies the finite element method (fem), with piecewise linear elements, to a 2d boundary value problem (bvp) in a rectangle, and compares the computed and exact solutions with the l2 and seminorm errors.