pycontrails.physics.thermo

Thermodynamic relationships.

Functions

T_potential(T, p)

Calculate potential temperature.

T_potential_gradient(T_top, p_top, T_btm, ...)

Calculate the potential temperature gradient between two altitudes.

brunt_vaisala_frequency(p, T, T_grad)

Calculate the Brunt-Vaisaila frequency.

c_pm(q)

Calculate isobaric heat capacity of moist air.

e_sat_ice(T)

Calculate saturation pressure of water vapor over ice.

e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Murphy and Koop (2005).

e_sat_liquid_prime(T)

Calculate the derivative of mk05_e_sat_liquid().

mk05_e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Murphy and Koop (2005).

mk05_e_sat_liquid_prime(T)

Calculate the derivative of mk05_e_sat_liquid().

p_vapor(q, p)

Calculate the vapor pressure.

pressure_dz(T, p, dz)

Calculate the pressure altitude dz meters below input pressure.

q_sat(T, p)

Calculate saturation specific humidity over liquid or ice.

q_sat_ice(T, p)

Calculate saturation specific humidity over ice.

q_sat_liquid(T, p)

Calculate saturation specific humidity over liquid.

rh(q, T, p)

Calculate the relative humidity with respect to to liquid water.

rhi(q, T, p)

Calculate the relative humidity with respect to ice (RHi).

rho_d(T, p)

Calculate air density for (T, p) assuming dry air.

rho_v(T, p)

Calculate the air density for (T, p) assuming all water vapor.

sonntag_e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Sonntag (1994).

sonntag_e_sat_liquid_prime(T)

Calculate the derivative of sonntag_e_sat_liquid().

water_vapor_partial_pressure_along_mixing_line(...)

Calculate water vapor partial pressure along mixing line.

pycontrails.physics.thermo.T_potential(T, p)

Calculate potential temperature.

The potential temperature is the temperature that an air parcel would attain if adiabatically brought to a standard reference pressure, constants.p_surface.

Parameters:
Returns:

ArrayScalarLike – Potential Temperature, [\(K\)]

References

pycontrails.physics.thermo.T_potential_gradient(T_top, p_top, T_btm, p_btm, dz)

Calculate the potential temperature gradient between two altitudes.

Parameters:
  • T_top (ArrayScalarLike) – Temperature at original altitude, [\(K\)]

  • p_top (ArrayScalarLike) – Pressure at original altitude, [\(Pa\)]

  • T_btm (ArrayScalarLike) – Temperature at lower altitude, [\(K\)]

  • p_btm (ArrayScalarLike) – Pressure at lower altitude, [\(Pa\)]

  • dz (float) – Difference in altitude between measurements, [\(m\)]

Returns:

ArrayScalarLike – Potential Temperature gradient, [\(K \ m^{-1}\)]

pycontrails.physics.thermo.brunt_vaisala_frequency(p, T, T_grad)

Calculate the Brunt-Vaisaila frequency.

The Brunt-Vaisaila frequency is the frequency at which a vertically displaced parcel will oscillate within a statically stable environment.

Parameters:
Returns:

numpy.ndarray – Brunt-Vaisaila frequency, [\(s^{-1}\)]

References

pycontrails.physics.thermo.c_pm(q)

Calculate isobaric heat capacity of moist air.

Parameters:

q (ArrayScalarLike) – Specific humidity, [\(kg \ kg^{-1}\)]

Returns:

ArrayScalarLike – Isobaric heat capacity of moist air, [\(J \ kg^{-1} \ K^{-1}\)]

Notes

Some models (including CoCiP) use a constant value here (1004 \(J \ kg^{-1} \ K^{-1}\))

pycontrails.physics.thermo.e_sat_ice(T)

Calculate saturation pressure of water vapor over ice.

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)]

Returns:

ArrayScalarLike – Saturation pressure of water vapor over ice, [\(Pa\)]

References

pycontrails.physics.thermo.e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Murphy and Koop (2005).

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)]

Returns:

ArrayScalarLike – Saturation pressure of water vapor over liquid water, [\(Pa\)]

Notes

Several formulations exist for the saturation vapor pressure over liquid water.

Buck (Buck Research Manual 1996)..

6.1121 * np.exp((18.678 * (T - 273.15) / 234.5) * (T - 273.15) / (257.14 + (T - 273.15)))

Magnus Tetens (Murray, 1967)..

6.1078 * np.exp(17.269388 * (T - 273.16) / (T - 35.86))

Guide to Meteorological Instruments and Methods of Observation (CIMO Guide) (WMO, 2008)..

6.112 * np.exp(17.62 * (T - 273.15) / (243.12 + T - 273.15))

Sonntag (1994) (see sonntag_e_sat_liquid()) is used in older versions of CoCiP.

pycontrails.physics.thermo.e_sat_liquid_prime(T)

Calculate the derivative of mk05_e_sat_liquid().

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)].

Returns:

ArrayScalarLike – Derivative of mk05_e_sat_liquid()

pycontrails.physics.thermo.mk05_e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Murphy and Koop (2005).

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)]

Returns:

ArrayScalarLike – Saturation pressure of water vapor over liquid water, [\(Pa\)]

Notes

Several formulations exist for the saturation vapor pressure over liquid water.

Buck (Buck Research Manual 1996)..

6.1121 * np.exp((18.678 * (T - 273.15) / 234.5) * (T - 273.15) / (257.14 + (T - 273.15)))

Magnus Tetens (Murray, 1967)..

6.1078 * np.exp(17.269388 * (T - 273.16) / (T - 35.86))

Guide to Meteorological Instruments and Methods of Observation (CIMO Guide) (WMO, 2008)..

6.112 * np.exp(17.62 * (T - 273.15) / (243.12 + T - 273.15))

Sonntag (1994) (see sonntag_e_sat_liquid()) is used in older versions of CoCiP.

pycontrails.physics.thermo.mk05_e_sat_liquid_prime(T)

Calculate the derivative of mk05_e_sat_liquid().

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)].

Returns:

ArrayScalarLike – Derivative of mk05_e_sat_liquid()

pycontrails.physics.thermo.p_vapor(q, p)

Calculate the vapor pressure.

Parameters:
  • q (ArrayScalarTypeVar) – Specific humidity, [\(kg \ kg^{-1}\)]

  • p (ArrayScalarTypeVar) – Pressure, [\(Pa\)]

Returns:

ArrayScalarTypeVar – Vapor pressure, [\(Pa\)]

pycontrails.physics.thermo.pressure_dz(T, p, dz)

Calculate the pressure altitude dz meters below input pressure.

Returns surface pressure if the calculated pressure altitude is greater than constants.p_surface.

Parameters:
Returns:

ArrayScalarLike – Pressure at altitude, [\(Pa\)]

Notes

This is used to calculate the temperature gradient and wind shear.

pycontrails.physics.thermo.q_sat(T, p)

Calculate saturation specific humidity over liquid or ice.

When T is above 0 C, liquid saturation is computed. Otherwise, ice saturation is computed.

Parameters:
Returns:

ArrayScalarLike – Saturation specific humidity, [\(kg \ kg^{-1}\)]

Notes

Smith et al. (1999)

pycontrails.physics.thermo.q_sat_ice(T, p)

Calculate saturation specific humidity over ice.

Parameters:
Returns:

ArrayScalarLike – Saturation specific humidity, [\(kg \ kg^{-1}\)]

Notes

Smith et al. (1999)

pycontrails.physics.thermo.q_sat_liquid(T, p)

Calculate saturation specific humidity over liquid.

Parameters:
Returns:

ArrayScalarLike – Saturation specific humidity, [\(kg \ kg^{-1}\)]

Notes

Smith et al. (1999)

pycontrails.physics.thermo.rh(q, T, p)

Calculate the relative humidity with respect to to liquid water.

Parameters:
Returns:

ArrayScalarLike – Relative Humidity, \([0 - 1]\)

pycontrails.physics.thermo.rhi(q, T, p)

Calculate the relative humidity with respect to ice (RHi).

Parameters:
Returns:

ArrayScalarLike – Relative Humidity over ice, \([0 - 1]\)

pycontrails.physics.thermo.rho_d(T, p)

Calculate air density for (T, p) assuming dry air.

Parameters:
Returns:

ArrayScalarLike – Air density of dry air, [\(kg \ m^{-3}\)]

pycontrails.physics.thermo.rho_v(T, p)

Calculate the air density for (T, p) assuming all water vapor.

Parameters:
Returns:

ArrayScalarLike – Air density of water vapor, [\(kg \ m^{-3}\)]

pycontrails.physics.thermo.sonntag_e_sat_liquid(T)

Calculate saturation pressure of water vapor over liquid water using Sonntag (1994).

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)]

Returns:

ArrayScalarLike – Saturation pressure of water vapor over liquid water, [\(Pa\)]

pycontrails.physics.thermo.sonntag_e_sat_liquid_prime(T)

Calculate the derivative of sonntag_e_sat_liquid().

Parameters:

T (ArrayScalarLike) – Temperature, [\(K\)].

Returns:

ArrayScalarLike – Derivative of sonntag_e_sat_liquid()

pycontrails.physics.thermo.water_vapor_partial_pressure_along_mixing_line(specific_humidity, air_pressure, T_plume, T_ambient, G)

Calculate water vapor partial pressure along mixing line.

Parameters:
  • specific_humidity (ArrayScalarLike) – Specific humidity at each waypoint, [\(kg_{H_{2}O} / kg_{air}\)]

  • air_pressure (ArrayScalarLike) – Pressure altitude at each waypoint, [\(Pa\)]

  • T_plume (ArrayScalarLike) – Plume temperature evolution along mixing line, [\(K\)]

  • T_ambient (ArrayScalarLike) – Ambient temperature for each waypoint, [\(K\)]

  • G (ArrayScalarLike) – Slope of the mixing line in a temperature-humidity diagram.

Returns:

ArrayScalarLike – Water vapor partial pressure along mixing line (p_mw), [\(Pa\)]

References

Eq. (2) of Karcher et al. (2015).