Git Product home page Git Product logo

photochem's Introduction

Photochem

Photochem is a photochemical and climate model of planet's atmospheres. Given inputs, like the stellar UV flux, the atmospheric temperature structure, etc., this code will find the steady-state chemical composition of an atmosphere, or evolve atmospheres through time. The code also contains 1-D climate models and a chemical equilibrium solver.

Installation

Option 1: Conda

conda install -c conda-forge photochem

Option 2: From source

You need a Fortran compiler (gfortran>=9.30, install instructions here) and C compiler (e.g. install with conda install -c conda-forge clang)

Create a conda environment with all dependencies

conda create -n photochem -c conda-forge python numpy scipy pyyaml numba scikit-build cython cmake ninja pip hdf5 fypp

Clone this Gitub repository:

git clone --depth=1 --recursive https://github.com/Nicholaswogan/photochem.git

Navigate to the root directory with a terminal, activate your new conda environment, then install with pip:

conda activate photochem
python -m pip install --no-deps --no-build-isolation .

Examples/Tutorial

Check out the examples directory.

History

In the 1980s Kevin Zahnle and Jim Kasting wrote the Atmos photochemical model in Fortran 77. An updated version of this code is maintained at this link by some excellent people at NASA Goddard. In December 2020, I reworked the Atmos photochemical model in Fortran 90, and made a Python wrapper to it using numpy.f2py. This resulted in PhotochemPy. PhotochemPy has several fundamental limitations that makes it challenging to build upon. So, starting Spring 2021, I began re-writing the model in Modern Fortran (2008) which resulted in this package.

Contact

If you have questions email me: [email protected]

Funding and Acknowledgements

Funding for the development of Photochem comes from

This model was build in collaboration with

  • David Catling
  • Kevin Zahnle
  • Mark Claire
  • Sandra Bastelberger
  • Shawn Domagal-Goldman
  • Josh Krissansen-Totton

photochem's People

Contributors

nicholaswogan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

photochem's Issues

Moses boundary condition for particles is wrong

Moses boundary condition makes sense for gases. But it does not make sense for particles. Particles should be fallout out of the bottom of the model, but they only diffuse out when Moses is used

add topics

I suggest adding the topics atmosphere, photochemical-model as you did for photochempy. Maybe earth-science too.

Climate model

Would be cool to also include a 1-D climate model. This could be used on its own, but could also coupled in a time-dependent fashion to the photochemical model.

Memory leak

Memory will leak here or here if an error occurs before the memory is deallocated.

Error with installation

Hello,

I'm following the instructions to install photochem, but I ran into an error when I tried to run part of the code:
python -m pip install --no-deps --no-build-isolation

Here's the error shown:
ERROR: You must give at least one requirement to install (see "pip help install")

What can I do to fix this issue? Thanks!

DIFFUSION ISSUE!!!

Looks like I'm screwing up molecular diffusion. There isn't conservation of H2 the atmosphere. There is MORE escaping than is being pushed into the atmosphere from the surface.

It has something to do with the ADU and ADL coefficients. I know this because when I neglect molecular diffusion, then there is conservation. Need to carefully step through all of this.

Implement second order upwind scheme for particle advection

Right now we are using a first order upwind scheme for particles falling. This is very diffusive. We can do better with a second order finite volume upwind scheme.

See Chapter 6 in LeVeque.

One potential issue is that these schemes depend on the size of the timestep. We can get the size of the timestep from CVODE, in the RHS function. I just worry that this will be an issue.

Stable finite differencing for advection

Right now I'm using center differencing for advection terms. This causes instability for particles falling. We can improve this by using a "upwind" differencing scheme.

Add redox state calculations

I'm thinking atoms should be specified like this

atoms:
  - {name: H, mass: 1, redox: - 0.5}

Then we can compute redox state of everything and check for redox conservation.

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.