Skip to content

photochem v0.9.3

Latest

Choose a tag to compare

@Nicholaswogan Nicholaswogan released this 13 Nov 02:08

This release adds atmospheric state persistence, pressure-dependent custom
optical properties, and a fixed-point photochemistry–climate solver. Gas-giant
state restoration now uses the shared atmospheric state machinery.

Atmospheric state persistence

  • Added EvoAtmosphereState for capturing and restoring an initialized
    atmosphere, including its grid, composition, temperature, eddy diffusion,
    particle radii, persistent pressure profiles, TOA-pressure maintenance, and
    custom optical properties.
  • Added HDF5 save/load and dictionary interchange using independent NumPy
    arrays. Restoration recomputes derived atmospheric properties and initializes
    subsequent integration with fresh solver history.
  • Boundary conditions, callbacks, and general solver controls are configured
    on the destination model.
from photochem import EvoAtmosphereState

state = pc.model_state()
state.save_to_h5("atmosphere.h5")
pc.initialize_from_state(EvoAtmosphereState("atmosphere.h5"))

saved = state.to_dict()
pc.initialize_from_state(EvoAtmosphereState.from_dict(saved))

Custom optical properties

  • Added EvoAtmosphere.set_custom_optical_properties() with profiles prescribed
    on hydrostatic pressure and evaluated as the atmosphere evolves or is regridded.
  • Both EvoAtmosphere and Clima now accept an explicit integer tau_mode.
    Mode 1 specifies extinction per cm, and mode 2 specifies extinction per
    log10 pressure interval. Both APIs accept wavelength, pressure, extinction,
    single-scattering albedo, and asymmetry parameter arrays.
  • Pressure interpolation uses constant extrapolation beyond the supplied grid.
    The per-pressure-decade mode converts to layer optical depth using the local
    hydrostatic scale height and layer thickness.
  • Invalid optical inputs are rejected, and failed prescription replacements
    preserve the previously installed optics.

Photochemistry–climate coupling

  • Added CoupledPhotochemistryClimate and FixedPointSolver for haze-free
    rocky-planet calculations coupling photochemical steady state to
    radiative-convective equilibrium.
  • The solver iterates surface pressure and the temperature profile, with
    damping, optional Anderson acceleration, and aligned iteration diagnostics.
    Anderson acceleration uses a history of three differences by default.
  • Added initial-guess construction and restartable coupled states. Climate
    condensates retain climate-determined vertical profiles, with surface
    constraints supplied by photochemical boundary conditions and abundances.
  • Fixed-point and chemical convergence are reported separately.

Gas-giant persistence

EvoAtmosphereGasGiant.model_state() now returns a GasGiantState containing
an EvoAtmosphereState plus climate-grid and deep-atmosphere profiles,
metallicity, C/O, reference geometry, and the gas lower-boundary prescription.
Use initialize_from_state() to restore it into a compatible model.

from photochem.extensions import GasGiantState

state = pc.model_state()
saved = state.to_dict()
pc.initialize_from_state(GasGiantState.from_dict(saved))

API migration

  • Clima's rad.set_custom_optical_properties() renames dtau_dz to dtau
    and requires tau_mode. Existing per-cm prescriptions should pass
    tau_mode=1.
  • Replace assignments to pc.var.tauc, pc.var.w0c, and pc.var.g0c with
    pc.set_custom_optical_properties(...). Evaluated layer properties are
    available as read-only arrays on pc.wrk. Convert old layer optical depths
    to extinction per cm by dividing by the corresponding layer thicknesses
    when constructing a mode-1 prescription.
  • Gas-giant model_state_to_dict() and initialize_from_dict(out=...) remain
    available as wrappers and are being phased out. They now use the new
    dictionary format. Previously saved gas-giant dictionaries are unsupported.

Fixes and validation

  • Fixed Clima's surface heat-flow contribution to the RCE energy residuals.
  • Fixed coupled-model construction with particle-free mechanisms.
  • Preserved an active ordinary CVODE stepper when gas-giant restoration
    rejects a candidate before modifying the atmosphere.
  • Replaced autodiff-based linear-interpolation derivatives with analytical
    slopes, checked locally against the previous implementation.
  • Expanded state, optics, and restart tests. Release validation covered the
    Fortran and Python suites, a complete coupled solve and converged restart,
    Modern Earth evolution, gas-giant trajectory restoration, and an installed
    0.9.3 wheel. GitHub Actions passed before release-note preparation.

Full Changelog: v0.9.2...v0.9.3