StochParticles.jl
A SciML-native Julia framework for particle-resolved Monte Carlo simulation of aerosol and colloidal population dynamics.
Overview
StochParticles.jl models particle populations as Piecewise Deterministic Markov Processes (PDMPs), seamlessly combining continuous ODE dynamics (condensational growth) with discrete stochastic events (coagulation, emission, dilution) through the SciML ecosystem.
Architecture
┌─────────────────────────────────────────────────────┐
│ User API: ParticleProblem, solve, diagnostics │
├─────────────────────────────────────────────────────┤
│ Physics Processes (pluggable traits) │
│ Condensation · Coagulation · Emission · Dilution │
├─────────────────────────────────────────────────────┤
│ Core: ParticleSystem, CNMC, JumpProblem assembly │
└─────────────────────────────────────────────────────┘Features
- Compile-time specialization — species count
Ais a type parameter; all inner loops are fully type-stable - Trait-based process system — each physics process declares whether it provides ODE drift and/or jumps
- CNMC particle management — Constant Number Monte Carlo with mass-conserving merge, clone, and volume rescale
- SciML integration — produces standard
JumpProblemobjects solvable withTsit5(),SSC1(), or any SciML algorithm
Installation
using Pkg
Pkg.add(url="https://github.com/VANvonZHANG/StochParticles.jl")Quick Start
julia> cond = CondensationProcess((μ, g, t) -> -0.01 .* μ)ERROR: UndefVarError: `CondensationProcess` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in StochParticles.julia> kernel = BrownianKernel(293.15, 101325.0, SVector(1800.0))ERROR: UndefVarError: `BrownianKernel` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in StochParticles.julia> coag = CoagulationProcess(kernel, GlobalMajorant())ERROR: UndefVarError: `CoagulationProcess` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in StochParticles.julia> particles = fill(SVector(1.0e-15), 50)ERROR: UndefVarError: `SVector` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in StaticArraysCore. - Also exported by StaticArrays (loaded but not imported in Main).julia> gas_fn = t -> SVector(0.0)#5 (generic function with 1 method)julia> prob = ParticleProblem(particles, 1.0, gas_fn, (cond, coag); tspan=(0.0, 10.0), n_sim=50)ERROR: UndefVarError: `cond` not defined in `Main` Suggestion: add an appropriate import or assignment. This global was declared but not assigned. Hint: a global variable of this name also exists in LinearAlgebra.julia> sol = solve(prob, Tsit5())ERROR: UndefVarError: `solve` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in CommonSolve. - Also exported by SciMLBase (loaded but not imported in Main). - Also exported by BracketingNonlinearSolve (loaded but not imported in Main). - Also exported by DiffEqBase (loaded but not imported in Main). - Also exported by JumpProcesses (loaded but not imported in Main). - Also exported by OrdinaryDiffEqCore (loaded but not imported in Main). - Also exported by LinearSolve (loaded but not imported in Main). - Also exported by SimpleNonlinearSolve (loaded but not imported in Main). - Also exported by NonlinearSolveFirstOrder (loaded but not imported in Main). - Also exported by NonlinearSolveQuasiNewton (loaded but not imported in Main). - Also exported by NonlinearSolveSpectralMethods (loaded but not imported in Main). - Also exported by NonlinearSolve (loaded but not imported in Main). - Also exported by OrdinaryDiffEqExtrapolation (loaded but not imported in Main). - Also exported by OrdinaryDiffEqStabilizedRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqStabilizedIRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqLowStorageRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqSSPRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqFeagin (loaded but not imported in Main). - Also exported by OrdinaryDiffEqSymplecticRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqRKN (loaded but not imported in Main). - Also exported by OrdinaryDiffEqVerner (loaded but not imported in Main). - Also exported by OrdinaryDiffEqHighOrderRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqSDIRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqBDF (loaded but not imported in Main). - Also exported by OrdinaryDiffEqTsit5 (loaded but not imported in Main). - Also exported by OrdinaryDiffEqRosenbrock (loaded but not imported in Main). - Also exported by OrdinaryDiffEqDefault (loaded but not imported in Main). - Also exported by OrdinaryDiffEqFIRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqQPRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqPDIRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqPRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqLowOrderRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqFunctionMap (loaded but not imported in Main). - Also exported by OrdinaryDiffEqAdamsBashforthMoulton (loaded but not imported in Main). - Also exported by OrdinaryDiffEqNordsieck (loaded but not imported in Main). - Also exported by OrdinaryDiffEqExplicitRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEqLinear (loaded but not imported in Main). - Also exported by OrdinaryDiffEqIMEXMultistep (loaded but not imported in Main). - Also exported by OrdinaryDiffEqExponentialRK (loaded but not imported in Main). - Also exported by OrdinaryDiffEq (loaded but not imported in Main).
Unit Convention
All quantities use SI units: masses in kg, volumes in m³, temperatures in K, viscosities in Pa·s, densities in kg/m³.
Contents
- Tutorial — step-by-step walkthrough of setting up a simulation
- API Reference — complete documentation of all exported types and functions