5.5. exec/DSMC – direct simulation Monte Carlo
- Purpose
Particle simulation of dilute gas mixtures with direct simulation Monte Carlo, including reservoirs and arbitrary planar surfaces. It serves as a molecular-level reference for the continuum FHD solvers.
- Libraries and build
src_particles(throughMakeDSMC.package),src_geometry,src_analysis,src_rng,src_common; built withUSE_PARTICLES = TRUE,DIM = 3andMAX_SPEC = 8. Application sources (collisions, particle generation, statistics, plotfiles) are inexec/DSMC. Particle data use AMReX particle containers (The ParticleContainer).- Algorithm
After building the surfaces and initialising particles and collision cells, each time step
selects and performs binary collisions in every collision cell (
CalcSelections,CollideParticles);injects particles at reservoir surfaces (
Source);moves particles and applies surface interactions (
MoveParticlesCPP);accumulates statistics (
EvaluateStats), which are reset aftern_steps_skipsteps.
- Species
Each species has a
mass,diameterandT_init. The number of simulated particles per species comes fromparticle_countif it is non-negative, otherwise from the volume fractionphi_domain, otherwise fromrho0and the mass fractionsYk0.particle_neffis the number of real molecules per simulated particle. Withparticle_input > 0, initial positions are read fromparticles.dat.- Surfaces
The six domain faces are always surfaces. Their behaviour follows from the boundary-condition parameters (
bc_vel_*,bc_therm_*,bc_mass_*,t_lo/hi,n_lo/hi, …); for example, reservoir faces inject particles at a prescribed state. Additional surfaces are read from a fileparamplanes.datin the run directory, if present. Its first entry is the number of extra surfaces, followed by one record per surface:x0 y0 z0 origin ux uy uz first in-plane direction vx vy vz second in-plane direction uTop vTop extent along u and v rnx rny rnz right-side normal lnx lny lnz left-side normal porosity specularity temperature density[nspecies] source sink momentumCons (right side) porosity specularity temperature density[nspecies] source sink momentumCons (left side) periodicity area
The notebook
exec/DSMC/py/paramPlane.ipynbgenerates this file, andexec/DSMC/py/paramplanes.datis an example.- Example inputs
inputs_conc: two species under a concentration gradient between mass-conserving reservoirs (bc_vel = 7in x).inputs_conc_gpuis the GPU variant, andtest_inputs/holds periodic-equilibrium, thermal and concentration tests.- Output
pltcu*(conserved variables, instantaneous and mean),pltprim*(primitive variables per species: number density, density, velocity, temperature, pressure, energy, concentration),pltvar*(variances),pltpart*(particles) andplt_SF_prim*(structure factors).- Related applications
exec/phononDSMCandexec/phononDetectorapply the same particle and surface machinery to phonon transport. There, all surfaces come fromparamplanes.dat, with no automatic domain faces.