# 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. Calculate isobaric heat capacity of moist air. Calculate saturation pressure of water vapor over ice. Calculate saturation pressure of water vapor over liquid water. 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.
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

Calculate the potential temperature gradient between two altitudes.

Parameters:
Returns:

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

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.

Parameters:

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

Returns:

ArrayScalarLike – Saturation pressure of water vapor over liquid water, [$$Pa$$]

References

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}$$]