Utils#
- abcmodel.utils.compute_esat(temp)[source]#
Calculate saturated vapor pressure using the August-Roche-Magnus formula.
- Parameters:
temp (
Array) – temperature [K].- Returns:
Saturated vapor pressure [Pa].
Notes
First, the temperature is converted from Kelvin (\(T_K\)) to Celsius (\(T_C\)) with
\[T_C = T_K - 273.16,\]then, the saturated vapor pressure \(e_{sat}\) is calculated as
\[e_{\text{sat}}(T_C) = 611 \cdot \exp\left( \frac{17.2694 \cdot T_C}{T_C + 237.3} \right),\]where \(611\) [Pa] is a reference pressure. For more on this, see wikipedia.
- abcmodel.utils.compute_qsat(temp, pressure)[source]#
Calculate saturated specific humidity.
- Parameters:
temp (
Array) – temperature [K].pressure (
Array) – pressure [Pa].
- Returns:
Saturated specific humidity [kg/kg].
Notes
Saturated specific humidity \(q_{sat}\) is the maximum amount of water vapor (as a mass fraction) that a parcel of air can hold at a given temperature and pressure.
The full formula for \(q_{sat}\) is
\[q_{\text{sat}} = \frac{\epsilon \cdot e_{\text{sat}}}{p - (1-\epsilon)e_{\text{sat}}},\]where \(e_{\text{sat}}\) is the saturated vapor pressure [Pa] from
get_esat(), \(p\) is the total atmospheric pressure [Pa] and \(\epsilon \approx 0.622\) is the ratio of the molar mass of water vapor to the molar mass of dry air. This formula can be derived from the definition of specific humidity (a ratio of vapour and total air mass), and then using the Ideal Gas Law and Dalton’s Law of Partial Pressures.In the code, this function uses a common approximation where the \((1-\epsilon)e_{\text{sat}}\) term in the denominator is negligible compared to \(p\), simplifying the formula to
\[q_{\text{sat}} \approx \epsilon \frac{e_{\text{sat}}}{p}.\]
- class abcmodel.utils.PhysicalConstants[source]#
Bases:
objectContainer for physical constants used throughout the model.
- lv = 2500000.0#
Heat of vaporization [J kg-1].
- cp = 1005.0#
Specific heat of dry air [J kg-1 K-1].
- rho = 1.2#
Density of air [kg m-3].
- g = 9.81#
Gravity acceleration [m s-2].
- rd = 287.0#
Gas constant for dry air [J kg-1 K-1].
- rv = 461.5#
Gas constant for moist air [J kg-1 K-1].
- rhow = 1000.0#
Density of water [kg m-3].
- k = 0.4#
Von Karman constant [-].
- bolz = 5.67e-08#
Boltzmann constant [-].
- solar_in = 1368.0#
Solar constant [W m-2]
- mco2 = 44.0#
Molecular weight CO2 [g mol-1].
- mair = 28.9#
Molecular weight air [g mol-1].
- nuco2q = 1.6#
Ratio molecular viscosity water to carbon dioxide.