Common Community Physics Package (CCPP) Scientific Documentation  Version 2.0
funcphys Module Reference

This module provides an Application Program Interface (API) for computing basic thermodynamic physics functions, in particular:

  1. saturation vapor pressure as a function of temperature;
  2. dewpoint temperature as a function of vapor pressure;
  3. equivalent potential temperature as a function of temperature and scaled pressure to the kappa power;
  4. temperature and specific humidity along a moist adiabat as functions of equivalent potential temperature and scaled pressure to the kappa power;
  5. scaled pressure to the kappa power as a function of pressure, and
  6. temperature at the lifting condensation level as a function of temperature and dewpoint depression.
More...

Functions/Subroutines

subroutine, public gpvsl
 This subroutine computes saturation vapor pressure table as a function of temperature for the table lookup function fpval. Exact saturation vapor pressures are calculated in subprogram fpvslx(). The current implementation computes a table with a length of 7501 for temperature ranging from 180. to. More...
 
elemental real(krealfp) function, public fpvsl (t)
 This funtion computes saturation vapor pressure from the temperature. A linear interpolation is done between values in a lookup table computed in gpvsl(). See documentation for fpvslx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvslq (t)
 This function computes saturation vapor pressure from the temperature. A quadratic interpolation is done between values in a lookup table computed in gpvsl(). See documentaion for fpvslx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvslx (t)
 This function exactly computes saturation vapor pressure from temperature. The water model assumes a perfect gas, constant specific heats for gas and liquid, and neglects the volume of the liquid. The model does account for the variation of the latent heat of condensation with temperature. The ice option is not included. The Clausius-Clapeyron equation is integrated from the triple point to get the formula:
pvsl=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants. This function should be expanded inline in the calling routine. More...
 
subroutine, public gpvsi
 This subroutine computes saturation vapor pressure table as a function of temperature for the table lookup function fpvsi(). Exact saturation vapor pressures are calculated in subprogram fpvsix(). The current implementation computes a table with a length of 7501 for temperatures ranging from 180. to 330. Kelvin. More...
 
elemental real(krealfp) function, public fpvsi (t)
 This function computes saturation vapor pressure from the temperature. A linear interpolation is done between values in a lookup table computed in gpvsi(). See documentation for fpvsix() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvsiq (t)
 This function computes saturation vapor pressure from the temperature. A quadratic interpolation is done between values in a lookup table computed in gpvsi(). See documentation for fpvsix() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvsix (t)
 This funtion exactly computes saturation vapor pressure from temperature. The water model assumes a perfect gas, constant specific heats for gas and ice, and neglects the volume of the ice. The model does account for the variation of the latent heat of condensation with temperature. The liquid option is not included. The Clausius- Clapeyron equation is integrated from the triple point to get the formula:
pvsi=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants. This function should be expanded inline in the calling routine. More...
 
subroutine, public gpvs
 This subroutine computes saturation vapor pressure table as a function of temperature for the table lookup function fpvs(). Exact saturation vapor pressures are calculated in subprogram fpvsx(). The current implementation computes a table with a length of 7501 for temperatures ranging from 180. to 330. Kelvin. More...
 
elemental real(krealfp) function, public fpvs (t)
 This function computes saturation vapor pressure from the temperature. A linear interpolation is done between values in a lookup table computed in gpvs(). See documentation for fpvsx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvsq (t)
 This function computes saturation vapor pressure from the temperature. A quadratic interpolation is done between values in a lookup table computed in gpvs(). See documentation for fpvsx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpvsx (t)
 This function exactly computes saturation vapor pressure from temperature. The saturation vapor pressure over either liquid and ice is computed over liquid for temperatures above the triple point, over ice for temperatures 20 degress below the triple point, and a linear combination of the two for temperatures in between. The water model assumes a perfect gas, constant specific heats for gas, liquid and ice, and neglects the volume of the condensate. The model does account for the variation of the latent heat of condensation and sublimation with temperature. The Clausius-Clapeyron equation is integrated from the triple point to get the formula:
pvsl=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants. The reference for this computation is Emanuel(1994), pages 116-117. This function should be expanded inline in the calling routine. More...
 
subroutine, public gtdpl
 This subroutine computes dewpoint temperature table as a function of vapor pressure for inlinable function ftdpl(). Exact dewpoint temperatures are calculated in subprogram ftdplxg(). The current implementation computes a table with a length of 5001 for vapor pressures ranging from 1 to 10001 Pascals giving a dewpoint temperature range of 208 to 319 Kelvin. More...
 
elemental real(krealfp) function, public ftdpl (pv)
 This function Compute dewpoint temperature from vapor pressure. A linear interpolation is done between values in a lookup table computed in gtdpl(). See documentation for ftdplxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdplq (pv)
 This function computes dewpoint temperature from vapor pressure. A quadratic interpolation is done between values in a lookup table computed in gtdpl(). See documentation for ftdplxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdplx (pv)
 This function exactly compute dewpoint temperature from vapor pressure. An approximate dewpoint temperature for function ftdplxg() is obtained using ftdpl() so gtdpl() must be already called. See documentation for ftdplxg() for details. More...
 
elemental real(krealfp) function, public ftdplxg (tg, pv)
 This function exactly computes dewpoint temperature from vapor pressure. A guess dewpoint temperature must be provided. The water model assumes a perfect gas, constant specific heats for gas and liquid, and neglects the volume of the liquid. The model does account for the variation of the latent heat of condensation with temperature. The ice option is not included. The Clausius-Clapeyron equation is integrated from the triple point to get the formula:
pvs=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants.
The formula is inverted by iterating Newtonian approximations for each pvs until t is found to within 1.e-6 Kelvin. This function can be expanded inline in the calling routine. More...
 
subroutine, public gtdpi
 This subroutine computes dewpoint temperature table as a function of vapor pressure for inlinable function ftdpi(). Exact dewpoint temperatures are calculated in subprogram ftdpixg(). The current implementation computes a table with a length of 5001 for vapor pressures ranging from 0.1 to 1000.1 Pascals giving a dewpoint temperature range of 197 to 279 Kelvin. More...
 
elemental real(krealfp) function, public ftdpi (pv)
 This subroutine computes dewpoint temperature from vapor pressure. A linear interpolation is done between values in a lookup table computed in gtdpi(). See documentation for ftdpixg for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdpiq (pv)
 This function computes dewpoint temperature from vapor pressure. A quadratic interpolation is done between values in a lookup table computed in gtdpi(). see documentation for ftdpixg() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdpix (pv)
 This function exactly computes dewpoint temperature from vapor pressure. An approximate dewpoint temperature for function ftdpixg() is obtained using ftdpi() so gtdpi() must be already called. See documentation for ftdpixg() for details. More...
 
elemental real(krealfp) function, public ftdpixg (tg, pv)
 This function exactly computes dewpoint temperature from vapor pressure. A guess dewpoint temperature must be provided. The water model assumes a perfect gas, constant specific heats for gas and ice, and neglects the volume of the ice. The model does account for the variation of the latent heat of sublimation with temperature. The liquid option is not included. The Clausius-Clapeyron equation is integrated from the triple point to get the formula:
pvs=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants. The formula is inverted by iterating Newtonian approximations for each pvs until t is found to within 1.e-6 Kelvin. This function can be expanded inline in the calling routine. More...
 
subroutine, public gtdp
 This subroutine computes dewpoint temperature table as a function of vapor pressure for inlinable function ftdp(). Exact dewpoint temperatures are calculated in subprogram ftdpxg(). The current implementation computes a table with a length of 5001 for vapor pressures ranging from 0.5 to 1000.5 Pascals giving a dewpoint temperature range of 208 to 319 Kelvin. More...
 
elemental real(krealfp) function, public ftdp (pv)
 This function computes dewpoint temperature from vapor pressure. A linear interpolation is done between values in a lookup table computed in gtdp(). See documentation for ftdpxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdpq (pv)
 This function computes dewpoint temperature from vapor pressure. A quadratic interpolation is done between values in a lookup table computed in gtdp(). See documentation for ftdpxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftdpx (pv)
 This function exactly computes dewpoint temperature from vapor pressure. An approximate dewpoint temperature for function ftdpxg() is obtained using ftdp() so gtdp() must be already called. See documentation for ftdpxg() for details. More...
 
elemental real(krealfp) function, public ftdpxg (tg, pv)
 This function exactly computes dewpoint temperature from vapor pressure. A guess dewpoint temperature must be provided. The saturation vapor pressure over either liquid and ice is computed over liquid for temperatures above the triple point, over ice for temperatures 20 degress below the triple point, and a linear combination of the two for temperatures in between. The water model assumes a perfect gas, constant specific heats for gas, liquid and ice, and neglects the volume of the condensate. The model does account for the variation of the latent heat of condensation and sublimation with temperature. The Clausius-Clapeyron equation is integrated from the triple point to get the formula:
pvsl=con_psat*(tr**xa)*exp(xb*(1.-tr))
where tr is ttp/t and other values are physical constants.
The reference for this decision is Emanuel(1994), pages 116-117. The formula is inverted by iterating Newtonian approximations for each pvs until t is found to within 1.e-6 Kelvin. This function can be expanded inline in the calling routine. More...
 
subroutine, public gthe
 This subroutine computes equivalent potential temperature table as a function of LCL temperature and pressure over 1e5 Pa to the kappa power for function fthe(). Equivalent potential temperatures are calculated in subprogram fthex() the current implementation computes a table with a first dimension of 241 for temperatures ranging from 183.16 to 303.16 Kelvin and a second dimension of 151 for pressure over 1e5 Pa to the kappa power ranging from \(0.04^{rocp}\) to \(1.10^{rocp}\). More...
 
elemental real(krealfp) function, public fthe (t, pk)
 This function computes equivalent potential temperature at the LCL from temperature and pressure over 1e5 Pa to the kappa power. A bilinear interpolation is done between values in a lookup table computed in gthe(). see documentation for fthex() for details. Input values outside table range are reset to table extrema, except zero is returned for too cold or high LCLs. More...
 
elemental real(krealfp) function, public ftheq (t, pk)
 This function computes equivalent potential temperature at the LCL from temperature and pressure over 1e5 Pa to the kappa power. A biquadratic interpolation is done between values in a lookup table computed in gthe(). see documentation for fthex() for details. Input values outside table range are reset to table extrema, except zero is returned for too cold or high LCLs. More...
 
real(krealfp) function, public fthex (t, pk)
 This function exactly computes equivalent potential temperature at the LCL from temperature and pressure over 1e5 Pa to the kappa power. Equivalent potential temperature is constant for a saturated parcel rising adiabatically up a moist adiabat when the heat and mass of the condensed water are neglected. Ice is also neglected. The formula for equivalent potential temperature (Holton) is
the=t*(pd**(-rocp))*exp(el*eps*pv/(cp*t*pd))
where t is the temperature, pv is the saturated vapor pressure, pd is the dry pressure p-pv, el is the temperature dependent latent heat of condensation hvap+dldt*(t-ttp), and other values are physical constants defined in parameter statements in the code. Zero is returned if the input values make saturation impossible. This function should be expanded inline in the calling routine. More...
 
subroutine, public gtma
 This subroutine computes temperature and specific humidity tables as a function of equivalent potential temperature and pressure over 1e5 Pa to the kappa power for subprogram stma(). Exact parcel temperatures are calculated in subprogram stmaxg(). The current implementation computes a table with a first dimension of 151 for equivalent potential temperatures ranging from 200 to 500 Kelvin and a second dimension of 121 for pressure over 1e5 Pa to the kappa power ranging from \(0.01^{rocp}\) to \(1.10^{rocp}\). More...
 
elemental subroutine, public stma (the, pk, tma, qma)
 This subroutine computes temperature and specific humidity of a parcel lifted up a moist adiabat from equivalent potential temperature at the LCL and pressure over 1e5 Pa to the kappa power. Bilinear interpolations are done between values in a lookup table computed in gtma(). See documentation for stmaxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental subroutine, public stmaq (the, pk, tma, qma)
 This subroutine computes temperature and specific humidity of a parcel lifted up a moist adiabat from equivalent potential temperature at the LCL and pressure over 1e5 Pa to the kappa power. Biquadratic interpolations are done between values in a lookup table computed in gtma(). See documentation for stmaxg() for details. Input values outside table range are reset to table extrema. More...
 
elemental subroutine, public stmax (the, pk, tma, qma)
 This subroutine exactly computes temperature and humidity of a parcel lifted up a moist adiabat from equivalent potential temperature at the LCL and pressure over 1e5 Pa to the kappa power. An approximate parcel temperature for subprogram stmaxg() is obtained using stma() so gtma() must be already called. See documentation for stmaxg() for details. More...
 
elemental subroutine, public stmaxg (tg, the, pk, tma, qma)
 This subroutine exactly computes temperature and humidity of a parcel lifted up a moist adiabat from equivalent potential temperature at the LCL and pressure over 1e5 Pa to the kappa power. A guess parcel temperature must be provided. Equivalent potential temperature is constant for a saturated parcel rising adiabatically up a moist adiabat when the heat and mass of the condensed water are neglected. Ice is also neglected. The formula for equivalent potential temperature (Holton) is
the=t*(pd**(-rocp))*exp(el*eps*pv/(cp*t*pd))
where t is the temperature, pv is the saturated vapor pressure, pd is the dry pressure p-pv, el is the temperature dependent latent heat of condensation hvap+dldt*(t-ttp), and other values are physical constants defined in parameter statements in the code. The formula is inverted by iterating Newtonian approximations for each the and p until t is found to within 1.e-4 Kelvin. The specific humidity is then computed from pv and pd. This subprogram can be expanded inline in the calling routine. More...
 
subroutine, public gpkap
 This subroutine computes pressure to the kappa table as a function of pressure for the table lookup function fpkap(). Exact pressure to the kappa values are calculated in subprogram fpkapx(). The current implementation computes a table with a length of 5501 for pressures ranging up to 110000 Pascals. More...
 
elemental real(krealfp) function, public fpkap (p)
 This subroutine raises pressure over 1e5 Pa to the kappa power. A linear interpolation is done between values in a lookup table computed in gpkap(). See documentation for fpkapx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public fpkapq (p)
 This function raises pressure over 1e5 Pa to the kappa power. A quadratic interpolation is done between values in a lookup table computed in gpkap(). see documentation for fpkapx() for details. Input values outside table range are reset to table extrema. More...
 
real(krealfp) function, public fpkapo (p)
 This function raises surface pressure over 1e5 Pa to the kappa power using a rational weighted chebyshev approximation. The numerator is of order 2 and the denominator is of order 4. The pressure range is 40000-110000 Pa and kappa is defined in fpkapx(). More...
 
elemental real(krealfp) function, public fpkapx (p)
 This function raises pressure over 1e5 Pa to the kappa power. Kappa is equal to rd/cp where rd and cp are physical constants. More...
 
subroutine, public grkap
 This subroutine computes pressure to the 1/kappa table as a function of pressure for the table lookup function frkap(). Exact pressure to the 1/kappa values are calculated in subprogram frkapx(). The current implementation computes a table with a length of 5501 for pressures ranging up to 110000 Pascals. More...
 
elemental real(krealfp) function, public frkap (pkap)
 This subroutine raises pressure over 1e5 Pa to the 1/kappa power. A linear interpolation is done between values in a lookup table computed in grkap(). See documentation for frkapx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public frkapq (pkap)
 This function raises pressure over 1e5 Pa to the 1/kappa power. A quadratic interpolation is done between values in a lookup table computed in grkap(). see documentation for frkapx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public frkapx (pkap)
 This function raise pressure over 1e5 Pa to the 1/kappa power. Kappa is equal to rd/cp where rd and cp are physical constants. More...
 
subroutine, public gtlcl
 This subroutine computes lifting condensation level temperature table as a function of temperature and dewpoint depression for function ftlcl(). Lifting condensation level temperature is calculated in subprogram ftlclx() The current implementation computes a table with a first dimension of 151 for temperatures ranging from 180.0 to 330.0 Kelvin and a second dimension of 61 for dewpoint depression ranging from 0 to 60 Kelvin. More...
 
elemental real(krealfp) function, public ftlcl (t, tdpd)
 This function computes temperature at the lifting condensation level from temperature and dewpoint depression. A bilinear interpolation is done between values in a lookup table computed in gtlcl(). See documentation for ftlclx() for details. Input values outside table range are reset to table extrema. More...
 
elemental real(krealfp) function, public ftlclq (t, tdpd)
 This function computes temperature at the lifting condensation level from temperature and dewpoint depression. A biquadratic interpolation is done between values in a lookup table computed in gtlcl(). see documentation for ftlclx() for details. Input values outside table range are reset to table extrema. More...
 
real(krealfp) function, public ftlclo (t, tdpd)
 This function computes temperature at the lifting condensation level from temperature and dewpoint depression. the formula used is a polynomial taken from Phillips mstadb routine which empirically approximates the original exact implicit relationship. More...
 
elemental real(krealfp) function, public ftlclx (t, tdpd)
 This function computes temperature at the lifting condensation level from temperature and dewpoint depression. A parcel lifted adiabatically becomes saturated at the lifting condensation level. The water model assumes a perfect gas, constant specific heats for gas and liquid, and neglects the volume of the liquid. The model does account for the variation of the latent heat of condensation with temperature. The ice option is not included. The Clausius-Clapeyron equation is integrated from the triple point to get the formulas:
pvlcl=con_psat*(trlcl**xa)*exp(xb*(1.-trlcl))
pvdew=con_psat*(trdew**xa)*exp(xb*(1.-trdew))
where pvlcl is the saturated parcel vapor pressure at the LCL, pvdew is the unsaturated parcel vapor pressure initially, trlcl is ttp/tlcl and trdew is ttp/tdew. The adiabatic lifting of the parcel is represented by the following formula
pvdew=pvlcl*(t/tlcl)**(1/kappa)
This formula is inverted by iterating Newtonian approximations until tlcl is found to within 1.e-6 Kelvin. Note that the minimum returned temperature is 180 Kelvin. More...
 
subroutine, public gfuncphys
 This subroutine computes all physics function tables. Lookup tables are set up for computing saturation vapor pressure, dewpoint temperature, equivalent potential temperature, moist adiabatic temperature and humidity, pressure to the kappa, and lifting condensation level temperature. More...
 

Variables

integer, parameter, public krealfp =kind_phys
 Integer parameter kind or length of reals. More...
 
real(krealfp), parameter psatb =con_psat*1.e-5
 
integer, parameter nxpvsl =7501
 
real(krealfpc1xpvsl
 
real(krealfpc2xpvsl
 
real(krealfp), dimension(nxpvsltbpvsl
 
integer, parameter nxpvsi =7501
 
real(krealfpc1xpvsi
 
real(krealfpc2xpvsi
 
real(krealfp), dimension(nxpvsitbpvsi
 
integer, parameter nxpvs =7501
 
real(krealfpc1xpvs
 
real(krealfpc2xpvs
 
real(krealfp), dimension(nxpvstbpvs
 
integer, parameter nxtdpl =5001
 
real(krealfpc1xtdpl
 
real(krealfpc2xtdpl
 
real(krealfp), dimension(nxtdpltbtdpl
 
integer, parameter nxtdpi =5001
 
real(krealfpc1xtdpi
 
real(krealfpc2xtdpi
 
real(krealfp), dimension(nxtdpitbtdpi
 
integer, parameter nxtdp =5001
 
real(krealfpc1xtdp
 
real(krealfpc2xtdp
 
real(krealfp), dimension(nxtdptbtdp
 
integer, parameter nxthe =241
 
integer, parameter nythe =151
 
real(krealfpc1xthe
 
real(krealfpc2xthe
 
real(krealfpc1ythe
 
real(krealfpc2ythe
 
real(krealfp), dimension(nxthe, nythetbthe
 
integer, parameter nxma =151
 
integer, parameter nyma =121
 
real(krealfpc1xma
 
real(krealfpc2xma
 
real(krealfpc1yma
 
real(krealfpc2yma
 
real(krealfp), dimension(nxma, nymatbtma
 
real(krealfp), dimension(nxma, nymatbqma
 
integer, parameter nxpkap =11001
 
real(krealfpc1xpkap
 
real(krealfpc2xpkap
 
real(krealfp), dimension(nxpkaptbpkap
 
integer, parameter nxrkap =5501
 
real(krealfpc1xrkap
 
real(krealfpc2xrkap
 
real(krealfp), dimension(nxrkaptbrkap
 
integer, parameter nxtlcl =151
 
integer, parameter nytlcl =61
 
real(krealfpc1xtlcl
 
real(krealfpc2xtlcl
 
real(krealfpc1ytlcl
 
real(krealfpc2ytlcl
 
real(krealfp), dimension(nxtlcl, nytlcltbtlcl
 

Detailed Description

The entry points required to set up lookup tables start with a "g". All the other entry points are functions starting with an "f" or are subroutines starting with an "s". These other functions and subroutines are elemental; that is, they return a scalar if they are passed only scalars, but they return an array if they are passed an array. These other functions and subroutines can in inlined, too.