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, 994
Direct Simulation Monte Carlo of gas flows: Definitions 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 gas dynamics. 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.
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 d 3 << n is the numerical concentration of gas molecule d 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 =.7 x 0 5 m -3, d = 3.7 x 0-0 m, and ε =.4 x 0-3 For a dilute gas Collision length scale d is much smaller then the average distance between molecules l = / n /3 = d / ε /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 billiardball -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 P N is the probability of simultaneous interaction between N gas molecules, then P N+ /P N ε => only binary collisions between gas molecules are important 3
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 Relative velocity of molecules, g = v -v Collision cross-section σ = π d g ν = nσg t t = nσg g t d Mean free path of a molecule λ = g ( / ν ) = / ( n σ ) Knudsen number Kn = λ / L = / ( n σ L ), L is the flow length scale Knudsen number is a measure of importance of collisions in a gas flow Kn << (Kn < 0.0) Kn ~ Kn >> (Kn > 0) Continuum flow Transitional flow Free molecular (collisionless) flow L Local equilibrium Non-equilibrium flows 4
Applications of DSMC simulations (I) Aerospace applications: Flows in upper atmosphere and in vacuum Satellites and spacecrafts on LEO and in deep space Re-entry vehicles in upper atmosphere Nozzles and jets in space environment Planetary science and astrophysics Dynamics of upper planetary atmospheres Global atmospheric evolution (Io, Enceladus, etc) Atmospheres of small bodies (comets, etc) 5
Applications of DSMC simulations (II) Fast, non-equilibrium gas flows (laser ablation, evaporation, deposition) Flows on microscale, microfluidics Flows in electronic devices and MEMS Flows in microchannes Flow over microparticles and clusters HD Si wafer Soot clusters 6
Basic approach of the DSMC method Gas is represented by a set of N simulated molecules (similar to MD) X(t)=(r (t),v (t),,r N (t),v N (t)) Velocities V i (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. Pair collision r i f ei v i External force field f e 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. Rebound of a molecule from the wall Computational domain 7
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 n, σ n, σ If n σ = n σ, 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. 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 / n sim 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 σ sim n = σ n sim = σw 8
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)=(r (t),v (t),,r N (t),v N (t)) X n = X(t n ), state of simulated molecules at time t n X n+ = X(t n+ ), state of simulated molecules at time t n+ = t n + t At every time step, the change of X n into X n+ (X n X n+ ) is splitted into a sequence of three basic stages Stage I. Collisionless motion of molecules (solution of the motion equations) X n 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 ** X n+ 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. 9
DSMC vs. Molecular Dynamics (MD) simulations Both MD and DSMC are particle-based methods MD simulations: Direct solution of the motion equations at a time step m i d v dt m i i = Interaction force between molecules i and j DSMC simulations: Splitting at a time step m i d dt d v dt j f ij v i = i f + f ei = j ei f ij i =,..., External force Special probabalistic approach for sampling of binary collisions instead of direct solution of Eq. (*) (*) N Use of statistical weights i =,..., N << sim N 0
DSMC vs. MD and CFD in simulations of gas flows Three alternative computational methodology for simulations of gas flows MD, Molecular dynamic simulations DSMC, Direct simulation Monte Carlo CFD, Computational fluid dynamics L MD DSMC CFD Theoretical model Classical equations of motion for particles Boltzmann kinetic equation Navier-Stokes equations Gas state Dilute gas, dense gas, clusters, etc. Dilute gas Dilute gas Where applied Dense gas flows, phase changes, complex molecules Transitional and free molecular nonequilibrium flows Continuum nearequilibrium flows Typical flow length scale L Less then micrometer No limitations, usually, λ / L > 0.0 No limitations, usually, λ / L < 0. Relative computational cost High Moderate Low
Stage I. Collisionless motion X n = (r n,v n,,r Nn,V Nn ) X n X * For every molecule, its equations of motion are solved for a time step dr i /dt = V i, m i dv i /dt = f ei, i =,, N r i (t n )=r in, V i (t n )=V in, m i is the real mass of a gas molecule In case of free motion (f ei = 0) X * =(r *,V n,,r N*,V Nn ) r i * = r in + t V i 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 * =(r *,V *,,r N*,V N* ) r i = r in + ( t/) V in, V i = V in + ( t/) f ei (r in ) r i* = r in + t V i, V i* = V in + t f ei (r i )
Stage II. Collision sampling (after G.A. Bird) X * = (r *,V *,,r N *,V N * ) X * X ** Computational domain is divided into a mesh of cells. Cell 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. 3
Collision sampling in a cell : Calculation of the collision probability during time step Cell of volume V cell containing N cell molecules Molecules are assumed to be distributed homogeneously within the cell Relative velocity of molecules i and j g ij = v j v i g ij = gij σ ij(sim) j i g ij g ij t Probability of a random collision between molecules i and j during time step P ij = σ ij( sim) V g cell ij t 4
Collision sampling in a cell : Calculation of particle velocities after a binary collision of hard sphere Velocities before collision Velocities after collision Conservation laws of momentum, energy, and angular momentum Equations for molecule velocities after collision For hard sphere (HS) molecules unity vector n is an isotropic random vector: n x = cosθ, n y = sin θcos(πα ), n z = sin θsin(πα ), cosθ = α, sin θ = cos α i is a random number distributed with equal probability from 0 to. In a computer code, it can be generated with the help of library functions, which are called random number generators. θ 5
Collision sampling in a cell: The primitive scheme i = j = i + P ij = tσ ij(sim) g ij / V cell Calculation of the collision probability Disadvantage of the primitive scheme: no α < P ij P(α < P ij ) = P ij j = j + yes j < N cell yes cos θ = α sin θ = n n n x y z = cos θ = sin θcos(πα = sin θsin(πα no i = i + cos θ ) ) Does collision between molecules i and j occur? Calculation of velocities after collision Are there other pairs of molecules in the cell? Number of operation ~ N cell In real DSMC simulations, more efficient schemes for collision sampling are used, e.g. the NTC scheme by Bird yes i < N cell - no Go to the next cell 6
Stage III. Implementation of boundary conditions X ** = (r **,V **,,r N **,V N ** ) X ** X n+ 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 Flow over a re-entry vehicle in Earth atmosphere Permeable boundary between the computational domain and the reservoir of molecules (e.g. Earth atmosphere) : free motion of molecules through boundary reproducing inflow/outflow fluxes Reservoir (Earth atmosphere) Computational domain 7
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, V r =V r (V i,n w,t w, ). V i z y n w V r 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. x T w, wall temperature Maxwell model of specular scattering: A molecule reflects from the wall like an ideal billiard ball, i.e. V rx = V ix, V ry = - V iy, V rz = V iz V r = V i ( V i n w ) n w Disadvantage: heat flux and shear drag on the wall are zero (V r = V i ). 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: n r mv ( ) exp 3/ ( ( / ) ) r f V r = π k m Tr ktw Random velocity of a reflected molecule can be generated using random numbers α i V V V rx ry rz = = = ( k / m) T ( k / m) T ( k / m) T w w w lgα lg α lg α 3 cos(πα sin(πα ) ) 8
Free inflow/outflow of molecules on a permeable boundary y Reservoir x x At every time step of DSMC simulations Computational domain. All molecules moving from the computational domain into reservoir is excluded from further simulations. 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. x Maxwellian velocity distribution in the reservoir: n f ( V) = (π( k / m) T ) n, concentration T, temperature, U, gas velocity Random coordinates: x = x y = y z = z + ( x + ( y + ( z x ) α y z ) α ) α 3 3/ m exp ( V U ) kt 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. Random velocities: V V V x y z = U = U = U x y z + + + ( k / m) T ( k / m) T ( k / m) T lgα lg α lgα 3 5 cos(πα cos(πα sin(πα 6 4 ) ) ) 9
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 >>. 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, 994. 0