Atmospheric Properties Subprograms
MW_AIR
NAME:
MW_Air
PURPOSE:
Function to calculate the effective, water vapor weighted molecular
weight of air.
CALLING SEQUENCE:
Molecular_Weight = MW_Air( Pressure, & ! Input
Water_Vapor_Pressure, & ! Input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Pressure: Total atmospheric pressure
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
Water_Vapor_Pressure: Water vapor partial pressure
UNITS: hectoPascals, hPa.
TYPE: REAL(fp)
DIMENSION: Same as Pressure
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
Molecular_Weight: The effective molecular weight of air.
If an error occurs, -1.0 is returned.
UNITS: grams, g
TYPE: REAL(fp)
DIMENSION: Same as input Pressure
PROCEDURE:
The change in the effective molecular weight of dry air
due to water vapor is given by:
pp(h2o) * ( MW(H2O) - MW(DRY_AIR) )
d(MW_Air) = -------------------------------------
Pressure
and the final result is given by:
MW(Air) = MW(DRY_AIR) + d(MW_Air)
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 01-May-2000
paul.vandelst@ssec.wisc.edu
DENSITY
NAME:
Density
PURPOSE:
Function to calculate gas density using the ideal gas law.
CALLING SEQUENCE:
Gas_Density = Density( Pressure, & ! Input
Temperature, & ! Input
Molecular_Weight, & ! Input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Pressure: Pressure of gas
UNITS: hPa
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
Temperature: Temperature of gas
UNITS: Kelvin
TYPE: REAL(fp)
DIMENSION: Same as Pressure
ATTRIBUTES: INTENT(IN)
Molecular_Weight: Molecular weight of the gas.
UNITS: g.mol^-1
TYPE: REAL(fp)
DIMENSION: Scalar or same as Pressure
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
Gas_Density: The gas density for the specified conditions.
If an error occurs, -1.0 is returned.
UNITS: kg.m^-3
TYPE: REAL(fp)
DIMENSION: Same as input Pressure
PROCEDURE:
The density is calculated using the ideal gas equation
p . MW
Density = --------
R0 . T
where R0 = universal gas constant.
Units:
------
Pressure : hPa == 100 Pa == 100 kg.m^-1.s^-2
Molecular_Weight : g.mol^-1 == 0.001 kg.mol^-1
MOLAR_GAS_CONSTANT : J.K^-1.mol^-1 == kg.m^2.s^-2.K^-1.mol^-1
Temperature : K
100 kg.m^-1.s^-2 . 0.001 kg.mol^-1
Density = -----------------------------------
kg.m^2.s^-2.K^-1.mol^-1 . K
0.1 kg^2.m^-1.s^-2
= --------------------
kg.m^2.s^-2
= 0.1 kg.m^-3
Thus the result is scaled by 0.1 to return density in units
of kg.m^-3.
COMMENTS:
Note that the rank-1 interface of this routine can be called with
either a scalar molecular weight (e.g. that for dry air for a number
of pressure levels) or a rank-1 molecular weight (e.g. that for air
where the water vapour contribution has been taken into account.)
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 01-May-2000
paul.vandelst@ssec.wisc.edu
SVP_WATER
NAME:
SVP_Water
PURPOSE:
Function to calculate the saturation vapor pressure over water.
CALLING SEQUENCE:
svp = SVP_Water( Temperature, & ! Input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Temperature: Temperatures for which the saturation vapor
pressure is required.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
svp: The saturation vapor pressure over water
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Same as input Temperature
RESTRICTIONS:
Valid temperature range is 188K - 343K (-85C - +70C). A warning is
reported if the input temperatures are outside this range.
PROCEDURE:
Flatau,P.J., R.L.Walko, and W.R.Cotton, 1992: "Polynomial fits to
saturation vapor pressure", J.Appl.Met., v31, pp1507-1513
__ N
\ i
SVP_Water = c0 + > c(i) . T
/__
i=1
where the c(i) are the relative error norm coefficients obtained
from the reference above.
Horner's method is used to evaluate the above polynomial.
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 24-Apr-1998
paul.vandelst@ssec.wisc.edu
SVP_ICE
NAME:
SVP_Ice
PURPOSE:
Function to calculate the saturation vapor pressure over ice
CALLING SEQUENCE:
svp = SVP_Ice( Temperature, & ! Input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Temperature: Temperatures for which the saturation vapor
pressure is required.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
svp: The saturation vapor pressure over ice
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Same as input Temperature
RESTRICTIONS:
Valid Temperature range is 183K - 273K (-90C - 0C). An warning is
reported if the input Temperatures are outside this range.
PROCEDURE:
Flatau,P.J., R.L.Walko, and W.R.Cotton, 1992: "Polynomial fits to
saturation vapor pressure", J.Appl.Met., v31, pp1507-1513
__ N
\ i
SVP_Ice = c0 + > c(i) . T
/__
i=1
where the c(i) are the relative error norm coefficients obtained
from the reference above.
Horner's method is used to evaluate the above polynomial.
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 24-Apr-1998
paul.vandelst@ssec.wisc.edu
SATURATION_MIXING_RATIO
NAME:
Saturation_Mixing_Ratio
PURPOSE:
Function to calculate the saturation mixing ratio for a given
pressure and temperature
CALLING SEQUENCE:
smr = Saturation_Mixing_Ratio( Pressure, & ! Input
Temperature, & ! Input
Ice_Temperature=Ice_Temperature, & ! optional input
Min_Pressure =Min_Pressure, & ! Optional input
Message_Log =Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Pressure: Total atmospheric pressure.
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
Temperature: Atmospheric Temperature.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Same as Pressure
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Ice_Temperature: Temperature below which the saturation vapor
pressure over ice is used in the conversion.
By default, only the saturation vapor pressure
over water is used.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
Min_Pressure: Pressure value below which the saturation
mixing ratio is not calculated. The default
is 50hPa. Saturation mixing ratios at pressures
less than the minimum pressure are set to zero.
This is because at pressures less than 50mb, the
saturation vapour pressure, which is based only on
temperature, can exceed the total air pressure.
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
smr: The saturation mixing ratio
If an error occurs, -1.0 is returned.
UNITS: g/kg
TYPE: REAL(fp)
DIMENSION: Same as input Pressure
PROCEDURE:
The saturation mixing ratio can be defined as:
rho_ws
ws = -------- .....(1)
rho_d
where rho_ws = the partial density of water vapour required to
saturate air with respect to water at a Temperature, T
rho_d = the partial density of dry air.
Equation (1) can be rewritten as:
es
---------
R_w . T
ws = ------------
p - es
---------
R_d . T
R_d es
= ----- . --------
R_w p - es
M_w es
= ----- . -------- .....(2)
M_d p - es
where M_w = molecular weight of water
M_d = molecular weight of dry air
es = water vapor partial pressure
p = total air pressure
R_d = gas constant for dry air
R_w = gas constant for water vapor
The units of equation (2) are:
g hPa
ws = --- . -----
g hPa
g
= 1000.0 ----
kg
A factor of 1000 is used to return values in units of g/kg.
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 18-Mar-1998
paul.vandelst@ssec.wisc.edu
VIRTUAL_TEMPERATURE
NAME:
Virtual_Temperature
PURPOSE:
Function to calculate the virtual temperature given the temperature and
water vapor mixing ratio.
There is also an "inverse" capability to compute the temperature given
the virtual temperature and the water vapor mixing ratio.
CALLING SEQUENCE:
Tv = Virtual_Temperature( Temperature, & ! Input
Water_Vapor_Mixing_Ratio, & ! Input
Inverse =Inverse, & ! Optional Input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Temperature: Atmospheric temperature.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
Water_Vapor_Mixing_Ratio: Water vapor mass mixing ratio.
UNITS: g/kg
TYPE: REAL(fp)
DIMENSION: Same as Temperature
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Inverse: Set this argument to compute the temperature
given the input is the virtual temperature.
If = 0, virtual temperature is calculated (default)
= 1, input value is assumed to be the virtual
temperature and the temperature is
calculated.
UNITS: N/A
TYPE: INTEGER
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
Tv: The virtual temperature. If the optional Inverse
argument is set, the function result is the
atmospheric temperature.
If an error occurs, -1.0 is returned.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Same as input Temperature
PROCEDURE:
The virtual temperature, the temperature that dry air must have in
order to have the same density as moist air at the same pressure, is
calculated using:
[ eps + w ]
Tv = T * [ ------------- ] .......................(1)
[ eps ( 1 + w ) ]
where T = temperature,
w = water vapour mixing ratio, and
eps = ratio of the molecular weights of water and dry air.
An approximation to eqn.(1) is,
[ 1 - eps ]
Tv = T * [ 1 + --------- w ]
[ eps ]
= T * [ 1 + ( 0.608 * w ) ] .....................(2)
however, depending on what accuracy is required (keeping in mind that
water vapor measurements are probably good to 2-5%), eqn.(2) can
differ from (1) by around 0.06-0.08K near the surface.
If virtual temperature is used to calculate geopotential heights,
this difference can lead to errors of up to 0.6-0.7m.
So I took the slightly more computationally expensive road
and use eqn.(1).
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 01-May-2000
paul.vandelst@ssec.wisc.edu
POTENTIAL_TEMPERATURE
NAME:
Potential_Temperature
PURPOSE:
Function to calculate the potential temperature given the temperature
and pressure.
There is also an "inverse" capability to compute the temperature given
the potential temperature and pressure.
CALLING SEQUENCE:
Theta = Potential_Temperature( Temperature, & ! Input
Pressure, & ! Input
Inverse =Inverse, & ! Optional input
Message_Log=Message_Log ) ! Error messaging
INPUT ARGUMENTS:
Temperature: Atmospheric temperature.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Scalar or Rank-1
ATTRIBUTES: INTENT(IN)
Pressure: Atmospheric pressure
UNITS: hectoPascals, hPa
TYPE: REAL(fp)
DIMENSION: Same as Temperature
ATTRIBUTES: INTENT(IN)
OPTIONAL INPUT ARGUMENTS:
Inverse: Set this argument to compute the temperature
given the input is the potential temperature.
If = 0, potential temperature is calculated (default)
= 1, input value is assumed to be the potential
temperature and the temperature is
calculated.
UNITS: N/A
TYPE: INTEGER
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
Message_Log: Character string specifying a filename in which any
Messages will be logged. If not specified, or if an
error occurs opening the log file, the default action
is to output Messages to standard output.
UNITS: N/A
TYPE: CHARACTER(*)
DIMENSION: Scalar
ATTRIBUTES: OPTIONAL, INTENT(IN)
FUNCTION RESULT:
Theta: The potential temperature. If the optional Inverse
argument is set, the function result is the
atmospheric temperature.
If an error occurs, -1.0 is returned.
UNITS: Kelvin, K
TYPE: REAL(fp)
DIMENSION: Same as input Temperature
PROCEDURE:
The potential temperature of a parcel of air is that temperature
the parcel would have if it were expanded or compressed adiabatically
to some reference pressure.
The conversion is given by Poisson's equation:
R/Cp
[ P0 ]
Theta = T * [ ---- ] .......................(1)
[ p ]
where T = temperature,
p = pressure,
P0 = standard pressure
R = gas constant,
Cp = specific heat of gas at constant pressure.
This routine uses the standard atmosphere as the reference pressure,
R for dry air, and Cp for an ideal diatomic gas:
7 R0
Cp = --- . -------
2 MWair
where R0 = universal gas constant
MWair = molecular weight of dry air
CREATION HISTORY:
Written by: Paul van Delst, CIMSS/SSEC 11-Sep-2002
paul.vandelst@ssec.wisc.edu