# FEM2D_HEAT_SQUARE FEM2D_HEAT applied to a SQUARE region

FEM2D_HEAT_SQUARE is a FORTRAN90 library which defines the geometry of a square region, as well as boundary and initial conditions for a given heat problem, and is called by FEM2D_HEAT as part of a solution procedure.

The mesh uses 81 nodes and forms 32 quadratic triangular elements.

We assume that the equation to be solved is

dUdT - Laplacian U + K * U = F
with
K = 0,
and
F = (2*pi*pi-1)*sin(pi*x)*sin(pi*y)*exp(-t).
The exact solution is:
U = sin(pi*x) * sin(pi*y) * exp(-t).
which is the formula we use to define our functions G (for the boundary conditions) and H (for the initial conditions).

### Languages:

FEM2D_HEAT_SQUARE is available in a FORTRAN90 version.

### Related Data and Programs:

CONTOUR_SEQUENCE4, a MATLAB program which makes a sequence of contour plots based on a single XY coordinate file, and a sequence of Z(X,Y) data files.

FEM2D_HEAT, a FORTRAN90 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.

### Source Code:

• square.f90, the user-supplied routines to evaluate the right hand side, linear coefficient, initial and boundary conditions;

### Examples and Tests:

The MATLAB program CONTOUR_SEQUENCE4 can make contour plots from the sequence of solutions:

### List of Routines:

• DIRICHLET_CONDITION sets the value of a Dirichlet boundary condition.
• INITIAL_CONDITION sets the initial condition.
• K_COEF evaluates the coefficient K(X,Y,T) function.
• RHS gives the right-hand side of the differential equation.

You can go up one level to the FORTRAN90 source codes.

Last revised on 29 December 2010.