How to Set Up Temperature-Pressure Profiles in ExoJAX: Complete Configuration Guide

Setting up temperature-pressure profiles in ExoJAX requires instantiating the ArtCommon class with pressure boundaries (pressure_top, pressure_btm) and layer count (nlayer), then selecting from built-in analytic temperature functions or providing a custom array.

ExoJAX is a differentiable radiative transfer code for exoplanet atmospheres built on JAX. Configuring accurate temperature-pressure profiles forms the computational foundation of atmospheric retrievals and forward models, requiring specific grid parameters and temperature prescription methods defined in the core radiative transfer modules according to the hajimekawahara/exojax source code.

Core Requirements for Pressure Grid Construction

To initialize a 1-D atmospheric structure, you must specify three mandatory parameters in ArtCommon.__init__ located in src/exojax/rt/common.py:

  • Pressure boundaries: pressure_top and pressure_btm (in bar) define the vertical extent of the model atmosphere at lines 23-30
  • Layer resolution: nlayer (int) sets the number of discrete atmospheric shells at lines 45-48
  • Reference point: reference_point (default 0.5) specifies the fractional location within a layer where representative pressure is calculated—0 for the upper bound, 0.5 for mid-layer, 1 for the lower bound at lines 35-38

Generating the Pressure Grid

Upon instantiation, ArtCommon automatically calls pressure_layer_logspace from src/exojax/atm/atmprof.py (lines 10-49) to generate three critical arrays:

  • self.pressure: Log-spaced pressure array of length nlayer
  • self.dParr: Layer thickness array representing the pressure difference across each shell
  • self.pressure_decrease_rate: The pressure decrease factor k defining the log-space spacing

Configuring Temperature Profiles

ExoJAX supports both analytic and custom temperature prescriptions through methods defined in ArtCommon. All temperature arrays must match the nlayer dimension of the pressure grid.

Built-in Analytic Profiles

The following methods wrap analytical functions from atmprof.py and return JAX arrays:

  • powerlaw_temperature: Implements power-law T(P) = T₀(P/1 bar)^α using atmprof_powerlow at src/exojax/atm/atmprof.py lines 176-188
  • gray_temperature: Computes grey-atmosphere equilibrium using atmprof_gray at lines 190-202, requiring surface gravity and IR opacity
  • guillot_temperature: Calculates irradiated atmosphere profiles via atmprof_Guillot at lines 209-226, extending the grey model with irradiation temperature and gamma parameters

Custom Temperature Arrays

For user-provided structures, custom_temperature (lines 140-151 in src/exojax/rt/common.py) accepts any JAX or NumPy array of length nlayer. This enables integration of external general circulation model outputs or arbitrary temperature structures.

Optional Temperature Constraints

You can enforce physical bounds using change_temperature_range (lines 64-71) to set Tlow and Thigh, then apply clipping via clip_temperature to any profile output.

Height-Dependent Calculations

When computing atmospheric scale height or variable gravity profiles, you must provide additional physical parameters to ArtCommon:

  • Gravity (cm s⁻²)
  • Mean molecular weight
  • Planetary radius

These are required for the atmosphere_height and gravity_profile methods (lines 55-70 and 93-115 in common.py), which depend on hydrostatic equilibrium calculations.

Implementation Workflow

  1. Instantiate ArtCommon with pressure_top, pressure_btm, and nlayer
  2. The constructor automatically generates the log-spaced pressure grid via pressure_layer_logspace
  3. Select a temperature prescription: powerlaw_temperature, gray_temperature, guillot_temperature, or custom_temperature
  4. Optionally apply temperature bounds using change_temperature_range and clip_temperature

Complete Code Example


# -------------------------------------------------

# 1. Create a pressure grid (20 layers from 1e-8 to 100 bar)

# -------------------------------------------------

from exojax.rt.common import ArtCommon

art = ArtCommon(
    pressure_top=1.0e-8,   # bar

    pressure_btm=1.0e+2,   # bar

    nlayer=20,
    nu_grid=None          # optional wavelength grid

)

# -------------------------------------------------

# 2. Simple analytic temperature profiles

# -------------------------------------------------

# Power-law profile: T(P) = T0 * (P/1 bar)^α

T0, α = 1500.0, -0.1
temp_powerlaw = art.powerlaw_temperature(T0, α)

# Grey-atmosphere profile (requires gravity & IR opacity)

g = 1.0e3                # cm s⁻²

kappa = 0.01             # cm² g⁻¹

Tint = 800.0             # K

temp_gray = art.gray_temperature(g, kappa, Tint)

# Guillot irradiated profile (needs irradiation temperature)

gamma = 0.5
Tirr = 1800.0
temp_guillot = art.guillot_temperature(g, kappa, gamma, Tint, Tirr)

# -------------------------------------------------

# 3. Custom temperature array (e.g., from a model)

# -------------------------------------------------

import numpy as np
custom_T = np.linspace(2500, 500, art.nlayer)   # decreasing linearly

temp_custom = art.custom_temperature(custom_T)

# -------------------------------------------------

# 4. Clip temperatures to a physically-reasonable range

# -------------------------------------------------

art.change_temperature_range(Tlow=100.0, Thigh=3000.0)
temp_clipped = art.clip_temperature(temp_custom)   # works for any profile

Each method returns a jax.numpy.ndarray of shape (nlayer,). The ArtCommon instance stores the pressure grid internally, making the temperature arrays immediately compatible with downstream opacity calculations.

Key Source Files

File Purpose
src/exojax/rt/common.py Core ArtCommon class that constructs pressure grids and provides temperature-profile methods
src/exojax/atm/atmprof.py Analytic temperature functions (atmprof_powerlow, atmprof_gray, atmprof_Guillot) and pressure-grid utilities
src/exojax/atm/idealgas.py Number density calculations required for opacity and CIA computations using the T-P structure

Summary

  • Pressure grid setup requires pressure_top, pressure_btm, and nlayer passed to ArtCommon, which automatically generates log-spaced arrays via pressure_layer_logspace
  • Temperature prescriptions include power-law, grey-atmosphere, and Guillot (2010) irradiated models, plus support for custom arrays via custom_temperature
  • Optional constraints allow temperature clipping via change_temperature_range to enforce physical bounds
  • Auxiliary parameters (gravity, mean molecular weight, radius) are only needed for height-dependent calculations like atmosphere_height

Frequently Asked Questions

What parameters define the vertical extent of an ExoJAX atmospheric model?

The pressure_top and pressure_btm parameters in ArtCommon.__init__ set the upper and lower pressure boundaries in bar, defining the atmospheric column's vertical range, while nlayer determines the discrete resolution of the grid.

How does ExoJAX determine the pressure sampling point within each layer?

The reference_point parameter (default 0.5) defines the fractional position within each layer where the representative pressure is evaluated, with 0.5 indicating mid-layer sampling, 0 the upper boundary, and 1 the lower boundary.

Can I use a temperature profile from an external climate model instead of the built-in analytic functions?

Yes, the custom_temperature method accepts any JAX or NumPy array of length nlayer, allowing seamless integration of external general circulation model outputs or arbitrary temperature structures into the radiative transfer calculation.

What additional inputs are required for height-dependent radiative transfer calculations?

Calculations involving atmosphere_height or gravity_profile require surface gravity (in cm s⁻²), mean molecular weight, and planetary radius to properly compute hydrostatic equilibrium and variable gravity effects through the atmospheric column.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →