fem1d_bvp_quadratic


fem1d_bvp_quadratic, an Octave code which applies the finite element method (FEM), with piecewise quadratic 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 quadratoc 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.

Usage:

u = fem1d_bvp_quadratic ( n, @a, @c, @f, x )
where

Licensing:

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

Languages:

fem1d_bvp_quadratic is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

fem1d_bvp_quadratic_test

fd1d_bvp, an Octave code which applies the finite difference method to a two point boundary value problem in one spatial dimension.

fem_neumann, an Octave code which sets up a time-dependent reaction-diffusion equation in 1d, with Neumann boundary conditions, discretized using the finite element method.

fem1d, an Octave code which applies the finite element method to a linear two point boundary value problem in a 1d region.

fem1d_adaptive, an Octave 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_linear, is an Octave 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.

fem1d_display, an Octave code which reads three files defining a 1d arbitrary degree finite element function, and displays a plot.

fem1d_function_10_display, an Octave 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, an Octave 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, an Octave code which applies the finite element method to a nonlinear two point boundary value problem in a 1d region.

fem1d_pmethod, an Octave 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_quadratic, an Octave code which applies the finite element method (FEM), with piecewise quadratic elements, to a 2d boundary value problem (BVP) in a rectangle, and compares the computed and exact solutions with the l2 and seminorm errors.

Reference:

  1. Dianne O'Leary,
    Finite Differences and Finite Elements: Getting to Know You,
    Computing in Science and Engineering,
    Volume 7, Number 3, May/June 2005.
  2. Dianne O'Leary,
    Scientific Computing with Case Studies,
    SIAM, 2008,
    ISBN13: 978-0-898716-66-5,
    LC: QA401.O44.
  3. Hans Rudolf Schwarz,
    Finite Element Methods,
    Academic Press, 1988,
    ISBN: 0126330107,
    LC: TA347.F5.S3313..
  4. Gilbert Strang, George Fix,
    An Analysis of the Finite Element Method,
    Cambridge, 1973,
    ISBN: 096140888X,
    LC: TA335.S77.
  5. Olgierd Zienkiewicz,
    The Finite Element Method,
    Sixth Edition,
    Butterworth-Heinemann, 2005,
    ISBN: 0750663200,
    LC: TA640.2.Z54

Source Code:


Last revised on 10 July 2023.