Transcript
Page 1: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

1

Direct Simulation Monte Carlo (DSMC) of gas flows

• Monte Carlo method: Definitions• Basic concepts of kinetic theory of gases• Applications of DSMC • Generic algorithm of the DSMC method• Summary

• Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas flows. Clarendon Press, 1994

Page 2: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

2

Direct Simulation Monte Carlo of gas flows: Definit ions

• Monte Carlo method is a generic numerical method for a variety of mathematical problems based on computer generation of random numbers.

• Direct simulation Monte Carlo (DSMC) method is the Monte Carlo method for simulation of dilute gas flows on molecular level, i.e. on the level of individual molecules. To date DSMC is the basic numerical method in the kinetic theory of gases and rarefied gasdynamics.

• Kinetic theory of gases is a part of statistical physics where the flow of gases are considered on a molecular level and described in terms of changes of probabilities of various states of gas molecules in space and in time.

Page 3: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

3

Dilute gas• DSMC is applied for simulations of flows of a dilute gas• Dilute gas is a gas where the density parameter ε (volume fraction) is small

ε = n d3 << 1n is the numerical concentration of gas moleculed is the diameter of gas molecules

• In Earth atmosphere, air can be considered as a dilute gas at any altitude, e.g. on the Earth surface n = 2.7 x 1025 m-3, d = 3.7 x 10-10 m, and ε = 1.4 x 10-3

• For a dilute gas– Collision length scale d is much smaller then the average distance between

molecules l = 1 / n1/3 = d / ε1/3, d << l =>• most of time every molecule moves without interactions with other

ones, hence, an interaction between molecules can be considered as an instant change of their velocities, i.e. as a collision between ‘billiard-ball’-like particles.

• Real process of molecular motion can be divided into two stages:(I) collisionless (free) motion of molecules and (II) instant collisions between them

– If PN is the probability of simultaneous interaction between N gas molecules, then PN+1/PN ∝ ε =>

• only binary collisions between gas molecules are important

Page 4: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

4

Flow regimes of a dilute gas• Collision frequency ν of a molecule with diameter d is the averaged number of collisions

of this molecule per unit time

• Mean free path of a molecule λ = g · (1 / ν ) = 1 / ( n σ )

• Knudsen number Kn = λ / L = 1 / ( n σ L ), L is the flow length scaleKnudsen number is a measure of importance of collisions in a gas flow

Kn << 1 (Kn < 0.01) Kn ~ 1 Kn >> 1 (Kn > 10)

Continuum flow Transitional flow Free molecular (collisionless) flow

2d

Collision cross-section σ = π d2

g · ∆t

g

Relative velocity of molecules, g = |v1-v2|

gnt

tgn σ=∆

∆σ=ν

L

Local equilibrium Non-equilibrium flows

Page 5: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

5

Applications of DSMC simulations (I)

• Aerospace applications: Flows in upper atmosphere and in vacuum

• Planetary science and

Satellites and spacecrafts on LEO and in deep space

Re-entry vehicles inupper atmosphere

Nozzles and jetsin space environment

Dynamics of upper planetary atmospheres

Atmospheres of smallbodies (comets, etc) astrophysics

Global atmospheric evolution (Io, Enceladus, etc)

Page 6: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

6

Applications of DSMC simulations (II)

• Fast, non-equilibrium gas flows (laser ablation, evaporation, deposition)

• Flows on microscale, microfluidics

Flows in microchannesFlows in electronic devices and MEMS

Flow over microparticlesand clusters

Soot clustersSi waferHD

Page 7: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

7

Basic approach of the DSMC method• Gas is represented by a set of N simulated molecules (similar to MD)

X(t)=(r1(t),V1(t),…,rN(t),VN(t))

• Velocities Vi (and coordinates r i) of gas molecules are random variables. Thus, DSMC is a probabilistic approach in contrast to MD which is a deterministic one.

• Gas flow is simulated as a change of X(t) in time due to– Free motion of molecules or motion under the effect of external (e.g. gravity) forces– Pair interactions (collisions) between gas molecules– Interaction of molecules with surfaces of streamlined bodies, obstacles, channel

walls, etc.

Computational domain

ri vi

Rebound of a molecule from the wall

External force field fe

fei

Pair collision

In typical DSMC simulations (e.g. flow over a vehicle in Earth atmosphere) the computational domain is a part of a larger flow. Hence, some boundaries of a domain are ‘transparent’ for molecules and number of simulated molecules, N, is varied in time.

Page 8: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

8

Statistical weight of simulated molecules in DSMC • Number of collisions between molecules is defined by the collision frequency ν = n σ g.• For the same velocities of gas molecules, the number of collisions depends on n and σ.

• Consider two flows

• Thus, in DSMC simulations the number of simulated molecules can not be equal to the number of molecules in real flow. This differs DSMC from MD, where every simulated particle represents one molecule of the real system.

• Every simulated molecule in DSMC represents W molecules of real gas, where W = n / nsim is the statistical weight of a simulated molecule. In order to make flow of simulated molecules the same as compared to the flow of real gas, the cross-section of simulated molecules is calculated as follows

Wn

n

simsim σ=σ=σ

If n1 σ1 = n2 σ2 ,then the collision frequencies are the same in both flows.

If other conditions in both flows are the same, then two flows are equivalent to each other.

n1, σ1 n2, σ2

Page 9: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

9

DSMC algorithm (after G.A. Bird)

• Any process (evolving in time or steady-state) is divided into short time intervals – time steps ∆t

X(t)=(r1(t),V1(t),…,rN(t),VN(t))

Xn = X(tn), state of simulated molecules at time tn

Xn+1 = X(tn+1), state of simulated molecules at time tn+1 = tn + ∆t

• At every time step, the change of Xn into Xn+1 (Xn → Xn+1) is splitted into a sequence of three basic stages– Stage I. Collisionless motion of molecules (solution of the motion

equations)Xn → X*

– Stage II. Collision sampling (pair collisions between molecules) X* → X**

– Stage III. Implementations of boundary conditions (interactions of molecules with surfaces, free inflow/outflow of molecules through boundaries, etc)

X** → Xn+1

Thus, in contrast with MD, where interaction between particles are described by forces in equations of motion, in DSMC, interactions between particles is described by means of a special random algorithm (collision sampling) which is a core of any DSMC computer code.

Page 10: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

10

DSMC vs. Molecular Dynamics (MD) simulations

MD simulations: Direct solution of the motion equations at a time step

eij

iji

i dt

dm ff

v +=∑2

2

eii

i dt

dm f

v =2

2

Ni ,...,1=

∑=j

iji

i dt

dm f

v2

2

Interaction force between molecules i and j External force

� Both MD and DSMC are particle-based methods

DSMC simulations:

� Splitting at a time step

(*)

� Special probabalistic approach for sampling of binary collisions instead of direct solution of Eq. (*)

� Use of statistical weights NNi sim <<= ,...,1

Page 11: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

11

DSMC vs. MD and CFD in simulations of gas flowsThree alternative computational methodology for simulations of gas flows

• MD, Molecular dynamic simulations

• DSMC, Direct simulation Monte Carlo• CFD, Computational fluid dynamics

LowModerateHighRelative computational cost

No limitations, usually, λ / L < 0.1

No limitations, usually, λ / L > 0.01

Less then 1 micrometer

Typical flow length scale L

Continuum near-equilibrium flows

Transitional and free molecular non-equilibrium flows

Dense gas flows, phase changes, complex molecules

Where applied

Dilute gasDilute gasDilute gas, dense gas, clusters, etc.

Gas state

Navier-Stokes equations

Boltzmann kinetic equation

Classical equations of motion for particles

Theoretical model

CFDDSMCMD

L

Page 12: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

12

Stage I. Collisionless motionXn = (r1

n,V1n,…,rN

n,VNn)

Xn → X*

• For every molecule, its equations of motion are solved for a time stepdri/dt = Vi, mi dVi/dt = fei, i = 1, …, Nri(tn)=ri

n, Vi(tn)=Vin,

mi is the real mass of a gas molecule

• In case of free motion (fei = 0)X*=(r1

*,V1n,…,rN

*,VNn)

ri* = rin + ∆t Vi

n

• If external force field is present, the equations of motion are solved numerically, e.g. by the Runge-Kutta method of the second order

X*=(r1*,V1

*,…,rN*,VN

*)ri = ri

n + (∆t/2) Vin, Vi = Vi

n + (∆t/2) fei(rin)

ri* = ri

n + ∆t Vi, Vi

* = Vin + ∆t fei(ri)

Page 13: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

13

Stage II. Collision sampling (after G.A. Bird)X* = (r1

*,V1*,…,rN

*,VN*)

X* → X**

• Computational domain is divided into a mesh of cells.

• For every molecule, the index of cell to which the molecule belongs is calculated (indexing of molecules).

• At a time step, only collisions between molecules belonging to the same cell are taken into account

• Every collision is considered as a random event occurring with some probability of collision

• In every cell, pairs of colliding molecules are randomly sampled (collision sampling in a cell). For every pair of colliding molecules, pre-collisional velocities are replaced by their post-collisional values.

Cell

Page 14: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

14

Collision sampling in a cell : Calculation of the collision probability during time step

)(simijσ

|| ijijg g=

cell

ijsimijij V

tgP

∆σ= )(

ijij vvg −=

ijg

tgij∆

Relative velocity of molecules i and j

Probability of a random collision between molecules i and j during time step

Cell of volume Vcell containing Ncell

molecules

j

i

Molecules are assumed to be distributed homogeneously within the cell

Page 15: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

15

Collision sampling in a cell : Calculation of parti cle velocities after a binary collision of hard sphere

Velocitiesbeforecollision

Velocitiesaftercollision

Conservation laws of momentum,energy, and angular momentum

Equations for moleculevelocities after collision

For hard sphere (HS) molecules unity vector n is an isotropic random vector:

θ−=θα−=θ

παθ=παθ=θ=2

1

22

cos1sin ,21cos

),2sin(sin ),2cos(sin ,cos zyx nnn

αi is a random number distributed with equal probability from 0 to 1.In a computer code, it can be generated with the help of library functions,which are called ‘random number generators’.

Page 16: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

16

Collision sampling in a cell: The ‘primitive’ schem e

i = 1

j = i + 1

Pij = ∆tσij(sim)gij / Vcell

α < Pij

)2sin(sin

)2cos(sin

cos

cos1sin

21cos

2

2

2

1

παθ=

παθ=θ=

θ−=θ

α−=θ

z

y

x

n

n

n

j = j + 1

i = i + 1

j < Ncell

Does collision between moleculesi and j occur?

no yes

yes

yes

no

noGo to the next cell

Calculation of the collision probability

Calculation ofvelocities aftercollision

Are there otherpairs of moleculesin the cell?

Disadvantage of the primitive scheme:

Number of operation ~ Ncell

2

In real DSMCsimulations, moreefficient schemesfor collisionsampling are used,e.g. the NTC schemeby Bird

i < Ncell - 1

P(α < Pij) = Pij

Page 17: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

17

X** = (r1**,V1

**,…,rN**,VN

**)X** → Xn+1

• Implementation of boundary conditions depends on the specifics of the flow problem under consideration. Typically, conditions on flow boundaries is the most specific part of the problem

• Examples of boundary conditions– Impermeable boundary (e.g. solid surface):

rebound of molecules from the wall

– Permeable boundary between the computational domain and the reservoir of molecules (e.g. Earth atmosphere) : free motion of molecules through boundaryreproducing inflow/outflow fluxes

Stage III. Implementation of boundary conditions

Computational domainReservoir (Earth atmosphere)

Flow over a re-entry vehiclein Earth atmosphere

Page 18: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

18

Rebound of molecules from an impermeable wall• Boundary condition is based on the

model describing the rebound of an individual gas molecule from the wall.

• The model should defined the velocity of reflected molecule as a function of the velocity of the incident molecule, Vr=Vr(Vi,nw,Tw,…).

• In DSMC simulations, velocity of every molecule incident to the wall is replaced by the velocity of the reflected molecule.

• In simulations, the Maxwell models of

molecule rebound are usually applied.

Maxwell model of specular scattering: A molecule reflects from the wall like anideal billiard ball, i.e.

Vrx = Vix, Vry = - Viy, Vrz = Viz

Vr = Vi – 2 ( Vi · nw ) nw

Disadvantage: heat flux and shear drag on the wall are zero (Vr

2 = Vi2). The model is

capable to predict normal stress only.

Maxwell model of diffuse scattering: Velocity distribution function of reflected molecules is assumed to be Maxwellian:

Random velocity of a reflected molecule can be generated using random numbers αi

Vi

nwVr

x

y

z Tw, wall temperature

)2sin(lg)/(2

lg)/(2

)2cos(lg)/(2

2exp

))/(2()(

21

3

21

2

2/3

παα−=

α−=

παα−=

π=

wrz

wry

wrx

w

r

r

rr

TmkV

TmkV

TmkV

kT

m

Tmk

nf

VV

Page 19: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

19

At every time step of DSMC simulations

1. All molecules moving from the computational domain into reservoir is excluded from further simulations

2. Reservoir is filled by N∞=n

∞V molecules, where V is the

reservoir volume. Random coordinates of every molecule in reservoir are generated homogeneously, random velocities are generated from the Maxwelian distribution.

3. All molecules in the reservoir ‘are moved’: Their positions and velocities are changed with accordance to their equations of motion during a time step.

4. All molecules from the reservoir that entered the computational domain during a time step are included to the set of simulated molecules. All other molecules from the reservoir are excluded from further simulations.

Free inflow/outflow of molecules on a permeable bou ndary

( )

−−π

=∞

kT

m

Tmk

nf

2exp

))/(2()(

2

2/3

UVV

)2sin(lg)/(2

)2cos(lg)/(2

)2cos(lg)/(2

65

43

21

παα−+=

παα−+=

παα−+=

∞∞

∞∞

∞∞

TmkUV

TmkUV

TmkUV

zz

yy

xx

Computational domainReservoir

3121

2121

1121

)(

)(

)(

α−+=α−+=

α−+=

zzzz

yyyy

xxxx

x

y

x1 x2

Random coordinates:

Random velocities:

Maxwellian velocity distributionin the reservoir:

n∞, concentration

T∞, temperature,

U∞, gas velocity

Page 20: Direct Simulation Monte Carlo (DSMC) of gas flowspeople.virginia.edu/~lz2n/mse627/notes/DSMC.pdf · • Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas

20

Summary� DSMC is a numerical method for simulations of free-molecular, transitional and

near-continuum flows of a dilute gas on a level of individual molecules.� It is usually used for flows where the local state of gas molecules is far from the

local equilibrium� As compared to MD, DSMC has the following distinctive features� Every simulated molecule in DSMC represents W molecules in real flow, typically

W >> 1. It makes DSMC capable for simulation of flows with almost arbitrary length scale (e.g., planetary atmosphere).� Interactions between molecules are taken into account in the framework of a special

collision sampling algorithm, where interactions (pair collisions) are considered as random events and simulated based on generation of random numbers.

� Typically, an implementation of DSMC in a computer code relays on two types of models describing� Pair collision between molecules

� Rebound of a molecule from an impermeable wall� Though in this lecture we consider only hard sphere molecules, a variety of models

exists for both inter-molecular and molecule-wall collisions. These models are capable to account for many features of molecules in real gases (e.g., internal degrees of freedom, etc.)

� Reading: G.A. Bird, Molecular gas dynamics and the direct simulation of gas flows. Clarendon Press, 1994.


Top Related