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.
| Structure | Description | Type/constructor |
|---|---|---|
| 1-D uniform grid | Uniform grid on $[0, L]$ with nx cells | Grid1DUniform |
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
| Structure | Description | Type/constructor |
|---|---|---|
| In-place grid sorter | Sorts particles into their grid cells | GridSortInPlace |
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 condition | Description | Type |
|---|---|---|
| Fully specular wall | Reflects the particle by flipping its normal velocity component | FullySpecularBC1D |
| Fully diffuse wall | Re-emits the particle from a Maxwellian at the wall temperature | FullyDiffuseBC1D |
| Maxwell wall | Mixture of specular and diffuse reflection set by an accommodation coefficient | MaxwellWallBC1D |
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:
| Function | Computes surface properties | Computes post-convection cell index |
|---|---|---|
convect_particles! | no | no |
convect_particles_periodic! (1D uniform grid only) | no | no |
convect_particles! (with SurfProps) | yes | no |
convect_particles_and_compute_cell! | no | yes |
convect_particles_and_compute_cell_periodic! (1D uniform grid only) | no | yes |
convect_particles_and_compute_cell! (with SurfProps) | yes | yes |
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.