dsmc 0.1.0.0 → 0.1.0.1
raw patch · 6 files changed
+28/−42 lines, 6 filesdep ~bytestringdep ~containersdep ~mwc-random
Dependency ranges changed: bytestring, containers, mwc-random, primitive, vector
Files
- dsmc.cabal +8/−24
- src/DSMC/Cells.hs +4/−9
- src/DSMC/Macroscopic.hs +1/−1
- src/DSMC/Particles.hs +5/−4
- src/DSMC/Traceables/Parser.hs +4/−4
- src/Data/Splittable.hs +6/−0
dsmc.cabal view
@@ -1,31 +1,15 @@ name: dsmc-description: Direct Simulation Monte Carlo is the numerical- used to model the behavior of rarefied gas flows.- This implementation supports complex bodies- defined using Constructive Solid Geometry, using- uniform grids and ray-casting. Specular, diffuse- and CLL gas-surface interaction models are- provided. Macroscopic parameters of number- density, absolute velocity, pressure and- translational temperature are obtained as the- result of the simulation. The library employs- parallelism on all steps of the DSMC algorithm.- See the dsmc-tools package for command-line- interfaces to the library.-version: 0.1.0.0+version: 0.1.0.1 synopsis: DSMC library for rarefied gas dynamics license: BSD3 license-file: LICENSE author: Dmitry Dzhus maintainer: dima@dzhus.org category: Physics+ build-type: Simple cabal-version: >=1.8-tested-with: GHC == 7.4.1--source-repository head- type: git- location: https://github.com/dzhus/dsmc/+tested-with: GHC == 7.6.1 library ghc-options: -Wall -O2 -funbox-strict-fields -Odph -rtsopts -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -fllvm -optlo-O3@@ -52,14 +36,14 @@ build-depends: attoparsec == 0.10.*, base == 4.*,- bytestring == 0.9.*,- containers == 0.4.*,+ bytestring == 0.10.*,+ containers == 0.5.*, entropy == 0.2.*, hslogger == 1.2.*,- mwc-random >= 0.12.0.1,+ mwc-random == 0.12.*, parallel == 3.2.*,- primitive == 0.4.*,+ primitive == 0.5.*, repa == 3.2.*, strict == 0.3.*, transformers == 0.3.*,- vector == 0.9.*+ vector == 0.10.*
src/DSMC/Cells.hs view
@@ -75,15 +75,10 @@ -- > cell1 c2 c3 -- > l1=9 l2=4 l3=6 ----- By using this storage scheme we allow fast particle classification--- (see 'classifyParticles'). Slicing from contiguous memory block to--- obtain contents of single cell is O(1) operation, and we maintain--- data locality.--- -- Note that any extra data about cells (like position or volume) -- should be maintained separately from cell contents. We use this -- approach because collision sampling and macroscopic parameter--- calculation require different extra arguments.+-- calculation require different data Cells = Cells !CellContents !Int !(VU.Vector Int) !(VU.Vector Int) @@ -115,7 +110,7 @@ classifyAll :: Classifier -> Ensemble -> (VU.Vector Int) classifyAll classify ens = runST $ do classes' <- R.computeP $ R.map classify ens- return $! R.toUnboxed classes'+ return $ R.toUnboxed classes' -- | Classify particle ensemble into @N@ cells using the classifier@@ -147,7 +142,7 @@ lengths <- VU.unsafeFreeze lengths' -- Starting positions for cells inside cell array- let !starts = VU.prescanl' (+) 0 lengths+ let starts = VU.prescanl' (+) 0 lengths -- Calculate indices for particles inside classified grand vector of -- cell contents (inverse mapping index)@@ -165,7 +160,7 @@ (\(R.Z R.:. position) -> ens VU.! (classifiedIds VU.! position)) - return $! Cells (R.toUnboxed classifiedEns) cellCount starts lengths+ return $ Cells (R.toUnboxed classifiedEns) cellCount starts lengths -- | Domain divided in uniform grid with given steps by X, Y and Z
src/DSMC/Macroscopic.hs view
@@ -117,7 +117,7 @@ -> BasicMacroParameters -> IntensiveMacroParameters makeIntensive !m !w !vol !(n, vel, c) =- if (n == 0 || vol == 0)+ if n == 0 then (0, (0, 0, 0), 0, 0) else (numDens, vel, c * dens / 3, m * c / (3 * boltzmann)) where
src/DSMC/Particles.hs view
@@ -53,8 +53,8 @@ deriving (Show) --- | Calculate what model concentration will simulate real flow--- concentration wrt statistical weight of single particle.+-- | Calculate model concentration to simulate real flow concentration+-- wrt statistical weight of single particle as set in flow options. modelConcentration :: Flow -> Double modelConcentration flow = (concentration flow) / (statWeight flow) @@ -68,16 +68,17 @@ emptyEnsemble = fromUnboxed1 $ VU.empty --- | Amount of particles in ensemble.+-- | Amount of particles in an ensemble. ensembleSize :: Ensemble -> Int ensembleSize ens = n where (R.Z R.:. n) = R.extent ens + -- | Print particles, one per row, using the format: -- -- > x y z u v w -- -- where @x y z@ are position coordinates and @u v w@ are velocity--- components.+-- components. This is handy for debugging purposes. printEnsemble :: Ensemble -> IO () printEnsemble particles = do VU.forM_ (R.toUnboxed particles)
src/DSMC/Traceables/Parser.hs view
@@ -74,21 +74,21 @@ -- | Transformer which adds lookup table to underlying monad.-type Table a k v = StateT (M.Map k v) a+type TableT a k v = StateT (M.Map k v) a -- | Add entry to the lookup table.-addEntry :: (Ord k, Monad a) => k -> v -> Table a k v ()+addEntry :: (Ord k, Monad a) => k -> v -> TableT a k v () addEntry key value = liftM (M.insert key value) get >>= put -- | Lookup entry in the table.-getEntry :: (Ord k, Monad a) => k -> Table a k v (Maybe v)+getEntry :: (Ord k, Monad a) => k -> TableT a k v (Maybe v) getEntry key = liftM (M.lookup key) get -- | Parser with lookup table.-type CSGParser = Table Parser String T.Body+type CSGParser = TableT Parser String T.Body lp :: Parser Char
src/Data/Splittable.hs view
@@ -1,3 +1,9 @@+{-|++Splittable containers abstraction.++-}+ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}