dparcel.thermo module¶
Thermodynamic calculations for parcel theory.
This module implements various atmospheric thermodynamics calculations, both original and from literature.
- dparcel.thermo.descend(pressure, temperature, specific_humidity, liquid_ratio, reference_pressure, improve=2, improve_reversible=2, kind='pseudo')¶
Calculate the temperature of a descending parcel.
Uses conservation of equivalent potential temperature to determine the final temperature if the parcel switches from a moist to a dry adiabat.
- Parameters
pressure – Final pressure.
temperature – Initial temperature.
specific_humidity – Initial specific humidity.
liquid_ratio – Initial liquid ratio.
reference_pressure – Initial pressure.
improve – Number of iterations to use if the parcel must switch from moist to dry adiabat (default: 1). Alternatively, specify False to skip iteration and take the moist adiabatic value, or ‘exact’ to iterate until convergence.
improve_reversible – Number of iterations to use for reversible adiabat calculation.
kind – ‘pseudo’ for pseudoadiabats, ‘reversible’ for reversible adiabats.
- Returns
Final temperature, specific humidity and liquid ratio.
- dparcel.thermo.equilibrate(pressure, t_initial, q_initial, l_initial)¶
Find parcel properties after phase equilibration.
- Parameters
pressure – Pressure during the change (constant).
t_initial – Initial temperature of the parcel.
q_initial – Initial specific humidity of the parcel.
l_initial – Initial ratio of liquid mass to parcel mass.
- Returns
- A tuple containing the final parcel temperature, specific
humidity and liquid ratio.
- dparcel.thermo.equivalent_potential_temperature(p, Tk, q, prime=False)¶
Calculate equivalent potential temperature.
Uses the approximation of theta-e given in eq. 39 of Bolton (1980). Variable names follow the notation of Bolton.
- Parameters
p – Pressure.
Tk – Temperature.
q – Specific humidity.
prime – Whether or not to also return the derivative of theta-e with respect to temperature at the given temperature and pressure (optional, defaults to False).
- Returns
The equivalent potential temperature (and its derivative w.r.t. temperature if prime=True).
References
Bolton, D 1980, ‘The Computation of Equivalent Potential Temperature’, Monthly weather review, vol. 108, no. 7, pp. 1046–1053.
- dparcel.thermo.lcl_romps(p, T, q)¶
Analytic solution for the LCL (adapted from Romps 2017).
This code is adapted from Romps (2017): https://romps.berkeley.edu/papers/pubdata/2016/lcl/lcl.py
- Parameters
p – Pressure.
T – Temperature.
q – Specific humidity.
- Returns
(pressure, temperature) at the LCL.
References
Romps, DM 2017, ‘Exact Expression for the Lifting Condensation Level’, Journal of the atmospheric sciences, vol. 74, no. 12, pp. 3891–3900.
- dparcel.thermo.mix(parcel, environment, rate, dz)¶
Mix parcel and environment variables (for entrainment).
- Parameters
parcel – Parcel value.
environment – Environment value.
rate – Entrainment rate.
dz – Distance descended.
- Returns
Mixed value of the variable.
- dparcel.thermo.moist_lapse_dj(pressure, initial_temperature, reference_pressure=None, improve=True)¶
Compute temperature from pressure along pseudoadiabats.
Follows the method of Davies-Jones (2008).
- Parameters
pressure – Array of pressures for which the temperature is to be found.
initial_temperature – Initial parcel temperature.
reference_pressure – The pressure corresponding to initial_temperature. Optional, defaults to pressure[0].
improve – Whether or not to apply an iteration of Newton’s method (only relevant for method == ‘fast’).
- Returns
Array of final temperatures.
References
DAVIES-JONES, R 2008, ‘An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats’, Monthly weather review, vol. 136, no. 7, pp. 2764–2785.
- dparcel.thermo.reversible_lapse_daviesjones(pressure, initial_temperature, initial_liquid_ratio, reference_pressure=None, improve=2)¶
Compute temperature along reversible adiabats.
Uses the method of Davies-Jones (2008). Variable names follow the notation of Davies-Jones.
Errors were found in Equations (5.1) and (5.3). They have been corrected here after consultation with the author.
- Parameters
pressure – Array of pressures for which the temperature is to be found.
initial_temperature – Initial parcel temperature.
q_initial – Initial specific humidity.
initial_liquid_ratio – Initial ratio of liquid mass to total.
reference_pressure – The pressure corresponding to initial_temperature. Optional, defaults to pressure[0].
improve – Number of iterations of Newton’s method to execute.
- Returns
Array of final temperatures.
References
DAVIES-JONES, R 2008, ‘An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats’, Monthly weather review, vol. 136, no. 7, pp. 2764–2785.
- dparcel.thermo.reversible_lapse_saunders(pressure, t_initial, l_initial, reference_pressure=None, improve=2)¶
Calculate temperature along reversible adiabats.
Uses Eq. 3 of Saunders (1957). Variable names follow the notation of Saunders.
- Parameters
pressure – Pressure array.
t_initial – Initial temperature.
l_initial – Initial ratio of liquid mass to total
reference_pressure – Pressure corresponding to t_inital.
improve – Number of Newton’s method iterations to use.
- Returns
Resultant temperature array.
References
Saunders, PM 1957, ‘The thermodynamics of saturated air: A contribution to the classical theory’, Quarterly journal of the Royal Meteorological Society, vol. 83, no. 357, pp. 342–350.
- dparcel.thermo.saturation_equivalent_potential_temperature(p, Tk, prime=False)¶
Calculate saturation equivalent potential temperature.
Uses the approximation of theta-e given in eq. 39 of Bolton (1980). Variable names follow the notation of Bolton.
- Parameters
p – Pressure.
Tk – Temperature.
prime – Whether or not to also return the derivative of theta-e with respect to temperature at the given temperature and pressure (optional, defaults to False).
- Returns
The saturation equivalent potential temperature (and its derivative w.r.t. temperature if prime=True).
References
Bolton, D 1980, ‘The Computation of Equivalent Potential Temperature’, Monthly weather review, vol. 108, no. 7, pp. 1046–1053.
- dparcel.thermo.saturation_specific_humidity(pressure, temperature)¶
Calculate saturation specific humidity.
- dparcel.thermo.temperature_change(delta_q)¶
Calculate the temperature change due to evaporation of water.
Neglects the heat capacity of components other than dry air.
- Parameters
delta_q – Specific humidity increase due to evaporation.
- Returns
The resulting change in temperature.
- dparcel.thermo.wetbulb(pressure, theta_e, improve=True)¶
Calculate wet bulb temperature using the method in Davies-Jones 2008.
Variable names follow the notation of Davies-Jones.
- Parameters
pressure – Pressure.
theta_e – Equivalent potential temperature.
improve – Whether or not to perform a single iteration of Newton’s method to improve accuracy (defaults to False).
- Returns
Wet bulb temperature.
References
DAVIES-JONES, R 2008, ‘An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats’, Monthly weather review, vol. 136, no. 7, pp. 2764–2785.
- dparcel.thermo.wetbulb_potential_temperature(theta_e)¶
Calculate theta-w from theta-e using Eq. 3.8 of Davies-Jones 2008.
Variable names follow the notation of Davies-Jones.
- Parameters
theta_e – Equivalent potential temperature.
- Returns
Wet bulb potential temperature.
References
DAVIES-JONES, R 2008, ‘An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats’, Monthly weather review, vol. 136, no. 7, pp. 2764–2785.
- dparcel.thermo.wetbulb_romps(pressure, temperature, specific_humidity)¶
Calculate wet bulb temperature using Normand’s rule and Romps (2017).
- Parameters
p – Pressure.
T – Temperature.
q – Specific humidity.
- Returns
Wet bulb temperature.
References
Romps, DM 2017, ‘Exact Expression for the Lifting Condensation Level’, Journal of the atmospheric sciences, vol. 74, no. 12, pp. 3891–3900.