Skip to main content

KISS SciPy-based CCN activation model

Project description

☁️ KISS SciPy-based CCN activation model

PyPI version

📌 overview

ccnact is a simple, yet complete, adiabatic/hydrostatic air-parcel framework employing moving-sectional/particle-resolved aerosol-cloud microphysics, featuring:

  • 🧮 integration using SciPy's interface to LSODA stiff ODE solver
  • 📝 ODE system based on Arabas & Shima 2017 (extended to polydisperse aerosol size spectrum)
  • 🏁 κ-Köhler wet radii equilibration of input dry-size spectrum with SciPy's elementwise root finder
  • 🌪️ capability of resolving aerosol activation, deactivation, drop growth, evaporation and ripening
  • 📈 mulit-modal lognormal (using SciPy's stats routines) spectrum specification (concentration at STP)
  • 🔌 portable across platforms and architectures (CI on Linux, macOS & Windows, on Intel & ARM CPUs)
  • ⚙️ single-function interface allowing to modify every single constant, and returning a tuple of:
    • concentration of activated droplets (at STP)
    • relative humidity (saturation) along the ascent (1D array)
    • wet radii for all sections/particles (2D array)
    • time values (1D array)
  • 🧩 effective interfacing options for Matlab, IDL, Julia, etc
  • ⚖️ unit-aware implemetation using Pint (dimensional analysis enabled for tests only)
  • 🚀 subsecond execution times for common parameter settings
  • 🔗 KISS design: depends on SciPy, NumPy & Pint only; single ~500 LOC file (physics + setup + tests)

The last five points were the key motivating factors for the development - the project originated from a search for a simple, lightweight (in dependencies) and fast CCN activation air-parcel model with concise code, automated testing and no hardcoded constants.

💡 example notebooks

  • exploring dependence of activatied fraction and maximal supersaturation on updraft velocity: View notebook Open In Colab Binder
  • plotting the raw state of the model (saturation and wet radii profiles): View notebook Open In Colab Binder

💻 notes for users

To install the package, try: pip install ccnact

Using from Python:

from ccnact import parcel
help(parcel)
n_act, rh, r_w, time = parcel(...)

Interfacing from Matlab (using the built-in Python bridge):

ccnact = py.importlib.import_module('ccnact');
ccnact.parcel(pyargs(...
   'MAC', 1,...
   'n_bins', int32(100),...
   'p', 101300,...
   'T', 300,...
   'RH', .99,...
   'dt', 1,...
   'nt', int32(100),...
   'w', 2,...
   'sigma', 0.072,...
   'kappa', py.tuple({1}),...
   'meanr', py.tuple({3e-8}),...
   'gstdv', py.tuple({1.5}),...
   'n_tot', py.tuple({1e9})...
))

⚙ notes for developers

To execute the tests after checking out from git: pip install -e .[dev]; pytest ccnact.py

To set-up pre-commit: pip install pre-commit; pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccnact-0.0.8.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccnact-0.0.8-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file ccnact-0.0.8.tar.gz.

File metadata

  • Download URL: ccnact-0.0.8.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccnact-0.0.8.tar.gz
Algorithm Hash digest
SHA256 954b0c13b9173ba503cce6b92d42a266875ecb3a9b516bf22b4eebd796912b6a
MD5 61ecfc8d569f229c72abbe5494ba21b2
BLAKE2b-256 3a3019cec1c6b8264321ab8ef4bd4b54eb10143c9edd3de52ead8537fd1ae6c3

See more details on using hashes here.

File details

Details for the file ccnact-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: ccnact-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccnact-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 45dc2f06fc91fef211ca9eecd5d37dba87a79b141745259b0dd9d0d67b10c410
MD5 3d9355bcf80295448c2af3c105f2eb27
BLAKE2b-256 2000aeec8d18dc53fc3ede4421bfd08abb51efc71d76dd61ffd3cbce3dde907f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page