fem1d_bvp_quadratic, a Python code which applies the finite element method, with piecewise quadratic elements, to a two point boundary value problem in one spatial dimension.
The BVP to be solved is:
-u'' = x * ( x + 3 ) * exp ( x ) over the interval 0 < x < 1 u(0) = 0.0 u(1) = 0.0
The exact solution is:
u(x) = x * ( 1 - x ) * exp ( x )
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 quadratic 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 three point Gauss quadrature formula is used to estimate the resulting integrals over each interval.
The computer code and data files described and made available on this web page are distributed under the MIT license
fem1d_bvp_quadratic is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version..
fem1d_bvp_linear, a Python code which applies the finite element method (FEM), with piecewise linear 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, a Python code which applies the finite element method (FEM) to a 1D linear two point boundary value problem (BVP) using piecewise linear basis functions.
fem1d_classes, a Python code which defines classes useful for solving a boundary value problem (BVP) of the form u''+2u'+u=f in 1 spatial dimension, using the finite element method (FEM), by Mike Sussman.