# Atmospheric Profiles

ClearSky contains functions for common atmospheric profiles and quantities.

## Temperature Profiles

Many radiative transfer calculations require an atmospheric temperature profile. ClearSky is designed to work with any arbitrary temperature profile if it can be defined as a function of pressure, T(P).

For convenience, dry and moist adiabatic profiles are available through the DryAdiabat and MoistAdiabat types, which are function-like types. There is also a tropopause function.

ClearSky.DryAdiabatType

Function-like type for initializing and evaluating a dry adiabatic temperature profile. Optional uniform upper atmospheric temperature below a specified temperature or pressure.

Constructor

DryAdiabat(Tₛ, Pₛ, cₚ, μ, Pₜ=1.0e-9; Tstrat=0.0, Ptropo=0.0)
• Tₛ: surface temperature [K]
• Pₛ: surface pressure [K]
• Pₜ: highest allowable pressure (can be small but not zero) [Pa]
• cₚ: specific heat of the atmosphere [J/kg/K]
• μ: molar mass of the atmosphere [kg/mole]
• Pₜ: highest pressure in the temperature profile (should generally be small to avoid evaluating out of range) [Pa]

If Tstrat is greater than zero, the temperature profile will not drop below that temperature. If Ptropo is greater than zero, the temperature profile at pressures lower than Ptropo will be equal to the temperature at exactly Ptropo. Tstrat and Ptropo cannot be greater than zero simultaneously.

Example

Once constructed, use a DryAdiabat like a function to compute temperature at a given pressure.

Tₛ = 288; #surface temperature [K]
Pₛ = 1e5; #surface pressure [Pa]
cₚ = 1040; #specific heat of air [J/kg/K]
μ = 0.029; #molar mass of air [kg/mole]

#construct the dry adiabat with an upper atmosphere temperature of 190 K
D = DryAdiabat(Tₛ, Pₛ, cₚ, μ, Tstrat=190);

#temperatures at 40-10 kPa
D.([4e4, 3e4, 2e4, 1e4])
ClearSky.MoistAdiabatType

Function-like type for initializing and evaluating a moist adiabatic temperature profile. Optional uniform upper atmospheric temperature below a specified temperature or pressure.

Constructor

MoistAdiabat(Tₛ, Pₛ, cₚₙ, cₚᵥ, μₙ, μᵥ, L, psat, Pₜ=1.0e-9; Tstrat=0, Ptropo=0, N=1000)
• Tₛ: surface temperature [K]
• Pₛ: surface pressure [K]
• cₚₙ: specific heat of the non-condensible atmospheric component (air) [J/kg/K]
• cₚᵥ: specific heat of the condensible atmospheric component [J/kg/K]
• μₙ: molar mass of the non-condensible atmospheric component (air) [kg/mole]
• μᵥ: molar mass of the condensible atmospheric component [kg/mole]
• L: condsible component's latent heat of vaporization [J/kg]
• psat: function defining the saturation vapor pressure for a given temperature, psat(T)
• Pₜ: highest pressure in the temperature profile (should generally be small to avoid evaluating pressures out of range) [Pa]

If Tstrat is greater than zero, the temperature profile will not drop below that temperature. If Ptropo is greater than zero, the temperature profile at pressures lower than Ptropo will be equal to the temperature at exactly Ptropo. Tstrat and Ptropo cannot be greater than zero simultaneously.

The profile is evaluated along a number of pressure values in the atmosphere set by N. Those points are then used to construct a cubic spline interpolator for efficient and accurate temperature calculation. Experience indicates that 1000 points is very accurate and also fast.

Example

Once constructed, use a MoistAdiabat like a function to compute temperature at a given pressure.

Tₛ = 288; #surface temperature [K]
Pₛ = 1e5; #surface pressure [Pa]
cₚₙ = 1040; #specific heat of air [J/kg/K]
cₚᵥ = 1996; #specific heat of H2O [J/kg/K]
μₙ = 0.029; #molar mass of air [kg/mole]
μᵥ = 0.018; #molar mass of H2O [kg/mole]
L = 2.3e6; #H2O latent heat of vaporization [J/kg]

#a saturation vapor pressure function for H2O is built in
psat = psatH2O;

#construct the moist adiabat with a tropopause pressure of 1e4 Pa
M = MoistAdiabat(Tₛ, Pₛ, cₚₙ, cₚᵥ, μₙ, μᵥ, L, psat, Ptropo=1e4);

#temperatures at 30-5 kPa
M.([3e4, 2e4, 1e4, 5e3])
ClearSky.tropopauseFunction
tropopause(Γ::AbstractAdiabat)

Compute the temperature [K] and pressure [Pa] at which the tropopause occurs in an adiabatic temperature profile. This function can be called on a DryAdiabat or a MoistAdiabat if it was constructed with nonzero Tstrat or Ptropo. Returns a tuple, (T,P).

## Pressure Profiles

In case a pressure profile with constant scale height isn't sufficient, hydrostatic profiles with arbitrary temperature and mean molar mass functions are available through the Hydrostatic type and related functions.

ClearSky.HydrostaticType

Function-like type for initializing and evaluating a hydrostatic pressure profile with arbitrary temperature and mean molar mass profiles. A Hydrostatic object maps altitude to pressure.

Constructor

Hydrostatic(Pₛ, Pₜ, g, fT, fμ, N=1000)
• Pₛ: surface pressure [Pa]
• Pₜ: top of profile pressure [Pa]
• g: gravitational acceleration [m/s$^2$]
• fT: temperature [K] as a function of presssure, fT(P)
• fμ: mean molar mass [kg/mole] as a function of temperature and pressure, fμ(T,P)
• N: optional, number of interpolation nodes

For a constant molar mass or temperature, you can use anonymous functions directly. For example, to construct a hydrostatic pressure profile for a crude Earth-like atmosphere:

#moist adiabatic temperature profile
M = MoistAdiabat(288, 1e5, 1040, 1996, 0.029, 0.018, 2.3e6, psatH2O, Ptropo=1e4);
#hydrostatic pressure profile with constant mean molar mass
H = Hydrostatic(1e5, 1, 9.8, M, (T,P)->0.029);
#evaluate pressures at a few different altitudes
H.([0, 1e3, 1e4])
ClearSky.hydrostaticFunction
hydrostatic(z, Pₛ, g, fT, fμ)

Compute the hydrostatic pressure [Pa] at a specific altitude using arbitrary atmospheric profiles of temperature and mean molar mass

Arguments

• z: altitude [m] to compute pressure at
• Pₛ: surface pressure [Pa]
• g: gravitational acceleration [m/s$^2$]
• fT: temperature [K] as a function of pressure, fT(P)
• fμ: mean molar mass [kg/mole] as a function of pressure and temperature fμ(T,P)
ClearSky.altitudeFunction
altitude(P, Pₛ, g, fT, fμ)

Compute the altitude [m] at which a specific hydrostatic pressure occurs using arbitrary atmospheric profiles of temperature and mean molar mass

Arguments

• P: pressure [Pa] to compute altitude at
• Pₛ: surface pressure [Pa]
• g: gravitational acceleration [m/s$^2$]
• fT: temperature [K] as a function of pressure, fT(P)
• fμ: mean molar mass [kg/mole] as a function of pressure and temperature fμ(T,P)
altitude(H::Hydrostatic, P)

Compute the altitude at which a specific pressure occurs in a Hydrostatic pressure profile.

## Other Functions

ClearSky.tsatCO2Function
tsatCO2(P)

Compute the saturation pressure of carbon dioxide at a certain pressure using an expression from Fanale et al. (1982)

ClearSky.ozonelayerFunction
ozonelayer(P, Cmax=8e-6)

Approximate the molar concentration of ozone in Earth's ozone layer using an 8 ppm peak at 1600 Pa which falls to zero at 100 Pa and 25500 Pa. Peak concentration is defined by Cmax.