Application of crank-nicolson method to a random component heat equation
* Author to whom correspondence should be addressed.
Sigma Journal of Engineering and Natural Sciences 2020, Vol. 38, Issue 1, pp. 475-480; doi.org/10.62051/ytu.sigma-journal-of-engineering-and-natural-sciences-application-of-crank-nicolson-method-to-a-random-component-heat-equation
Abstract
Keywords: Random component heat equation; expected value; Crank-Nicolson method; variance.
1. Introduction
The random partial differential equations (RPDEs) are defined as random partial differential equations with random inputs that can be a random variable or a stochastic process. The subject of the random component partial differential equations is one of much current interests due to the great importance of many applications in engineering, mathematics, biology, physics and a lot of applied sciences. In the literature, there are very few studies on random partial differential equations (RPDEs). Babuska et al. proposed and analysed a stochastic collocation method to solve elliptic partial differential equations by random coefficients and forcing terms [2]. Nobile et al. proposed and analysed an anisotropic sparse grid stochastic collocation method for solving partial differential equations with random coefficients and forcing terms [21]. Charrier examined the problem of the numerical solution of an elliptic partial differential equation by random coefficients and homogeneous Dirichlet boundary conditions [3]. Kuo applied quasi-Monte Carlo methods to a class of elliptic partial differential equations by random coefficients which was parametrized by a countably infinite number of terms in a Karhunen–Loeve expansion [17]. Gunzburger used the stochastic finite element methods for solving partial differential equations by random input data [10]. It is generally impossible to solve random nonlinear partial differential equations *
Corresponding Author: e-mail: halilanac0638@gmail.com, tel: (456) 233 10 00 / 1955 475
analytically. Thus, va rious numerical methods and approximation schemes for RPDEs, ordinary differential equations and partial differential equations have been developed. There are a lot of numerical methods and approximation schemes as adomian decomposition method (ADM) [16], homotopy perturbation method [12-14,22,27], collocation method [24,25,28], Galerkin-type method [29], differential transformation method (DTM) [1,15,19,20,26,30], variational iteration method (VIM) [11], finite difference method [7,8,23], Crank-Nicolson method [4,6,18,23], random finite difference scheme [5,8] and many other methods. The main motivation of this paper is to analyze a random component heat equation by the Crank-Nicolson method which is the reliable computational method. This work studies a random component heat equation solve numerically by the CrankNicolson method. Crank and Nicolson established a practical method for numerical evaluation of solutions of partial differential equations of the heat conduction type [4]. The aim of this study is to present the application of Crank-Nicolson method for obtaining the approximate analytical solution of the random component heat equation and for calculating the expected value and variance of this solution. It is observed that the numerical solution obtained by Crank-Nicolson method for this equation is almost similar to exact solution for this equation.
2. Crank-Nicolson Method
In this section, we present Crank-Nicolson method [18]. Consider the one-dimensional heat equation, for 0 ≤ 𝑥 < 𝑎, and 0 < 𝑡 < 𝑏, 𝑢𝑡 (𝑥, 𝑡) = 𝑐 2 𝑢𝑥𝑥 (𝑥, 𝑡)
with the boundary conditions 𝑢(0, 𝑡) = 𝑐1 for 𝑥 = 0 and 0 ≤ 𝑡 ≤ 𝑏, 𝑢(1, 𝑡) = 𝑐2 for 𝑥 = 𝑎 and 0 ≤ 𝑡 ≤ 𝑏. If the Crank- Nicolson discretization is applied to the problem (1) and (2), then it is obtained as [18] 𝑢𝑖,𝑗+1 −𝑢𝑖,𝑗 𝑘
Moreover, 𝑟 = 2 is substituted in Eq. (3). If Eq. (3) is rearranged, then the following ℎ implicit difference formula is obtained. For 𝑖 = 2,3, … , 𝑛 − 1 [18] −𝑟𝑢𝑖−1,𝑗+1 + (2 + 2𝑟)𝑢𝑖,𝑗+1 − 𝑟𝑢𝑖+1,𝑗+1 = (2 − 2𝑟)𝑢𝑖,𝑗 + 𝑟(𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 )
where the terms on the right hand side of this equation are all known. Formula (4) is sometimes implemented by using ratio r=1. In this case, Eq. (4) become [18] −𝑢𝑖−1,𝑗+1 + 4𝑢𝑖,𝑗+1 − 𝑢𝑖+1,𝑗+1 = 𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗
for 𝑖 = 2,3, … , 𝑛 − 1. Also, The boundary conditions gives the first and last equations (i.e. 𝑢1,𝑗 = 𝑢1,𝑗+1 = 𝑐1 and 𝑢𝑛,𝑗 = 𝑢𝑛,𝑗+1 = 𝑐2 , respectively). Equations (5) are usually solved in their tridiagonal matrix form 𝐴𝑥 = 𝐵 [18]
If the Crank-Nicolson m ethod is applied in Matlab software, then this linear system 𝐴𝑥 = 𝐵 is solved by either direct means or by iteration.
3. Normal Distribution
Definition (Normal random variable): If the probability density function of a random variable 𝑋 has the following form, this random variable has the Normal distribution and is called a Normal random variable. 𝑓(𝑥) =
If the random variable 𝑋 gets a normal distribution with parameters 𝜇 and 𝜎 2 , the expected value and variance of the random variable 𝑋 are given as [9] 𝐸(𝑋) = 𝜇, 𝑉𝑎𝑟(𝑋) = 𝜎 2
4. Numerical Experiment
Consider the following random component heat equation. For 0 < 𝑥 < 1 and 0 < 𝑡 < 0.1, 𝑢𝑡 (𝑥, 𝑡) = 𝑢𝑥𝑥 (𝑥, 𝑡)
with the initial condition 𝑢(𝑥, 0) = 𝐴𝑠𝑖𝑛(𝜋𝑥) + 𝐵𝑠𝑖𝑛(3𝜋𝑥) for 𝑡 = 0 and 0 ≤ 𝑥 ≤ 1
with the boundary conditions 𝑢(0, 𝑡) = 0 for 𝑥 = 0 and 0 ≤ 𝑡 ≤ 0.1 𝑢(1, 𝑡) = 0 for 𝑥 = 1 and 0 ≤ 𝑡 ≤ 0.1 where 𝐴 and 𝐵 are normal distributed random variable with parameters μ = 1, 𝜎 = 1, i.e. 𝐴, 𝐵~𝑁(μ = 1, 𝜎 2 = 1). If we use the step sizes ∆𝑥 = ℎ = 0.1 and ∆𝑡 = 𝑘 = 0.01, the ratio 𝑟 = 1. The grid is obtained 𝑛 = 11 columns wide with 𝑚 = 11 rows high. If we apply the algorithm, then it is generated the expected values of the approximate solutions of Eq. (8) for 0 < 𝑥𝑖 < 1 and 0 ≤ 𝑡𝑗 ≤ 0.1. Also, Monte Carlo simulation is performed 1000 times for the expected values of these solutions of the Eq. (8) using the Matlab software. Then the expected values of approximate solutions of Eq. (8) in Table 1 is obtained for 0 < 𝑥𝑖 < 1 and 0 ≤ 𝑡𝑗 ≤ 0.1. If we compare these values obtained from Crank-Nicolson method, it is seen that these are 2 2 almost similar with the analytical solution 𝑢(𝑥, 𝑡) = 𝑠𝑖𝑛(𝜋𝑥)𝑒 −𝜋 𝑡 + 𝑠𝑖𝑛(3𝜋𝑥)𝑒 −9𝜋 𝑡 for 𝐴 = 𝐵 = 1.
Table 1. The expected values of approximate solutions of Eq. (8) 𝑥2 = 0.1 𝑥3 = 0.2 𝑥4 = 0.3 𝑥5 = 0.4 𝑥6 = 0.5 𝑥7 = 0.6 𝑥8 = 0.7 𝑥9 = 0.8 𝑥10 = 0.9 𝑡1 1,14413 𝑡2 0,61866 𝑡3 0,38665 𝑡4 0,27804 𝑡5 0,22190 𝑡6 0,18863 𝑡7 0,16580 𝑡8 0,14815 𝑡9 0,13341 𝑡10 0,12059 𝑡11 0,10918
Also, the graph of the expected values of approximate solutions of the Eq. (8) is given in figure 1.
Moreover, if we apply the algorithm, then it is generated the variances of the approximate solutions of Eq. (8) for 0 < 𝑥𝑖 < 1 and 0 ≤ 𝑡𝑗 ≤ 0.1. Also, Monte Carlo simulation is performed 1000 times for the variances of these solutions of the Eq. (8) using the Matlab software. Then then the variances of approximate solutions of Eq. (8) in Table 2 is obtained for 0 < 𝑥𝑖 < 1 and 0 ≤ 𝑡𝑗 ≤ 0.1. Table 2. The variances of approximate solutions of Eq. (8) 𝑥2 = 0.1 𝑥3 = 0.2 𝑥4 = 0.3 𝑥5 = 0.4 𝑥6 = 0.5 𝑥7 = 0.6 𝑥8 = 0.7 𝑥9 = 0.8 𝑥10 = 0.9 𝑡1 1,60787 𝑡2 1,26553 𝑡3 1,06739 𝑡4 0,93447 𝑡5 0,83340 𝑡6 0,74986 𝑡7 0,67748 𝑡8 0,61326 𝑡9 0,55561 𝑡10 0,50359 𝑡11 0,45652
Also, the graph of the variances of approximate solutions of Eq. (8) is given in figure 2.
5. Conclusion
In this study, we successfully applied Crank-Nicolson method to solve a random component heat equation. Also, the expected value and variance of this solution are obtained. Graphs of the expected value and variance are plotted with MAPLE software. Numerical results show that this method is very effective and practical.
Share and Cite
ANAÇ, H.; MERDAN, M.; KESEMEN, T. Application of crank-nicolson method to a random component heat equation. Sigma Journal of Engineering and Natural Sciences 2020, Vol. 38, pp. 475-480. https://doi.org/10.62051/ytu.sigma-journal-of-engineering-and-natural-sciences-application-of-crank-nicolson-method-to-a-random-component-heat-equation

