Functions related to common atmospheric thermodynamic relationships.
IdealGas(p, t, rho, R =287.058)Adiabat(p, t, theta, p0 =1e+05, kappa =2/7)VirtualTemperature(p, t, e, tv, epsilon =0.622)MixingRatio(p, e, w, epsilon =0.622)ClausiusClapeyron(t, es)DewPoint(p, ws, td, epsilon =0.622)
Arguments
p: pressure
t: temperature
rho: density
R: gas constant for air
theta: potential temperature
p0: reference pressure
kappa: ratio of dry air constant and specific heat capacity at constant pressure
e: vapour partial pressure
tv: virtual temperature
epsilon: ratio of dry air constant and vapour constant
w: mixing ratio
es: saturation vapour partial pressure
ws: saturation mixing ratio
td: dewpoint
Returns
Each function returns the value of the missing state variable.
Details
IdealGas computes pressure, temperature or density of air according to the ideal gas law P=ρRT.
Adiabat computes pressure, temperature or potential temperature according to the adiabatic relationship θ=T(P0/P)κ.
VirtualTemperature computes pressure, temperature, vapour partial pressure or virtual temperature according to the virtual temperature definition T(1−e/P(1−ϵ))−1.
MixingRatio computes pressure, vapour partial temperature, or mixing ratio according to w=ϵe/(P−e).
ClausiusClapeyron computes saturation pressure or temperature according to the August-Roche-Magnus formula es=aexpbT/(T+c) with temperature in Kelvin and saturation pressure in Pa.
DewPoint computes pressure, saturation mixing ration or dew point from the relationship ws=ϵes(Td)/(p−es(Td)). Note that the computation of dew point is approximated.
Is important to take note of the units in which each variable is provided. With the default values, pressure should be passed in Pascals, temperature and potential temperature in Kelvins, and density in kg/m3. ClausiusClayperon and DewPoint require and return values in those units.
The defaults value of the R and kappa parameters are correct for dry air, for the case of moist air, use the virtual temperature instead of the actual temperature.
Examples
IdealGas(1013*100,20+273.15)IdealGas(1013*100, rho =1.15)-273.15(theta <- Adiabat(70000,20+273.15))Adiabat(70000, theta = theta)-273.15# Relative humidity from T and Tdt <-25+273.15td <-20+273.15p <-1000000(rh <- ClausiusClapeyron(td)/ClausiusClapeyron(t))# Mixing ratiows <- MixingRatio(p, ClausiusClapeyron(t))w <- ws*rh
DewPoint(p, w)-273.15# Recover Td