physicsFunctions_mod¶
Dependency Diagrams:
Description
MODULE physicsFunctions_mod (prefix=’phf’ category=’8. Low-level utilities and constants’)
- Purpose
A collection of basic functions for various purposes (e.g. computing saturation vapour pressure).
Quick access
- Routines
phf_calcdistance()
,phf_calcdistancefast()
,phf_convert_z_to_gz()
,phf_convert_z_to_pressure()
,phf_fodla8()
,phf_fodle8()
,phf_fodle8_cmam()
,phf_fodqa8()
,phf_fodqs8()
,phf_fodti8()
,phf_fodti8_cmam()
,phf_fodtw8()
,phf_fodtw8_cmam()
,phf_fodtwi8()
,phf_fodtwi8_cmam()
,phf_foefq8()
,phf_foefqa()
,phf_foefql()
,phf_foefqpsa()
,phf_foei8_cmam()
,phf_foerat8_cmam()
,phf_foew8()
,phf_foew8_cmam()
,phf_foewa8()
,phf_foewi8_cmam()
,phf_fohr8()
,phf_fohra8()
,phf_folnqva()
,phf_foqfe8()
,phf_foqsa8()
,phf_foqst8()
,phf_foqst8_cmam()
,phf_foti8()
,phf_foti8_cmam()
,phf_fottv8()
,phf_fottva()
,phf_fotvt8()
,phf_fotvvl()
,phf_fotw8()
,phf_fotw8_cmam()
,phf_fotwi8()
,phf_fotwi8_cmam()
,phf_fqbranch()
,phf_get_pbl()
,phf_get_tropopause()
,phf_gravityalt()
,phf_gravitysrf()
,phf_height2geopotential()
,phf_tetens_coefs_switch()
Needed modules
mathphysconstants_mod
: MODULE mathPhysConstants_mod (prefix=’mpc’ category=’8. Low-level utilities and constants’)
earthconstants_mod
: MODULE earthConstants_mod (prefix=’ec’ category=’8. Low-level utilities and constants’)
utilities_mod
: MODULE utilities_mod (prefix=’utl’ category=’8. Low-level utilities and constants’)
message_mod
: MODULE message_mod (prefix=’msg’ category=’8. Low-level utilities and constants’)Variables
Subroutines and functions
- subroutine physicsfunctions_mod/phf_tetens_coefs_switch()¶
- Purpose
Read water saturation strategy from nml. Options are:
‘Tetens_1930’ was active before 2018.
‘Tetens_2018a’ is a partial update that missed some functions (active before IC4)
‘Tetens_2018’ completes the update to the intended 2018 specification.
- Called from
phf_foew8()
,phf_fodle8()
,phf_foewa8()
,phf_fodla8()
,phf_fotw8()
,phf_foti8()
,phf_fodtw8()
,phf_fodti8()
- Call to
- function physicsfunctions_mod/phf_foew8(ttt)¶
- Purpose
Water vapour saturation pressure (Tetens) - EW or EI as a fct of TT
- Arguments
ttt [real ,in]
- Return
phf_foew8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodle8(ttt)¶
- Purpose
FONCTION CALCULANT LA DERIVEE SELON T DE LN EW (OU LN EI)
- Arguments
ttt [real ,in]
- Return
phf_fodle8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_foqst8(ttt, prs)¶
- Purpose
FONCTION CALCULANT L’HUMIDITE SPECIFIQUE SATURANTE (QSAT)
- Arguments
ttt [real ,in]
prs [real ,in]
- Return
phf_foqst8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodqs8(qst, ttt)¶
- Purpose
FONCTION CALCULANT LA DERIVEE DE QSAT SELON T
- Arguments
qst [real ,in]
ttt [real ,in]
- Return
phf_fodqs8 [real ]
- Call to
- function physicsfunctions_mod/phf_foefq8(qqq, prs)¶
- Purpose
FONCTION CALCULANT TENSION VAP (EEE) FN DE HUM SP (QQQ) ET PRS
- Arguments
qqq [real ,in]
prs [real ,in]
- Return
phf_foefq8 [real ]
- Called from
hutoes()
,hutoes_tl()
,hutoes_ad()
,phf_fohr8()
,phf_fohra8()
- function physicsfunctions_mod/phf_foqfe8(eee, prs)¶
- Purpose
FONCTION CALCULANT HUM SP (QQQ) DE TENS. VAP (EEE) ET PRES (PRS)
- Arguments
eee [real ,in]
prs [real ,in]
- Return
phf_foqfe8 [real ]
- function physicsfunctions_mod/phf_fotvt8(ttt, qqq)¶
- Purpose
FONCTION CALCULANT TEMP VIRT. (TVI) DE TEMP (TTT) ET HUM SP (QQQ)
- Arguments
ttt [real ,in]
qqq [real ,in]
- Return
phf_fotvt8 [real ]
- Called from
calcheight_gsv_nl_vcode5xxx()
,calcpressure_gsv_nl_vcode2100x()
,calcpressure_col_nl_vcode2100x()
,calcheightcoeff_gsv()
,calcheightcoeff_col()
- function physicsfunctions_mod/phf_fottv8(tvi, qqq)¶
- Purpose
FONCTION CALCULANT TTT DE TEMP VIRT. (TVI) ET HUM SP (QQQ)
- Arguments
tvi [real ,in]
qqq [real ,in]
- Return
phf_fottv8 [real ]
- function physicsfunctions_mod/phf_fohr8(qqq, ttt, prs)¶
- Purpose
FONCTION CALCULANT HUM REL DE HUM SP (QQQ), TEMP (TTT) ET PRES (PRS). Where HR = E/ESAT
- Arguments
qqq [real ,in]
ttt [real ,in]
prs [real ,in]
- Return
phf_fohr8 [real ]
- Call to
- function physicsfunctions_mod/phf_foewa8(ttt)¶
- Purpose
FONCTION DE VAPEUR SATURANTE (TETENS)
- Arguments
ttt [real ,in]
- Return
phf_foewa8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodla8(ttt)¶
- Purpose
FONCTION CALCULANT LA DERIVEE SELON T DE LN EW
- Arguments
ttt [real ,in]
- Return
phf_fodla8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_foqsa8(ttt, prs)¶
- Purpose
FONCTION CALCULANT L’HUMIDITE SPECIFIQUE SATURANTE
- Arguments
ttt [real ,in]
prs [real ,in]
- Return
phf_foqsa8 [real ]
- Call to
- function physicsfunctions_mod/phf_fodqa8(qst, ttt)¶
- Purpose
FONCTION CALCULANT LA DERIVEE DE QSAT SELON T
- Arguments
qst [real ,in]
ttt [real ,in]
- Return
phf_fodqa8 [real ]
- Call to
- function physicsfunctions_mod/phf_fohra8(qqq, ttt, prs)¶
- Purpose
FONCTION CALCULANT L’HUMIDITE RELATIVE
- Arguments
qqq [real ,in]
ttt [real ,in]
prs [real ,in]
- Return
phf_fohra8 [real ]
- Call to
- function physicsfunctions_mod/phf_fotw8(eee)¶
- Purpose
FONCTION DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE PAR RAPPORT A EW.
- Arguments
eee [real ,in]
- Return
phf_fotw8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_foti8(eee)¶
- Purpose
FONCTION DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE PAR RAPPORT A EI.
- Arguments
eee [real ,in]
- Return
phf_foti8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodtw8(ttt, eee)¶
- Purpose
FONCTION DE LA DERIVE DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE (EW).
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodtw8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodti8(ttt, eee)¶
- Purpose
FONCTION DE LA DERIVE DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE (EI).
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodti8 [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fotwi8(ttt, eee)¶
- Purpose
FONCTION DE L’AJUSTEMENT DE LA TEMPERATURE.
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fotwi8 [real ]
- Call to
- function physicsfunctions_mod/phf_fodtwi8(ttt, eee)¶
- Purpose
FONCTION DE L’AJUSTEMENT DE LA DERIVEE DE LA TEMPERATURE.
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodtwi8 [real ]
- Call to
- function physicsfunctions_mod/phf_foew8_cmam(ttt)¶
- Purpose
FONCTION DE TENSION DE VAPEUR SATURANTE - EW
- Arguments
ttt [real ,in]
- Return
phf_foew8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_foei8_cmam(ttt)¶
- Purpose
FONCTION DE TENSION DE VAPEUR SATURANTE - EI
- Arguments
ttt [real ,in]
- Return
phf_foei8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_foerat8_cmam(ttt)¶
- Purpose
FONCTION DE LA PROPORTION DE LA CONTRIBUTION DE EW VS EI
- Arguments
ttt [real ,in]
- Return
phf_foerat8_cmam [real ]
- Called from
phf_foewi8_cmam()
,phf_fodle8_cmam()
,phf_fotwi8_cmam()
,phf_fodtwi8_cmam()
- function physicsfunctions_mod/phf_foewi8_cmam(ttt)¶
- Purpose
FONCTION DE TENSION DE VAPEUR SATURANTE RESULTANTE - EW et EI
- Arguments
ttt [real ,in]
- Return
phf_foewi8_cmam [real ]
- Called from
- Call to
- function physicsfunctions_mod/phf_fodle8_cmam(ttt)¶
- Purpose
FONCTION DE LA DERIVE DE LN(E) PAR RAPPORT A LA TEMPERATURE
- Arguments
ttt [real ,in]
- Return
phf_fodle8_cmam [real ]
- Call to
- function physicsfunctions_mod/phf_foqst8_cmam(ttt, prs)¶
- Purpose
FONCTION CALCULANT L’HUMIDITE SPECIFIQUE SATURANTE (QSAT). PREND EN COMPTE LES PHASES GLACE ET EAU.
- Arguments
ttt [real ,in]
prs [real ,in]
- Return
phf_foqst8_cmam [real ]
- Call to
- function physicsfunctions_mod/phf_fotw8_cmam(eee)¶
- Purpose
FONCTION DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE PAR RAPPORT A EW.
- Arguments
eee [real ]
- Return
phf_fotw8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_foti8_cmam(eee)¶
- Purpose
FONCTION DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE PAR RAPPORT A EI.
- Arguments
eee [real ,in]
- Return
phf_foti8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_fodtw8_cmam(ttt, eee)¶
- Purpose
FONCTION DE LA DERIVE DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE (EW).
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodtw8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_fodti8_cmam(ttt, eee)¶
- Purpose
FONCTION DE LA DERIVE DE LA TEMPERATURE EN FONCTION DE LA TENSION DE VAPEUR SATURANTE (EI).
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodti8_cmam [real ]
- Called from
- function physicsfunctions_mod/phf_fotwi8_cmam(ttt, eee)¶
- Purpose
FONCTION DE L’AJUSTEMENT DE LA TEMPERATURE.
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fotwi8_cmam [real ]
- Call to
- function physicsfunctions_mod/phf_fodtwi8_cmam(ttt, eee)¶
- Purpose
FONCTION DE L’AJUSTEMENT DE LA DERIVEE DE LA TEMPERATURE.
- Arguments
ttt [real ,in]
eee [real ,in]
- Return
phf_fodtwi8_cmam [real ]
- Call to
- function physicsfunctions_mod/phf_fqbranch(qqq)¶
- Purpose
function returning 0/1 depending on the minimum q branch condition as discussed by Brunet (1996) to prevent getting a vapour pressure that exceeds the total pressure p when q exceeds 1.
- Arguments
qqq [real ,in]
- Return
phf_fqbranch [real ]
- Called from
- function physicsfunctions_mod/phf_foefql(qql, prsl, qqq, prs, pneta)¶
- Purpose
TLM OF FUNCTION CALCULATING VAPOUR PRESSURE
INPUTS:
QQL , PERTURBATION OF LN SPECIFIC HUM
PRSL , PERTURBATION OF SURFACE PRESSURE
QQQ , SPECIFIC HUMIDITY
PRS , PRESSURE
PNETA , VALUE OF ETA LEVEL
OUTPUT:
FOEFQL, PERTURBATION OF VAPOUR PRESSURE
- Arguments
qql [real ,in]
prsl [real ,in]
qqq [real ,in]
prs [real ,in]
pneta [real ,in]
- Return
phf_foefql [real ]
- Call to
- function physicsfunctions_mod/phf_fotvvl(qqq, ttt, ttl, plnql)¶
- Purpose
Tangent-linear operator of virtual temperature
- Arguments
qqq [real ,in] :: backgroud specific humidity
ttt [real ,in] :: backgroud temperature
ttl [real ,in] :: temperature increment
plnql [real ,in] :: increment of logarithm specific humidity (del(ln q))
- Return
phf_fotvvl [real ]
- function physicsfunctions_mod/phf_foefqa(pades, pgamma, qqq, prs)¶
- Purpose
ADJOINT OF LN SPECIFIC HUM (QQQ) DUE TO DEWPOINT DEPRESSION CORRECTIONS
- Arguments
pades [real ,in] :: ADJOINT OF DEWPOINT DEPRESSION
pgamma [real ,in] :: ADOINT OF VAPOUR PRESSURE RELATIONSHIP
qqq [real ,in] :: SPECIFIC HUMIDITY
prs [real ,in] :: PRESSURE
- Return
phf_foefqa [real ]
- Called from
- function physicsfunctions_mod/phf_foefqpsa(pades, pgamma, qqq, pneta)¶
- Purpose
ADJOINT OF SURFACE PRESSURE DUE TO DEWPOINT DEPRESSION CORRECTIONS
- Arguments
pades [real ,in] :: ADJOINT OF DEWPOINT DEPRESSION
pgamma [real ,in] :: ADOINT OF VAPOUR PRESSURE RELATIONSHIP
qqq [real ,in] :: SPECIFIC HUMIDITY
pneta [real ,in] :: VALUE OF NETA
- Return
phf_foefqpsa [real ]
- Called from
- function physicsfunctions_mod/phf_fottva(qqq, tva)¶
- Purpose
Adjoint of temperature due to virtual temperature correction
- Arguments
qqq [real ,in] :: background specific humidity
tva [real ,in] :: adjoint variable of virtual temperature
- Return
phf_fottva [real ]
- Called from
- function physicsfunctions_mod/phf_folnqva(qqq, ttt, tva)¶
- Purpose
Adjoint of logarithm of specific humidity due to virtual temperature correction
- Arguments
qqq [real ,in] :: background specific humidity
ttt [real ,in] :: background temperature
tva [real ,in] :: adjoint variable of virtual temperature
- Return
phf_folnqva [real ]
- Called from
- function physicsfunctions_mod/phf_convert_z_to_pressure(altitude, rgz_mod, press_mod, nlev, nlev_mod, lat, success)¶
- Purpose
Converts an array of (geometric) altitudes to pressures. Uses linear interpolation in log(p).
- Arguments
altitude (nlev) [real ,in] :: altitudes to convert to pressures (m)
rgz_mod (nlev_mod) [real ,in] :: geopotential heights on model levels (m), assumed to be in decending order
press_mod (nlev_mod) [real ,in] :: pressure on model levels, assumed to be in ascending order
nlev [integer ,in,] :: length of altitude array
nlev_mod [integer ,in,] :: number of model levels
lat [real ,in] :: latitude (rad)
success (nlev) [logical ,inout] :: flag indicating success
- Return
press (nlev) [real ] :: converted pressures
- Called from
- Call to
- function physicsfunctions_mod/phf_convert_z_to_gz(altitude, lat, nlev)¶
- Purpose
Converts altitudes to geopotential heights. Uses the Helmert formula to parameterize the latitude dependence and uses analytical result of the integral of int g(z)dz for the altitude dependence (see J.A. Dutton 1976, p.65). At an altitude of 50 km, the altitude and geopotential height differ by around 0.2-0.5 km, depending on the latitude.
- Arguments
altitude (nlev) [real ,in] :: altitudes (m)
lat [real ,in] :: latitude (rad)
nlev [integer ,in,] :: number of levels
- Return
rgz (nlev) [real ] :: geopotential heights (m)
- Called from
- function physicsfunctions_mod/phf_get_tropopause(nmodlev, pressmod, tt, height[, hu_opt])¶
- Purpose
Determines pressure level of tropopause. Final tropopause is taken as max pressure (lowest altitude) from the water vapour and temperature based tropopauses.
- Arguments
nmodlev [integer ,in,] :: Number of model levels
pressmod (nmodlev) [real ,in] :: Model pressure array (Pa)
tt (nmodlev) [real ,in] :: Model temperature (Kelvin)
height (nmodlev) [real ,in] :: Model height (m)
hu_opt (nmodlev) [real ,in,] :: Model specific humidity
- Return
tropo_press [real ] :: Tropopause level in Pa (output)
- Call to
- function physicsfunctions_mod/phf_get_pbl(nmodlev, pressmod, tt, height[, hu_opt[, uu_opt[, vv_opt]]])¶
- Purpose
Determines pressure level of planetary boundary layer using a first threshold of 0.5 for the bulk Richadson number (after Mahrt, 1981; requires availability of uu and vv). Threshold reduced to largest value between 0.25 and 0.5 if first not satisfied.
If not found with this approach, applies a variant of the Heffter approach described in Aliabadi et al (2016), with some local variation.
References:
Aliabadi A.A., R.M. Staebler, J. de Grandpre, A. Zadra, and P.A. Vaillancourt, 2016: Comparison of Estimated Atmospheric Boundary Layer Mixing Height in teh Arctic and Southern Great Plains under Statisticallt Stable Conditions: Experimental and Numerical Aspects, Submitted to Atmosphere-Ocean (2015).
Mahrt, L. 1981: Modelling depth of the stable boundary-layer, Bound-Lay. Meteorol., 21, 3-19
Heffter, J.L.,1980: Transport layer depth calculations, Second Joint Conference on Applications of Air Pollution Meteorology, New Orleans, LA, 24-27 March 1980. American Meteorological Society, Boston, MA.
Comments: Currently assumes (uu,vv) midlayer levels approximately at tt, height, and hu levels when size(uu).ne.nmodlev.
- Arguments
nmodlev [integer ,in,] :: Number of model levels for variables other than uu and vv
pressmod (nmodlev) [real ,in] :: Model pressure array (Pa)
tt (nmodlev) [real ,in] :: Model temperature (Kelvin)
height (nmodlev) [real ,in] :: Model height (meters)
hu_opt (nmodlev) [real ,in,] :: Specific humidity
- Options
uu_opt (*) [real ,in,] :: Model zonal wind component (m/s)
vv_opt (*) [real ,in,] :: Model meridional wind component (m/s)
- Return
pbl_press [real ] :: PBL level in Pa (output)
- Call to
- function physicsfunctions_mod/phf_calcdistance(lat2, lon2, lat1, lon1)¶
- Purpose
Compute the distance between two point on earth: (lat1,lon1) and (lat2,lon2). Calcul utilisant la Formule d’Haversine.
Reference: R.W. Sinnott,’Virtues of Haversine’,Sky and Telescope, vol.68, no.2, 1984, p.159)
- Arguments
lat2 [real ,in]
lon2 [real ,in]
lat1 [real ,in]
lon1 [real ,in]
- Return
distanceinm [real ]
- Called from
aer_computeanlerrorstd()
,bdiff_setup()
,gpos_xyfll_unstructgrid()
,hco_weight()
- function physicsfunctions_mod/phf_calcdistancefast(lat2, lon2, lat1, lon1)¶
- Purpose
Compute the distance between two point on earth: (lat1,lon1) and (lat2,lon2). Using a quick and dirty formula good for short distances not close to the pole.
- Arguments
lat2 [real ,in]
lon2 [real ,in]
lat1 [real ,in]
lon1 [real ,in]
- Return
distanceinm [real ]
- Called from
- function physicsfunctions_mod/phf_gravitysrf(slat)¶
- Purpose
Normal gravity on ellipsoidal surface
- Arguments
slat [real ,in] :: sin of latitude
- Return
phf_gravitysrf [real ] :: normal gravity (m/s2)
- Called from
- function physicsfunctions_mod/phf_gravityalt(slat, altitude)¶
- Purpose
Normal gravity above the ellipsoidal surface
- Arguments
slat [real ,in] :: sin of latitude
altitude [real ,in] :: altitude (m)
- Return
phf_gravityalt [real ] :: Normal gravity (m/s2)
- Called from
calcheight_gsv_nl_vcode5xxx()
,calcpressure_gsv_nl_vcode2100x()
,calcpressure_col_nl_vcode2100x()
,calcheightcoeff_gsv()
,calcheightcoeff_col()
,phf_height2geopotential()
- Call to
- subroutine physicsfunctions_mod/phf_height2geopotential(altitude, latitude, geopotential[, printheight_opt])¶
- Purpose
Geopotential energy at a given point. Result is based on the WGS84 approximate expression for the gravity acceleration as a function of latitude and altitude, integrated with the trapezoidal rule.
- Arguments
altitude (*) [real ,in] :: altitude (m)
latitude [real ,in] :: latitude (rad)
geopotential (*) [real ,inout] :: geopotential (m2/s2)
- Options
printheight_opt [logical ,inout,]
- Called from
- Call to