Macroscopic parameters calculation.
We use regular spatial grid and time averaging for sampling. Sampling should start after particle system has reached steady state. Samples are then collected in each cell for a certain number of time steps.
Sampling is performed in
MacroSamplingMonad to ensure consistency of
averaging process. During sampling, basic parameters are calculated
like number of molecules per cell or mean square of thermal velocity.
After sampling these are used to derive final (intensive) parameters
like number density or temperature.
- type MacroSamples = Array U DIM1 BasicMacroParameters
- type MacroField = Array U DIM1 (Point, IntensiveMacroParameters)
- type BasicMacroParameters = (Double, Vec3, Double)
- type IntensiveMacroParameters = (Double, Vec3, Double, Double)
- type MacroSamplingMonad = StateT SamplingState (ReaderT Int GridMonad)
- data SamplingState
- runMacroSampling :: MacroSamplingMonad r -> ParallelSeeds -> Grid -> Body -> Int -> Int -> DSMCRootMonad (r, SamplingState)
- updateSamples :: Ensemble -> MacroSamplingMonad Bool
- getField :: Double -> Double -> MacroSamplingMonad (Maybe MacroField)
Vector which stores averaged macroscropic parameters in each cell.
If samples are collected for M iterations, then this vector is
built as a sum of vectors
V1, .. VM, where
Vi is vector of
parameters sampled on
i-th time step divided by
Array of central points of grid cells with averaged macroscopic parameters attached to every point.
Basic macroscopic parameters calculated in every cell: particle count, mean absolute velocity, mean square of thermal velocity.
Particle count is non-integer because of averaging.
These are then post-processed into number density, flow velocity, pressure and translational temperature.
Note the lack of root on thermal velocity!
Intensive macroscopic parameters available after averaging has completed. These are: number density, absolute velocity, pressure and translational temperature.
Macroscopic sampling monad
Monad which keeps track of sampling process data and stores options of macroscopic sampling.
GridMonad is used to ensure that only safe values for cell count
and classifier are used in
(that may otherwise cause unbounded access errors). Note that
steady condition is not handled by this monad (instead, caller code
should decide when to start averaging).
Inner Reader Monad stores averaging steps setting.
State of sampling process.
|:: MacroSamplingMonad r|
Grid used to sample macroscopic parameters.
Use that many points to approximate every cell volume.
Averaging steps count.
|-> DSMCRootMonad (r, SamplingState)|
Gather samples from ensemble. Return True if sampling is finished, False otherwise.