Grids and particle-surface interaction models

For non-0D simulations, Merzbild.jl provides a spatial grid, particle sorting onto that grid, boundary conditions describing particle–surface interactions, and convection routines that move particles and apply the boundary conditions.

Grids

Currently a single 1-D grid type is implemented.

StructureDescriptionType/constructor
1-D uniform gridUniform grid on $[0, L]$ with nx cellsGrid1DUniform

A Grid1DUniform discretizes the domain $[0, L]$ into nx equal cells; it subtypes AbstractGrid. The grid can be written to disk with write_grid.

Particle sorting

StructureDescriptionType/constructor
In-place grid sorterSorts particles into their grid cellsGridSortInPlace

Particles are sorted into their cells with sort_particles! using a GridSortInPlace instance, which also restores contiguity of the particle indexing (see Particle buffers and contiguous indexing).

Boundary conditions: 1D

Boundary conditions describe how particles interact with the walls at the ends of the 1-D domain. They are collected into a tuple (left wall, right wall) that is passed to the convection routines. All wall types subtype AbstractBC.

Boundary conditionDescriptionType
Fully specular wallReflects the particle by flipping its normal velocity componentFullySpecularBC1D
Fully diffuse wallRe-emits the particle from a Maxwellian at the wall temperatureFullyDiffuseBC1D
Maxwell wallMixture of specular and diffuse reflection set by an accommodation coefficientMaxwellWallBC1D
OutflowDeletes the particle: it leaves the domainOutflowBC
InflowReservoir boundary: emits particles into the domain, deletes those reaching itInflowBC1D

OutflowBC is neither species-specific nor dimension-specific and simply deletes particles reaching the surface. Deletion makes pia non-contiguous so a sort is required before any per-cell operation runs. Outflowing particles are recorded in SurfProps as incident only.

InflowBC1D describes an equilibrium reservoir of a given number density, temperature and streaming velocity adjacent to the surface. It is species-specific, and particles of the domain reaching it are deleted exactly as for an OutflowBC. The velocity of an entering particle is sampled with sample_inflow_velocity using the method described in Garcia and Wagner (2006), and the number flux across the surface is given by compute_inflow_number_flux.

TODO: describe the emission routine that injects the particles into the domain once it is implemented, including the per-particle residual flight time within a timestep.

Both FullyDiffuseBC1D and MaxwellWallBC1D are species-specific, since the thermal reflection velocity depends on the species mass; MaxwellWallBC1D reduces to specular reflection at an accommodation coefficient of 0 and to fully diffuse reflection at a value of 1. These specular/diffuse gas–surface interaction models are the standard DSMC wall models found in Bird (1994).

Periodic BCs for 1D grids are implemented via convection functions that wrap the particle positions, see below.

Convection

Convection moves particles according to their velocities and applies the boundary conditions when particles reach a wall (periodic versions do not take any lists of boundary conditions as input parameters and simply wrap particle coordinates on 1D uniform grids). Six routines are available, distinguished by whether they accumulate surface properties into a SurfProps instance, and by whether they also compute and store each particle's post-convection cell index (into particles.cell, which avoids required an additional pass over all particles during sorting), plus periodic convection versions:

FunctionComputes surface propertiesComputes post-convection cell index
convect_particles!nono
convect_particles_periodic! (1D uniform grid only)nono
convect_particles! (with SurfProps)yesno
convect_particles_and_compute_cell!noyes
convect_particles_and_compute_cell_periodic! (1D uniform grid only)noyes
convect_particles_and_compute_cell! (with SurfProps)yesyes

The surface-property-computing variants take an additional SurfProps argument, into which per-wall incident and reflected fluxes of mass, momentum, and energy are accumulated as particles strike the walls.

The convection routines return the number of particles deleted at OutflowBC and InflowBC1D boundaries (particles reaching an inflow/reservoir boundary are deleted); the periodic convection routine always returns 0 to be consistent with non-periodic convection functions.