Giter Site home page Giter Site logo

pyvap's Introduction

pyvap 0.1.1: kinetic model of particle evaporation

https://travis-ci.org/awbirdsall/pyvap.svg?branch=master

pyvap models evaporation of components from a multicomponent spherical particle. The model follows the treatment of Maxwellian flux given in Atmospheric Chemistry & Physics by Seinfeld and Pandis. The model is written in Python 3, with Scipy's ode solver.

Usage

Example code to model the evaporation of an equimolar mixture of polyethylene trimer and hexamer (PEG-3 and PEG-6) in a particle with starting radius 5 micron, and create a figure of the output:

import pyvap
import matplotlib.pyplot as plt
import numpy as np

# define model parameters
peg3 = {"name": "PEG-3",
        "Dg": 5.95e-6,
        "M": 0.1502,
        "rho": 1108.0,
        "cinf": 0,
        "p298": 6.68e-2,
        "delh": 78.3e+3}
peg6 = {"name": "PEG-6",
        "Dg": 4.26e-6,
        "M": 0.2823,
        "rho": 1180.0,
        "cinf": 0,
        "p298": 3.05e-5,
        "delh": 102.1e+3}
cmpds = [peg3, peg6]
# equimolar mixture of PEG-3 and PEG-6
comp = [0.5, 0.5]
r_init = 5e-6 # starting radius, m
time = 2*60*60 # integration time, s
numpts = 2000 # number of points to integrate
temp = 298 # K

# run model
model = pyvap.analyze_evap(cmpds, comp, r_init, time, numpts, temp,
                           makefig=True)

# display generated figure during, e.g., interactive ipython session
plt.show()

# save generated figure
evap_fig, (evap_ax0, evap_ax1) = model["evap_fig"]
evap_fig.savefig("evaporation.png")

# save csv of evaporation model output (no. of molecules of each component,
# at each timestep)
np.savetxt("evaporation.csv", model["evap_a"], delimiter=",")

Installation

Install using pip.

Install from PyPI:

pip install pyvap

Install most recent Github commit (stability not guaranteed):

pip install git+https://github.com/awbirdsall/pyvap

Dependencies

Tested on Python 2.7 and 3.5.

Requires numpy, scipy, and matplotlib>=1.5 (automatically handled if using pip to install). I recommend using conda to install the Scipy stack on a Windows machine if pip is having issues.

Running the tests requires pytest.

Testing

Tests are located in the tests/ subfolder and can be run using pytest. Tests also require numpy.

Development

Posting issues or pull requests to the github page is welcome!

pyvap's People

Contributors

awbirdsall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lelelovejing

pyvap's Issues

couple evaporation to chemistry

We want to model evaporation as chemistry causes the particle composition to change. Requirements:

  • numeric solver for chemistry (0-D)
  • appropriate treatment of simultaneous solving of both chemistry and evaporation. Code should be kept separate as much as possible, but full single ODE might need to be assembled at the end, since it's probably either not possible, or not a good idea, to jump back and forth between two ODE solvers at each timestep (i.e., want to avoid "re-entrant" integrators).
  • make it easy to define chemistry with some sort of external parameter file(s). Compatibility with evaporation parameter file, and/or chemistry file for a different model, would be good.

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.