Astron. Astrophys. 347, 391-400 (1999)

## 2. Monte-Carlo simulations

### 2.1. Formulation of the SDE's

The usual form of the advection-diffusion equation, describing the transport of cosmic-rays (Skilling 1975) is (in 3D)

where S is a source term and D is a diffusion operator of the form

The diffusion tensor describes the spatial transport of particles. Adding the effects of synchrotron losses, and second-order Fermi acceleration one finds

Here the coefficients and describe the second-order Fermi process and synchrotron losses. Eqs. (1) and (3) give the full advection-diffusion equation of cosmic particles in the diffusion approximation.

The general system of SDEs describing the motion of a point phase space can be written as:

where is a Wiener process: a stochastic diffusive process used to describe Brownian motion, with a conditional probability which follows a Gaussian distribution. For initial conditions given by at , we have at time t:

where means the average value. Itô (1951) has shown that the distribution function describing the stochastic trajectories of the point obeys the Fokker-Planck equation if the coefficients and are identified with the dynamic friction and diffusion coefficients of this equation. In the case of the Fokker-Planck equation (1), together with (2) or (3), the phase space is four-dimensional, , and expressions for the coefficients and are given by KA94. In this paper we shall restrict ourselves to the case of one space dimension, and include only the terms in Eq. (3) describing spatial diffusion and synchrotron losses, i.e., , so that the phase space is two-dimensional: . Further simplifying to the case where the spatial diffusion coefficient is independent of both position and momentum and the loss rate is independent of position, the set of SDE's (4) reduces to

In this system, is a continuous but non-differentiable process, so that, as written, these equations do not exist in a strictly mathematical sense. To overcome this problem Itô (1951) (see also Gardiner 1983) has defined stochastic differential integrals of the form . Approximate solutions of the system of SDE's can be found by discretizing in time:

The term in brackets is the increment of the Wiener process, which is proportional to the square root of :

where is a Gaussian distributed random number with zero mean and unit variance. This is the so-called Cauchy-Euler procedure (Gardiner 1983), as used by KA94. At each time step , the change in x is made up of two parts: an advective (and deterministic) step

and a diffusive (stochastic) step

The approximate solutions converge to the exact solution of the SDE for . However, this scheme has the disadvantage that must be small enough to resolve the spatial structure in . Denoting by the shortest lengthscale associated with , KA94 found for a particular example the requirement

Thus, although the diffusive step can be long compared to , the advective step must resolve it, and the method is not appropriate for flow patterns containing sharp gradients (or discontinuities).

### 2.2. Implicit Euler schemes

Implicit methods, in which the increments are expressed not just in terms of the solution at the start of a time step, but implicitly in terms of the solution at the end of it, are frequently effective in relieving time-step problems, and have been discussed for SDE's by Smith & Gardiner (1989). Their main advantage is that they yield stable algorithms. However, the problem raised by the condition (13) is not one of instability, but accuracy. Furthermore, it would appear that the advective, deterministic term is more sensitive to the problem than is the diffusive term. In view of this, we have chosen to test an algorithm in which, for the advective term, the coefficient is evaluated neither at the initial point of a time step (explicit) nor at the end point (fully implicit) but is integrated exactly over the step, using a linear interpolation of the trajectory. In this way, we may hope to account approximately for changes in the velocity which occur on very small length scales, unresolved by either , or .

Replacing the advective terms in Eqs. (8) and (9) using

we find, neglecting for the moment the synchrotron losses,

which has the character of an implicit scheme, since the right-hand side of Eq. (15) is a function of . This technique has been used in applications of SDE to other fields (see Klöden & Platen 1992), but we are not aware of a detailed discussion of its properties. We show in the following that for the test cases we have examined, the scheme yields accurate results when the condition (13) is replaced by the less restrictive one:

© European Southern Observatory (ESO) 1999

Online publication: June 18, 1999