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. Optionally, a uniform upper atmospheric temperature can be set below a specified temperature or pressure.

Constructor

DryAdiabat(Tₛ, Pₛ, cₚ, μ; Tstrat=0.0, Ptropo=0.0, Pₜ=1.0e-9)
  • Tₛ: surface temperature [K]
  • Pₛ: surface pressure [K]
  • cₚ: specific heat of the atmosphere [J/kg/K]
  • μ: molar mass of the atmosphere [kg/mole]

If Tstrat is greater than zero, the temperature profile will never 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 both greater than zero.

Pₜ defines the highest pressure [Pa] in the temperature profile. If should generally be small but cannot be zero.

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])
source
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; Tstrat=0, Ptropo=0, N=1000, Pₜ=1.0e-9)
  • 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)

If Tstrat is greater than zero, the temperature profile will never 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 both greater than zero.

Pₜ defines the highest pressure [Pa] in the temperature profile. If should generally be small but cannot be zero.

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])
source
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 the tuple (T,P).

source

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. Internally, a pressure vs altitude profile is generated and used for interpolation.

Constructor

Hydrostatic(Pₛ, Pₜ, g, fT, fμ, N=250)
  • 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)
  • : 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])
source
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. This function integrates the hydrostatic relation,

``\frac{dP}{dz} = \frac{\mu g}{R T}

from the surface to a height of $z$, where $R$ is the universial gas constant.

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)
  • : mean molar mass [kg/mole] as a function of pressure and temperature fμ(T,P)
source
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. This function applies a root finder to the hydrostatic function.

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)
  • : mean molar mass [kg/mole] as a function of pressure and temperature fμ(T,P)
source
altitude(H::Hydrostatic, P)

Compute the altitude at which a specific pressure occurs in a Hydrostatic pressure profile. A root finder is applied to the object.

source

Other Functions

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. This approximation is discussed in

  • Jacob, D. Introduction to Atmospheric Chemistry. (Princeton University Press, 1999).
source
ClearSky.condensibleprofileFunction
condensibleprofile(Γ::AbstractAdiabat, fPₛ)

Create a function defining concentration vs pressure for a condensible with uniform upper-atmosphere (stratosphere) concentration. The new concentration profile is created with reference to an existing adiabatic profile (DryAdiabat or MoistAdiabat), which must have Ptropo != 0 or Tstrato != 0. Lower atmospheric concentration is determined by the temperature dependent partial pressure function fPₛ(T). The concentration is P/(fPₛ + P), where P is the dry/non-condensible pressure.

source
ClearSky.haircut!Function
haircut!(T, P, fTₛ)

Put a temperature floor on a temperature profile using the saturation temperature function fTₛ(P).

source
Missing docstring.

Missing docstring for rayleighCO2. Check Documenter's build log for details.