0% found this document useful (0 votes)
297 views4 pages

Sadiku

The document discusses extending the Monte Carlo method to solve time-dependent heat problems. It presents the 1D and 2D heat equations and describes using a random walk algorithm and the finite difference method to calculate solutions, comparing results to exact solutions.

Uploaded by

Felipe Lucena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
297 views4 pages

Sadiku

The document discusses extending the Monte Carlo method to solve time-dependent heat problems. It presents the 1D and 2D heat equations and describes using a random walk algorithm and the finite difference method to calculate solutions, comparing results to exact solutions.

Uploaded by

Felipe Lucena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Monte Carlo Analysis of Time-dependent Problems

M. N. O. Sadiku, C. M. Akujuobi, and S.M. Musa


Center of Excellence for Communication Systems Technology Research
College of Engineering
Prairie View A&M University
Prairie View, TX 77446
Email: mnsadiku, cmakujuobi, smmusa @pvamu.edu

respect to t. The problem models temperature


Abstract distribution in a rod or eddy current in a conducting
medium [5]. In order to solve this problem using the
Monte Carlo method, we first need to obtain the finite
Monte Carlo method is well known for solving difference equivalent of the partial differential equation
static problems such as Laplace’s or Poisson’s in eq.(1). Using the central-space and backward-time
equation. In this paper, we extend the scheme, we obtain
applicability of the conventional Monte Carlo
method to solve time-dependent (heat) U(i + 1, n) − 2U(i, n) + U(i − 1, n) U(i, n) − U(i, n − 1)
=
problems. We present results in 1-D and 2-D (∆x)2 ∆t
that agree with the exact solutions. (3)
where x=i∆x and t=n∆t. If we let
1. INTRODUCTION (∆x)2
α= (4)
The Monte Carlo method (MCM) is a nondeterministic ∆t
(probabilistic or stochastic) numerical method for eq.(3) becomes
solving mathematical and physical problems. Monte U(i, n) = px + U(i + 1, n) + px −U(i − 1, n) + pt −U(i, n − 1)
Carlo methods have been applied successfully for (5)
solving differential and integral equations, for finding where
eigenvalues, for inverting matrices, and for evaluating
1 α
multiple integrals. Monte Carlo is often used to solve px + = p x− = , pt − = (6)
Laplace’s and Poisson’s equations [1-4], which are 2+α 2+α
elliptic partial differential equations. They are hardly Notice that px + + px − + pt − = 1. Equation (5) can
applied in solving parabolic and hyperbolic partial
be given a probabilistic interpretation. If a
differential equations. In this paper, we extend the
random-walking particle is instantaneously at the point
applicability of the conventional Monte Carlo method to
solve time-dependent (heat) problems. We consider one- (x,y), it has probabilities p+ , p− , and pt- of
dimensional (1-D) and two-dimensional (2-D) heat moving from (x,t) to (x+∆x,t), (x-∆x,t), and (x, t-∆t )
equations. We compare Monte Carlo solutions with the respectively. The particle can only move toward the
finite difference and exact solutions. past, but never toward the future. A means of
determining which way the particle should move is to
2. ONE-DIMESIONAL HEAT EQUATION generate a random number r, 0 < r < 1 , and instruct the
particle to walk as follows:
To be concrete, consider the one-dimensional heat (x, t) 
→(x + ∆x, t) if (0 < r < 0.25)
equation:
Uxx = Ut , 0 < x < 1, t > 0 (1) (x, t) 
→(x − ∆x, t) if (0.25 < r < 0.5)
Boundary conditions: (x, t) 
→(x, t − ∆t) if (0.5 < r < 1) (7)
U(0,t) = 0 = U(1,t), t>0 (2a) where it is assumed that α = 2 . Most modern software
Initial condition:
such as MATLAB have a random number generator to
U( x ,0) = 100, 0<x<1 (2b)
obtain r.
In (1), Uxx indicates second partial derivative with To calculate U at point (xo,to), we follow the
respect to x, while Ut indicates partial derivative with following random walk algorithm:

0-4244-0169-0/06/$20.00 © 2006 IEEE. 7


1.Begin a random walk at (x,t)= (xo,to). Using the central-space and backward-time scheme, we
2.Generate a random number 0 < r < 1, and move to the obtain the finite difference equivalent as
next point using eq. (7). U(i + 1, j, n) − 2U(i, j, n) + U(i − 1, j, n)
3(a). If the next point is not on the boundary, repeat step
2. (∆x)2
3(b). If the random walk hits the boundary, terminate the U(i, j + 1, n) − 2U(i, j, n) + U(i, j − 1, n)
random walk. Record Ub at the boundary and go to step +
1 and begin another random walk. (∆y)2
4. After N random walks, determine U(i, j, n) − U(i, j, n − 1)
1 N =
U(xo , t o ) = ∑ Ub(k)
N k =1
(8) ∆t
(12)
where N, the number of random walks, is assumed large.
A typical random walk is illustrated in Fig.1. Let ∆x=∆y=∆ and
As a numerical example, consider the solution of the ∆2
problem in eqs. (1) and (2). We select α = 2, ∆x=0.1, α= (13)
∆t
1 1 eq. (12) becomes
so that ∆t=0.005 and px + = p x− = , pt − =
4 2
We calculate U at x = 0.4, t = 0.01, 0.02, 0.03,…. As U(i, j, n) = px+ U(i + 1, j, n) + px −U(i − 1, j, n)
shown in Table 1, we compare the results with the finite
different solution and exact solution [6]: + py + U(i, j + 1, n) + py −U(i, j − 1, n)
400 ∞
1 + pt −U(i, j, n − 1)
U(x, t) =
π
∑ n sin(nπ x)exp(−n π
k =0
2 2
t),
(14)
(9) where
n = 2k + 1 1
px + = px− = py + = py − =
4 +α
Table 1 Comparing Monte Carlo (MCM) solution (15a)
with finite difference (FD) and exact solution (xo=0.4)
α
pt − = (15b)
t Exact MCM FD 4+α
Note that px + + px − + py + + py − + pt − = 1 so that
0.01 99.53 98.44 100
0.02 95.18 93.96 96.87 a probabilistic interpretation can be given to eq.(14). A
0.03 88.32 87.62 89.84 random walking particle at point (x,y,t) moves to
0.04 80.88 81.54 82.03 (x+∆,y,t), (x-∆,y,t), (x,y+∆,t), (x,y-∆,t), (x,y,t-∆t) with
0.10 45.13 46.36 45.18 probabilities px+, px-, py+, py-, and pt- respectively. By
generating a random number 0 < r < 1, we instruct the
particle to move as follows:
3. TWO-DIMESIONAL HEAT EQUATION
(x, y, t) 
→(x + ∆, y, t) if (0 < r < 0.2)
Suppose we are interested in the solution of the two-
dimensional heat equation: (x, y, t) 
→(x − ∆, y, t) if (0.2 < r < 0.4)
Uxx + Uyy = Ut , 0 < x < 1,0 < y < 1, t > 0
(10)
(x, y, t) 
→(x, y + ∆, t) if (0.4 < r < 0.6)
Boundary conditions: (x, y, t) 
→(x, y − ∆, t) if (0.6 < r < 0.8)
U(0,y,t) = 0 = U(1,y,t), 0 < y < 1, t>0
(11a)
U(x,0,t) = 0 = U(x,1,t), 0 < x < 1, t>0 (x, y, t) 
→(x, y, t − ∆t) if (0.8 < r < 1)
(11b) (16)
Initial condition: assuming that α = 1. Therefore, we take the following
U(x,y,0) = 10xy, 0< x < 1, 0 < y < 1 steps to calculate U at point (xo,yo,to):
(11c)
1. Begin a random walk at (x,y,t)= (xo, yo, to).

8
2. Generate a random number 0 < r < 1, and well with the finite difference solution and the exact
move the next point according to eq. (16). analytical solutions and it is easier to understand and
3(a) If the next point is not on the boundary, repeat program than the finite difference method. The method
step 2. can be extended to axial symmetric heat equation.
3(b) If the random walk hits the boundary,
terminate the random walk. Record Ub at the REFERENCES
boundary and go to step 1 and begin another
random walk. [1] G. M. Royer, "A Monte Carlo Procedure for
4. After N random walks, determine Potential theory of problems," IEEE Trans. Micro.
1 N Theo. & Tech.,vol. MTT-19, no. 10, Oct. 1971, pp. 813-
U(xo , yo , t o ) = ∑ Ub(k) (17)
N k =1
818.
[2] R. M. Bevensee, "Probabilistic potential theory
The only difference between 1-D and 2-D is that there applied to electrical engineering problems," Proc. IEEE,
are three kinds of displacement in 1-D while there are vol. 61, no. 4, April 1973, pp. 423 - 437.
five displacements (four spatial ones and one temporal [3] T. E. Booth, “Exact Monte Carlo solution of elliptic
one) in 2-D. partial differential equation,” J. Comp. Phys., vol. 39,
As a numerical example, consider the solution 1981, pp. 396-404
of the problem in eqs. (10) and (11). We select [4] R. Schlott, “A Monte Carlo method for the Dirichlet
α = 1, ∆=0.1, so that ∆t=0.01 and we calculate U at x = problem of dielectric wedges,” IEEE Trans. Micro. Theo.
0.5, y=0.5, t = 0.05, 0.1, 0.15, 0.2, 0.25, 0.3. As shown Tech., vol. 36, no. 4, April 1988, pp. 724-730.
in Table 2, we compare the results from the Monte Carlo [5] D. Netter, J. Levenque, P. Masson and A. Rezzoug,
method (MCM) with the finite difference (FD) solution “Monte Carlo method for transient eddy-current
and exact solution [7]: calculations,” IEEE Trans. Magnetics, vol.40, no.5,
Sept. 2004, pp.3450-3456.
40 ∞
cos(mπ )cos(nπ )

U(x, y , t) = 2 ∑∑
π m=1 n=1 mn
sin(mπ x) [6] M. N. O. Sadiku, Numerical Techniques in
Electromagnetics. Boca Raton, FL: CRC Press, 2nd
2 edition, 2001, pp. 125-130.
× sin(nπ y)exp(−λmnt), [7] D. L. Powers, Boundary Value Problems. New York:
(18) Academic Press, 1972, pp. 135-139.

2 2 2
where λmn = (mπ ) + (nπ ) .
Due to the randomness of the Monte Carlo solution, each
MCM result in Tables 1 and 2 was obtained by running
the simulation five times and taking the average.

Table 2 Comparing Monte Carlo solution with finite


difference and exact solution.

t Exact MCM FD

0.05 1.491 1.534 1.518


0.10 0.563 0.6627 0.5627
0.15 0.216 0.267 0.2063
0.20 0.078 0.106 0.0756
0.25 0.029 0.0419 0.0277
0.30 0.0015 0.019 0.0102

4. CONCLUSION

In this paper, we demonstrate how the conventional


Monte Carlo method can be applied to time-dependent
problems such as the heat equation. For 1-D and 2-D
cases, we notice that the Monte Carlo solutions agree

9
U(0,t)=0
U(1,t)=0

x=0 U(x,0)=100 x=1

Fig. 1 A typical random walk.

10

You might also like