Repository navigation
photochem v0.9.0
Photochem v0.9.0 is a large pre-1.0 release that substantially updates the photochemical model, integrates the Clima and Equilibrate implementations into the repository and build, expands the public Python interfaces, strengthens numerical behavior and diagnostics, reorganizes testing and packaging, and introduces the first official documentation website.
Documentation: https://nicholaswogan.github.io/photochem/
Highlights
- Photochem, Clima, and Equilibrate are now built from their in-tree Fortran sources and Cython bindings as one versioned package.
EvoAtmospherecan be configured without an initial atmosphere file and then initialized explicitly from altitude- or pressure-based profiles.- Pressure-based temperature and eddy-diffusion profiles can remain persistent during integration, with optional top-of-atmosphere pressure maintenance.
- The shared robust integration path now supports both rocky-planet and gas-giant workflows.
- Production-and-loss diagnostics now account for chemistry, condensation and evaporation, rainout, transport, boundary fluxes, distributed sources, custom rates, and hydrogen escape.
- An analytical chemistry Jacobian is now the default and is tested against automatic differentiation.
- New MkDocs documentation includes installation and development guidance, generated API documentation, and executable tutorials for rocky-planet photochemistry, rocky-planet climate, and gas-giant photochemistry.
Photochemical model
Atmospheric initialization and profiles
- The atmosphere file passed to
EvoAtmosphereis now optional. Constructing a model without it loads the mechanism, settings, stellar spectrum, and other static data while leaving atmospheric operations guarded until initialization succeeds. - Added
initialize_atmosphere_zfor altitude, temperature, eddy diffusion, composition, and optional particle-radius profiles. - Added
initialize_atmosphere_pfor pressure-based profiles. The method constructs altitude hydrostatically and can retain temperature and eddy diffusion as functions of pressure. - Both explicit initializers accept partial species dictionaries, validate the complete input before committing it, and leave an existing model state unchanged after a failed reinitialization.
- When
mix=None, the new initializers can infer an initial gas composition from fixed-partial-pressure lower boundary conditions, including relative-humidity caps and upward cold trapping for potentially condensing gases. - Added
atmosphere_initializedso callers can inspect the model lifecycle explicitly. - Added persistent pressure-profile controls through
set_press_temp_edd_profile,clear_press_temp_edd_profile, and the pressure initializer. - Atmospheric grid changes and initialization now use transactional state preparation so failures do not partially mutate the model.
Integration and vertical-grid behavior
- Centralized ordinary and robust CVODE setup, restart, recovery, and counter handling.
- Hardened
update_vertical_grid, including failure-atomic regridding and a bracketed top-pressure solve. - Added optional approximate top-of-atmosphere pressure maintenance for persistent pressure-profile integrations. The default target is
0.1 dyn/cm^2, and the behavior can be configured or disabled through the persistent-profile API. - Gas-giant integrations now use the shared Fortran robust stepper instead of maintaining a separate Python implementation.
evolveis now a fixed-grid trajectory integrator. Dynamic top-of-atmosphere changes are handled explicitly byupdate_vertical_gridor by robust-stepper pressure maintenance.
Chemistry and diagnostics
- Expanded
production_and_lossto return resolved profiles and column integrals for all modeled contributions to a selected species, together with total production, total loss, and net tendencies. - Added analytical derivatives for ordinary and particle reactions, short-lived species, gas rainout, and finite-rate condensation and evaporation. The analytical chemistry Jacobian is now the default; automatic differentiation and finite differences remain selectable.
- Refactored the chemistry and boundary-condition tendency assembly so the right-hand side, Jacobian, and diagnostics use consistent process definitions.
- Added Python access to additional prepared atmospheric state, including rainout and resolved production-and-loss information.
- Added support for charged species names such as
H+andH-in reaction and species parsing. - Added stricter validation of particle radii and optical-property inputs.
Climate and chemical equilibrium
- Imported the Clima Fortran implementation, C API, Cython bindings, and tests into this repository while preserving the
photochem.climaimport path. - Documented the
AdiabatClimate, radiative-transfer, and utility interfaces and exposed additional RCE solver controls and status information through Python. - Exposed
rebin_with_errorsfromphotochem.climaalongsiderebin. - Imported the Equilibrate Fortran implementation, C API, Cython bindings, and tests while preserving the
photochem.equilibrateimport path. - Expanded
ChemEquiAnalysiswith species, gas, and condensate masses; phase-resolved mole fractions; mass fractions; and thermodynamic outputs includingnabla_ad,gamma2, density, and heat capacity. - Standardized component-specific Python exceptions and clarified Fortran and Python documentation throughout Clima and Equilibrate.
Utilities and model data
solar_spectrumnow uses the packaged Thuillier et al. (2004) ATLAS-1 spectrum supplied byphotochem_clima_datarather than requiring the reference spectrum to live in this repository.- Updated the climate-file helpers, stellar-spectrum utilities, atmosphere conversion helpers, and gas-giant extension for the new initialization and profile APIs.
- Added Python helpers for reading and reformatting
evolveoutput. - Photochem now targets
photochem_clima_datav0.3.2.
Packaging, tests, and repository organization
- Migrated Python builds from
setup.pyand scikit-build topyproject.tomland scikit-build-core. - Consolidated package version ownership in the top-level CMake project and reorganized sources into component-owned
src/,bindings/, andtests/directories. - Added
environment-dev.ymlfor reproducible source-build and documentation dependencies. - Reorganized tests into independent Photochem, Clima, and Equilibrate suites with self-contained fixtures.
- CI now performs a clean CMake build, Fortran correctness tests, Valgrind coverage of all three model components, source-distribution and wheel builds, installed-package Python tests, and a Linux executable-stack check.
- Removed the legacy
examples/directory. Its maintained introductory workflows are now executable documentation tutorials.
Documentation
- Added an MkDocs Material website with generated API documentation for Photochem, Clima, Equilibrate, the gas-giant extension, and public utilities.
- Added tutorials for modern-Earth photochemistry, rocky-planet climate, and WASP-39b-like gas-giant photochemistry.
- Added installation, source-build, and contribution guides.
- Documentation builds execute all tutorials, expose their Jupytext Python sources for download, and deploy to GitHub Pages from
main.
Compatibility notes
- The minimum supported Python version is now 3.9, increased from 3.6.
- Existing construction with an
atmosphere.txtfile remains supported. Code that omits the file must callinitialize_atmosphere_zorinitialize_atmosphere_pbefore using atmosphere-dependent methods. PhotochemVars.usol_inithas been removed. The committed atmospheric state is stored inPhotochemWrk.usol.regrid_prep_atmosphereand the legacy automatic moving-top controlsP_top_min,P_top_max, andtop_atmos_adjust_frachave been removed. Useupdate_vertical_gridor persistent-profile top-pressure maintenance.- The obsolete self-consistent evolving-climate mode and its
EvoAtmosphereclimate properties have been removed. Usephotochem.clima.AdiabatClimatefor climate calculations. - The
conserving-initializationsetting has been removed; legacy atmosphere-file initialization uses the established non-conserving interpolation. fix-water-in-troposphere: trueandwater-condensation: trueare no longer supported. Represent water through ordinary boundary conditions and, when required, particle condensation.- Atmospheric grid settings now specify the number of layers; explicit altitude- or pressure-based initialization determines the model domain.
- Because v0.9.0 intentionally precedes API stabilization at v1.0, users with custom settings, direct access to internal state, or specialized grid-management code should review these notes and the current API documentation before upgrading.
Deferred documentation
The input-file reference, model-explanation page, Chemical Equilibrium tutorial, Habitable Zone tutorial, additional coupled-workflow tutorials, full citation page, and historical versioned documentation are deferred until after this release.
Full Changelog: v0.8.4...v0.9.0