Global Random Walk Simulations of Diffusion

12
GLOBAL RANDOM WALK SIMULATIONS OF DIFFUSION C˘ alin Vamo¸ s and Nicolae Suciu ”Tiberiu Popoviciu” Institute of Numaerical Analysis, Cluj Napoca Branch of Romanian Academy, [email protected], nsuciu@@ictp-acad.math.ubbcluj.ro Harry Vereecken, Olaf Nitzsche and Horst Hardelauf Institut f¨ ur Agrosph¨are (ICG-IV), Forschungszentrum J¨ ulich GmbH, [email protected], [email protected], [email protected] Abstract Random walk methods are suitable to build up convergent solutions for reaction-diusion problems and were successfully applied to simulations of transport processes in a random environment. The disadvantage is that, for realistic cases, these methods become time and memory ex- pensive. To increase the computation speed and to reduce the required memory, we derived a “global random walk” method in which the parti- cles at a given site of the grid are simultaneously scattered following the binomial Bernoulli repartition. It was found that the computation time is reduced three orders of magnitude with respect to individual random walk methods. Moreover, by suitable “microscopic balance” boundary conditions, we obtained good simulations of transport in unbounded domains, using normal size grids. The global random walk improves the statistical quality of simulations for diusion processes in random elds. The method was tested by comparisons with analytical and nite dierence solutions as well as with concentrations measured in “column experiments”, used in laboratory study of soils’ hydrogeological and chemical properties. Keywords: diusion, unbounded domains, random elds 1. INTRODUCTION In this article we present a new numerical method capable of per- forming simulations for complex transport processes, faster than other similar approaches, and using realistic initial and boundary conditions. 1

Transcript of Global Random Walk Simulations of Diffusion

GLOBAL RANDOMWALK SIMULATIONSOF DIFFUSION

Calin Vamos and Nicolae Suciu”Tiberiu Popoviciu” Institute of Numaerical Analysis,

Cluj Napoca Branch of Romanian Academy,

[email protected], nsuciu@@ictp-acad.math.ubbcluj.ro

Harry Vereecken, Olaf Nitzsche and Horst HardelaufInstitut fur Agrosphare (ICG-IV), Forschungszentrum Julich GmbH,

[email protected], [email protected], [email protected]

Abstract Random walk methods are suitable to build up convergent solutions forreaction-diffusion problems and were successfully applied to simulationsof transport processes in a random environment. The disadvantage isthat, for realistic cases, these methods become time and memory ex-pensive. To increase the computation speed and to reduce the requiredmemory, we derived a “global random walk” method in which the parti-cles at a given site of the grid are simultaneously scattered following thebinomial Bernoulli repartition. It was found that the computation timeis reduced three orders of magnitude with respect to individual randomwalk methods. Moreover, by suitable “microscopic balance” boundaryconditions, we obtained good simulations of transport in unboundeddomains, using normal size grids. The global random walk improvesthe statistical quality of simulations for diffusion processes in randomfields. The method was tested by comparisons with analytical and finitedifference solutions as well as with concentrations measured in “columnexperiments”, used in laboratory study of soils’ hydrogeological andchemical properties.

Keywords: diffusion, unbounded domains, random fields

1. INTRODUCTION

In this article we present a new numerical method capable of per-forming simulations for complex transport processes, faster than othersimilar approaches, and using realistic initial and boundary conditions.

1

2

Numerical simulations for diffusion can be obtained by both discretesolutions of diffusion equations and by random walk methods. In the firstclass enter the well known finite difference and finite element/volumemethods. In the second, we quote “fractional random walk method”used by Chorin [1] to solve the viscous terms in Navier-Stokes equations,“particle tracking” methods, as that used by Tompson and Gelhar [10]as model of solute transport in porous media, as well as the more recent“cellular automata” [5] and “lattice gas models” [12]. The common de-nominator of random walk methods is the use of statistical ensembles ofdistinct random walkers trajectories to compute the concentration fieldas average number of particles in a reference volume. For more detailsand reviews on these methods we refer to [10, 11] and to the handbook instochastic methods of Gardiner [3]. Besides the simplicity of their algo-rithms, random walk methods are not affected by numerical oscillationsat large Peclet numbers (Pe), as it is the case for finite differences [11],and many diffusion problems benefit from strong proofs of convergence[3, 13].Related to these methods, we remark: 1) the computation of concen-

trations requires only statistical ensembles of positions, at given time,for systems of fictitious particles, and 2) the states of this ensemble areinvariant under the particles’ permutation. Thus, the knowledge of theindividual trajectories is not necessary to compute concentrations. Thisenables us to use a global random walk law: all the particles from agiven site are simultaneously scattered following the binomial Bernoullirepartition (the sum of individual random walk probabilities). We pro-pose for this approach the name of “global random walk”, hereinafterreferred to as GRW.As a mathematical object, GRW is similar to a “lattice gas model”,

where “the state of the system is described by specifying the numberof particles present at the site x, n(x)”, the states space is the spaceof configurations Ω = ω = n(·), and the dynamics is a stochasticprocess in Ω [12]. “Lattice gas” deals with Markov processes in Ω. It isthe same for diffusion processes modeled with GRW, with the differencethat the simpler rules (random walk or, more generally, random biasedjumps between the grid points) allow the use of Bernoulli repartition toachieve global change of state.The advantages of the new method are: the computing time is reduced

by several orders of magnitude, microscopic processes (reactions, decay,retention) and variable diffusion coefficients can be easily implemented,it describes the diffusion fronts, it allows the simulation of transport inunbounded domains using normal size grids, and it is numerically stableand not sensitive to great Pe numbers.

Global Random Walk Simulations of Diffusion 3

2. THE ALGORITHM

For sake of simplicity we present the GRW algorithm in the 1-dimensionalcase, for unbiased random walk, in the conservative case. We considerthat there are no “staying states” for individual particles: the new po-sition of a particle at the site i is either i − 1 or i + 1. The space andtime steps are, respectively, δx and δt. The states of the grid sites aredefined by n(i, t), the number of particles, 0 6 n(i, t) 6 n0, where n0 isthe total number of particles initially released in the grid. If nrgt andnlft denote, respectively, the number of particles undergoing jumps tothe right and to the left, the states of first neighbor sites are related bythe balance equation

n(i, t+ δt) = nrgt(i− 1, t) + nlft(i+ 1, t).Because each particle has only two transition events, the number ofparticles is conserved at each site, nrgt(i, t) + nlft(i, t) = n(i, t). If theexperiment is repeated N times, then

limN−→∞

1

N (PN

γ=1nγrgt(i, t)/n(i, t)) = lim

N−→∞1

N (PN

γ=1nγlft(i, t)/n(i, t)) = 1/2.

The spreading of the n random walkers jumping from the site i can bedescribed as “an experiment consisting of obtaining nrgt heads in tossingan unbiased coin n times”, i.e. by a Bernoulli process [3]. The event“maximum nrgt jumps to the right” occurs with the probability givenby the binary repartition

Rn(nrgt) =Xnrgt

j=0

1

2nCjn, with the normalization condition Rn(n) = 1.

The use of a Bernoulli repartition Rn achieves a global scattering for then particles lying at a grid site. To do that, Bernoulli repartitions with2k degrees of freedom, 0 6 k 6 20, were computed and stored.The global scattering algorithm consists of the following steps:If the number n(i, t) 6 220 then it is decomposed in a binaryexpansion,

n =Plk=0 a(k)2

k, where a(k) is either 0 or 1.For 0 6 k 6 l, one generates random numbers,

randk, uniformly distributed in [0, 1];For 0 6 j 6 2k,If (R2k(j) 6 randk 6 R2k(j + 1)) Then nk = j.

Finally, nrgt(i, t) =Plk=0 nk and nlft(i, t) = n(i, t)−nrgt(i, t).

If n(i, t) is greater than 220, then it is divided into groupsof 220 or less and scattered with the same procedure. ¤

4

The concentration field is estimated by c(i, t) = n(i, t)/δx. Its smooth-ness can be considerably improved by averaging over an ensemble con-sisting of N GRW numerical experiments.If the von Neumann condition is fulfilled, Dδt/δx2 6 1/2, then the

centered finite-difference form of the diffusion equation ∂tc = D∂2xc,written for particles number n = cδx, gives the “stable explicit finite-difference formula” [2],

n(i, t+ δt)− n(i, t)δt

= Dn(i+ 1, t)− 2n(i, t) + n(i− 1, t)

δx2.

The maximum value of the stability criterion defines the diffusion coef-ficient as D = δx2/2δt. The corresponding explicit formula n(i, t+ δt) =12n(i− 1, t) + 1

2n(i+ 1, t) is just the average of the change of states ruleused in the GRW algorithm and proves that averages over N runs givestable numerical solutions for the diffusion equation with appropiate ini-tial and boundary conditions.Using some results from [3] it is easy to check that, for Dirac initial

condition and infinite domain, the GRW solution c = n/δx approachesthe Gaussian as δx → 0. For convergence proofs in reaction-diffusionproblems we refer to [13].Variable diffusion coefficients, for given δx and δt, can be defined by

replacing the amplitude δx of diffusion jumps with irwδx. Generally,when the jumps’ amplitude is a space-time function irw = irw(x, t),x = iδx, the maximum value of the von Neumann criterion gives thevariable diffusion coefficient

D(x, t) =[irw(x, t)δx]

2

2δt. (1)

Correspondingly, the GRW rule becomes

n(i, t+ δt) = nrgt(i− irw, t) + nlft(i+ irw, t).

The GRW algorithms in 2 and 3-dimensional cases were implementedby performing the previously described global scattering on x, y, and zdirections, in this order.Using the GRW, the computation time can be reduced by several

orders of magnitude with respect to the individual random walk. Toshow that, we simulated the random walk of n0 particles injected att = 0 into the origin of a 3-dimensional grid, (21 × 21 × 21), over 10time steps. The computation times, on a “Cray T3E” parallel machine,corresponding to GRW are compared in fig. 1 with those correspondingto a continuous-space “particle tracking” code [6].

Global Random Walk Simulations of Diffusion 5

Fig. 1

One can see, for instance, that the time to perform the diffusion fora billion of particles was thousand times larger for “particle tracking”and 256 “Cray nodes” were necessary, while all the computations withGRW used a single node.

3. APPLICATIONS

3.1. DIFFUSION IN UNBOUNDEDDOMAINS

The GRW algorithm is able to model diffusion in unbounded domainsusing finite size grids. For instance, the state of the grid i| −N 6i 6 N is initialized by the analytical values of the Gaussian at t >0. The particle balance inside a volume VN−1,L = j | N − 1 − L 6j 6 N − 1 is described by the equation ∆Tn =n+ + n−, where n+ isthe number of particles entering into, n− those of particles leaving thevolume VN−1,L, during a time interval T , and ∆Tn is the time variationof number of particles from the volume, in the same time interval T .This balance equation allows the computation of the number of fictitiousparticles outside the border, n cor(t) = n(N + 1, t), which, by left-jumps, compensate for the decrease of concentration due to the particlesjumping outside the grid (fig. 2). In this way, one expects that randomwalk does not destroy the form of the Gaussian concentration in infinitedomains.

6

Fig. 2

For L = 1, and T = 2δt, ∆Tn(N − 1, t) is estimated from the hypoth-esis

∆Tn

n(N − 1, t)− ∆Tn

n(N − 3, t) ' ∆Tn

n(N − 3, t)− ∆Tn

n(N − 5, t),

using the values of∆Tn in (N−1) and (N−3) resulting from the particlebalance in VN−3,L and VN−5,L. From the particle balance in VN−1,L, oneobtaines the “correction number” of particles

n cor(t) = 2n(N − 1, t)− n(N − 3, t) + 4∆Tn(N − 1, t).The simulations were performed on the 1-dimensional grid x ∈ [−20; 20],

for 400 time steps, with the initial condition given by the Gaussian so-

Global Random Walk Simulations of Diffusion 7

lution at t = 30δt multiplied by n0 = 107. The diffusion coefficient was

D = 0.5 and the number of numerical experimentsN = 10. Comparisonsfrom fig. 3 show that the numerical solution is a good approximation ofthe Gaussian solution, in the limits of the standard deviations.

Fig. 3

3.2. ADVECTION-DIFFUSION INUNBOUNDED DOMAINS

The conditions from Section 3.1 can also be used to simulate thesolutions of the advection-diffusion equation, ∂tc + U∂xc. = D∂2xc, inunbounded domains. The good property of GRW is that large Pe num-bers do not affect the quality of simulation. Moreover, at large Pe, forconstant coefficients, there are situations when no boundary conditionsare necessary. To adjust the computation steps, δx, δt, besides the rela-tion with the diffusion coefficient D, expressed by (1), there also shouldbe fulfilled a condition which gives the correct discretization for the ad-vection velocity

iadvδx = Uδt, (2)

where iadv is the advective displacement in a time step, expressed inspace steps. The equations (1) and (2) relate the set of computation

8

parameters δx, δt, irw, iadv to the transport problem parameters Dand U . When the advection amplitude iadv is greater than or equal tothat of the random walk, irw, then the particles lying on the outflowborder no longer return into the computation domain. The conditioniadv > irw and eqs. (1-2) give

Pe grid =U2δt

D> 2, (3)

where the grid Peclet number [11] is defined as Pe grid = U∆xadv/D and∆xadv = iadvδx. For Pe grid > 2 no boundary conditions are necessaryto simulate diffusion in unbounded domains.The new algorithm can be used to model the fate of solutes in soil-

column experiments. In such experiments, the solution passes througha cylinder filled with sand, which was previously wetted. A stationarystate is maintained so that the advection velocity is constant along theaxis of the cylinder and oriented from bottom to top. The recording ofthe solute concentration in the outflow gives the so called “breakthroughcurve”. The “Plexk1-10 Bromid“ experiment, used to verify the numer-ical model, consisted of transport of 17.7 mg LiBr in a column of 30cm lenght, 2.5 cm diameter and soil porosity of 0.32 [7]. In fig. 4, themeasured values for a given experiment are compared with the Gaus-sian theoretical solution, numerical simulation by finite-differences andGRW, with N = 1, for two different Pe grid numbers.

Fig. 4. GRW, experiment, theoretical and finite differencesolutions

As expected, the solution for smaller Pe grid number (correspondingto a more refined space grid) gives a better fitting of reference curves.

Global Random Walk Simulations of Diffusion 9

3.3. DIFFUSION IN RANDOM FIELDS

The diffusion in random velocity fields, frequently used as model ofsolute transport in groundwater, consists of a mixture between genuineBrownian motion and a superimposed random advection. For instance,in the 1-dimensional case, the motion of a “tracer” particle is describedby the Ito stochastic differential equation [3]

dx(t) = u(x(t), t)dt+√2Ddw(t). (4)

The constant diffusion coefficient D and the Wiener process w describethe transport at the local scale (given by the “representative elementaryvolume” of continuous modeling in porous media) and u is a functiondescribing the large scale heterogeneous advective transport. Usually,such “stochastic theories” of transport in porous media consider onlyspace dependences u(x) given as realizations of a random field. Due tothe dependence of x on w(t) and u, and to the implicit dependence ofu = u(x(t)), both position x and the velocity u become random func-tions defined on the product probability space Ω, i.e. the ensemble ofrealizations u(x) multiplied by the ensemble of the Brownian motion’srealizations [9]. No solution was yet found for the general problem thatconsists of associating to the stochastic equation (4) a diffusion (Fokker-Planck) equation [3]. Nevertheless, using some idealizations of the ran-dom field u, the question can be addressed if the random function xbehaves asymptotically diffusively, i.e. if there exists a large time limitfor the time derivative of the variance σ2(t) = MΩ[(x(t) −MΩ[x(t)])

2],where MΩ denotes the ensemble average, defining the effective diffusioncoefficient Deff ,

Deff = limt→∞

1

2

d

dt(σ2(t)). (5)

Sometimes the effective coefficient is approximated by Deff ' limσ2/2tfor t→∞. For different assumptions on u statistics, approximations [8]or even exact analytical values [4] of Deff can be obtained.A complementary approach is the numerical modeling of the prob-

lem, which allows the simulation of more realistic ensembles Ω. Herethe advantage of the GRW method with respect to individual randomwalk is obvious, because it deals with large numbers of particles. But,the existence and value of the effective diffusion coefficient is still a con-troversial matter. For instance, improper use of definition (5) causesartificial numerical oscillations at the beginning of computation, whichcould hide the real time behavior of the process and increase the timeneeded to reach the asymptotic value of the effective diffusion coefficient.

10

For example, if n particles start from the origin, after the first jump ofan unbiased random walk σ2(t) = (nrgtδx

2 + nlftδx2)/n = δx2, in any

realization. When the definition σ2(t) =MΩ[(x(t)−MΩ[x(t)])2] is used,

for a single realization one obtains σ2(t) = 4nrgtnlftδx2/n2. This gives

the same result as the first definition only as average over the ensem-ble of realizations (becauseMΩ[nrgt] =MΩ[nlft] = n/2). To prevent thepropagation of an initial perturbation during the computation, when themean velocity has a known value (for instance, by the procedure whichgenerates the random field), U = MΩ[u], the mean position to be usedin the computation of variances should be MΩ[x] = Ut. The differencescan be important in 2 or 3-dimension simulations. In figs. 5 and 6the two definitions are compared for the effective diffusion coefficientsDx and Dy of a 2-dimensional diffusion in a random field u(x, y), withexponential decreasing correlation.

Fig. 5 Fig. 6

There are notable differences in behavior of both Dx and Dy (fig.5). The local maximum at small times, due to the cross correlations,is completely hidden by the noise induced when stochastic averages hxiand hyi are used instead of exact values of the mean displacements, Utand 0, and the asymptotic behavior will be reached more slowly (fig. 6).To avoid difficulties related to the computation of long time behavior

of effective diffusion coefficient as Deff ∼ σ2/2t, we recall the Kol-mogorov definition of local diffusion coefficients [3],

D(x, t) =1

2

d

ds(σ2(t+ s;x, t)) |s=0,

where (σ2(t+s;x, t)) is the variance computed at t+s, over the trajecto-ries of a process starting from (x, t) (conditional averages). The numeri-cal computation of local variance is possible when there are enough parti-cles at each point (x, t). This is just the case when GRW is used instead

Global Random Walk Simulations of Diffusion 11

of individual random walk. Then, illustrating with the 1-dimensionalcase,

σ2(t+ δt;x, t) = nrgt((iadv + irw)dx)2 + nlft((iadv − irw)dx)2.

This enables us to introduce a new definition for the effective diffusioncoefficient as a bulk quantity defined by

DGRWeff =1

2MΩ×X [

σ2(t+ δt;x, t)

δt], (6)

where MΩ×X denotes the average over the realizations of the statisticalensemble and over the grid points. If the coefficients defined by (6) areconstant as time functions, then a diffusion process can be used to de-scribe the concentration of particles transported according to (4). As anillustration, in figs. 7 and 8 the center of mass, variances and effectivediffusion coefficients computed by (5) and (6) are compared. The simu-lated process is a 2-dimensional random walk in a uncorrelated randomfield, both with the same values of irw, corresponding to a diffusion co-efficient of 0.5. Obvious, the resulting diffusion coefficient must be 1.0.After 20 time steps the particles crossing the boundaries are removedfrom the computation, so that at t = 100 only about n0/2 remain insidethe grid. One can see that the variance curves become flat and, corre-spondingly, Dx and Dy defined by (5) gives erroneous values (smaller)while Dx loc and Dy loc, which were computed by (6) using the localvariances, are not affected.

Fig. 7 Fig. 8

The approach based on (6) will be used in a following work, intendedto test numerically various estimations of asymptotic diffusion coeffi-cients as given by stochastic theories.

12

References

[1] Chorin, A. J. Vortex Sheet Approximation of Boundary Layers. J.Comput. Phys. 27, 4 423-442, 1978.

[2] Crank, J. The Mathematics of Diffusion. Oxford Univ. Press, 1975.

[3] Gardiner, C. W. Handbook of Stochastic Methods. Springer NewYork, 1983.

[4] Matheron,G., and G. de Marsily. Is Transport in Porous Media Al-ways Diffusive?. Water Resour. Res., 16, 901-917, 1980.

[5] Nishidate, K. M. Baba and R. J. Gaylord, Cellular Automaton Modelfor Random Walkers. Phys. Rev. Lett., 77, 9, 1675-1679, 1996.

[6] Neuendorf, O. Numerische 3D-Simulation des Stofftransport in einemheterogenen Aquifer. Ph.D. thesis, Jul-3421, ForschungszentrumJulich, 1997.

[7] Nitzsche, O., H. Vereecken and O. Esser. Reactive Modeling ofLithium at Laboratory and Field Scale. In Proc. Inter. Workshopon Modeling of Transport Processes in Soils at Various Scales inTime and Space, Leuven, November 1999.

[8] Schwarze, H., U. Jaekel and H. Vereecken. Estimation of Macrodis-persivity by Different Approximation Methods. in press at Transportin Porous media, Kluwer, 2000.

[9] Suciu, N., Mathematical Background for Diffusion Processes in natu-ral porous media. Forschungszentrum Julich/ICG-4 Internal ReportNo. 501800, 2000.

[10] Tompson, A. F. B. and L. W. Gelhar. Numerical Simulation ofSolute Transport in Three-Dimensional, Randomly HeterogeneousPorous Media. Water Resour. Res., 26, 10, 2541-2562, 1990.

[11] Tompson, A. F. B., E. G. Vomvoris and L. W. Gelhar. NumericalSimulation of Solute Transport in Randomly Heterogeneous PorousMedia: Motivation, Model Development, and Application. InternalReport UCID- 31381, Lawrence Livermore National Laboratory, Liv-ermore, 1987.

[12] Varadhan, S. R. S. Infinite Particle Systems and Their Scaling Lim-its. in Mathematical Physics 2000, Eds. A. Fokass, A. Grigorian, T.Kibble and B. Zegarlinski, pp. 306-315, Imperial College Press, 2000.

[13] Weidoung, L., Convergence of a RandomWalk Method for a PartialDifferential Equation. Math. of Comp., 67, 593, 1998.