dsmc- DSMC library for rarefied gas dynamics

Safe HaskellNone




Domain operations: defining domains; free flow boundary conditions & clipping for DSMC steps.

PRNG required to sample molecular velocities implies monadic interface for most of operations. We use functions specifically typed for ST.



data Domain Source

Domain in which particles are spawned or system evolution is simulated.


Domain !Double !Double !Double !Double !Double !Double

Rectangular volume, given by min/max value on every dimension.


getDimensions :: Domain -> (Double, Double, Double)Source

Calculate width, length and height of a domain, which are dimensions measured by x, y and z axes, respectively.

getCenter :: Domain -> PointSource

Calculate geometric center of a domain.



:: Point

Center point.

-> Double

X dimension.

-> Double

Y dimension.

-> Double

Z dimension.

-> Domain 

Create a rectangular domain with center in the given point and dimensions.

Flow boundary

initializeParticles :: Domain -> Flow -> Body -> Seed -> (Ensemble, Seed)Source

Fill the domain with particles for given flow parameters. Particles inside the body are removed.



:: DomainSeeds 
-> Domain

Simulation domain.

-> Double

Interface domain extrusion length.

-> Flow 
-> Ensemble 
-> (Ensemble, DomainSeeds) 

Sample new particles in 6 interface domains along each side of rectangular simulation domain and add them to existing ensemble.

This function implements open boundary condition for three-dimensional simulation domain.

Interface domains are built on faces of simulation domain using extrusion along the outward normal of the face.

In 2D projection:

          |    Interface1   |
       |I3|    Simulation   |I4|
       |  |      domain     |  |
          |        I2       |

Particles in every interface domain are spawned in parallel using Strategies.

type DomainSeeds = (Seed, Seed, Seed, Seed, Seed, Seed)Source

PRNG seeds used by particle generators.

clipToDomain :: Domain -> Ensemble -> EnsembleSource

Filter out particles which are outside of the domain.

Free volume calculation



:: Domain 
-> Body 
-> Int

Use that many points to approximate the body volume.

-> GenST s 
-> ST s Double 

Volume of a domain unoccupied by a given body, in m^3.

We use Monte Carlo method to calculate the approximate body volume and then subtract it from the overall domain volume.

freeVolumes :: Body -> Int -> GenST s -> Vector Domain -> ST s (Vector Double)Source

Sequential freeVolume for a vector of domains.