Numerical Solution of a One Dimensional Heat Equation with Dirichlet Boundary Conditions
School of Mathematical and Statistical Sciences, Hawassa University, Hawassa, Ethiopia
To cite this article:
Benyam Mebrate. Numerical Solution of a One Dimensional Heat Equation with Dirichlet Boundary Conditions. American Journal of Applied Mathematics. Vol. 3, No. 6, 2015, pp. 305-311. doi: 10.11648/j.ajam.20150306.20
Abstract: In this paper I present Numerical solutions of a one dimensional heat Equation together with initial condition and Dirichlet boundary conditions. Two methods are used to compute the numerical solutions, viz. Finite difference methods and Finite element methods. The finite element methods are implemented by Crank - Nicolson method. The numerical solutions of a one dimensional heat Equation together with initial condition and Dirichlet boundary conditions using finite difference methods do not always converge to the exact solutions. It indicates the occurrence of numerical instability in finite difference methods. Finally the numerical solutions obtained by these two methods are compared with the analytic solutions graphically into two and three dimensions.
Keywords: Initial Condition, Dirichlet Boundary Conditions, Finite Difference Methods, Finite Element Methods, Heat Equation, Instability
Many physical problems in the real world such as heat equation, wave equation, Poisson equation and Laplace equation are modeled by partial differential equations. Some of these partial differential equations have exact solution in regular shape domain. But in general if the domain has irregular shape, computing exact solution of such equations is difficult. Due to this we use numerical methods to compute the solution of the modeled partial differential equations.
Finite difference and finite element methods are the two numerical methods that are applied to compute the solutions of partial differential equations by discretizing the domain in to finite number of regions. The solutions are computed at the grid points of the domain.
In literature  B-spline finite element methods are applied for numerical Simulation of one dimensional heat Equation. This motivates me to apply finite difference and finite element methods to heat equation with the given conditions and study the behavior of the solution for different values of.
This paper includes the following sections. Section 2 Problem definition Section 3 Finite difference methods Section 4 Finite element methods Section 5 Exact solution Section 6 Comparison of solutions Section 7 Conclusions.
2. Problem Definition
is known as heat equation in one dimension. Equation (1) is parabolic second order linear partial differential equation.
The initial condition is
and the Dirichlet boundary conditions are
Equations (1), (2) and (3) together are called Boundary – Initial value problem. To compute the numerical solution of equations (1) together with equations (2) and (3), we divide the interval in to equal parts by the points with step length . Also we divide the time interval in to equal parts by the points with step length . Here the problem is computing the solution for . For simplicity we take.
3. Finite Difference Methods
In this method the partial differential equation is approximated by the set of finite difference equations. When we solve equation (1) using finite difference methods, infinitely many points in the - plane is replaced by a finite set of points. Thus equation (1) is replaced by algebraic equations and the algebraic equations are solved at each point. More specifically, we follow the following steps:
i. We discretize the domain.
ii. We discretize equation (1). In this process equation (1) is replaced by algebraic equations.
iii. We discretize the boundary conditions and the initial conditions.
iv. We solve the algebraic equations obtained in steps (ii) and (iii) at the points obtained in step (i).
Using these steps, we obtain the following set of algebraic equations
Equation (4) approximates the partial differential equation (1) together with initial condition
and boundary conditions
The finite difference method for equation (1) together with equations (2) and (3) is stable if and unstable if .
4. Finite Element Methods
The main idea of finite element methods is changing equation (1) in to weak form. The solution of the weak formulation of equation (1) approximates the exact or analytic solution of equation (1). The accuracy of the solutions depends on the number and size of the elements, and the types of functions that are considered within the elements. To implement the finite element method for equation (1) we follow the following steps:
i. We find the weak formulation of equation (1).
ii. We discretize the interval and.
iii. We compute the stiffness matrix and mass matrix.
iv. We apply the Crank - Nicolson method to solve the resulting system of first order differential equations.
We use these steps as follows:
The weak formulation of equation (1) together with boundary conditions (3) is to find such that
Thus using (7) the finite element problem is to find such that
where and depends on a positive parameter . Also dim .
Linear basis functions are chosen on the interval as shown in the figure 1.
The basis function is defined by
Here we take
Thus using (8) and (9) the weak formulation becomes
We may write as
Crank – Nicolson or trapezoidal method is applied to compute (11) at the nodes. The method is given by
5. Numerical Solutions
In order to show the stability and instability of the finite difference method, and the accuracy of the numerical solution, we take. We also consider. Then from equations (12) and (13), and are respectively.
Here we list the numerical solution of equation (1) together with initial condition (2) and boundary conditions (3).
5.1. Solutions Using Finite Difference Methods
5.2. Solutions Using Finite Element Methods
6. Exact Solution
Using separation of variables the exact solution of equation (1) with initial condition (2) and boundary conditions (3) is
The value of at is given in table 7 and 8 for and respectively.
7. Comparisons of Solutions
Here we compare the solutions using finite element methods, finite difference methods and exact method for and different values of as shown in Figure 2 (a), (b) and (c). We also compare the numerical solution with the exact solution for as shown in Figure 2 (d) and Figure 3.
As we observe in Figure 2 (a), (b) and (c) the solution curve close to – axis, that is, decreases as increases. In figure 2 (d) the numerical solutions approximates the exact or analytic solutions. We can also see .
As we see in Figure 3 the numerical solutions using finite element methods approximates the exact or analytic solutions but numerical solutions using finite difference method does not approximate the exact or analytic solutions. This is the effect of instability and not a truncation effect. Here.
In three dimensions the solution surface are shown in figure 4, 5 and 6.
As we see Figure (4) the graphs are identical. This indicates the numerical solutions approximate the exact solutions.
In figure 5 the surface (a) is drawn on the region because the solution using finite difference methods on is unbounded.
As we notice in figure 5, (a) is different from (b) and (c). This arises due to. Hence the finite difference methods do not give approximate solutions to the exact solutions when.
The finite element methods approximate the exact solution of heat equation (1) together with (2) and (3). But the finite difference methodsdo not give approximate solutions for all.The stepsize in the direction must be much smaller than the step size in the direction.Though these depend on the partial differential equation as well as the boundary conditions, iffor the heat equation, then the finite difference method is stable, that is it gives reasonable approximations to the exact solution. If, the finite difference method is unstable. Therefore; finite element methods are best methods if we compare with finite difference methods to compute the solutions of equation (1) together with (2) and (3).