Giter Club home page Giter Club logo

pyrcel's Introduction

pyrcel: cloud parcel model

sample parcel model run

DOIPyPI VersionCircleCI Build StatusDocumentation Status

This is an implementation of a simple, adiabatic cloud parcel model for use in aerosol-cloud interaction studies. Rothenberg and Wang (2016) discuss the model in detail and its improvements and changes over Nenes et al (2001):

  • Implementation of κ-Köhler theory for condensation physics (Petters and Kreidenweis, 2007)
  • Extension of model to handle arbitrary sectional representations of aerosol populations, based on user-controlled empirical or parameterized size distributions
  • Improved, modular numerical framework for integrating the model, including bindings to several different stiff integrators:

among other details. It also includes a library of droplet activation routines and scripts/notebooks for evaluating those schemes against equivalent calculations done with the parcel model.

Updated code can be found the project github repository. If you'd like to use this code or have any questions about it, please contact the author. In particular, if you use this code for research purposes, be sure to carefully read through the model and ensure that you have tweaked/configured it for your purposes (i.e., modifying the accomodation coefficient); other derived quantities).

Detailed documentation is available, including a scientific description, installation details, and a basic example which produces a figure like the plot at the top of this page.

Quick Start / Installation

To quickly get started with running pyrcel, complete the following steps:

  • Set up a new Python environment; we recommend using mambaforge:
  $ mamba create -n pyrcel_quick_start python=3.11
  • Activate the new Python environment and install the model and its dependencies. If you install the published version from PyPi (recommended), then you also need to install Assimulo using the Mamba package manager - but no other manual dependency installation is necessary:
  $ mamba activate pyrcel_quick_start
  $ pip install pyrcel
  $ mamba install -c conda-forge assimulo
  • Run a test simulation using the CLI tool and a sample YAML file from pyrcel/examples/*.yml (you may want to clone the repository or download them locally):
  $ run_parcel simple.yml
  • Visualize the output NetCDF (should be in the directory you ran the CLI tool, at output/simple.nc)

That's it!

Requirements

Required

Optional

The following packages are used for better numerics (ODE solving)

The easiest way to satisfy the basic requirements for building and running the model is to use the Anaconda scientific Python distribution. Alternatively, a miniconda environment is provided to quickly set-up and get running the model. Assimulo's dependency on the SUNDIALS library makes it a little bit tougher to install in an automated fashion, so it has not been included in the automatic setup provided here; you should refer to Assimulo's documentation for more information on its installation process. Note that many components of the model and package can be used without Assimulo.

Development

http://github.com/darothen/pyrcel

Please fork this repository if you intend to develop the model further so that the code's provenance can be maintained.

License

All scientific code should be licensed. This code is released under the New BSD (3-clause) license.

pyrcel's People

Contributors

darothen avatar dependabot[bot] avatar lompar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyrcel's Issues

Problems with ARG activation for multimode lognormal aerosols

Dear Daniel,

This is Tianning Zhao. I'm currently using PYRCEL for a course project. Thanks a lot for all the efforts to put together parcel model in python, it was really helpful. I was having trouble to run ARG activation for customized multimode lognormal aerosols. The error I was getting is like this: 'MultiModeLognorm' object has no attribute 'mu'. Could you please help me fix this? Thank you.

Quick diagnostic plots

Need a library of convenience methods for producing common plots on

  • supersaturation, temperature, other variable traces
  • diagnosis of time-dependent activation
  • initial / dry / wet vs final aerosol / droplet spectra
  • more as identified

Rename to pyrcel

  • Re-factor code
  • Re-name repository
  • Update github
  • Update readthedocs
  • Update travis
  • Update Zenodo

Implement density temperature correction

Currently, the air temperature is diagnosed in both the thermodynamics and RHS routines by using the virtual temperature, $$T_v \equiv T(1 + 0.61w)$$ Rather - at least and most importantly in the RHS evaluation - it should be diagnosed using density temperature, $$T_\rho \equiv T(1 - q_t + q/\epsilon)$$ where $q_t$ is the total vapor/condensate mixing ratio.

Extensible I/O module

Proposing a user-extensible output module. The basic idea is that a user can pass either a set of default or derived-type classes which encapsulates how to record data to disk. For instance, suppose we have a default writer type

class OutputWriter(object):

    def __init__(self, output_filename):
        self.output_filename = output_filename

    def write_step(self, model_state)
    def finalize(self)

The __init__ and finalize methods take care of maintaining a reference to the output file. The write_step method would be what is called during model runtime. E.g., in a proposed model physics loop:

output_handler = OutputWriter("my_output.csv")

while t < t_end:
    model.step()
    if ( output_step ):
        output_handler.write_step(model.state)
    t += dt

Then any output handlers simply need to implement the interface. Ideally, the write_step file would incrementally add to a file.

Release v1.4.0

A litany of things to do in prep for a nice, new v1.4.0 release:

  • Update documentation to include more references to work using this paper
  • Deprecate all Cython for Numba
  • (potentially) re-factor integration solvers to use a different ODE solver library (either call out to Julia's DifferentialEquations or possibly scikit-odes
  • Re-factor internal arrays to wrap behind xarray
  • Create new Factory-style initialization procedure for easier customizability of the core simulation
  • black formatting
  • More complete type annotations throughout code
  • Deprecate Python <= 3.5 support
  • Move from TravisCI to CircleCI

Quarantine Assimulo dependency

Right now, you can't import any of the model components without a working build of Assimulo. That shouldn't be a requirement - the integrators.pypackage should be refactored to accommodate this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.