FEM1D_BVP_QUADRATIC is a Python program 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 GNU LGPL license.
FEM1D_BVP_QUADRATIC is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version..
FEM1D_BVP_LINEAR, a Python program 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 program 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 library 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.
You can go up one level to the Python source codes.