FFH_SPARSE is a MATLAB library which applies the finite element method to solve a form of the time-dependent heat equation over an arbitrary triangulated region.
The linear system is created and stored using MATLAB's sparse matrix storage. The system is factored and solved by MATLAB, using sparse matrix solution techniques.
This program is derived from a similar program, FREE_FEM_HEAT, which uses banded storage, factorization and solution methods.
The geometry is entirely external to the program. The user specifies one file of nodal coordinates, and one file that describes the triangles in terms of six node coordinates.
The program makes a default assumption that all boundary conditions correspond to Dirichlet boundary conditions. The user can adjust these boundary conditions (and even specify Dirichlet constraints on any variable at any node) by setting the appropriate data in certain user routines.
At the moment, Neumann conditions, if specified, must have a zero right hand side. The machinery to integrate a nonzero Neumann condition has not been set up yet.
The computational region is initially unknown by the program. The user specifies it by preparing a file containing the coordinates of the nodes, and a file containing the indices of nodes that make up triangles that form a triangulation of the region.
Normally, the user does not type in this information by hand, but has a program fill in the nodes, and perhaps another program that constructs the triangulation. However, in the simplest case, the user might construct a very crude triangulation by hand, and have TRIANGULATION_REFINE refine it to something more reasonable.
For the following ridiculously small example:
10-11-12
|\ |\
| \ | \
6 7 8 9
| \| \
1-2--3--4-5
the node file would be:
0.0 0.0
1.0 0.0
2.0 0.0
3.0 0.0
4.0 0.0
0.0 1.0
1.0 1.0
2.0 1.0
3.0 1.0
0.0 2.0
1.0 2.0
2.0 2.0
and the triangle file would be
1 3 10 2 7 6
3 5 12 4 9 8
12 10 3 11 7 8
The program is set up to handle the time dependent heat equation with a right hand side function, and nonhomogeneous Dirichlet boundary conditions. The state variable U(T,X,Y) is then constrained by:
Ut - ( Uxx + Uyy ) + K(x,y,t) * U = F(x,y,t) in the region
U = G(x,y,t) on the boundary
U = H(x,y,t) at initial time TINIT.
To specify the right hand side function F(x,y,t), the linear coefficient K(x,y,t), the boundary condition function G(x,y,t), and the initial condition H(x,y,t), the user has to supply four functions,
The program writes out a file containing an Encapsulated PostScript image of the nodes and elements, with numbers. If there are too many nodes, the plot may be too cluttered to read. For lower values, however, it is a valuable map of what is going on in the geometry.
The program is also able to write out a file containing the solution value at every node. This file may be used to create contour plots of the solution.
To run the program, the user must write the user files described above, make all the files associated with ffh_sparse available in the same directory, or in the user's MATLAB path, and supply the names of the node and triangle files to the main program:
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
CVT_TRIANGULATION is a FORTRAN90 program which constructs a CVT triangulation for certain regions.
FD1D_HEAT_EXPLICIT is a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_IMPLICIT is a MATLAB program which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1D.
FD1D_HEAT_STEADY is a MATLAB program which uses the finite difference method to solve the steady (time independent) heat equation in 1D.
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 a 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 and writes the node, element and data files that define a finite element model.
FEM_TO_TEC is a MATLAB program which can convert 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 heat equation on the unit square, using the finite element method.
FEM2D_POISSON is a MATLAB program which solves Poisson's equation on a square, using the finite element method.
FEM2D_SAMPLE is a MATLAB library which evaluates a finite element function defined on an order 3 or order 6 triangulation.
FEMPACK is a MATLAB library which carries out finite element calculations.
FFNS_SPARSE is a MATLAB program which solves the steady Navier Stokes equations in an arbitrary triangulated 2D region, using MATLAB's sparse matrix storage format and solver.
FFP_SPARSE is a MATLAB program which solves the steady Poisson equations in an arbitrary triangulated 2D region, using MATLAB's sparse matrix storage format and solver.
FFS_SPARSE is a MATLAB program which solves the steady Stokes equations in an arbitrary triangulated 2D region, using MATLAB's sparse matrix storage format and solver.
FREE_FEM_HEAT is a MATLAB program which solves the time-dependent heat equation on a triangulated 2D region, using a banded linear solver.
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 the steady Poisson equation on a triangulated 2D region.
FREE_FEM_STOKES is a MATLAB program which solves the steady Stokes flow equations on a triangulated 2D region.
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.
PLOT_POINTS is a FORTRAN90 program which make a plot of the nodes that define the region.
TABLE is a data file format which is used to store the input and output files used by the program.
TABLE_DELAUNAY is a FORTRAN90 program which constructs a Delaunay triangulation of a region which is described by a set of points.
TABLE_IO is a MATLAB library which supplies the routines used to read the data files.
TRIANGULATION_ORDER6 is a data file format which can describe an order 6 triangulation.
TRIANGULATION_ORDER6_CONTOUR is a MATLAB program which can make contour plots of the computed solution.
TRIANGULATION_PLOT is a MATLAB program which can display an image of the triangulation used by the program.
TRIANGULATION_REFINE is a MATLAB program which can refine a triangulation.
A GZIP'ed TAR file of the contents of this directory is available. This is only done as a convenience for users who want ALL the files, and don't want to download them individually. This is not a convenience for me, so don't be surprised if the tar file is somewhat out of date.
You can go up one level to the MATLAB source codes.