This repository contains python scripts for training latent-space machine learning representations of warm rain droplet coalescence (1) with uncertainty quantification (2) and is the companion to a paper titled "Data-Driven Reduced Order Modeling for Warm Rain Microphysics". Superdroplet-enabled simulations of this warm rain formation process provide high information-density training data upon which various data-driven model structures are trained. All structures share in common a latent-space discovery based on an autoencoder (3); differences lie in the varying representation of time-evolving dynamics within the latent space, which utilize one of three model structures: (1) SINDy (4); (2) a neural-network derivative; (3) a finite-time step autoregressor.
You will need to create a Python environment (such as venv or conda) with certain package dependencies, including PyTorch.
Option 1: Using uv (recommended)
After installing uv:
uv syncThis will create a virtual environment with all dependencies. If you don't have Python 3.11.9 available:
uv python install 3.11.9
uv syncOption 2: Using pip
A basic list of required packages can be found in requirements.txt:
pip install -r requirements.txtFor a complete environment specification (MacOS, Python 3.11.9):
pip install -r requirements_os.txtNote: package versions may not be compatible with all operating systems.
- Clone the repository:
git clone <repo_link>
cd mphys-surrogate-model-
Set up your environment (see Prerequisites above)
-
Train a model:
python training_scripts/coalescence/train_coalescence_model.py- Run tests to verify installation:
python tests/test_unified_interface.py- View the documentation (see Building Documentation below)
Core library modules for building and training microphysics reduced-order models:
data_utils.py- PyTorch dataloaders, datasets, and postprocessing utilities including ODE solversmodels.py- Neural network architectures for autoencoders and latent space dynamicsmodel_factory.py- Factory functions for creating model instances from configuration parametersnwi.py- Neural Weighted Integral (NWI) encoder/decoder implementationsrecon_coalescence_losses.py- Loss functions for reconstruction and coalescence physicstraining_utils.py- Training loop utilities and helper functionssave_utils.py- Model checkpointing and result serializationdiagnostics.py- Model performance diagnostics and metricsplotting.py- Visualization tools for predictions and accuracy analysis
End-to-end training and evaluation scripts organized by model type:
Scripts for coalescence microphysics models:
train_coalescence_model.py- Unified training script supporting multiple architectures (AE-SINDy, AE-NNdzdt, AE-AR)optuna_study.py- Hyperparameter optimization using Optunaeval_models_testdata.py- Evaluate trained models on test datasetsrandom_seed_variation.py- Test model stability across random initializationsexport_to_ftorch.py- Export trained models to FTorch format for Fortran integration
Scripts for sedimentation microphysics models:
train_sedimentation_model.py- Training script for sedimentation flux prediction models
See docs/TRAINING_PARAMS.md for complete parameter documentation.
Test suite for validating model interfaces and training pipelines:
test_unified_interface.py- Unit tests for encoder/decoder interface with all combinationstest_all_training_configs.py- End-to-end training pipeline tests
Uncertainty quantification scripts using conformal prediction, including SLURM submission scripts for HPC environments.
Archived trained model weights, diagnostic outputs, and analysis notebooks. Organized by model type (NNWI, Optuna studies, etc.).
Figures and visualizations for the associated manuscript.
Training datasets and data generation pipelines:
erf_data/- Postprocessed netCDF datasets from ERF model with SDM microphysicspysdm/- Jupyter notebooks for generating box-model SDM simulations using PySDM
Note: PySDM data generation requires additional dependencies (see PySDM documentation).
The repository uses Sphinx for API documentation. To build the docs:
cd docs
make htmlThe built documentation will be in docs/build/html/. Open docs/build/html/index.html in your browser to view.
For a complete rebuild:
cd docs
./build_all_docs.shTo see all available build formats:
cd docs
make helpCore contributors to this codebase include:
- Emily de Jong (LLNL) - ekdejong
- Nipun Gunawardena (LLNL) - madvoid
- Jonas Katona (Yale U.) Other co-authors who made this work possible include Hassan Beydoun, Peter Caldwell, and Debo Ghosh.
To cite this work, please cite:
(1) E. K. de Jong, N. Gunawardena, J. E. Katona, et al. Data-Driven Reduced Order Modeling for Warm Rain Microphysics. JGR:ML&C 2026, DOI [10.22541/au.176220214.46858428/v1] (https://www.authorea.com/doi/full/10.22541/au.176220214.46858428/v1) (in press).
(2) J. E. Katona, E. K. de Jong, N. Gunawardena. Uncertainty Quantification for Reduced-Order Surrogate Models Applied to Cloud Microphysics. Accepted to 2025 NeurIPS workshop on Machine Learning for Physical Sciences, (https://arxiv.org/abs/2511.04534).
Several scientific principles and training strategies in this work are based on published work by:
(3) K. D. Lamb, M. van Lier-Walqui, S. Santos, and H. Morrison. Reduced-Order Modeling for Linearized Representations of Microphysical Process rates. JAMES 2024, DOI 10.1029/2023MS003918.
(4) Kathleen Champion, Bethany Lusch, J. Nathan Kutz, and Steven L. Brunton. Data-driven discovery of coordinates and governing equations. PNAS 2019, DOI 10.1073/pnas.1906995116.
This codebase has been released under LLNL-CODE-2012627 and is distributed under the terms of the BSD-Commercial License. See LICENSE and NOTICE.