FEMPACK
Finite Element Routines
FEMPACK is a MATLAB library
which contains utilities for implementing the finite element method.
The emphasis is on simplicity and clarity.
Only the 2D case is handled, with a choice
of low order triangular and quadrilateral elements.
A few routines are included for computing a "sphere grid",
that is, a finite element mesh on the surface of a sphere.
Related Data and Programs:
FEKETE
is a MATLAB library which
defines a Fekete rule for quadrature or interpolation over a triangle.
FEM
is a data directory which
contains a description of the data files
that can be used to describe a finite element model.
FEM_50
is a MATLAB program which
implements the finite element method in just 50 lines of code.
FEM_50_HEAT
is a MATLAB program which
is a modified version of FEM_50 suitable
for solving the heat equation.
FEM_BASIS_T3_DISPLAY
is a MATLAB program which
displays a basis function associated with a linear triangle ("T3") mesh.
FEM_BASIS_T6_DISPLAY
is a MATLAB program which
reads a quadratic triangle mesh and displays any associated basis function.
FEM_IO
is a MATLAB library which
reads or writes
the node, element and data files that define a finite element model.
FEM_TO_TEC
is a MATLAB program which
converts an FEM model
into a TEC graphics file.
FEM1D,
is a MATLAB program which
applies the finite element method, with piecewise linear basis functions, to a linear
two point boundary value problem;
FEM1D_ADAPTIVE
is a MATLAB program 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_NONLINEAR
is a MATLAB program which
applies the finite element method to a nonlinear two point boundary value problem
in a 1D region.
FEM1D_PMETHOD
is a MATLAB program which
applies the p-method version of the finite element method to a linear
two point boundary value problem in a 1D region.
FEM2D_HEAT
is a MATLAB program which
solves the time dependent heat equation in the unit square.
FEM2D_POISSON
is a MATLAB program which
solves Poisson's equation
on a square, using the finite element method.
FEM2D_POISSON_LINEAR
is a MATLAB program which
solves the 2D Poisson equation on a rectangle, using the finite element method,
and piecewise linear triangular elements.
FEM2D_SAMPLE
is a MATLAB library which
evaluates a finite element function defined on an order 3 or order 6 triangulation.
FEMPACK is available in
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
FREE_FEM_HEAT
is a MATLAB program which
solves the
time dependent heat equation in an arbitrary triangulated 2D region.
FREE_FEM_NAVIER_STOKES
is a MATLAB program which
solves the
steady incompressible Navier Stokes equations
on an arbitrary triangulated region, using the finite element method.
FREE_FEM_POISSON
is a MATLAB program which
solves Poisson's equation
on a triangulated region, using the finite element method.
FREE_FEM_STOKES
is a MATLAB program which
solves the Stokes equations
on a triangulated region, using the finite element method.
HOT_PIPE
is a MATLAB program which
can be run with FEM_50_HEAT.
HOT_POINT
is a MATLAB program which
can be run with FEM_50_HEAT.
POLYGONAL SURFACE
is a data directory which
contains a description of the data files
that can be used to describe a polygonal surface. FEMPACK includes
routines for creating a polygonal surface grid of a sphere.
TRIANGULATION_ORDER3
is a data directory which
contains a description and
examples of how an order 3 (linear) triangulation is defined by a node
and element file.
TRIANGULATION_ORDER6
is a data directory which
contains a description and
examples of how an order 6 (quadratic) triangulation is defined by a node
and element file.
TRIANGULATION_ORDER6_CONTOUR
is a MATLAB program which
makes contours of a scalar quantity defined on the nodes of an order 6
triangulation.
Reference:
-
Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0-486-61272-4,
LC: QA47.A34.
-
Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart,
LINPACK User's Guide,
SIAM, 1979,
ISBN13: 978-0-898711-72-1.
-
Vladimir Krylov,
Approximate Calculation of Integrals,
Dover, 2006,
ISBN: 0486445798.
-
Hans Rudolf Schwarz,
Finite Element Methods,
Academic Press, 1988,
ISBN: 0126330107,
LC: TA347.F5.S3313..
-
Gilbert Strang, George Fix,
An Analysis of the Finite Element Method,
Cambridge, 1973,
ISBN: 096140888X,
LC: TA335.S77.
-
Arthur Stroud,
Approximate Calculation of Multiple Integrals,
Prentice Hall, 1971,
ISBN: 0130438936,
LC: QA311.S85.
-
Arthur Stroud, Don Secrest,
Gaussian Quadrature Formulas,
Prentice Hall, 1966,
LC: QA299.4G3S7.
-
Olgierd Zienkiewicz,
The Finite Element Method,
Sixth Edition,
Butterworth-Heinemann, 2005,
ISBN: 0750663200,
LC: TA640.2.Z54
-
Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3.
Tar File:
A GZIP'ed TAR file of the contents of this directory is available.
Source Code:
-
bandwidth_mesh.m
computes the bandwidth associated with the finite element mesh;
-
bandwidth_var.m
computes the bandwidth associated with an arbitrary assignment
of variables to the nodes of the finite element mesh;
-
basis_11_t3.m
one basis at one point for the T3 element;
-
basis_11_t3_test.m
verifies BASIS_11_T3;
-
basis_11_t4.m
one basis at one point for the T4 element;
-
basis_11_t4_test.m
verifies BASIS_11_T4;
-
basis_11_t6.m
one basis at one point for the T6 element;
-
basis_11_t6_test.m
verifies BASIS_11_T6;
-
basis_mn_q4.m
all basis functions for N points in a Q4 element;
-
basis_mn_q4_test.m
verifies BASIS_MN_Q4.
-
basis_mn_t3.m
all basis functions for N points in a T3 element.
-
basis_mn_t3_test.m
verifies BASIS_MN_T3.
-
basis_mn_t4.m
all basis functions for N points in a T4 element.
-
basis_mn_t4_test.m
verifies BASIS_MN_T4.
-
basis_mn_t6.m
evaluates all basis functions for a T6 element.
-
basis_mn_t6_test.m
verifies the basis values at the basis nodes for a T6 element.
-
ch_cap.m
capitalizes a single character.
-
degrees_to_radians.m
converts an angle from degrees to radians.
-
derivative_average_t3.m
averages derivatives at the nodes of a T3 mesh.
-
div_q4.m
estimates the divergence and vorticity of a discrete field.
-
dtable_close_write.m,
closes a DTABLE file that was written to.
-
dtable_data_write.m,
writes a table to a double precision TABLE file.
-
dtable_header_write.m,
writes a table header to a double precision TABLE file.
-
dtable_write.m,
writes a table to a double precision TABLE file.
-
element_code.m
returns the code for each element.
-
elements_eps.m
creates an EPS file image of the elements of a grid.
-
grid_element.m
returns the grid associated with any available element.
-
grid_element_num.m
counts the elements in a grid given the element code.
-
grid_node_num.m
counts the nodes in a grid given the element code.
-
grid_nodes.m
defines a rectangular grid of equally spaced nodes in the unit square.
-
grid_print.m
prints the elements that form a grid.
-
grid_q4_element.m
produces a grid of Q4 elements.
-
grid_q4_element_num.m
counts the elements in a grid of Q4 elements.
-
grid_q4_node_num.m
counts the nodes in a grid of Q4 elements.
-
grid_q8_element.m
produces a grid of Q8 elements.
-
grid_q8_element_num.m
counts the elements in a grid of Q8 elements.
-
grid_q8_node_num.m
counts the nodes in a grid of Q8 elements.
-
grid_q9_element.m
produces a grid of Q9 elements.
-
grid_q9_element_num.m
counts the elements in a grid of Q9 elements.
-
grid_q9_node_num.m
counts the nodes in a grid of Q9 elements.
-
grid_q12_element.m
produces a grid of Q12 elements.
-
grid_q12_element_num.m
counts the elements in a grid of Q12 elements.
-
grid_q12_node_num.m
counts the nodes in a grid of Q12 elements.
-
grid_q16_element.m
produces a grid of Q16 elements.
-
grid_q16_element_num.m
counts the elements in a grid of Q16 elements.
-
grid_q16_node_num.m
counts the nodes in a grid of Q16 elements.
-
grid_ql_element.m
produces a grid of QL elements.
-
grid_ql_element_num.m
counts the elements in a grid of QL elements.
-
grid_ql_node_num.m
counts the nodes in a grid of QL elements.
-
grid_shape_2d.m
guesses the shape N1 by N2 of a vector of data.
-
grid_t3_element.m
produces a grid of pairs of T3 elements.
-
grid_t3_element_num.m
counts the elements in a grid of T3 elements.
-
grid_t3_node_num.m
counts the nodes in a grid of T3 elements.
-
grid_t4_element.m
produces a grid of pairs of T4 elements.
-
grid_t4_element_num.m
counts the elements in a grid of T4 elements.
-
grid_t4_node_num.m
counts the nodes in a grid of T4 elements.
-
grid_t6_element.m
produces a grid of pairs of T6 elements.
-
grid_t6_element_num.m
counts the elements in a grid of T6 elements.
-
grid_t6_node_num.m
counts the nodes in a grid of T6 elements.
-
grid_t10_element.m
produces a grid of pairs of T10 elements.
-
grid_t10_element_num.m
counts the elements in a grid of T10 elements.
-
grid_t10_node_num.m
counts the nodes in a grid of T10 elements.
-
grid_test.m
tests the grid routines.
-
grid_width.m
computes the width of a given grid.
-
i4_modp.m
returns the nonnegative remainder of integer division.
-
i4_sign.m
returns the sign of an integer.
-
i4_wrap.m
forces an integer to lie between given limits by wrapping.
-
interp.m
interpolates a quantity in an element from basis node values.
-
interp_test.m
tests the interpolation power of the basis functions for a given element;
-
itable_data_write.m,
writes a table to an integer TABLE file.
-
itable_header_write.m,
writes a table header to an integer TABLE file.
-
itable_write.m,
writes a table to an integer TABLE file.
-
i4vec_print.m
prints an I4VEC;
-
legendre_com.m
computes abscissas and weights for Gauss-Legendre quadrature.
-
legendre_set.m
sets abscissas and weights for Gauss-Legendre quadrature.
-
map.m
returns the interpolation matrix for any available element.
-
map_test.m
tests the map routines.
-
mass_matrix_t6.m
computes the mass matrix for T6 elements.
-
next_boundary_node.m
returns the next boundary node in any element.
-
next_boundary_node_q4.m
returns the next boundary node in a Q4 element.
-
next_boundary_node_q8.m
returns the next boundary node in a Q8 element.
-
next_boundary_node_q9.m
returns the next boundary node in a Q9 element.
-
next_boundary_node_q12.m
returns the next boundary node in a Q12 element.
-
next_boundary_node_q16.m
returns the next boundary node in a Q16 element.
-
next_boundary_node_ql.m
returns the next boundary node in a QL element.
-
next_boundary_node_t3.m
returns the next boundary node in a T3 element.
-
next_boundary_node_t4.m
returns the next boundary node in a T4 element.
-
next_boundary_node_t6.m
returns the next boundary node in a T6 element.
-
next_boundary_node_t10.m
returns the next boundary node in a T10 element.
-
node_reference.m
returns the basis nodes for any available element.
-
node_reference_q4.m
returns the basis nodes for a Q4 element.
-
node_reference_q8.m
returns the basis nodes for a Q8 element.
-
node_reference_q9.m
returns the basis nodes for a Q9 element.
-
node_reference_q12.m
returns the basis nodes for a Q12 element.
-
node_reference_q16.m
returns the basis nodes for a Q16 element.
-
node_reference_ql.m
returns the basis nodes for a QL element.
-
node_reference_t3.m
returns the basis nodes for a T3 element.
-
node_reference_t4.m
returns the basis nodes for a T4 element.
-
node_reference_t6.m
returns the basis nodes for a T6 element.
-
node_reference_t10.m
returns the basis nodes for a T10 element.
-
ns_t6_var_count.m
counts the Navier Stokes variables on a T6 grid.
-
ns_t6_var_set.m
sets the Navier Stokes variables on a T6 grid.
-
order_code.m
returns the order for each element.
-
physical_to_reference_t3.m
maps points in physical space into a T3 reference element.
-
points_plot.m
creates an EPS file containing an image of the nodes.
-
poly.m
returns the polynomial terms associated with any available element.
-
poly_q4.m
returns the monomials associated with a Q4 element.
-
poly_q8.m
returns the monomials associated with an Q8 element.
-
poly_q9.m
returns the monomials associated with a Q9 element.
-
poly_q12.m
returns the monomials associated with a Q12 element.
-
poly_q16.m
returns the monomials associated with a Q16 element.
-
poly_ql.m
returns the monomials for a QL element.
-
poly_t3.m
returns the monomials associated with a T3 element.
-
poly_t6.m
returns the monomials associated with a T6 element.
-
poly_t10.m
returns the monomials associated with a T10 element.
-
r8_epsilon.m
returns the machine epsilon.
-
r8_power.m
returns a power of a real number.
-
r8_uniform_01.m
returns a pseudorandom value in [0,1].
-
r8ge_fa.m
performs a LINPACK style PLU factorization of a DGE matrix.
-
r8ge_inverse.m
computes the inverse of a matrix factored by DGE_FA.
-
r8mat_print.m
prints a double precision matrix, with an optional title.
-
r8mat_print_some.m
prints some of a double precision matrix, with an optional title.
-
reference_sample.m
samples a reference element.
-
reference_to_physical_q4.m
maps points in a Q4 reference triangle into physical space.
-
reference_to_physical_t3.m
maps points in a T3 reference triangle into physical space.
-
reference_to_physical_t6.m
maps points in a T6 reference triangle into physical space.
-
s_eqi.m
is a case insensitive comparison of two strings for equality.
-
s_l2norm.m
computes the "big" L2 norm of a scalar function over a region.
-
s_len_trim.m
returns the length of a string to the last nonblank.
-
serene.m
interpolates data using a Q8 element.
-
shape.m
evaluates shape functions for any available element.
-
shape_test.m
verifies the shape function values at the basis nodes.
-
shape_q4.m
evaluates shape functions for a Q4 element.
-
shape_q8.m
evaluates shape functions for a Q8 element.
-
shape_q9.m
evaluates shape functions for a Q9 element.
-
shape_q12.m
evaluates shape functions for a Q12 element.
-
shape_q16.m
evaluates shape functions for a Q16 element.
-
shape_ql.m
evaluates shape functions for a QL element.
-
shape_t3.m
evaluates shape functions for a T3 element.
-
shape_t4.m
evaluates shape functions for a T4 element.
-
shape_t6.m
evaluates shape functions for a T6 element.
-
shape_t10.m
evaluates shape functions for a T10 element.
-
sphere_grid_element_num.m
returns the number of elements in a sphere grid.
-
sphere_grid_node_num.m
returns the number of nodes in a sphere grid.
-
sphere_grid_q4_element.m
produces a Q4 sphere grid.
-
sphere_grid_q4_element_num.m
counts the elements in a Q4 sphere grid.
-
sphere_grid_q4_node_num.m
counts the nodes in a Q4 sphere grid.
-
sphere_grid_q4_node_xyz.m
sets the nodes in a Q4 sphere grid.
-
sphere_grid_q9_element.m
produces a Q9 sphere grid.
-
sphere_grid_q9_element_num.m
counts the elements in a Q9 sphere grid.
-
sphere_grid_q9_node_num.m
counts the nodes in a Q9 sphere grid.
-
sphere_grid_q9_node_xyz.m
sets the nodes in a Q9 sphere grid.
-
sphere_grid_q16_element.m
produces a Q16 sphere grid.
-
sphere_grid_q16_element_num.m
counts the elements in a Q16 sphere grid.
-
sphere_grid_q16_node_num.m
counts the nodes in a Q16 sphere grid.
-
sphere_grid_q16_node_xyz.m
sets the nodes in a Q16 sphere grid.
-
sphere_grid_t3_element.m
produces a T3 sphere grid.
-
sphere_grid_t3_element_num.m
counts the elements in a T3 sphere grid.
-
sphere_grid_t3_node_num.m
counts the nodes in a T3 sphere grid.
-
sphere_grid_t3_node_xyz.m
sets the nodes in a T3 sphere grid.
-
sphere_grid_t6_element.m
produces a T6 sphere grid.
-
sphere_grid_t6_element_num.m
counts the elements in a T6 sphere grid.
-
sphere_grid_t6_node_num.m
counts the nodes in a T6 sphere grid.
-
sphere_grid_t6_node_xyz.m
sets the nodes in a T6 sphere grid.
-
timestamp.m
prints the current YMDHMS date as a time stamp.
-
timestring.m
writes the current YMDHMS date into a string.
-
triangle_unit_set.m
sets a quadrature rule in a unit triangle.
-
triangle_unit_size.m
returns the order of a quadrature rule in a unit triangle.
Examples and Tests:
-
fempack_test.m,
runs all the tests;
-
fempack_test01.m,
tests BANDWIDTH_MESH;
-
fempack_test02.m,
tests BANDWIDTH_VAR;
-
fempack_test03.m,
tests BASIS_11_**_TEST;
-
fempack_test04.m,
tests BASIS_MN_**_TEST;
-
fempack_test05.m,
tests DERIVATIVE_AVERAGE_T3;
-
fempack_test06.m,
tests DIV_Q4;
-
fempack_test07m,
tests ELEMENTS_EPS with Q4 elements;
-
fempack_test08.m,
tests ELEMENTS_EPS with T3 elements;
-
fempack_test09.m,
tests ELEMENTS_EPS with T4 elements;
-
fempack_test10.m,
tests ELEMENTS_EPS with T6 elements;
-
fempack_test105.m,
tests GRID_NODES_01;
-
fempack_test11.m,
tests GRID_TEST;
-
fempack_test12.m,
tests INTERP_TEST;
-
fempack_test13.m,
tests MAP_TEST;
-
fempack_test14.m,
tests MASS_MATRIX_T6;
-
fempack_test15.m,
tests PHYSICAL_TO_REFERENCE_T3 and REFERENCE_TO_PHYSICAL_T3.
-
fempack_test16.m,
tests PHYSICAL_TO_REFERENCE_T6.
-
fempack_test17.m,
tests S_L2NORM;
-
fempack_test18.m,
tests SHAPE_TEST;
-
fempack_test19.m,
tests SPHERE_GRID_Q4;
-
fempack_test20.m,
tests SPHERE_GRID_Q9;
-
fempack_test21.m,
tests SPHERE_GRID_Q16;
-
fempack_test22.m,
tests SPHERE_GRID_T3;
-
fempack_test23.m,
tests SPHERE_GRID_T6;
-
fempack_test24.m,
tests TRIANGLE_UNIT_SET.
-
fempack_test.out,
the sample output.
-
fempack_test_q4.png,
a PNG image of
a Q4 mesh.
-
fempack_test_t3.png,
a PNG image of
a T3 mesh.
-
fempack_test_t4.png,
a PNG image of
a T4 mesh.
-
fempack_test_t6.png,
a PNG image of
a T6 mesh.
-
sphere_q4_nodes.txt,
a node file for a Q4 mesh, which is also a
polygonal surface,
that approximates a sphere.
-
sphere_q4_elements.txt,
an element file for a Q4 mesh, which is also a
polygonal surface,
that approximates a sphere.
-
sphere_q9_nodes.txt,
a node file for a Q9 mesh
that approximates a sphere.
-
sphere_q9_elements.txt,
an element file for a Q9 mesh
that approximates a sphere.
-
sphere_q16_nodes.txt,
a node file for a Q16 mesh
that approximates a sphere.
-
sphere_q16_elements.txt,
an element file for a Q16 mesh
that approximates a sphere.
-
sphere_t3_nodes.txt,
a node file for a T3 mesh, which is also a
polygonal surface,
that approximates a sphere.
-
sphere_t3_elements.txt,
an element file for a T3 mesh, which is also a
polygonal surface,
that approximates a sphere.
-
sphere_t6_nodes.txt,
a node file for a T6 mesh
that approximates a sphere.
-
sphere_t6_elements.txt,
an element file for a T6 mesh
that approximates a sphere.
You can go up one level to
the MATLAB source codes.
Last revised on 15 May 2008.