icon_sc.icon.thermo — thermodynamic relations

ICON thermodynamic relations, exactly as ICON defines them (S06).

Formulas are transcribed from the pinned references (REFERENCES.lock, S06):

  • diag_temp in ICON src/atm_dyn_iconam/mo_nh_diagnose_pres_temp.f90 (equals icon4py v0.2.0 diagnose_temperature.py): tempv = theta_v * exner, temp = tempv / (1 + vtmpc1*qv - qsum);

  • pressure (cpd) Exner path: exner = (p/p0ref)**rd_o_cpd (mo_nh_vert_extrap_utils.f90), inverse p = p0ref * exner**(cpd/rd);

  • density (cvd) Exner path: exner = EXP(rd_o_cvd*LOG(rd_o_p0ref*rho*theta_v)) (mo_nh_nest_utilities.f90) — ICON’s isochoric coupling uses cvd downstream, so both paths exist here from the start and are named unambiguously (PLAN pitfall).

All functions are array-namespace generic (PEP 3118/array-API duck typing via array_api_compat): numpy in → numpy out, cupy in → cupy out, and — unchanged — JAX in S10 (the start of the functional cores). Nothing here allocates other than the result; no field/DataArray types appear at this layer.

icon_sc.icon.thermo.exner_from_pressure(pressure)

Exner function from pressure — the pressure (cpd) path.

exner = (p / p0ref)**(rd/cpd) (ICON mo_nh_vert_extrap_utils.f90).

Parameters:

pressure (Any)

Return type:

Any

icon_sc.icon.thermo.exner_from_rho_thetav(rho, theta_v)

Exner function from density and θv — the density (cvd) path.

exner = EXP(rd/cvd * LOG(rd/p0ref * rho * theta_v)) operation-for-operation as ICON writes it (mo_nh_nest_utilities.f90:1657); the dycore/physics isochoric coupling is cvd-based, distinct from the cpd exponent of the pressure path.

Parameters:
Return type:

Any

icon_sc.icon.thermo.pressure_from_exner(exner)

Pressure from the Exner function — inverse of the pressure (cpd) path.

p = p0ref * exner**(cpd/rd) (plain form: mo_nh_vert_extrap_utils.f90:754; the fused EXP(cpd_o_rd*LOG(exner)+...) surface-pressure variant lives in mo_nh_diagnose_pres_temp.f90).

Parameters:

exner (Any)

Return type:

Any

icon_sc.icon.thermo.temperature_from_thetav_exner(theta_v, exner, qv, q_condensate=0.0)

Temperature from θv, Exner function and moisture — ICON diag_temp verbatim.

tempv = theta_v * exner; temp = tempv / (1 + vtmpc1*qv - qsum).

Parameters:
Return type:

Any

icon_sc.icon.thermo.virtual_potential_temperature(temperature, exner, qv, q_condensate=0.0)

θv from temperature, Exner function and moisture (inverse of diag_temp).

theta_v = temp * (1 + vtmpc1*qv - qsum) / exner.

Parameters:
Return type:

Any

icon_sc.icon.thermo.virtual_temperature(temperature, qv, q_condensate=0.0)

Virtual temperature with moisture and condensate loading.

tempv = temp * (1 + vtmpc1*qv - qsum) where qsum is the total mass fraction of prognostic condensate (qc+qi+qr+qs+qg in ICON diag_temp, inverted; here a single pre-summed q_condensate argument).

Parameters:
  • temperature (Any)

  • qv (Any)

  • q_condensate (Any)

Return type:

Any