Вы находитесь на странице: 1из 255

Open Source DSMC Modelling Using

dsmcFoam - Introduction.
Tom Scanlon, Craig White, Stephanie Docherty

James Weir Fluids Laboratory

Department of Mechanical and Aerospace


Engineering

University of Strathclyde
Glasgow, UK
www.jwfl.org.uk
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
www.jwfl.org.uk
October 2013
tom.scanlon@strath.ac.uk Slide 1
Scope of introductory lecture:

• About ourselves.
• Multiscale flows research at Strathclyde.
• Background to dsmcFoam.
• Outline of DSMC13 short course.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 2
University of Strathclyde, Glasgow, Scotland, UK

 Glasgow is the largest city in Scotland (700,000 people), with 4 universities


 Strathclyde University (est. 1796), has 12,000 undergraduate, 5,000 postgraduate students
 Scottish alumni: Kelvin, Watt, Bell, Logie-Baird, Carnegie, Fleming, Maxwell….McDonalds?
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 3
New engineering opportunities: “exploring the scales”

nanotech micro gas re-entry orbital


engines ships bridges
desalination flow systems vehicles dynamics
2025+ 2015+ 1800-1950 1950+ 2020+
0.000001

0.0001

0.01

100

10,000

1,000,000
scale of metres length

 JWFL1 and CFASTT2 work across extreme scale ranges.


 Hydrodynamic, extended hydrodynamic, kinetic and quantum.
 Continuum NSF-CFD, slip, Burnett + moment methods, DSMC, LB, MD.
1 James Weir Fluids Laboratory 2 Centre for Future Air-Space Transportation Technologies
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 4
Perspectives:

 while engineering at conventional (time, space) scales is still


important for society, the frontiers of engineering are increasingly
moving towards extreme scales
 this involves re-thinking how we design and simulate these new engineering
systems

 truly inter-disciplinary engineering, as we need to borrow ideas from Physics,


Chemistry, Biology, Applied Mathematics, etc.

 engineering simulations at these scales are generally very computationally-


intensive, so large-scale parallel machines are needed (new HPC 3500 cores)

 real commercial opportunities and societal benefits can be realised through


this type of engineering

 these Advanced Engineering Concepts are motivating new research in the


Department of Mechanical and Aerospace Engineering at the University of
Strathclyde, UK
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 5
Background to dsmcFoam:

 OpenFOAM (Open Field Operation


and Manipulation) CFD Toolbox
 Freely available and open source
(GNU GPL) Molecular dynamics
 Flexible set of efficient C++ modules
for solving complex fluid flows
 JWFL/CFASTT Groups at
Strathclyde use OpenFOAM
 MD code developed in group
 Create new DSMC code using
existing algorithms for MD
initialisation and particle tracking in
unstructured, arbitrary polyhedral
meshes
 dsmcFoam tested successfully [1]

[1] Scanlon, et al (2010), Computers and Fluids, 39, 2078-2089.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 6
Why OpenFOAM ?
 C++ code flexibility, hierarchical structure,
inheritance features
 Solvers, utilities and libraries fully extensible
 Modular nature allows facile new model
incorporation
 Advanced error checking at compile and run
times
 Robust solver and utility executables
 Can easily handle complex 3D geometries
 Unlimited parallel processing capability
 Open source + free
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 7
DSMC13 Short Course Outline
Lecture 1 : Introduction to dsmcFoam
 Differences between old and new versions of
dsmcFoam.
 Background to C++ classes and objects (parcels,
clouds etc.)
 Code structure (location of classes/objects e.g.
collision models, reactions etc.)
 General case structure (0/ constant/ system/)
 Examples of dictionaries - setting species
properties, collision properties, initial/boundary
conditions and time-step size.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 8
DSMC13 Short Course Outline
Lecture 2: Running dsmcFoam
 Meshing with OpenFOAM utility snappyHexMesh
including live demonstration with Orion capsule.
 Generic hypersonic case set-up.
 Particle initialisation and solving in serial and
parallel.
 Macroscopic sampling at steady-state.
 Post-processing with paraview including contour
plots, streamlines etc.
 Extraction of line/surface properties.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 9
DSMC13 Short Course Outline

Lecture 3 : Applications of dsmcFoam

 Hypersonic reacting flows using the quantum-


kinetic (Q-K) chemistry approach.
 Low-speed, pressure-driven flows for microscale
applications.
 Microscale heat transfer and hybrid methods.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 10
Lecture 4 : Special features and future
developments

 Time correlation functions for species property


extraction.
 Fluxal property measurements using method of
bins.
 Alternative wall boundary conditions e.g. CLL,
mixed specular/diffusive.
 How to download and install dsmcFoam.
 Conclusions and future work via open source
community.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 11
Introduction to dsmcFoam:
Programming in OpenFOAM &
Strathclyde Modifications

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 12
OpenCFD: dsmcFoam

• A free and open source DSMC code developed by OpenCFD and


researchers at the University of Strathclyde

• C++, but uses OpenFOAM’s custom templates, so looks slightly different

• A natural extension to OpenFOAM’s molecular dynamics code, mdFoam

• Parallel, multi-species, 3-dimensional, rotational energy

• It is, however, missing some key features that most modern DSMC codes
have

• dsmcFoam is a good basic DSMC code – a solid starting point!

• OpenFOAM has some very appealing features, e.g. powerful 3D meshing


capabilities

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 13
dsmcFoam: What Can’t It Do?

• No vibrational energy mode

• No chemical reactions

• Can’t distinguish between species during measurements – all


measurements are for the mixture

• All solid surfaces must have the same gas-surface interaction


model

• These weaknesses can be dealt with, and the strengths and


advantages of OpenFOAM/dsmcFoam make it worth doing so

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 14
dsmcFoamStrath Improvements

• Vibrational energy
• Chemical reactions
• New boundary condition framework
• New field measurement property framework
• Everything is easily extendible
• General bug fixes

• There will be more details on these later.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 15
dsmcFoam/OpenFOAM Terminology

• ‘Parcel’ – a single DSMC particle

• ‘Cloud’ – all of the parcels in the simulation

• ‘label’ instead of ‘int’

• ‘scalar’ instead of ‘float’ or ‘double’

• ‘Info’ rather than ‘cout’

• OpenFOAM code housekeeping rules:


– http://www.openfoam.org/contrib/code-style.php

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 16
dsmcFoam: Code Structure
src

lagrangian
Shared Object Library
dsmc

dsmc

clouds parcels submodels

baseClasses derived BinaryCollisionModel

derived Templates InflowBoundaryModel

Templates DsmcCloud.C DsmcParcel.C WallInteractionModel


DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 17
dsmcFoam: Code Structure
Executables applications

solvers utilities

discreteMethods
preProcessing postProcessing
dsmc
dsmc miscellaneous
dsmcFoam
dsmcInitialise dsmc
dsmcFoam.C
dsmcInitialise dsmcFieldsCalc
dsmcInitialise.C dsmcFieldsCalc.C

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 18
dsmcFoamStrath: Code Structure
src

lagrangian
Shared Object Library
dsmc

dsmcStrath

boundaryMeasu collisionPartne
boundaries clouds collisions controllers faceTracker initialise
rements rSelection

macroscopicPro
parcels reactions
perties

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 19
dsmcFoamStrath: Code Structure
Executables applications

solvers utilities

discreteMethods
preProcessing postProcessing
dsmc
dsmc miscellaneous
dsmcStrath
dsmcInitialise dsmc
dsmcFoam.C
dsmcInitialiseStrath dsmcFieldsCalcStrath
dsmcInitialise.C dsmcFieldsCalc.C

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 20
Boundary Conditions: Base Class

‘Patch’ type boundaries, i.e. wall boundaries

The base class stores properties that are common


to all types of wall boundaries, so you don’t need
to repeat the code.

Faces that belong to the boundary

Surface area of the boundary, including


parallelisation

Surface temperature and velocity

For measuring heat flux, etc.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 21
Boundary Conditions: Derived Class

Diffuse reflection

Surface orientation

Assign new thermal velocity

Assign new internal energies

Define surface temperature and


velocity (from base class)
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 22
Introduction to dsmcFoam:
Case structure

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 23
Case structure
• All cases are located in the user’s “run” directory.

• In OpenFoam, the general approach to constructing a new


case is to copy a similar existing case and edit the case files as
required.

• For each case, all input data is stored in a set of organised files
known as “dictionaries”.

• Each case directory consists of a “constant” directory and a


“system” directory.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 24
Basic case structure
run

case directory

constant system 0 etc…

controlDict
polyMesh dsmcPropertiesDict boundariesDict
dsmcInitialiseDict
blockMeshDict
decomposeParDict

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 25
Dictionary files
• Each dictionary file contains a header, e.g.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 26
blockMeshDict
• The mesh generator blockMesh is used to generate
simple block mesh geometries from a description
specified in this dictionary.

• First we must specify the vertices of each


block.
• We then define each block (ensuring the
vertices are in the correct order) and the
number of cells in each direction.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 27
blockMeshDict

• Finally we define the boundary patch


types for each block (e.g. wall, cyclic
etc.).

• The mesh can then be generated by


running the “blockMesh” command in
the case directory.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 28
dsmcPropertiesDict
• This dictionary is used to specify parameters which
remain constant throughout the simulation, including:

o The number of molecules


that each DSMC particle will
represent.

o Collision properties
including the binary collision
model and the collision
partner selection model.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 29
dsmcPropertiesDict

o The molecular species and


the associated molecular
properties.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 30
controlDict
• This dictionary is used to define the control of time
during a simulation run by setting:

o The start and end time of


the simulation.
o The time-step size.
o The frequency at which data
is written out.
o How many of the latest time
directories will be stored.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 31
controlDict

• This dictionary is also used


to set up the measurement
of extensive fields across
the domain (e.g. mass,
momentum, and energy).

• When the simulation is


complete, the
dsmcFieldsCalc utility can
be called to calculate
intensive fields (e.g.
temperature, pressure) from
these averaged extensive
fields.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 32
boundariesDict

• To allow for development of


boundary conditions, we use a
different boundaries structure
than the standard dsmcFoam
distribution.
• This dictionary is used to specify
the boundary patches and
associated properties.

• Example: for a diffuse wall patch


we define the wall temperature
and velocity.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 33
dsmcInitialiseDict
• The dsmcInitialise utility is used to populate the mesh
with DSMC particles.
• This dictionary is used to specify the following initialisation
parameters:

o Number density
o Temperature
(translational,
rotational, vibrational)
o Streaming velocity

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 34
dsmcInitialiseDict
• The flow is initialised with a Maxwellian distribution
based on these parameters.
• By running the “dsmcInitialise” command in the case
directory, a time-directory at the defined ‘startTime’
(e.g. 0) is created.
o In this time directory, the mesh is populated at
these specified initial conditions.

• Note: In the dsmcFoam code we have developed, we


have renamed this utility such that we run
“dsmcInitialiseStrath”.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 35
decomposeParDict
• A key feature of OpenFOAM is its unlimited parallel
processing capability.
• The method of parallel computing used by OpenFOAM is
known as domain decomposition.
o The geometry and associated fields are broken into pieces
and allocated to separate processors for solution.

• This directory is used to specify the number of processors to


be used and the method of decomposition.
• The mesh and fields are then decomposed by running the
“decomposePar” utility in the case directory.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 36
decomposeParDict
• OpenFOAM provides the user with a choice of several
mesh decomposition methods.

• The most basic is


“simple” geometric
decomposition in which
the domain is split into
pieces by direction.

• The “scotch” decomposition method is often used as it


provides increased computational efficiency.
o The domain is divided amongst processors depending on
the number of particles per cell.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 37
Running dsmcFoam in serial
• When using the standard dsmcFoam code, the DSMC
solver can be run in serial simply by typing the
“dsmcFoam” command in the case directory.
o When using our newer dsmcFoamStrath code, we instead
run “dsmcFoamStrath” in the case directory.

• Typically we run the DSMC solver as a background process:


“dsmcFoamStrath > log &”

• Note: we store a log file in the case directory which allows us


to view the progress of the simulation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 38
Running dsmcFoam in parallel
• After decomposition of the mesh across n processors
using the “decomposePar” utility, we can run DSMC in
parallel:
“mpirun -np n dsmcFoamStrath -parallel > log &”

• For post-processing of data in a given time directory t, we


must reconstruct the simulation to this time directory:
“reconstructPar -time t”
• Generally post-processing is performed on the latest time
directory:
“reconstructPar -latestTime”

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 39
Meshing in OpenFOAM with
snappyHexMesh

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 40
• Two OpenFOAM meshing utilities are
normally used – blockMesh and
snappyHexMesh.
• blockMesh is used to create a background
hexahedral mesh.
• snappyHexMesh is used to “snap” the background
hexahedral mesh on to the surface of a geometry
in .stl / .obj format.
• Two OpenFOAM dictionaries are used to set the
meshing parameters: blockMeshDict located in
constant/polyMesh and snappyHexMeshDict
located in the system directory.
• .stl geometry file located in constant/triSurface.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 41
• Triangular surfaces

• Orion capsule at 45o


in .stl format.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 42
• Settings in
blockMeshDict to
create background
hexahedral mesh.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 43
• Orion.stl location with
background mesh.
• We normally use ¼ or
½ symmetry.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 44
• Settings in snappyHexMeshDict.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 45
• Settings in snappyHexMeshDict.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 46
Terminal window
output at end of
snappyHexMesh
run.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 47
Surface
mesh on
Orion.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 48
Surface
mesh on
Orion.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 49
Mesh
section
through
Orion.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 50
Mesh
section
through
Orion.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 51
Mesh
section
through
Orion.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 52
Corrected settings in blockMeshDict and
snappyHexMeshDict more suitable for
DSMC study.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 53
Background
mesh for
DSMC
study.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 54
Improved
Orion
surface
mesh.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 55
Improved
Orion
surface
mesh.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 56
Improved
Orion
surface
mesh.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 57
• Other meshing examples

• Wafer chip manufacture under high vacuum.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 58
• Other meshing examples

• H2 flow through slits, gas flow upwards and


downwards.
• Determine forces acting on wafer containing chips.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 59
• Meshing in slit region.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 60
• Other meshing examples

• Skylon hypersonic concept vehicle.


• EU LAPCAAT initiative – hypersonic civilian airliner
• UK company Reaction Engines Ltd.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 61
• Other meshing examples

• Skylon location in
computational
domain

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 62
• Skylon hypersonic concept vehicle.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 63
• Skylon hypersonic concept vehicle.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 64
Skylon hypersonic concept vehicle.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 65
• Advanced meshing strategies – create .stl
(freeCAD) for inlet to reduce cell number.

.stl surface for inlet

flow direction

.stl surface for body

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 66
• Advanced meshing strategies – layer
addition on .stl body surface.

High quality
hexahedral layer on
body surface.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 67
• Advanced meshing strategies – create .stl
(freeCAD) for inlet to reduce cell number.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 68
Conclusions
• snappyHexMesh is a very powerful
meshing utility for complex geometries.
• Straightforward and easy to use.
• Can create spline .stl surfaces in freeCAD to act as
inlet boundary and reduce cell number.
• Can use layers option to create high quality,
orthogonal hexahedra on body surfaces.
• Other OpenFOAM utilities exist for checking the
quality of the .stl surface prior to meshing and for
reparations of bad .stl geometries with “illegal
faces”.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 69
Running dsmcFoam:
Supersonic corner flow

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 70
Example: Supersonic corner flow
• Here we demonstrate how we set up and run a
DSMC simulation in OpenFOAM.

• This example case considers


supersonic flow of argon gas in
the ‘corner’ between two flat
plates that are perpendicular to
one another, and parallel to the
incoming stream flow.

• This case is one of Bird’s three-


dimensional flow examples [1].

[1] G. A. Bird. Molecular Gas Dynamics and the Direct Simulation of Gas Flows.
Oxford Science Publications, Oxford University Press Inc, New York, 1994.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 71
Example: Supersonic corner flow
• Both plates are 0.25 m in length and 0.18 m wide, and
there is a 0.05 m region upstream of the plates.

• The stream is argon gas at Mach 6 with temperature T∞ of


300 K, and a number density n∞ of 1×1020 m−3.

• The plate temperature is 1000 K and all gas-surface


interactions are considered to be fully diffuse.

• The VHS mean free path λVHS [2] is 1.33×10−2 m.

o Results in Knudsen number of 0.053 based on the plate


length of 0.25 m.

[2] G. A. Bird. Definition of mean free path for real gases. Physics of Fluids,
26(11):3222–3223, 1983.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 72
blockMeshDict
• In this case we generate two blocks to allow definition
of the appropriate boundary patches.

• We set the number of cells such that each cell


dimension is 0.38 λVHS.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 73
blockMeshDict

• We then define the face boundaries as


shown:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 74
blockMeshDict
• The mesh is generated by running the “blockMesh”
command in the case directory.

• The surface of the plates are shown in solid grey, and the
mesh itself is shown as a wireframe.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 75
dsmcPropertiesDict

• We assume that each


DSMC particle
represents 6×1011
molecules.
o This gives ~ 21
particles per cell.

• We select the VHS


collision model and the
‘no time counter’ partner
selection model.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 76
dsmcPropertiesDict
• We also define the molecular properties of argon.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 77
controlDict
• The DSMC time step is chosen
to be 5×10−7 s.
– Smaller than mean collision
time
– Small enough that particles
will remain in each cell for
several time steps
• End time is set as 100,000 time
steps.
• Write interval set as 1000 time
steps.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 78
boundariesDict

• We create diffuse wall


boundaries for both plates,
setting the wall temperatures
to be 1000 K.

• Each general flow boundary


is set to act as a deletion
patch such that particles are
deleted on contact.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 79
boundariesDict

• Each general flow boundary


is also set be a free stream
in-flow patch with an inlet
temperature of 300 K, a
number density of
1×1020 m−3, and a velocity
corresponding to Mach 6.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 80
dsmcInitialiseDict

• Here we define the


number density,
temperatures, and
streaming velocity for
initialisation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 81
dsmcInitialiseDict
• By running the “dsmcInitialiseStrath” command in the
case directory, a time-directory at the defined
‘startTime’ (e.g. 0) is created.

• In this time directory, the mesh is populated at the specified


initial conditions.
– Files containing initial boundary information for extensive
fields (e.g. mass, momentum, etc.) are generated for
visualisation in paraView.
– When using “dsmcInitialiseStrath”, general inflow/outflow
type boundaries are initialised as “calculated” boundaries,
however, for visualisation in paraView, this should be
changed to “zeroGradient”.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 82
dsmcInitialiseDict
• Example extensive field: dsmcRhoN

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 83
Running dsmcFoam in serial
• Typically we run the DSMC solver as a background
process:
“dsmcFoamStrath > log &”
• We store a log file in the case directory which allows us
to monitor the progress of the simulation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 84
decomposeParDict
• The number of processors to be used and the
method of decomposition is up to the user.

• Here we use “simple”


geometric decomposition,
splitting the domain across 4
processors.

• The mesh and fields are then decomposed by running the


“decomposePar” utility in the case directory.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 85
Running dsmcFoam in parallel
• After decomposition of the mesh across n processors
using the “decomposePar” utility, we can run DSMC in
parallel:
“mpirun -np n dsmcFoamStrath -parallel > log &”

• For post-processing of data in a given time directory t, we


reconstruct the simulation to this time directory:
“reconstructPar -time t”
• Generally post-processing is performed on the latest time
directory:
“reconstructPar -latestTime”

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 86
Monitoring steady-state conditions

• For steady-state problems, DSMC simulations are


generally performed in two stages:
1. A transient period enables the flow to reach steady-state
2. A longer averaging period reduces the statistical scatter in
the macroscopic fields

• It is important that we are able to monitor the simulation to


determine when steady-state is reached so that we can begin
averaging the macroscopic properties.
o This is done by monitoring the number of particles and the
energy in the system.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 87
Monitoring steady-state conditions
• The output log file is able write out the number of
particles and the energy in system at each time step.

• We then use the gnuplot graphing program to monitor these


parameters as the simulation proceeds.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 88
Monitoring steady-state conditions

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 89
Monitoring steady-state conditions

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 90
Post Processing & Parallel
Performance

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 91
Post Processing dsmcFoam Results

• We try to ensure all post processing is done in free and open source software

• ParaView
– good for qualitative checks

– isovalue contour plots, etc

• sampleDict
– OpenFOAM utility for extracting raw quantitative data from completed simulations

• gnuplot
– open source plotting software

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 92
ParaView: Supersonic Corner Case

• ‘paraFoam’ command issued from terminal in case directory to launch


ParaView in OpenFOAM format

• http://www.openfoam.org/docs/user/paraview.php

• To view flow field properties, select the ‘internalMesh’ option on the left hand
side

• To view surface properties, select the relevant surface on the left hand side
(deselect the internalMesh)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 93
ParaView: Contours of Ch

• Select only the ‘walls’ patch

• Use the calculator tool to calculate the heat transfer coefficient from the heat
flux

• Type the equation into the calculator menu

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 94
ParaView: Contours of Ch

• Now plot the contours

• Use the contour tool

• Enter the values you wish to plot – here we choose the same values as Bird
(page 397)

• The ‘Display’ tab contains options to


change the colour and thickness of the
contour lines

• ParaView is unable to put values on the


contours. These can be added in an image
editor later.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 95
ParaView: Contours of Ch

dsmcFoam DSMC3

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 96
ParaView: Contours of Ma

• Select the internalMesh

• Create a slice normal to the plate surfaces

• Use the contours tool again

• Contour by Mach number and select


the same values as Bird (page 401)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 97
ParaView: Contours of Ma

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 98
sampleDict & gnuplot

• sampleDict allows for sampling of 1D data for plotting on graphs

• http://www.openfoam.org/docs/user/sample.php

• 1D line along the x-axis through


the geometric centre of the domain

• Measure number density along


this line

• Plot it using gnuplot

• Start point: 0, 0.09, 0.09 m

• End point: 0.3, 0.09, 0.09 m

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 99
sampleDict & gnuplot

Define the fields to measure here


(can measure multiple fields at once)

Tell the utility what axis to measure


on, and the start and end point of
your line. This example will give 200
uniformly spaced points

The surfaces subdict can be used to


sample surface properties by
providing details of the patch you are
interested in

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 100
sampleDict & gnuplot

• Run ‘sample’ from case directory

• Results written as a columned text file to caseDirectory/sets/timeDirectory/


– Any surface results written to caseDirectory/surfaces/timeDirectory/

• This can be plotted with gnuplot

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 101
sampleDict & gnuplot

• Run ‘gnuplot gnuplotExample’ from a terminal to plot the data to an EPS


image
– Different terminal options can be used in the first line of the script to plot to jpeg, gif, etc

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 102
Parallel Performance Tests

• Using Bird’s supersonic corner flow test case


– case was pre-run until steady state

– particle weighting used so each core has a similar number of particles

• Case has been run in serial, and in parallel on 2, 4, 6 and 8 cores


– reasonably small case

• A periodic box with 10 million particles is tested up to around 200 cores


– larger case, so gives better idea of parallel performance without being subject to
communication time lag

• Periodic box also tested with 100 million particles

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 103
Parallel Performance: Supersonic Corner

• Scales well on 2 cores, not so well on more cores

• Only 2 million particles, doesn’t really require 8 cores


– a rule of thumb from my experience is no less than 500,000 particles per core

• A larger case is really needed to characterise the parallel performance


DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 104
Parallel Performance: Periodic Box

• 10 million particles

• Scales reasonably well up to 100 cores

• Performance decreases with more cores than plotted here

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 105
Parallel Performance: Periodic Box

• 100 million particles

• Scales reasonably well up to 200 cores

• Performance decreases with more cores than plotted here

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 106
Parallel Performance: Load Balacing
A practical case with gradients: Hypersonic cylinder flow

• Top: contours of number density • Top: particle weighted Scotch decomposition


with 16 cores
• Bottom: processor distribution with standard
Scotch decomposition method, 8 cores • Bottom: particle weighted Scotch decomposition
with 8 cores
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 107
Parallel Performance: Load Balacing
Planetary probe test case

• Scotch decomposition offers marginally better scaling performance than simply dividing the domain
into equally sized and spaced sections

• The particle weighted Scotch method allows for a significant improvement in parallel performance as
it improves the load balancing
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 108
Parallel Performance Tests

• dsmcFoam can achieve good parallel performance

• We do not currently have any automatic parallel efficiency tool implemented


– weighted Scotch method requires user input to stop simulation, recompose, re-decompose and
then restart from the latest time step

– can still be a worthwhile exercise for cases with large density gradients

• As with any DSMC code, parallel performance depends on many things


– and varies from case to case!

• Best approach is not just to use as many cores as you have available!

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 109
Parallel Performance Tests

• dsmcFoam can achieve good parallel performance

• We do not currently have any automatic parallel efficiency tool implemented


– weighted Scotch method requires user input to stop simulation, recompose, re-decompose and
then restart from the latest time step

– can still be a worthwhile exercise for cases with large density gradients

• As with any DSMC code, parallel performance depends on many things


– and varies from case to case!

• Best approach is not just to use as many cores as you have available!

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 110
Open Source DSMC Chemistry
Modelling Using the Quantum-Kinetic
(Q-K) Approach

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 111
Scope of presentation

• Implementation of vibrational mode in dsmcFoam.


• Background to Q-K approach for dissociation and
exchange reactions.
• Equilibrium and non-equilibrium validation cases.
• Hypersonic test case with comparison of Q-K
(dsmcFoam) with TCE (MONACO).
• How do we activate Q-K in dsmcFoam?
• Conclusions.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 112
• Following the recent work of Bird [1] the
quantum kinetic (Q-K) method has been
implemented in dsmcFoam to describe
chemical reactions in a 5-species air
model.
• Starting point was the implementation of the
vibrational mode.
• Assume that this mode exists as discrete
quantum values (harmonic oscillator model).
• Redistribute post-collision vibrational energy
using QLB.
[1] Bird, G. A. The Q-K model for gas phase chemical reaction rates, Physics of
Fluids, 23, 106101, 2011.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 113
• Define “quantized collision temperature”:

• Maximum quantum level available to molecule:

• Collision energy between particles p and q:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 114
• Vibrational collision number:

where:
and

finally: with 0 < i* < imax

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 115
• Total energy reduced accordingly by

subtracting Evib =𝑖 𝑘θ𝑣 .
• Particle p then considered for relaxation
into Erot and Etrans using standard LB.

• Test case Bird DSMC07 notes.


• Singe cell adiabatic heat bath, 1.2 million N2
particles.
• Trot = Ttrans = 20,000 K, no energy in vibrational
mode at t = 0, VHS collision model.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 116
• Test case Bird DSMC07 notes:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 117
• Until recently chemically-reacting gas flows
in DSMC relied upon input data derived at
macro level and rate coeffs at equilibrium
conditions – the TCE approach (1979).

• Bird (2011) proposed alternative methodology – the


Quantum-Kinetic (Q-K) approach based on QLB.
• No dependence on macro data nor need for gas to
be near thermodynamic equilibrium.
• Q-K approach introduced into dsmcFoam for 5-
species air model O2, N2, NO, N, O with a total of 19
reactions (dissociation + exchange, no recomb.)
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 118
Q-K Dissociation
• If energy in a collision is high enough to
allow a dissociation event then it will always
occur.
AB + C  A + B + C

Where AB is the molecule considered for


dissociation and C is the reactant partner (molecule
or atom).
• Consider serial application of QLB approach and
determine imax as shown previously.
• If imax is beyond the dissociation limit, i.e.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 119
• Then molecule AB must split before any vibrational
or rotational relaxation can be considered.
• One distinct feature of Q-K is that gas need not be
in equilibrium.
• However, if it is assumed it is then analytical
solutions for reaction rates can be derived.
• For a VHS gas in equilibrium the rate coefficient for
dissociation is:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 120
where:

and the fraction of collisions resulting in dissociation is:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 121
Dissociation in dsmcFoam

• Q-K implemented
for the following
“Type-1” molecule-
molecule
dissociations:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 122
Dissociation in dsmcFoam

• and the following


“Type-2” molecule-
atom dissociations:
• Producing a total
of 15 dissociation
reactions.
• Single cell
adiabatic heat bath
test case.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 123
• Single cell adiabatic heat bath test case.
• Side length 1e-5 m, dt = 1.52e-9 s and
50,000 DSMC particles.
• Zrot = Zvib = 1.0.
• Particles allowed to move and exchange energy
but no splitting.
• Forward reaction only considered, no
recombination.
• Number of reaction events augmented by 1 after
each dissociation .
• Comparison made with equilibrium Q-K analytical
rates.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 124
Equilibrium dissociation rate for
N2 + N2  N + N + N2

Satisfactory
comparison
between
dsmcFoam,
analytical Q-
K and
previous
DSMC-Q-K
(Gallis, 2009)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 125
Equilibrium dissociation rate for
O2 + O2  O + O + O2

Satisfactory
comparison
between
dsmcFoam,
analytical Q-
K and
previous
DSMC-Q-K
(Gallis, 2009)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 126
Equilibrium dissociation rate for
N2 + N  N + N + N

Satisfactory
comparison
between
dsmcFoam,
analytical Q-
K and
previous
DSMC-Q-K
(Gallis, 2009)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 127
Equilibrium dissociation rate for
O2 + O  O + O + O

Satisfactory
comparison
between
dsmcFoam,
analytical Q-
K and
previous
DSMC-Q-K
(Gallis, 2009)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 128
Non-equilibrium
Dissociation in dsmcFoam

• We allow particle splitting to occur.


• Start from equilibrium gas mixture.
• Particle splitting with conservation of mass,
momentum and energy.
• Non-equilibrium broth of original and nascent
species.
• Compare dsmcFoam-Q-K results with analytical
rate kinetic equation (Boyd):

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 129
• Time evolution of species concentration and
equilibrium temperature of gas mixture.
• Equilibrium kf(T) rates provided from Q-K analytical
values in Arrhenius form:

• Same single cell test case as aforementioned.


• Initial T = 20,000 K, P = 0.063 atm.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 130
Species concentrations during
dissociation of an O2 reservoir
from 20,000 K and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 131
Gas mixture temperature during
dissociation of an O2 reservoir
from 20,000 K and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 132
Species evolution during
dissociation of an N2 -
NO reservoir from
30,000 K and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 133
Gas mixture temperature
during dissociation of an
N2-NO reservoir from
30,000 K and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 134
Q-K Exchange
• Exchange reactions contain one stable
molecule and one radical before and after
the reaction.
A + B  C + D
Where A and C are molecules and B and D are
atoms.
• In our 5-species air model:
• Each has a forward (endo) and
a backward (exo) direction
giving a total of 4 exchange
reactions.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 135
• dsmcFoam-Q-K implementation for
exchange leads to reactions being possible
if Ec > Ea with a probability of:

• and the analytical


Q-K rates given as:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 136
• The default Ea for forward exchange is the
heat of formation, Eh , and for the reverse
exchange is zero.
• We attempt to ensure that the ratio of forward to
reverse exchange reactions is consistent with that
predicted by statistical mechanics.
• To do this it is necessary to
adjust the activation energies
in a phenomenological
manner:
• a and b are adjustable
parameters.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 137
• Parameters for adjusted activation energies:

• Parameters chosen in order to satisfy:


• The analytical equilibrium Q-K rates.
• The analytical kinetic rate equation (Boyd).
• The ratio kf / kr consistent with stat. mech.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 138
• Forward to reverse exchange rate
ratio kf / kr :

• Same single cell test case with initial 50 % split by


species number
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 139
Equilibrium exchange reactions in
dsmcFoam

• Note
differences
between
non-adjusted
Ea (Gallis,
2009) and
current work.
• Note also
differences
in Tmacro and
Tcoll results.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 140
Equilibrium exchange reactions in
dsmcFoam

• Note
differences
between
non-adjusted
Ea (Gallis,
2009) and
current work.
• Note also
differences
in Tmacro and
Tcoll results.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 141
Equilibrium exchange reactions in
dsmcFoam

• Note
differences
between
non-adjusted
Ea (Gallis,
2009) and
current work.
• Note also
differences
in Tmacro and
Tcoll results.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 142
Equilibrium exchange reactions in
dsmcFoam

• Note
differences
between
non-adjusted
Ea (Gallis,
2009) and
current work.
• Note also
differences
in Tmacro and
Tcoll results.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 143
• Definition of collision temperature:

• Bird (2011) recommends that if Tcoll is to be used


then exchange factor a needs to be replaced by:

• Necessary as:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 144
• dsmcFoam-Q-K results showed no
difference whether a’ adjustment used in
conjunction with Tcoll or not.
• Obviously desirable to use Tcoll as information
should be passed from micro to macro (we have
used Tcoll in all subsequent calculations).
• Use of Tmacro matches dsmcFoam results with Q-K
analytical exchange rates and helps validate our
coding.
• Use of Tcoll does not match analytical with disparity
widening as the value of exchange factor b
increases.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 145
Non-equilibrium exchange reactions in
dsmcFoam
• We allow particle splitting to occur.
• Same single cell adiabatic heat bath conditions as
previous.
• Start from equilibrium gas mixture with initial 50 %
split in species.
• Initial temperature = 20,000 K and pressure =
0.063 atm.
• Results highlight both exo- and endothermicity in
reactions.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 146
Non-equilibrium exchange reactions in
dsmcFoam

Forward endothermic
exchange reaction

Species

Initial conditions 20,000 K


Temperature
and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 147
Non-equilibrium exchange reactions in
dsmcFoam

Reverse exothermic
exchange reaction

Species

Initial conditions 20,000 K Temperature


and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 148
Non-equilibrium exchange reactions in
dsmcFoam

Forward endothermic
exchange reaction

Species

Initial conditions 20,000 K


Temperature
and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 149
Non-equilibrium exchange reactions in
dsmcFoam

Reverse exothermic
exchange reaction

Species

Initial conditions 20,000 K Temperature


and 0.063 atm

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 150
Air reactions in dsmcFoam

• Complete set of 19 reactions activated for


air decomposition.
• Initial composition is 79 % N2 and 21% O2.
• Three cases considered with initial conditions of
0.063 atm pressure and temperatures of 30,000 K,
20,000 K and 10,000 K.
• Results compared with analytical kinetic rate
equation (Boyd).
• Arrhenius rates for analytical solution provided by
Q-K equilibrium rates.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 151
Species
fate
during air
decompo
sition
from
30,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 152
Mixture
temperature
during air
decompositi
on from
30,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 153
Species
fate
during air
decompo
sition
from
20,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 154
Mixture
temperature
during air
decompositi
on from
20,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 155
Species
fate
during air
decompo
sition
from
10,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 156
Mixture
temperature
during air
decompositi
on from
10,000 K.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 157
Hypersonic test case
• High speed, reacting
air flow over a 2D
cylinder.

• Corresponds to 86 km altitude, Ma = 24.85.


• Comparison between dsmcFoam (Q-K) and
MONACO (TCE).
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 158
• Full set of 19 dissociation/exchange
reactions activated.
• Zrot = 5, Zvib = 50 fixed for both codes.
• For MONACO-TCE Arrhenius rates provided from
Q-K analytical equilibrium values.
• Zrot = 5, Zvib = 50 fixed for both codes.
• dsmcFoam mesh 345,000 cells, 23.4 million DSMC
particles at steady-state, dt = 1.e-7 s.
• MONACO mesh 175,000 cells, 7.7 million DSMC
particles at steady-state, variable dt.
• Verification cell size/ mfp < 1.0 for both codes.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 159
• Check non-reacting results firstly using
VHS collisions:

Velocity along stagnation


streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 160
Non-reacting flow.

Species number density


along stagnation streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 161
Non-reacting flow.

Temperatures along
stagnation streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 162
Reacting flow.

Velocity along stagnation


streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 163
Reacting flow.

Species number density


along stagnation streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 164
Reacting flow.

Temperatures along
stagnation streamline.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 165
MONACO-TCE MONACO-TCE
TCE TCE

dsmcFoam
Q-K - QK
dsmcFoam
Q-K
- QK

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 166
Where is the code located?
src/lagrangian/dsmc/dsmcStrath/reactions

How are the reactions activated?


New dictionary in system directory called
chemReactDict, e.g.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 167
chemReactDict

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 168
chemReactDict

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 169
Output to
screen:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 170
• Flexibility of coding means that any
reaction can be created (e.g.
combustion) in chemReactDict with
knowledge of heats of reaction/formation.
• No modification of source code required.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 171
Conclusions

• 5-species air chemistry model available in


dsmcFoam based on Q-K approach.
• Discussion of Tcoll / Tmacro highlighted.
• New Arrhenius rates presented from Q-K
equilibrium analytical solutions.
• Q-K chemistry model validated against analytical
solutions and hypersonic test case (MONACO-
TCE).
• Thanks to Iain Boyd / Erin Farbar at the University
of Michigan for the MONACO results.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 172
O2
dissociation
animation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 173
Applications of dsmcFoam:
Multiscale simulation of heat transfer
in micro gas flows

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 174
Multiscale hybrids
• Continuum-molecular hybrids combine the computational
efficiency of continuum solvers with the accuracy of
molecular solvers.

• Two dominant hybrid frameworks are:


– Domain Decomposition (DD)
– Heterogeneous Multiscale
Method (HMM)

• To simulate dilute gas flows, DSMC is


the chosen molecular solver.
• To date, there are very few existing
HMM type continuum-DSMC hybrids.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 175
Our hybrid method
• With DSMC providing the molecular description, a new
form of the HMM technique is proposed.

• This method is capable of dealing with situations where traditional


boundary conditions and/or constitutive relations are invalid.

• It is tailored for modelling heat transfer problems in dilute gas flows.


– We consider problems where the gas is essentially stationary, with
large temperature gradients placing focus on heat transfer.
– Coupling is performed in terms of heat-flux.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 176
Conventional continuum description
• Assume steady-state “flow” with no streaming velocity.

• Conservation of energy equation:


𝛻∙𝑞 =0
– Closed using Fourier’s law:
𝑞 = −κ𝛻𝑇
 Giving:
𝛻 ∙ (κ𝛻𝑇) = 0
• Traditional boundary conditions: ‘no temperature-jump’ at walls.

 Solution produces the ‘conventional’ continuum temperature field Tconv


across the domain.

• Tconv is taken as an initial estimate in this hybrid.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 177
Coupling framework
• Adopting an HMM-type framework:
– The continuum description is applied across the entire macro
domain.
– DSMC is then performed in dispersed micro sub-domains.

• Placing focus on the transport of


heat, a new strategy is presented
here to achieve a two-way
coupling between these domains:
A. Constraining the micro
sub-domains
B. Correcting the continuum
description

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 178
Constraining the micro sub-domains
• The gas state in each DSMC sub-domain must perfectly
represent the conditions in the same region within the
macro domain.

• *Fundamental problem* → the molecular distribution required at


the sub-domain boundaries cannot be determined directly from the
macroscopic continuum state.

• How can we obtain this molecular distribution?


– Avoid making any assumption about its exact form.
– Assume that it can be dictated by the macroscopic continuum
state alone.
 Allowed by establishing an artificial region around the
sub-domain.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 179
Constraining the micro sub-domains
• Artificial region:
– Gas state does not have to match
corresponding macro domain.
– Sole purpose → apply boundary conditions
to core region of the sub-domain.

• Core region:
– Sampling of macroscopic fields is
performed.
• Referred to as the ‘sampling zone’.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 180
Constraining the micro sub-domains
• How exactly do we apply boundary conditions to this
sampling zone?
o Apply some molecular distribution at the
outer boundaries of the artificial region
(e.g. Maxwellian).

o Enforce continuum temperature field


throughout the artificial region.
 Can be done molecular controllers
in dsmcFoam.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 181
Constraining the micro sub-domains
• The molecular distribution imposed at the boundaries of the
artificial region must not impact the molecular state in the
sampling zone.
 Artificial region must provide sufficient separation.
 The form of the imposed distribution is then irrelevant.

• The molecular state will relax through the artificial region.


– Artificial region is referred to as the ‘relaxation zone’.

 Prior to reaching the sampling zone, the molecular state should be


fully relaxed.
 Distribution is dictated solely by the imposed continuum state.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 182
Correcting the continuum description
• Fourier’s law fails in certain flow conditions.
• ‘Flux-corrected’ constitutive relation:
𝑞 = −κ𝛻𝑇 + Φ
 Inaccuracy quantified by ‘heat flux correction’ field Φ.
 Represents departure of the flow from equilibrium.
 Represents inaccuracy in the thermal conductivity model.

• Extract Φ from cluster of DSMC sub-domains:


 Compute across the sampling zone of each micro sub-domain.
 Use measured temperature and heat-flux fields:
Φ = 𝑞 + κ𝛻𝑇
 Interpolate between sampling zones to obtain flux-correction
field for the entire domain.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 183
Correcting the continuum description
• ‘Flux-corrected’ energy equation:
𝛻 ∙ κ𝛻𝑇 − 𝛻 ∙ Φ = 0
• Boundary conditions: must account for temperature-jump at the walls
– Set the temperature of the gas at the wall from that measured in
near-wall DSMC sub-domains.

 Solution produces a ‘flux-corrected’ temperature field 𝑇Φ across the


domain.

• 𝑇Φ replaces the initial temperature field 𝑇conv in constraint of the micro


sub-domains and the process is repeated.

• With advancing iterations, 𝑇Φ will converge to the correct form which


would be obtained from a full DSMC simulation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 184
Iterative algorithm
(0) Assuming no temperature-jump, solve the conventional
energy equation,
𝛻 ∙ κ𝛻𝑇 = 0
to obtain an initial estimate for the temperature field across the
simulation domain 𝑇conv .
(1) Constrain each micro sub-domain by applying boundary
conditions as follows:
(a) Enforce the local continuum temperature field from the
previous step (𝑇conv or 𝑇Φ ) throughout the relaxation zone.
(b) Impose some molecular distribution at the outer boundaries
of the relaxation zone.
(2) Perform DSMC in each micro sub-domain, measuring
macroscopic fields in the sampling zone.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 185
Iterative algorithm
(3) Apply the measured macroscopic temperature and
heat-flux fields to the flux-corrected constitutive relation
to compute the flux-correction field across each sampling zone,
Φ = 𝑞 + κ𝛻𝑇
(4) Interpolate between sampling zones to approximate the flux-
correction field across the full domain.
(5) Accounting for temperature-jump, solve the flux-corrected
energy equation,
𝛻 ∙ κ𝛻𝑇 − 𝛻 ∙ Φ = 0
to obtain the flux-corrected temperature field 𝑇Φ .
After the first iteration, we repeat from Step (1).
We continue until 𝑇Φ converges to the temperature field obtained from a
full DSMC simulation.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 186
1D Fourier flow
• Simplicity is essential, both in testing the performance of the
method, and in validation against a full DSMC simulation.
– Demonstrate the method for the simple case of 1D heat transfer.
– Argon is chosen as the working gas.

• In rarefied gas dynamics, 1D heat transfer is characterized by the


classical Fourier flow problem:

• When Kn ≥ 0.01, Knudsen layers will extend from the walls.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 187
Implementation
• In implementation of the general coupling algorithm for this
1D system:
o All continuum equations are in 1D form, e.g.
𝑑2 𝑇 𝑑Φ
κ − =0
𝑑𝑥 2 𝑑𝑥
o All DSMC sub-domains are 1D:

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 188
Testing
• Testing found high accuracy can be achieved, provided that:
a) Sampling zones are large enough to capture the Knudsen layers.
b) Relaxation zones are large enough to allow full relaxation of the
molecular distribution.

• Example: 𝐿 = 1 μm, 𝐾𝑛 = 0.01, Δ𝑇 = 100 K


– Known 𝜅(𝑇)
– Wall sub-domains only
• 𝐿𝑆𝑍 =𝐿𝑅𝑍 =0.1𝐿

• Convergence occurs within


a number of iterations.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 189
Testing
• Compare final iteration with full DSMC simulation results:

 Average error in flux-corrected temperature field : 0.06%

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 190
Testing
• Sensitivity studies have been performed to determine the
appropriate size of sampling and relaxation zones.

• We have simulated a range of test cases which explore the methods


ability to accommodate:
1. Missing boundary conditions and the associated thermal
Knudsen layer.
2. Both known and unknown thermal conductivity variation.

 These capabilities are demonstrated for:


 Various levels of rarefaction.
 Both mild and extreme temperature conditions.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 191
Conclusions
• Hybrid method has been implemented for 1D heat transfer:
– Uses measurement and controller tools developed in dsmcFoam.
– Testing has shown that high accuracy can be obtained.
– Test cases have been performed which fully demonstrate the
methods capabilities.

• Development of the method will focus on:


– Full coupling → mass, momentum, and
heat transfer.
– Application to complex 2D/3D problems.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 192
Microscale Applications

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 193
Microscale Applications of dsmcFoam

• Lower speed applications

• Defined pressure boundaries

• Couette flow using uniform bins method to measure velocity profile

• Poiseuille flow using face measurements for mass flux

• Cylindrical Couette flow showing rotating wall boundary and radial bins
measurements

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 194
Pressure Boundaries

• dsmcFoam didn’t have any boundary condition for a fixed pressure

• This was implemented following the work of Liou & Fang


– W. W. Liou and Y. H. Fang. Heat transfer in microchannels using DSMC. Journal of
Microelectromechanical Systems, 10(2):274-279, 2001.

• Pressure and temperature known at inlet, only pressure known at outlet

• Velocity, densities and temperatures at the boundaries are updated as the


simulation proceeds to maintain the desired pressures

• Wang & Li updated the inlet boundary condition to improve the convergence
behaviour
– M. Wang and Z. Li. Simulations in microgeometries using the direct simulation Monte Carlo
method. International Journal of Heat and Fluid Flow, 25(6):975-985, 2004.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 195
Microscale Case Set Up
boundariesDict
• Case set up for these types of problems is
fairly standard

• Create mesh, set up particle properties

• Define your boundary conditions in


boundariesDict

• Here we have a planar micro-Couette flow,


with the upper wall moving at 100 m/s

• 1D, but rather than making it cyclic/periodic,


we use the pressure inlets and outlets to
introduce new particles

Particles leaving the system at inlets/outlets are


deleted by this boundary condition (same entry
for ‘inlet’ not shown here)
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 196
Microscale Case Set Up
boundariesDict
• General boundaries are those
that insert new particles and
need to know the time step size

• Still with the micro-Couette flow


example…

Define inlet temperature and


pressure, along with the species
and mole fractions

Define outlet pressure, species


and the mole fractions

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 197
Microscale Case Set Up
fieldPropertiesDict
• Measurements in
fieldPropertiesDict

• Still with the micro-Couette flow


example…
Equally sized bins

Set bins in y-direction to capture


velocity gradient

Required to get
volume of bins. It
knows the height
of each bin, but we
need to give it the
cross-sectional
area of the bins.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 198
Microscale Case Set Up
• Results written to caseDir/<processor0>/timeDir/uniform

• Bins method writes a lot of results; temperatures, velocities, stress tensor, etc

• All in a format that can easily be plotted or altered in a spreadsheet

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 199
Pressure Boundaries: Couette Flow

• Planar micro-Couette flow of nitrogen gas

• Knudsen number = 0.163

• The bins method is independent of the collision cells

• Allows for reducing scatter very effectively in 1D problems

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 200
Micro-Channels with Bends

• A 2-dimensional investigation of argon gas flow in channels with one and two
sharp ninety degree bends

• Constant inlet-to-pressure ratio of 3

• Measure the mass flux with the face measurement tool

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 201
Micro-Channels with Bends
planeSurfacesDict

• createPlaneSurfaces utility

• Group sets of faces together

• Count particles crossing those


faces

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 202
Micro-Channels with Bends
fieldPropertiesDict

faceZoneName as defined in
planeSurfacesDict

Positive mass flux direction (x-


axis for face2)

Results written to caseDir/<processor0>/fieldMeasurements/

Positive mass flux direction (y-


axis for face3)
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 203
Normalised Mass Fluxes

Single bend Double bend

• Results normalised with the mass flux from the equivalent straight channel
• Evident that in a small range of Knudsen number the presence of a bend
increases the mass flux relative to the straight channel
• Outside of this region, the bend decreases the mass flux
• Adding a second bend results in a larger increase or decrease

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 204
Cylindrical Couette Flow
• Canonical non-planar test case
• Under rarefied conditions can exhibit highly non-intuitive behaviour
• If inner cylinder is rotating while outer is stationary, the velocity can be higher
at the stationary surface
– Inverted velocity profile

– At low accommodation coefficients

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 205
Cylindrical Couette Flow
boundariesDict

• Rotating wall boundary condition


• Done in quarters here because
that was best way to build the
mesh

Linear velocity (m/s)

Rotating around z-axis

Centre of cylindrical surface

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 206
Cylindrical Couette Flow
fieldPropertiesDict

• Measure properties with radial


bins

Radial rather than


uniform bins

Through centre of the


cylinders and the
thickness of the mesh

Radius of outer cylinder


Bin width is not equal
here; each bin has equal
area
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 207
Cylindrical Couette Flow
• Tibbs et al. first demonstrated velocity inversion in a rarefied gas
– K.W. Tibbs, F. Baras and A.L. Garcia. Anomalous flow profile due to the curvature effect on slip
length. Physical Review E, 56:2282-2283, 1997.

• R2/R1 = 5/3, STP argon gas, Kn = 0.5, Ma = 0.3


• Simulations repeated with dsmcFoam and results compare well with Tibbs’
data

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 208
Further Results
• Force driven Poiseuille flow
• Hard sphere Kn = 0.1, normalised driving acceleration = 0.22
• Domain was 30 x 30 cells, measurements performed in 40 bins
– Each bin volume = 22.5 times an individual cell volume

• Temperature and density profiles compared to independent DSMC data

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 209
Further Results
• Knudsen minimum shown using mass flux measurements
• Compared to experimental (Ewart et al.) and independent DSMC data
• Aspect ratio (L/h) of the channel for all DSMC simulations is 20
• Experimental aspect ratio is 1000
– Experimental results don’t match the simulation ones as the values proportional to ln (L/h)

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 210
Conclusions

• Low speed, pressure driven boundary conditions have been implemented in


dsmcFoamStrath
• Shown various different microscale problems and how to set up different
boundary conditions and measurements for each one
• The bins method has more binModels
– Angular bins

– Cuboid bins

– Spherical bins

• Other measurement techniques


– Zone measurements – returns spatial average of a combined set of cells

– Cell measurements – traditional ‘sampling cell’ measurements

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 211
Extracting Gas Transport Properties
using DSMC

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 212
DSMC instantaneous density fluctuations with time
CRBS and
dsmcFoam

www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013


tom.scanlon@strath.ac.uk
xxx Slide 213
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 214
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 215
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 216
DSMC instantaneous density fluctuations with time

www.strath.ac.uk/mae
tom.scanlon@strath.ac.uk
xxx Slide 217
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 218
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 219
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 220
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 221
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 222
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 223
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 224
www.strath.ac.uk/mae
tom.scanlon@strath.ac.uk
xxx Slide 225
Thermal Coeff = 1.6403e-05
Sound Damping Coeff = 1.39262e-05
Sound Speed Coeff = 312.077
Sine Coeff = 0.427287

www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013


tom.scanlon@strath.ac.uk
xxx Slide 226
www.strath.ac.uk/mae
tom.scanlon@strath.ac.uk
xxx Slide 227
Conclusions:

• New utility in dsmcFoam to determine time


correlation function of instantaneous density
fluctuations.
• This experimental analog allows us to extract gas
transport properties (thermal conductivity, shear
viscosity etc.) in non-equilibrium situations such
as during combustion.
• Useful for continuum CFD applications.
• Extend work into gas mixtures, di- and
polyatomics and reacting conditions (Q-K).
• Validation with experimental work at UCL.
• Thanks to Alej Garcia.
www.strath.ac.uk/mae DSMC-CRBS 29th Aug.2013
tom.scanlon@strath.ac.uk
xxx Slide 228
Special features of dsmcFoam:
New developments and perspectives

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 229
Developments in dsmcFoam
• To extend the functionality of the standard dsmcFoam
code, we have introduced several new features.

• These include:
– Vibrational energy (see previous lecture on QK)
– Quantum kinetic chemical reactions (see previous lecture
on QK)
– New boundary conditions
– The CLL gas-surface interaction model
– A new measurement framework
– A controller framework

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 230
Boundary conditions
• In standard dsmcFoam, wall boundary patches are
based on Maxwell’s model of diffuse and specular reflections.

• Extensions to this type of wall boundary include the ability to:


– Implement different types of wall patches in the same
simulation.
– Create property gradients across the surface.
– Model rotating surfaces.

• As an alternative to the Maxwell gas-surface interaction model,


the Cercignani-Lampis-Lord (CLL) model has also been
implemented.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 231
CLL gas-surface interaction model
• The Cercignani-Lampis-Lord (CLL) model differs from
Maxwell’s model:
– The normal and tangential components of the reflected
velocity have separate accommodation coefficients (while
they share the same coefficient in Maxwell’s model).
– The scattering angle is always a function of the incoming
angle (while in Maxwell’s model it is independent of the
incoming angle for the diffuse fraction).

• The CLL model has been implemented in dsmcFoam as


follows.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 232
CLL gas-surface interaction model
• Post-interaction normalised normal component of the

particle velocity 𝑢 is:

where,

𝑢 = pre-interaction normalised normal component of


the particle velocity
𝜚 𝑛 = normal energy accommodation coefficient
𝜎𝑛 = normal momentum accommodation coefficient
𝑅𝑓,1 𝑅𝑓,2 = random fractions selected uniformly between 0
and 1

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 233
CLL gas-surface interaction model
• Post-interaction normalised tangential components of
∗ ∗
the particle velocity 𝑣 and 𝑤 are:

where,

𝑣 = pre-interaction normalised normal component of


the particle velocity
𝜚 𝑡 = normal energy accommodation coefficient
𝜎𝑡 = normal momentum accommodation coefficient
𝑅𝑓,3 𝑅𝑓,4 = random fractions selected uniformly between 0
and 1

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 234
CLL gas-surface interaction model

• For diatomic molecules with rotational energy, the


selection of post-interaction rotational energy 𝜔∗ 𝑟 is
analogous to the selection of a normal velocity component,

where,

𝜔𝑟 = pre-interaction rotational energy


𝜚 𝑟 = rotational energy coefficient
𝑅𝑓,5 𝑅𝑓,6 = random fractions selected uniformly between 0
and 1
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 235
CLL gas-surface interaction model

Scattering angle probabilities using the


CLL model.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 236
Measurement/controller frameworks
• An extensive measurement framework has been
added to dsmcFoam, along with a molecular controller
framework.
– Both of these are based on frameworks developed in
OpenFoam’s MD solver, mdFoam.

• Both frameworks utilise:


– the Method of Zones (MOZ)
– the Method of Bins (MOB)

• All measurement and controller tools have been fully


parallelised.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 237
Method of Zones (MOZ)
• The MOZ technique enables the measurement or
control of properties in a user-defined region of a DSMC
domain.
– Measures/controls the spatial average of the zone (spatial
gradients cannot be captured/created).

• A zone consists of a number of connected cells on the mesh.


– Can take any size/shape (including being the whole mesh)
and be at any location on the mesh.
– Can be defined in the blockMeshDict or by using a utility
such as “createSquareZones”.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 238
squareZoneDict
• This dictionary can be used to define any cuboid
shaped zone on the mesh.

• Zones are created by running the “createSquareZones”


command in the case directory.
– Executed after “blockMesh” and before “dsmcFoamStrath”.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 239
Method of Bins (MOB)
• The MOB is useful for measuring or controlling
properties where there is a spatial variation.
– The domain is split into a number of bins and the spatial
average of a given macroscopic property inside each bin is
measured/set.

• The binning method is independent


of the mesh.
– Bins can be smaller/larger than
the cells.
• The MOB has been merged with the
MOZ technique such that user-
defined zone can be split into bins.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 240
Measurement framework
• Our extensive measurement framework allows us to
use a variety of tools to measure both macroscopic and
microscopic properties.

• We define the measurement tools to be used in a simulation


within the fieldPropertiesDict (system folder).
– Each entry in the dictionary is a measurement model.
– We can define exactly which species we are interested in.

• For both the MOZ and the MOB, we have created combined
measurement tools which measure all macroscopic
properties (velocity, pressure, temperature etc.).

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 241
Measurement framework
• It would be much too memory intensive to store
particle properties (e.g. position, velocity) at every time-step
and compute macroscopic properties on completion.
 Instead, we perform measurements “on the fly”, storing
less memory intensive macroscopic properties at each
write interval.

• All measurement tools can perform:


– instantaneous measurements until steady state is
reached (resetting measurements after write out).
– cumulative measurements during the steady-state run
(averaging measurements over time).

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 242
fieldPropertiesDict (MOZ)
• Combined zone measurement tool measures the
spatial average of all macroscopic properties in the specified
zone.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 243
fieldPropertiesDict (MOB)

• Combined bins
measurement tool
measures the
spatial average of all
macroscopic properties in
each bin in the specified
zone.

• For each zone we must


define a start point and
end point, the number of
bins to be used, and the
cross-sectional area of
the bins.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 244
Fluxal measurements
• Macroscopic fluxes from particles crossing faces on
the mesh can be measured.
– OpenFOAM’s particle tracking algorithm keeps track of
particles as they cross faces on the mesh during a time
step.
• Currently, only a mass flux measurement tool has been
implemented in dsmcFoam.
– Useful for measuring mass flow rates in microscale
geometries.
– Could be extended to include momentum flux and energy
flux measurement tools.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 245
Fluxal measurements: mass
• In OpenFOAM, two neighbour cells 𝑃 and 𝑄 are
connected by a common face 𝑓.
• The face normal vector 𝒏𝑓 is defined as being positive in the
direction of owner cell 𝑃 to neighbour cell 𝑄.
• The direction that a particle 𝑖 crosses face
𝑓 can be defined as 𝑠𝑔𝑛 𝒄𝑖 ∙ 𝒏𝑓 :
– If 𝒄𝑖 ∙ 𝒏𝑓 > 0, 𝑠𝑔𝑛 𝒄𝑖 ∙ 𝒏𝑓 = 1
– If 𝒄𝑖 ∙ 𝒏𝑓 < 0, 𝑠𝑔𝑛 𝒄𝑖 ∙ 𝒏𝑓 = −1
– If 𝒄𝑖 ∙ 𝒏𝑓 = 0, 𝑠𝑔𝑛 𝒄𝑖 ∙ 𝒏𝑓 = 0

 This is measured and summed for all particles crossing all


faces each time step.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 246
Fluxal measurements: mass
• The average mass flow rate crossing face 𝑓 is defined
as:

𝑡𝑎𝑣 = time that the mass flow rate is averaged for


𝑁𝑓 (𝑡 → 𝑡𝑛 ) = total number of molecules that cross face 𝑓
during the time period 𝑡 → 𝑡 + 𝑡𝑎𝑣

• The mass flux can then be calculated from 𝑚𝑓 /𝐴𝑓


𝐴𝑓 = area of face 𝑓

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 247
planeSurfacesDict
• This dictionary can be used to define faces/planes
on the mesh.

• We must define start and end points to include only one face.
• Planes are created by running the “createPlaneSurfaces”
command in the case directory.
– Executed after “blockMesh” and before “dsmcFoamStrath”.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 248
fieldPropertiesDict

• For each face, we must


define the direction of
flow that we are
interested in.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 249
Controller framework
• Our controller framework allows us to introduce
control of Lagrangian properties to obtain desired
macroscopic states.

• We use a general feedback loop controller algorithm for


steering a region of the domain (zone or bin) towards a
desired macroscopic state.
– A measured property within a control region is compared
with the target value, and the error serves as the action
for control on particles.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 250
Controller framework
• Controllers which have been implemented in
dsmcFoam include:
– Density Controller
• Counts the particles in a volume, and adds/deletes
particles to reach the target density.
– Temperature Controller
• Adjusts the thermal velocities of particles to alter
temperature, keeping the streaming velocity unchanged.
– Velocity Controller
• Adjusts the streaming velocities of particles, keeping the
thermal velocities (and hence temperature) unchanged.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 251
Controller framework
• We define which controllers should be used in a
simulation within the controllersDict (system folder).
– Each entry in the dictionary is a molecular controller.
– We can define exactly which species we wish to control.

• For the MOZ, a molecular controller is applied throughout a


zone such that the spatial average of the zone set by the
user.

• For the MOB, a molecular controller is implemented in each


individual bin such that a desired spatial gradient be
obtained across a zone.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 252
ControllersDict

• Example: Berendsen
temperature control
• For each zone we define
a start/end point, and the
number and cross-
sectional area of the bins.
• Must also define the start
and end temperature for
each zone.
– A linear temperature
gradient is assumed.

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 253
dsmcFoam::perspectives

DSMC13 Short Course - 20th


www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk Slide 254
Future for dsmcFoam ?

o Collaboration is better than competition.


o Commitment to open source community to
move forward together.
o JWFL happy to assess new developments in
dsmcFoam and coordinate future releases.
o Code distribution using bitbucket/github.
o Welcome suggestions for future developments /
collaborations.
o JWFL running CPD courses in dsmcFoam
early 2014.
o If interested please get in touch www.jwfl.org.uk.
DSMC13 Short Course - 20th
www.strath.ac.uk/mae
October 2013
tom.scanlon@strath.ac.uk
View publication stats Slide 255

Вам также может понравиться