FEM2D_PACK
Finite Element Routines
FEM2D_PACK
is a FORTRAN77 library which
can help in implementing the finite element method.
The emphasis is on simplicity and clarity.
Primarily, the 2D planar case is handled, with a choice
of low order triangular ("T") and quadrilateral ("Q") elements.
A few routines are included for computing a "sphere grid",
that is, a finite element mesh on the surface of a sphere.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
FEM2D_PACK is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
FEM_BASIS,
a FORTRAN77 library which
can define basis functions for the finite element method (FEM)
for any degree in an M-dimensional simplex (1D interval, 2D triangle,
3D tetrahedron, and higher dimensional generalizations.)
FEM2D,
a data directory which
contains examples of 2D FEM files,
three text files that describe a 2D finite element geometry;
FEM2D_HEAT,
a FORTRAN90 program which
solves the 2D time dependent heat equation on the unit square.
FEM2D_POISSON,
a FORTRAN90 program which
solves the 2D Poisson equation on a square, using the finite element method.
FEM2D_SAMPLE,
a FORTRAN77 library which
evaluates a finite element function defined on an order 3 or order 6 triangulation.
MESH_BANDWIDTH,
a FORTRAN77 program which
returns the geometric bandwidth associated with a mesh of
elements of any order and in a space of arbitrary dimension.
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,
TA640.2.Z54
-
Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3.
Source Code:
Examples and Tests:
-
fem2d_pack_prb.f, the calling program;
-
fem2d_pack_prb.sh,
commands to compile, link and run the calling program;
-
fem2d_pack_prb_output.txt,
the output file.
-
fem2d_pack_prb_q4.png,
a PNG image of
a Q4 mesh.
-
fem2d_pack_prb_t3.png,
a PNG image of
a T3 mesh.
-
fem2d_pack_prb_t4.png,
a PNG image of
a T4 mesh.
-
fem2d_pack_prb_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.
List of Routines:
-
BANDWIDTH_MESH: bandwidth of finite element mesh.
-
BANDWIDTH_VAR determines the bandwidth for finite element variables.
-
BASIS_11_Q4: one basis at one point for a Q4 element.
-
BASIS_11_Q4_TEST verifies BASIS_11_Q4.
-
BASIS_11_T3: one basis at one point for the T3 element.
-
BASIS_11_T3_TEST verifies BASIS_11_T3.
-
BASIS_11_T4: one basis at one point for a T4 element.
-
BASIS_11_T4_TEST verifies BASIS_11_T4.
-
BASIS_11_T6: one basis at one point for the T6 element.
-
BASIS_11_T6_TEST verifies BASIS_11_T6.
-
BASIS_MN_Q4: all bases at N points for a Q4 element.
-
BASIS_MN_Q4_TEST verifies BASIS_MN_Q4.
-
BASIS_MN_T3: all bases at N points for a T3 element.
-
BASIS_MN_T3_TEST verifies BASIS_MN_T3.
-
BASIS_MN_T4: all bases at N points for a T4 element.
-
BASIS_MN_T4_TEST verifies BASIS_MN_T4.
-
BASIS_MN_T6: all bases at N points for a T6 element.
-
BASIS_MN_T6_TEST verifies BASIS_MN_T6.
-
CH_CAP capitalizes a single character.
-
DEGREES_TO_RADIANS converts an angle measure from degrees to radians.
-
DERIVATIVE_AVERAGE_T3 averages derivatives at the nodes of a T3 mesh.
-
DERIVATIVE_AVERAGE_T6 averages derivatives at the nodes of a T6 mesh.
-
DIV_Q4 estimates the divergence and vorticity of a discrete field.
-
ELEMENT_CODE returns the code for each element.
-
GET_UNIT returns a free FORTRAN unit number.
-
GRID_NODES_01 returns an equally spaced rectangular grid in the unit square.
-
GRID_PRINT prints the elements that form a grid.
-
GRID_WIDTH computes the width of a given grid.
-
I4_MODP returns the nonnegative remainder of integer division.
-
I4_WRAP forces an I4 to lie between given limits by wrapping.
-
I4MAT_WRITE writes an I4MAT file.
-
I4VEC_PRINT prints an I4VEC.
-
INTERP interpolates a quantity in an element from basis node values.
-
LEGENDRE_DR_COMPUTE: Gauss-Legendre quadrature by Davis-Rabinowitz method.
-
LEGENDRE_SET sets abscissas and weights for Gauss-Legendre quadrature.
-
MASS_MATRIX_T3 computes the mass matrix, using 3-node triangles.
-
MASS_MATRIX_T6 computes the mass matrix, using 6-node triangles.
-
NEXT_BOUNDARY_NODE returns the next boundary node in any element.
-
NEXT_BOUNDARY_NODE_Q4 returns the next boundary node in a Q4 element.
-
NEXT_BOUNDARY_NODE_Q8 returns the next boundary node in a Q8 element.
-
NEXT_BOUNDARY_NODE_Q9 returns the next boundary node in a Q9 element.
-
NEXT_BOUNDARY_NODE_Q12 returns the next boundary node in a Q12 element.
-
NEXT_BOUNDARY_NODE_Q16 returns the next boundary node in a Q16 element.
-
NEXT_BOUNDARY_NODE_QL returns the next boundary node in a QL element.
-
NEXT_BOUNDARY_NODE_T3 returns the next boundary node in a T3 element.
-
NEXT_BOUNDARY_NODE_T4 returns the next boundary node in a T4 element.
-
NEXT_BOUNDARY_NODE_T6 returns the next boundary node in a T6 element.
-
NEXT_BOUNDARY_NODE_T10 returns the next boundary node in a T10 element.
-
NODE_REFERENCE returns the basis nodes for any available element.
-
NODE_REFERENCE_Q4 returns the basis nodes for a 4 node quadrilateral.
-
NODE_REFERENCE_Q8 returns the basis nodes for an 8 node quadrilateral.
-
NODE_REFERENCE_Q9 returns the basis nodes for a 9 node quadrilateral.
-
NODE_REFERENCE_Q12 returns the basis nodes for a 12 node quadrilateral.
-
NODE_REFERENCE_Q16 returns the basis nodes for a 16 node quadrilateral.
-
NODE_REFERENCE_QL returns the basis nodes for a quadratic/linear.
-
NODE_REFERENCE_T3 returns the basis nodes for the 3 node triangle.
-
NODE_REFERENCE_T4 returns the basis nodes for the 4 node triangle.
-
NODE_REFERENCE_T6 returns the basis nodes for a 6 node triangle.
-
NODE_REFERENCE_T10 returns the basis nodes for a 10 node triangle.
-
NS_T6_VAR_COUNT counts the Navier Stokes variables on a T6 grid.
-
NS_T6_VAR_SET sets the Navier Stokes variables on a T6 grid.
-
ORDER_CODE returns the order for each element.
-
PHYSICAL_TO_REFERENCE_T3 maps physical points to reference points.
-
POLY returns the polynomial terms associated with any available element.
-
POLY_Q4 returns the monomials associated with a 4 node quadrilateral.
-
POLY_Q8 returns the monomials associated with an 8 node quadrilateral.
-
POLY_Q9 returns the monomials associated with a 9 node quadrilateral.
-
POLY_Q12 returns the monomials associated with a 12 node quadrilateral.
-
POLY_Q16 returns the monomials associated with a 16 node quadrilateral.
-
POLY_QL returns the monomials for a quadratic/linear quadrilateral.
-
POLY_T3 returns the monomials associated with a 3 node triangle.
-
POLY_T6 returns the monomials associated with a 6 node triangle.
-
POLY_T10 returns the monomials associated with a 10 node triangle.
-
R8_HUGE returns a "huge" R8.
-
R8_POWER computes the P-th power of an R8.
-
R8_SWAP switches two R8's.
-
R8_UNIFORM_01 returns a unit pseudorandom R8.
-
R8GE_FA performs a LINPACK style PLU factorization of an R8GE matrix.
-
R8GE_INVERSE computes the inverse of a matrix factored by R8GE_FA.
-
R8MAT_PRINT prints an R8MAT.
-
R8MAT_PRINT_SOME prints some of an R8MAT.
-
R8MAT_WRITE writes a R8MAT file.
-
R8VEC_DOT_PRODUCT finds the dot product of a pair of R8VEC's.
-
R8VEC_SUM sums the entries of an R8VEC.
-
REFERENCE_SAMPLE samples a reference element.
-
REFERENCE_TO_PHYSICAL_Q4 maps Q4 reference points to physical points.
-
REFERENCE_TO_PHYSICAL_T3 maps T3 reference points to physical points.
-
REFERENCE_TO_PHYSICAL_T6 maps T6 reference points to physical points.
-
S_EQI is a case insensitive comparison of two strings for equality.
-
SHAPE evaluates shape functions for any available reference element.
-
SHAPE_Q4 evaluates shape functions for a 4 node reference quadrilateral.
-
SHAPE_Q8 evaluates shape functions for an 8 node reference quadrilateral.
-
SHAPE_Q9 evaluates shape functions for a 9 node reference quadrilateral.
-
SHAPE_Q12 evaluates shape functions for a 12 node reference quadrilateral.
-
SHAPE_Q16 evaluates shape functions for a 16 node reference quadrilateral.
-
SHAPE_QL evaluates shape functions for a 6 node quadratic/linear.
-
SHAPE_T3 evaluates shape functions for a 3 node reference triangle.
-
SHAPE_T4 evaluates shape functions for a 4 node reference triangle.
-
SHAPE_T6 evaluates shape functions for a 6 node reference triangle.
-
SHAPE_T10 evaluates shape functions for a 10 node reference triangle.
-
SHAPE_TEST verifies the shape function values at the basis nodes.
-
TIMESTAMP prints out the current YMDHMS date as a timestamp.
-
TRIANGLE_UNIT_SET sets a quadrature rule in the unit triangle.
-
TRIANGLE_UNIT_SIZE returns the "size" of a unit triangle quadrature rule.
You can go up one level to
the FORTRAN77 source codes.
Last revised on 16 January 2013.