FEM_50 is a MATLAB program which applies the finite element method to solving Laplace's equation in an arbitrary region, using about 50 lines of MATLAB code, by Jochen Alberty, Carsten Carstensen, Stefan Funken.
FEM_50 is partly a demonstration, to show how little it takes to implement the finite element method (at least using every possible MATLAB shortcut.) The user supplies datafiles that specify the geometry of the region and its arrangement into triangular and quadrilateral elements, and the location and type of the boundary conditions, which can be any mixture of Neumann and Dirichlet.
The unknown state variable U(x,y) is assumed to satisfy Laplace's equation:
-Uxx(x,y) - Uyy(x,y) = F(x,y) in Omegawith Dirichlet boundary conditions
U(x,y) = U_D(x,y) on GammaDand Neumann boundary conditions on the outward normal derivative:
Un(x,y) = G(x,y) on GammaNIf Gamma designates the boundary of the region Omega, then we presume that
Gamma = GammaD + GammaNbut the user is free to determine which boundary conditions to apply. Note, however, that the problem will generally be singular unless at least one Dirichlet boundary condition is specified.
The code uses piecewise linear basis functions for triangular elements, and piecewise isoparametric bilinear basis functions for quadrilateral elements.
The user is required to supply a number of data files and MATLAB functions that specify the location of nodes, the grouping of nodes into elements, the location and value of boundary conditions, and the right hand side function in Laplace's equation. Note that the fact that the geometry is completely up to the user means that just about any two dimensional region can be handled, with arbitrary shape, including holes and islands.
FEM_50 is available in a MATLAB version.
FD2D_HEAT_EXPLICIT_SPMD, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 2D. A black and white image is used as the "initial condition". MATLAB's SPMD facility is used to carry out the computation in parallel.
FEM_50_HEAT, a MATLAB program which is a modified version of FEM_50 suitable for solving the heat equation.
FEM2D_HEAT, a MATLAB program which uses the finite element method and the backward Euler method to solve the 2D time-dependent heat equation on an arbitrary triangulated region. In order to run, it requires user-supplied routines that define problem data.
FEM2D_HEAT_RECTANGLE, a MATLAB program which solves the 2D time dependent heat equation on the unit square, using a uniform grid of triangular elements.
FEM2D_HEAT_SPARSE, a MATLAB program which solves the time dependent heat equation in an arbitrary triangulated 2D region, using MATLAB's sparse matrix storage format and solver.
FEM2D_HEAT_SPARSE_SQUARE, a MATLAB library which defines the geometry of a square region, as well as boundary and initial conditions for a given heat problem, so that fem2d_heat_sparse can be called for a solution.
FEM2D_HEAT_SQUARE, a MATLAB library which defines the geometry of a square region, as well as boundary and initial conditions for a given heat problem, so that fem2d_heat can be called for a solution.
HOT_PIPE, a MATLAB program which uses FEM_50_HEAT to solve the heat equation for a pipe model.
HOT_POINT, a MATLAB program which uses FEM_50_HEAT to solve the heat equation for a 2D region with a hot point.
You can go up one level to the MATLAB source codes.