# ExoJAX Atmospheric Models: Temperature-Pressure Profiles and Cloud Microphysics Guide

> Explore ExoJAX's comprehensive atmospheric models. Find resources for temperature-pressure profiles and Ackerman-Marley cloud microphysics. Learn more at hajimekawahara/exojax.

- Repository: [Hajime Kawahara/exojax](https://github.com/hajimekawahara/exojax)
- Tags: guide
- Published: 2026-03-03

---

**ExoJAX implements a complete suite of atmospheric modeling tools in the `exojax.atm` package, with temperature-pressure profiles located in [`atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmprof.py) and Ackerman-Marley cloud microphysics handled by [`atm/atmphys.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmphys.py) and [`atm/amclouds.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/amclouds.py).**

The open-source radiative transfer framework ExoJAX (hajimekawahara/exojax) provides JAX-native utilities for constructing exoplanet atmospheres. All atmospheric modeling components reside within the `exojax.atm` subpackage, offering auto-differentiable, JIT-compatible implementations for gradient-based spectroscopic retrievals. These pure-JAX modules enable users to construct custom temperature-pressure structures and sophisticated cloud models while maintaining full compatibility with automatic differentiation.

## Temperature-Pressure Profiles

ExoJAX generates atmospheric structure grids and analytic temperature profiles through the [`atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmprof.py) module. These functions construct the vertical atmospheric foundation required for radiative transfer calculations.

### Log-Spaced Pressure Grids

The `pressure_layer_logspace` function creates the vertical pressure grid that underlies all atmospheric calculations. Located in [`atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmprof.py), this utility generates logarithmically spaced pressure layers suitable for radiative transfer modeling.

```python
from exojax.atm.atmprof import pressure_layer_logspace

# Generate 20 layers from 1 µbar (10^-4 bar) to 100 bar (10^2 bar)

press, dpress, k = pressure_layer_logspace(
    log_pressure_top=-4,   # log10(1e-4 bar)

    log_pressure_btm=2,    # log10(100 bar)

    nlayer=20,
)

```

The function returns the pressure array `press`, the pressure difference array `dpress`, and the index array `k`, all as JAX arrays compatible with JIT compilation.

### Analytic Temperature Profiles

The [`atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmprof.py) module provides several analytic prescriptions for temperature-pressure relationships:

- **`atmprof_Guillot`** – Implements the Guillot (2010) analytic temperature profile for irradiated atmospheres
- **`atmprof_gray`** – Gray atmosphere approximation
- **`atmprof_powerlaw`** – Power-law temperature profile

The following example demonstrates generating a Guillot-type profile:

```python
import jax.numpy as jnp
from exojax.atm.atmprof import atmprof_Guillot

# Atmospheric parameters

gravity = 1.0e3               # cm s^-2

kappa   = 0.01                # IR opacity (cm^2 g^-1)

gamma   = 0.5                 # Visible-to-IR opacity ratio

Tint    = 150.0               # Intrinsic temperature (K)

Tirr    = 1000.0              # Irradiation temperature (K)

# Generate temperature profile

temp = atmprof_Guillot(
    pressures=press,
    gravity=gravity,
    kappa=kappa,
    gamma=gamma,
    Tint=Tint,
    Tirr=Tirr,
    f=0.25,   # Planet-wide averaging factor

)

```

## Cloud Microphysics Implementation

ExoJAX implements the Ackerman & Marley (2001) cloud model through specialized classes in [`atm/atmphys.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmphys.py), supported by utility functions in [`atm/amclouds.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/amclouds.py). These modules compute condensate mixing ratios, particle size distributions, and cloud base pressures using microphysical principles.

### The Ackerman-Marley Cloud Model (`AmpAmcloud`)

The `AmpAmcloud` class in [`atm/atmphys.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmphys.py) provides the primary interface for cloud calculations. This implementation requires a particulates database (`pdb`) and background atmosphere object (`bkgatm`), and computes cloud properties through the `calc_ammodel` method.

Key parameters include:
- **`fsed`** – Sedimentation efficiency parameter
- **`sigmag`** – Geometric standard deviation of particle sizes
- **`Kzz`** – Eddy diffusion coefficient profile
- **`MMR_base`** – Mass mixing ratio at cloud base

```python
from exojax.atm.atmphys import AmpAmcloud
from exojax.atm.atmprof import pressure_layer_logspace

# Initialize pressure grid and temperature

press, _, _ = pressure_layer_logspace(
    log_pressure_top=-4,
    log_pressure_btm=2,
    nlayer=30,
)
temp = jnp.full_like(press, 1500.0)   # Isothermal for illustration

# Initialize cloud model (requires proper database objects in practice)

pdb = None      # Replace with exojax.database.MdbExomol or similar

bkg_atm = None  # Replace with exojax.atm.Atmosphere instance

cloud = AmpAmcloud(pdb=pdb, bkgatm=bkg_atm)

# Compute cloud profile

rg, mmr_cond = cloud.calc_ammodel(
    pressures=press,
    temperatures=temp,
    mean_molecular_weight=jnp.full_like(press, 2.33),  # H2-He mix

    molecular_mass_condensate=60.0,                    # g mol^-1

    gravity=1.0e3,                                     # cm s^-2

    fsed=2.0,
    sigmag=2.0,
    Kzz=jnp.full_like(press, 1e7),                     # cm^2 s^-1

    MMR_base=1e-4,
)

```

### Supporting Cloud Functions

The [`atm/amclouds.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/amclouds.py) module contains lower-level utilities supporting the Ackerman-Marley implementation:

- **`mixing_ratio_cloud_profile`** – Computes condensate mixing ratio vertical profiles
- **`get_rw`** and **`get_rg`** – Calculate particle size distributions (radius of weight `rw` and geometric mean radius `rg`)
- **Terminal velocity calculations** and **dynamic viscosity** computations for atmospheric condensates

These functions handle the microphysical details of cloud formation, including the determination of cloud base pressure and the vertical distribution of condensates based on sedimentation-diffusion balance.

## Utility Modules for Atmospheric Modeling

Beyond the core profile and cloud modules, ExoJAX provides supporting utilities for atmospheric calculations:

- **[`atm/atmconvert.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/atmconvert.py)** – Conversion utilities including `mmr_to_vmr` (mass mixing ratio to volume mixing ratio), `mmr_to_density`, and related functions for switching between atmospheric composition units
- **[`atm/simple_clouds.py`](https://github.com/hajimekawahara/exojax/blob/main/atm/simple_clouds.py)** – Simplified opacity prescriptions such as `powerlaw_clouds` for rapid parameterization of cloud opacity without full microphysical modeling

All atmospheric modules are implemented in pure JAX, ensuring that temperature gradients, cloud opacities, and microphysical parameters remain fully differentiable for gradient-based optimization in Bayesian retrieval frameworks.

## Summary

- **Temperature-pressure profiles** are implemented in [`src/exojax/atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/atmprof.py), providing functions like `pressure_layer_logspace` for grid generation and `atmprof_Guillot` for analytic profiles.
- **Cloud microphysics** follows the Ackerman & Marley (2001) formalism through the `AmpAmcloud` class in [`src/exojax/atm/atmphys.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/atmphys.py), supported by particle physics utilities in [`src/exojax/atm/amclouds.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/amclouds.py).
- All atmospheric models are **pure JAX implementations**, enabling automatic differentiation and JIT compilation for high-performance retrievals.
- **Unit conversion utilities** in [`atmconvert.py`](https://github.com/hajimekawahara/exojax/blob/main/atmconvert.py) facilitate transitions between mass mixing ratios, volume mixing ratios, and number densities.
- The modular structure allows seamless integration of custom T-P profiles and cloud models into differentiable radiative transfer pipelines.

## Frequently Asked Questions

### Where are the temperature-pressure profile functions located in ExoJAX?

All T-P profile utilities reside in [`src/exojax/atm/atmprof.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/atmprof.py). This module contains `pressure_layer_logspace` for generating pressure grids and analytic functions including `atmprof_Guillot`, `atmprof_gray`, and `atmprof_powerlaw` for calculating temperature structures based on different physical assumptions.

### How does ExoJAX implement the Ackerman-Marley cloud model?

ExoJAX implements the Ackerman & Marley (2001) cloud microphysics through the `AmpAmcloud` class in [`src/exojax/atm/atmphys.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/atmphys.py). This class provides the `calc_ammodel` method which computes cloud particle size distributions (`rg`) and condensate mixing ratio profiles given atmospheric conditions, sedimentation efficiency (`fsed`), and eddy diffusion coefficients (`Kzz`).

### Are ExoJAX atmospheric models compatible with automatic differentiation?

Yes. All atmospheric modeling components in `exojax.atm` are implemented in pure JAX, making them fully auto-differentiable and JIT-compatible. This allows users to compute gradients of synthetic spectra with respect to atmospheric parameters (temperature, cloud opacity, mixing ratios) for gradient-based optimization and Hamiltonian Monte Carlo sampling.

### What conversion utilities does ExoJAX provide for atmospheric composition?

The [`src/exojax/atm/atmconvert.py`](https://github.com/hajimekawahara/exojax/blob/main/src/exojax/atm/atmconvert.py) module provides functions to convert between different composition units, including `mmr_to_vmr` (mass mixing ratio to volume mixing ratio), `mmr_to_density`, and related utilities. These conversions are essential for interfacing between atmospheric models that use different units for gas and condensate abundances.