FMS  2025.04
Flexible Modeling System
sat_vapor_pres.F90
1 !***********************************************************************
2 !* Apache License 2.0
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* Licensed under the Apache License, Version 2.0 (the "License");
7 !* you may not use this file except in compliance with the License.
8 !* You may obtain a copy of the License at
9 !*
10 !* http://www.apache.org/licenses/LICENSE-2.0
11 !*
12 !* FMS is distributed in the hope that it will be useful, but WITHOUT
13 !* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
14 !* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 !* PARTICULAR PURPOSE. See the License for the specific language
16 !* governing permissions and limitations under the License.
17 !***********************************************************************
18 !> @defgroup sat_vapor_pres_mod sat_vapor_pres_mod
19 !> @ingroup sat_vapor_pres
20 !> @brief Routines for computing the saturation vapor pressure (es),
21 !! the specific humidity (qs) and vapor mixing ratio (mrs)
22 !> Given a specified relative humidity, calculates es, qs, and mrs, as well as their
23 !! derivatives with respect to temperature, and also includes routines
24 !! to initialize the look-up table.
25 !! This module contains routines for determining the saturation vapor
26 !! pressure (<TT>ES</TT>) from lookup tables constructed using equations given
27 !! in the Smithsonian tables. The <TT>ES</TT> lookup tables are valid between
28 !! -160C and +100C (approx 113K to 373K).
29 !!
30 !! The values of <TT>ES</TT> are computed over ice from -160C to -20C,
31 !! over water from 0C to 100C, and a blended value (over water and ice)
32 !! from -20C to 0C.
33 !!
34 !! Routines are also included to calculate the saturation specific
35 !! humidity and saturation mixing ratio for vapor, and their deriv-
36 !! atives with respect to temperature. By default, the values returned
37 !! are those at saturation; optionally, values of q and mr at a spec-
38 !! ified relative humidity may instead be returned. Two forms are
39 !! available; the approximate form that has been traditionally used in
40 !! GCMs, and an exact form provided by SJ Lin in which saturation is
41 !! reached while maintaining constant pressure and temperature.
42 !!
43 !! This version was written for non-vector machines.
44 !! See the <LINK SRC="#NOTES">notes</LINK> section for details on vectorization.
45 !!
46 !! arguments
47 !! ---------
48 !! temp intent in temperature in degrees kelvin
49 !! es intent out saturation vapor pressure in Pascals
50 !! des intent out derivative of saturation vapor pressure
51 !! with respect to temperature
52 !! (Pascals/degree)
53 !! press intent in atmospheric pressure in Pascals
54 !! qs intent out specific humidity at relative humidity hc
55 !! (kg(vapor) / kg(moist air)
56 !! mrs intent out mixing ratio at relative humidity hc
57 !! (kg(vapor) / kg(dry air)
58 !!
59 !! optional arguments
60 !! ------------------
61 !! q intent in vapor specific humidity
62 !! (kg(vapor) / kg(moist air)
63 !! hc intent in relative humidity at which output
64 !! fields are desired: default is 100 %
65 !! dqsdT intent out derivative of saturation specific
66 !! humidity with respect to temperature
67 !! (kg(vapor) / kg(moist air) /degree)
68 !! mr intent in vapor mixing ratio
69 !! (kg(vapor) / kg(dry air)
70 !! dmrsdT intent out derivative of saturation mixing ratio
71 !! with respect to temperature
72 !! (kg(vapor) / kg(dry air) /degree)
73 !! esat intent out saturation vapor pressure
74 !! (Pascals)
75 !! err_msg intent out character string to hold error message
76 !! es_over_liq
77 !! intent in use es table wrt liquid only
78 !!
79 !! Example Usages:
80 !!
81 !! call lookup_es (temp, es, err_msg)
82 !!
83 !! call lookup_des (temp, des, err_msg)
84 !!
85 !! call lookup_es_des (temp, es, des, err_msg)
86 !!
87 !! call lookup_es2 (temp, es, err_msg)
88 !!
89 !! call lookup_des2 (temp, des, err_msg)
90 !!
91 !! call lookup_es2_des2 (temp, es, des, err_msg)
92 !!
93 !! call compute_qs (temp, press, qs, q, hc, dqsdT, esat,
94 !! err_msg, es_over_liq)
95 !!
96 !! call compute_mrs (temp, press, mrs, mr, hc, dmrsdT, esat,
97 !! err_msg, es_over_liq)
98 
99 module sat_vapor_pres_mod
100 
101 !-----------------------------------------------------------------------
102 !
103 !
104 ! arguments
105 ! ---------
106 ! temp intent in temperature in degrees kelvin
107 ! es intent out saturation vapor pressure in Pascals
108 ! des intent out derivative of saturation vapor pressure
109 ! with respect to temperature
110 ! (Pascals/degree)
111 ! press intent in atmospheric pressure in Pascals
112 ! qs intent out specific humidity at relative humidity hc
113 ! (kg(vapor) / kg(moist air)
114 ! mrs intent out mixing ratio at relative humidity hc
115 ! (kg(vapor) / kg(dry air)
116 !
117 ! optional arguments
118 ! ------------------
119 ! q intent in vapor specific humidity
120 ! (kg(vapor) / kg(moist air)
121 ! hc intent in relative humidity at which output
122 ! fields are desired: default is 100 %
123 ! dqsdT intent out derivative of saturation specific
124 ! humidity with respect to temperature
125 ! (kg(vapor) / kg(moist air) /degree)
126 ! mr intent in vapor mixing ratio
127 ! (kg(vapor) / kg(dry air)
128 ! dmrsdT intent out derivative of saturation mixing ratio
129 ! with respect to temperature
130 ! (kg(vapor) / kg(dry air) /degree)
131 ! esat intent out saturation vapor pressure
132 ! (Pascals)
133 ! err_msg intent out character string to hold error message
134 ! es_over_liq
135 ! intent in use es table wrt liquid only
136 !
137 !-----------------------------------------------------------------------
138 
139 ! <CONTACT EMAIL="Bruce.Wyman@noaa.gov">
140 ! Bruce Wyman
141 ! </CONTACT>
142 
143 ! <HISTORY SRC="http://www.gfdl.noaa.gov/fms-cgi-bin/cvsweb.cgi/FMS/"/>
144 
145 ! <OVERVIEW>
146 ! Routines for determining the saturation vapor pressure
147 ! (<TT>ES</TT>), saturation vapor specific humidity and saturation
148 ! vapor mixing ratio, and their derivatives with respect to
149 ! temperature.
150 ! </OVERVIEW>
151 
152 ! <DESCRIPTION>
153 ! This module contains routines for determining the saturation vapor
154 ! pressure (<TT>ES</TT>) from lookup tables constructed using equations given
155 ! in the Smithsonian tables. The <TT>ES</TT> lookup tables are valid between
156 ! -160C and +100C (approx 113K to 373K).
157 
158 ! The values of <TT>ES</TT> are computed over ice from -160C to -20C,
159 ! over water from 0C to 100C, and a blended value (over water and ice)
160 ! from -20C to 0C.
161 
162 ! Routines are also included to calculate the saturation specific
163 ! humidity and saturation mixing ratio for vapor, and their deriv-
164 ! atives with respect to temperature. By default, the values returned
165 ! are those at saturation; optionally, values of q and mr at a spec-
166 ! ified relative humidity may instead be returned. Two forms are
167 ! available; the approximate form that has been traditionally used in
168 ! GCMs, and an exact form provided by SJ Lin in which saturation is
169 ! reached while maintaining constant pressure and temperature.
170 
171 ! This version was written for non-vector machines.
172 ! See the <LINK SRC="#NOTES">notes</LINK> section for details on vectorization.
173 
174 ! </DESCRIPTION>
175 
176 ! <PUBLIC>
177 ! Description summarizing public interface.
178 ! </PUBLIC>
179 
180  use constants_mod, only: tfreeze, rdgas, rvgas, hlv, es0
181  use fms_mod, only: write_version_number, stdout, stdlog, mpp_pe, mpp_root_pe, &
182  mpp_error, fatal, warning, fms_error_handler, &
184  use mpp_mod, only: input_nml_file
185  use sat_vapor_pres_k_mod, only: sat_vapor_pres_init_k, lookup_es_k, &
187  lookup_es2_k, &
189  lookup_es3_k, &
192  use platform_mod, only: r4_kind, r8_kind
193 
194 implicit none
195 private
196 
197  public :: lookup_es, lookup_des, sat_vapor_pres_init
201 !public :: compute_es
202  public :: escomp, descomp ! for backward compatibility
203  ! use lookup_es, lookup_des instead
204 
205 !-----------------------------------------------------------------------
206 
207 ! <INTERFACE NAME="lookup_es">
208 
209 ! <OVERVIEW>
210 ! For the given temperatures, returns the saturation vapor pressures.
211 ! </OVERVIEW>
212 ! <DESCRIPTION>
213 ! For the given temperatures these routines return the
214 ! saturation vapor pressure (esat). The return values are derived from
215 ! lookup tables (see notes below).
216 ! </DESCRIPTION>
217 ! <TEMPLATE>
218 ! call lookup_es( temp, esat, err_msg )
219 ! </TEMPLATE>
220 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
221 ! Temperature in degrees Kelvin.
222 ! </IN>
223 ! <OUT NAME="esat" UNITS="pascal" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
224 ! Saturation vapor pressure in pascals.
225 ! May be a scalar, 1d, 2d, or 3d array.
226 ! Must have the same order and size as temp.
227 ! </OUT>
228 ! <OUT NAME="err_msg" UNITS=" " TYPE="character">
229 ! Character string containing error message to be returned to
230 ! calling routine.
231 ! </OUT>
232 ! <ERROR MSG="table overflow, nbad=##" STATUS="FATAL">
233 ! Temperature(s) provided to the saturation vapor pressure lookup
234 ! are outside the valid range of the lookup table (-160 to 100 deg C).
235 ! This may be due to a numerical instability in the model.
236 ! Information should have been printed to standard output to help
237 ! determine where the instability may have occurred.
238 ! If the lookup table needs a larger temperature range,
239 ! then parameters in the module header must be modified.
240 ! </ERROR> *
241 
242  !> @brief For the given temperatures, returns the saturation vapor pressures
243  !!
244  !> For the given temperatures these routines return the saturation vapor pressure(esat).
245  !! The return values are derived from lookup tables.
246  !! Example usage:
247  !! @code{.F90} call lookup_es( temp, esat, err_msg ) @endcode
248  !!
249  !! @param temp Temperature in degrees Kelvin.
250  !! @param esat Saturation vapor pressure in pascals.
251  !! May be a scalar, 1d, 2d, or 3d array
252  !! Must have the same order and size as temp.
253  !! @param err_msg Character string containing error message to be returned to
254  !! calling routine.
255  !! @throws FATAL table overflow, nbad=##
256  !! Temperature(s) provided to the saturation vapor pressure lookup
257  !! are outside the valid range of the lookup table (-160 to 100 deg C).
258  !! This may be due to a numerical instability in the model.
259  !! Information should have been printed to standard output to help
260  !! determine where the instability may have occurred.
261  !! If the lookup table needs a larger temperature range,
262  !! then parameters in the module header must be modified.
263  !> @ingroup sat_vapor_pres_mod
264  interface lookup_es
265  module procedure lookup_es_0d_r4, lookup_es_0d_r8
266  module procedure lookup_es_1d_r4, lookup_es_1d_r8
267  module procedure lookup_es_2d_r4, lookup_es_2d_r8
268  module procedure lookup_es_3d_r4, lookup_es_3d_r8
269  end interface lookup_es
270  !> Provided for backward compatibility (to be removed soon)
271  !> @ingroup sat_vapor_pres_mod
272  interface escomp
273  module procedure lookup_es_0d_r4, lookup_es_0d_r8
274  module procedure lookup_es_1d_r4, lookup_es_1d_r8
275  module procedure lookup_es_2d_r4, lookup_es_2d_r8
276  module procedure lookup_es_3d_r4, lookup_es_3d_r8
277  end interface escomp
278 ! </INTERFACE>
279 !-----------------------------------------------------------------------
280 ! <INTERFACE NAME="lookup_des">
281 
282 ! <OVERVIEW>
283 ! For the given temperatures, returns the derivative of saturation vapor pressure
284 ! with respect to temperature.
285 ! </OVERVIEW>
286 ! <DESCRIPTION>
287 ! For the given temperatures these routines return the derivative of esat w.r.t.
288 ! temperature (desat). The return values are derived from
289 ! lookup tables (see notes below).
290 ! </DESCRIPTION>
291 ! <TEMPLATE>
292 ! call lookup_des( temp, desat )
293 ! </TEMPLATE>
294 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
295 ! Temperature in degrees Kelvin.
296 ! </IN>
297 ! <OUT NAME="desat" UNITS="pascal" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
298 ! Derivative of saturation vapor pressure w.r.t. temperature
299 ! in pascals/degree. May be a scalar, 1d, 2d, or 3d array.
300 ! Must have the same order and size as temp.
301 ! </OUT>
302 ! <OUT NAME="err_msg" UNITS=" " TYPE="character">
303 ! Character string containing error message to be returned to
304 ! calling routine.
305 ! </OUT>
306 ! <ERROR MSG="table overflow, nbad=##" STATUS="FATAL">
307 ! Temperature(s) provided to the saturation vapor pressure lookup
308 ! are outside the valid range of the lookup table (-160 to 100 deg C).
309 ! This may be due to a numerical instability in the model.
310 ! Information should have been printed to standard output to help
311 ! determine where the instability may have occurred.
312 ! If the lookup table needs a larger temperature range,
313 ! then parameters in the module header must be modified.
314 ! </ERROR> *
315 
316  !> For the given temperatures, returns the derivative of saturation vapor pressure
317  !! with respect to temperature.
318  !!
319  !! For the given temperatures these routines return the derivtive of esat w.r.t. temperature
320  !! (desat). The return values are derived from lookup tables.
321  !!
322  !! @param [in] temp Temperature in degrees kelvin
323  !! @param [out] desat Derivative of saturation vapor pressure w.r.t. temperature
324  !! in pascals/degree. May be a scalar, 1d, 2d, or 3d array.
325  !! Must have the same order and size as temp.
326  !! @param [out] err_msg Character string containing error message to be returned to
327  !! calling routine.
328  !!
329  !! @error FATAL table overflow, nbad=##
330  !! Temperature(s) provided to the saturation vapor pressure lookup
331  !! are outside the valid range of the lookup table (-160 to 100 deg C).
332  !! This may be due to a numerical instability in the model.
333  !! Information should have been printed to standard output to help
334  !! determine where the instability may have occurred.
335  !! If the lookup table needs a larger temperature range,
336  !! then parameters in the module header must be modified.
337  !!
338  !! <br>Example usage:
339  !! @code{.F90} call lookup_des( temp, desat) @endcode
340  !> @ingroup sat_vapor_pres_mod
341  interface lookup_des
342  module procedure lookup_des_0d_r4, lookup_des_0d_r8
343  module procedure lookup_des_1d_r4, lookup_des_1d_r8
344  module procedure lookup_des_2d_r4, lookup_des_2d_r8
345  module procedure lookup_des_3d_r4, lookup_des_3d_r8
346  end interface lookup_des
347 ! </INTERFACE>
348  !> Provided for backward compatibility (to be removed soon)
349  !> @ingroup sat_vapor_pres_mod
350  interface descomp
351  module procedure lookup_des_0d_r4, lookup_des_0d_r8
352  module procedure lookup_des_1d_r4, lookup_des_1d_r8
353  module procedure lookup_des_2d_r4, lookup_des_2d_r8
354  module procedure lookup_des_3d_r4, lookup_des_3d_r8
355  end interface descomp
356 
357 !-----------------------------------------------------------------------
358 
359 ! <INTERFACE NAME="lookup_es_des">
360 
361 ! <OVERVIEW>
362 ! For the given temperatures, returns the saturation vapor pressure
363 ! and the derivative of saturation vapor pressure with respect to
364 ! temperature.
365 ! </OVERVIEW>
366 ! <DESCRIPTION>
367 ! For the given temperatures these routines return the
368 ! saturation vapor pressure (esat) and the derivative of esat w.r.t
369 ! temperature (desat). The return values are derived from
370 ! lookup tables (see notes below).
371 ! </DESCRIPTION>
372 ! <TEMPLATE>
373 ! call lookup_es_des( temp, esat, desat, err_msg )
374 ! </TEMPLATE>
375 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
376 ! Temperature in degrees Kelvin.
377 ! </IN>
378 ! <OUT NAME="esat" UNITS="pascal" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
379 ! Saturation vapor pressure in pascals.
380 ! May be a scalar, 1d, 2d, or 3d array.
381 ! Must have the same order and size as temp.
382 ! </OUT>
383 ! <OUT NAME="desat" UNITS="pascal/ degree" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
384 ! Derivative of saturation vapor pressure w.r.t. temperature
385 ! in pascals/degree. May be a scalar, 1d, 2d, or 3d array.
386 ! Must have the same order and size as temp.
387 ! </OUT>
388 ! <OUT NAME="err_msg" UNITS=" " TYPE="character">
389 ! Character string containing error message to be returned to
390 ! calling routine.
391 ! </OUT>
392 ! <ERROR MSG="table overflow, nbad=##" STATUS="FATAL">
393 ! Temperature(s) provided to the saturation vapor pressure lookup
394 ! are outside the valid range of the lookup table (-160 to 100 deg C).
395 ! This may be due to a numerical instability in the model.
396 ! Information should have been printed to standard output to help
397 ! determine where the instability may have occurred.
398 ! If the lookup table needs a larger temperature range,
399 ! then parameters in the module header must be modified.
400 ! </ERROR> *
401 
402  !> @brief For the given temperatures, returns the saturation vapor pressure
403  !! and the derivative of saturation vapor pressure with respect to
404  !! temperature.
405  !!
406  !> For the given temperatures these routines return the
407  !! saturation vapor pressure (esat) and the derivative of esat w.r.t
408  !! temperature (desat). The return values are derived from
409  !! lookup tables (see notes below).
410  !!
411  !! <br>Example usage:
412  !! @code{.F90} call lookup_es_des( temp, esat, desat, err_msg ) @endcode
413  !!
414  !! @param temp Temperature in degrees Kelvin.
415  !! @param [out] esat Saturation vapor pressure in pascals. May be a scalar, 1d, 2d, or 3d array.
416  !! Must have the same order and size as temp.
417  !! @param [out] desat Derivative of saturation vapor pressure w.r.t. temperature
418  !! in pascals/degree. May be a scalar, 1d, 2d, or 3d array.
419  !! Must have the same order and size as temp.
420  !! @param [out] err_msg Character string containing error message to be returned to
421  !! calling routine.
422  !! @error FATAL table overflow, nbad=##
423  !! Temperature(s) provided to the saturation vapor pressure lookup
424  !! are outside the valid range of the lookup table (-160 to 100 deg C).
425  !! This may be due to a numerical instability in the model.
426  !! Information should have been printed to standard output to help
427  !! determine where the instability may have occurred.
428  !! If the lookup table needs a larger temperature range,
429  !! then parameters in the module header must be modified.
430  !> @ingroup sat_vapor_pres_mod
431  interface lookup_es_des
432  module procedure lookup_es_des_0d_r4, lookup_es_des_0d_r8
433  module procedure lookup_es_des_1d_r4, lookup_es_des_1d_r8
434  module procedure lookup_es_des_2d_r4, lookup_es_des_2d_r8
435  module procedure lookup_es_des_3d_r4, lookup_es_des_3d_r8
436  end interface lookup_es_des
437 
438  !> @ingroup sat_vapor_pres_mod
439  interface lookup_es2
440  module procedure lookup_es2_0d_r4, lookup_es2_0d_r8
441  module procedure lookup_es2_1d_r4, lookup_es2_1d_r8
442  module procedure lookup_es2_2d_r4, lookup_es2_2d_r8
443  module procedure lookup_es2_3d_r4, lookup_es2_3d_r8
444  end interface lookup_es2
445 
446  !> @ingroup sat_vapor_pres_mod
447  interface lookup_des2
448  module procedure lookup_des2_0d_r4, lookup_des2_0d_r8
449  module procedure lookup_des2_1d_r4, lookup_des2_1d_r8
450  module procedure lookup_des2_2d_r4, lookup_des2_2d_r8
451  module procedure lookup_des2_3d_r4, lookup_des2_3d_r8
452  end interface lookup_des2
453 
454  !> @ingroup sat_vapor_pres_mod
455  interface lookup_es2_des2
456  module procedure lookup_es2_des2_0d_r4, lookup_es2_des2_0d_r8
457  module procedure lookup_es2_des2_1d_r4, lookup_es2_des2_1d_r8
458  module procedure lookup_es2_des2_2d_r4, lookup_es2_des2_2d_r8
459  module procedure lookup_es2_des2_3d_r4, lookup_es2_des2_3d_r8
460  end interface lookup_es2_des2
461 
462  !> @ingroup sat_vapor_pres_mod
463  interface lookup_es3
464  module procedure lookup_es3_0d_r4, lookup_es3_0d_r8
465  module procedure lookup_es3_1d_r4, lookup_es3_1d_r8
466  module procedure lookup_es3_2d_r4, lookup_es3_2d_r8
467  module procedure lookup_es3_3d_r4, lookup_es3_3d_r8
468  end interface lookup_es3
469 
470  !> @ingroup sat_vapor_pres_mod
471  interface lookup_des3
472  module procedure lookup_des3_0d_r4, lookup_des3_0d_r8
473  module procedure lookup_des3_1d_r4, lookup_des3_1d_r8
474  module procedure lookup_des3_2d_r4, lookup_des3_2d_r8
475  module procedure lookup_des3_3d_r4, lookup_des3_3d_r8
476  end interface lookup_des3
477 
478  !> @ingroup sat_vapor_pres_mod
479  interface lookup_es3_des3
480  module procedure lookup_es3_des3_0d_r4, lookup_es3_des3_0d_r8
481  module procedure lookup_es3_des3_1d_r4, lookup_es3_des3_1d_r8
482  module procedure lookup_es3_des3_2d_r4, lookup_es3_des3_2d_r8
483  module procedure lookup_es3_des3_3d_r4, lookup_es3_des3_3d_r8
484  end interface lookup_es3_des3
485 
486 !-----------------------------------------------------------------------
487 
488 ! <INTERFACE NAME="compute_qs">
489 
490 ! <OVERVIEW>
491 ! For the given temperatures, pressures and optionally vapor
492 ! specific humidity, returns the specific humidity at saturation
493 ! (optionally at relative humidity hc instead of at saturation) and
494 ! optionally the derivative of saturation specific humidity w.r.t.
495 ! temperature, and the saturation vapor pressure.
496 ! </OVERVIEW>
497 ! <DESCRIPTION>
498 ! For the input temperature and pressure these routines return the
499 ! specific humidity (qsat) at saturation (unless optional argument
500 ! hc is used to specify the relative humidity at which qsat should
501 ! apply) and, if desired, the derivative of qsat w.r.t temperature
502 ! (dqsdT) and / or the saturation vapor pressure (esat). If the
503 ! optional input argument specific humidity (q) is present, the
504 ! exact expression for qs is used; if q is not present the tradit-
505 ! ional form (valid at saturation) is used. if the optional qsat
506 ! derivative argument is present, the derivative of qsat w.r.t.
507 ! temperature will also be returned, defined consistent with the
508 ! expression used for qsat. The return values are derived from
509 ! lookup tables (see notes below).
510 ! </DESCRIPTION>
511 ! <TEMPLATE>
512 ! call compute_qs( temp, press, qsat, q, hc, dqsdT, esat, err_msg )
513 ! </TEMPLATE>
514 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
515 ! Temperature in degrees Kelvin.
516 ! </IN>
517 ! <IN NAME="press" UNIT="Pascals" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
518 ! Air pressure in Pascals.
519 ! </IN>
520 ! <OUT NAME="qsat" UNITS="kg(vapor) / kg(moist air)" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
521 ! Specific humidity in kg (vapor) / kg (moist air)
522 ! May be a scalar, 1d, 2d, or 3d array.
523 ! Must have the same order and size as temp.
524 ! </OUT>
525 ! <IN NAME="q" UNIT="kg(vapor) / kg (moist air)" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
526 ! Vapor specific humidity in kg (vapor) / kg (moist air).
527 ! If present, exact formulation for qsat and dqsdT will be used.
528 ! </IN>
529 ! <IN NAME="hc" UNIT="fraction" TYPE="real" DIM="(scalar)">
530 ! Relative humidity at which output variables are desired.
531 ! If not present, values will apply at saturation.
532 ! </IN>
533 ! <OUT NAME="dqsdT" UNITS="kg(vapor) / kg(moist air) / degree" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
534 ! Derivative of saturation specific humidity w.r.t. temperature
535 ! in kg(vapor) / kg(moist air) / degree. May be a
536 ! scalar, 1d, 2d, or 3d array.
537 ! Must have the same order and size as temp.
538 ! </OUT>
539 ! <OUT NAME="esat" UNITS="Pascals" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
540 ! Saturation vapor pressure. May be a scalar, 1d, 2d, or 3d array.
541 ! Must have the same order and size as temp.
542 ! </OUT>
543 ! <OUT NAME="err_msg" UNITS=" " TYPE="character">
544 ! Character string containing error message to be returned to
545 ! calling routine.
546 ! </OUT>
547 ! <ERROR MSG="table overflow, nbad=##" STATUS="FATAL">
548 ! Temperature(s) provided to the saturation vapor pressure lookup
549 ! are outside the valid range of the lookup table (-160 to 100 deg C).
550 ! This may be due to a numerical instability in the model.
551 ! Information should have been printed to standard output to help
552 ! determine where the instability may have occurred.
553 ! If the lookup table needs a larger temperature range,
554 ! then parameters in the module header must be modified.
555 ! </ERROR> *
556 
557  !> @brief For the given temperatures, pressures and optionally vapor
558  !! specific humidity, returns the specific humidity at saturation
559  !! (optionally at relative humidity hc instead of at saturation) and
560  !! optionally the derivative of saturation specific humidity w.r.t.
561  !! temperature, and the saturation vapor pressure.
562  !!
563  !! For the input temperature and pressure these routines return the
564  !! specific humidity (qsat) at saturation (unless optional argument
565  !! hc is used to specify the relative humidity at which qsat should
566  !! apply) and, if desired, the derivative of qsat w.r.t temperature
567  !! (dqsdT) and / or the saturation vapor pressure (esat). If the
568  !! optional input argument specific humidity (q) is present, the
569  !! exact expression for qs is used; if q is not present the tradit-
570  !! ional form (valid at saturation) is used. if the optional qsat
571  !! derivative argument is present, the derivative of qsat w.r.t.
572  !! temperature will also be returned, defined consistent with the
573  !! expression used for qsat. The return values are derived from
574  !! lookup tables (see notes below).
575  !!
576  !! Example usage:
577  !! @code{.F90} call compute_qs( temp, press, qsat, q, hc, dqsdT, esat, err_msg ) @endcode
578  !!
579  !> @ingroup sat_vapor_pres_mod
580  interface compute_qs
581  module procedure compute_qs_0d_r4, compute_qs_0d_r8
582  module procedure compute_qs_1d_r4, compute_qs_1d_r8
583  module procedure compute_qs_2d_r4, compute_qs_2d_r8
584  module procedure compute_qs_3d_r4, compute_qs_3d_r8
585  end interface compute_qs
586 
587 !-----------------------------------------------------------------------
588 
589 ! <INTERFACE NAME="compute_mrs">
590 
591 ! <OVERVIEW>
592 ! For the given temperatures, pressures and optionally vapor
593 ! mixing ratio, returns the vapor mixing ratio at saturation
594 ! (optionally at relative humidity hc instead of at saturation) and
595 ! optionally the derivative of saturation vapor mixing ratio w.r.t.
596 ! temperature, and the saturation vapor pressure.
597 ! </OVERVIEW>
598 ! <DESCRIPTION>
599 ! For the input temperature and pressure these routines return the
600 ! vapor mixing ratio (mrsat) at saturation (unless optional argument
601 ! hc is used to specify the relative humidity at which mrsat should
602 ! apply) and, if desired, the derivative of mrsat w.r.t temperature
603 ! (dmrsdT) and / or the saturation vapor pressure (esat). If the
604 ! optional input argument specific humidity (mr) is present, the
605 ! exact expression for mrs is used; if qr is not present the tradit-
606 ! ional form (valid at saturation) is used. if the optional mrsat
607 ! derivative argument is present, the derivative of mrsat w.r.t.
608 ! temperature will also be returned, defined consistent with the
609 ! expression used for mrsat. The return values are derived from
610 ! lookup tables (see notes below).
611 ! </DESCRIPTION>
612 ! <TEMPLATE>
613 ! call compute_mrs( temp, press, mrsat, mr, hc, dmrsdT, esat,
614 ! err_msg )
615 ! </TEMPLATE>
616 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
617 ! Temperature in degrees Kelvin.
618 ! </IN>
619 ! <IN NAME="press" UNIT="Pascals" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
620 ! Air pressure in Pascals.
621 ! </IN>
622 ! <OUT NAME="mrsat" UNITS="kg(vapor) / kg (dry air)" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
623 ! Vapor mixing ratio in kg (vapor) / kg (dry air)
624 ! May be a scalar, 1d, 2d, or 3d array.
625 ! Must have the same order and size as temp.
626 ! </OUT>
627 ! <IN NAME="mr" UNIT="kg(vapor) / kg (dry air)" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
628 ! Vapor mixing ratio in kg (vapor) / kg (dry air).
629 ! If present, exact formulation for mrsat and dmrsdT will be used.
630 ! </IN>
631 ! <IN NAME="hc" UNIT="fraction" TYPE="real" DIM="(scalar)">
632 ! Relative humidity at which output variables are desired.
633 ! If not present, values will apply at saturation.
634 ! </IN>
635 ! <OUT NAME="dmrsdT" UNITS="kg(vapor) / kg(dry air) / degree" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
636 ! Derivative of saturation vapor mixing ratio w.r.t. temperature
637 ! in kg(vapor) / kg(dry air) / degree. May be a
638 ! scalar, 1d, 2d, or 3d array.
639 ! Must have the same order and size as temp.
640 ! </OUT>
641 ! <OUT NAME="esat" UNITS="Pascals" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
642 ! Saturation vapor pressure. May be a scalar, 1d, 2d, or 3d array.
643 ! Must have the same order and size as temp.
644 ! </OUT>
645 ! <OUT NAME="err_msg" UNITS=" " TYPE="character">
646 ! Character string containing error message to be returned to
647 ! calling routine.
648 ! </OUT>
649 ! <ERROR MSG="table overflow, nbad=##" STATUS="FATAL">
650 ! Temperature(s) provided to the saturation vapor pressure lookup
651 ! are outside the valid range of the lookup table (-160 to 100 deg C).
652 ! This may be due to a numerical instability in the model.
653 ! Information should have been printed to standard output to help
654 ! determine where the instability may have occurred.
655 ! If the lookup table needs a larger temperature range,
656 ! then parameters in the module header must be modified.
657 ! </ERROR> *
658 
659  !> For the given temperatures, pressures and optionally vapor
660  !! mixing ratio, returns the vapor mixing ratio at saturation
661  !! (optionally at relative humidity hc instead of at saturation) and
662  !! optionally the derivative of saturation vapor mixing ratio w.r.t.
663  !! temperature, and the saturation vapor pressure.
664  !!
665  !! For the input temperature and pressure these routines return the
666  !! vapor mixing ratio (mrsat) at saturation (unless optional argument
667  !! hc is used to specify the relative humidity at which mrsat should
668  !! apply) and, if desired, the derivative of mrsat w.r.t temperature
669  !! (dmrsdT) and / or the saturation vapor pressure (esat). If the
670  !! optional input argument specific humidity (mr) is present, the
671  !! exact expression for mrs is used; if qr is not present the tradit-
672  !! ional form (valid at saturation) is used. if the optional mrsat
673  !! derivative argument is present, the derivative of mrsat w.r.t.
674  !! temperature will also be returned, defined consistent with the
675  !! expression used for mrsat. The return values are derived from
676  !! lookup tables (see notes below).
677  !!
678  !! <br>Example usage:
679  !! @code{.F90} call compute_mrs( temp, press, mrsat, mr, hc, dmrsdT, esat,
680  !! err_msg ) @endcode
681  !> @ingroup sat_vapor_pres_mod
682  interface compute_mrs
683  module procedure compute_mrs_0d_r4, compute_mrs_0d_r8
684  module procedure compute_mrs_1d_r4, compute_mrs_1d_r8
685  module procedure compute_mrs_2d_r4, compute_mrs_2d_r8
686  module procedure compute_mrs_3d_r4, compute_mrs_3d_r8
687  end interface compute_mrs
688 
689 !-----------------------------------------------------------------------
690 ! <INTERFACE NAME="compute_es">
691 
692 ! <OVERVIEW>
693 ! For the given temperatures, computes the saturation vapor pressures.
694 ! </OVERVIEW>
695 ! <DESCRIPTION>
696 ! Computes saturation vapor pressure for the given temperature using
697 ! the equations given in the Smithsonian Meteorological Tables.
698 ! Between -20C and 0C a blended value over ice and water is returned.
699 ! </DESCRIPTION>
700 ! <TEMPLATE>
701 ! es = compute_es ( temp )
702 ! </TEMPLATE>
703 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
704 ! Temperature in degrees Kelvin.
705 ! </IN>
706 ! <OUT NAME="es" UNITS="pascal" TYPE="real" DIM="(scalar),(:),(:,:),(:,:,:)">
707 ! Saturation vapor pressure in pascals.
708 ! May be a scalar, 1d, 2d, or 3d array.
709 ! Must have the same order and size as temp.
710 ! </OUT>
711 
712 !interface compute_es
713 ! module procedure compute_es_0d, compute_es_1d, compute_es_2d, compute_es_3d
714 !end interface
715 ! </INTERFACE>
716 !-----------------------------------------------------------------------
717  !> @ingroup sat_vapor_pres_mod
718  interface check_1d
719  module procedure check_1d_r4, check_1d_r8
720  end interface check_1d
721 
722  interface check_2d
723  module procedure check_2d_r4, check_2d_r8
724  end interface check_2d
725 
726  !> @ingroup sat_vapor_pres_mod
727  interface temp_check
728  module procedure temp_check_1d_r4, temp_check_1d_r8
729  module procedure temp_check_2d_r4, temp_check_2d_r8
730  module procedure temp_check_3d_r4, temp_check_3d_r8
731  end interface temp_check
732 
733  !> @ingroup sat_vapor_pres_mod
734  interface show_all_bad
735  module procedure show_all_bad_0d_r4, show_all_bad_0d_r8
736  module procedure show_all_bad_1d_r4, show_all_bad_1d_r8
737  module procedure show_all_bad_2d_r4, show_all_bad_2d_r8
738  module procedure show_all_bad_3d_r4, show_all_bad_3d_r8
739  end interface show_all_bad
740 
741 !> @addtogroup sat_vapor_pres_mod
742 !> @{
743 !-----------------------------------------------------------------------
744 ! Include variable "version" to be written to log file.
745 #include<file_version.h>
746 
747  logical :: module_is_initialized = .false.
748 
749 !-----------------------------------------------------------------------
750 ! parameters for use in computing qs and mrs
751 
752  real(r8_kind), parameter :: EPSILO = real(rdgas,r8_kind)/real(rvgas, r8_kind)
753  real(r8_kind), parameter :: ZVIR = real(rvgas,r8_kind)/real(rdgas,r8_kind) - 1.0_r8_kind
754 
755 !-----------------------------------------------------------------------
756 ! parameters for table size and resolution
757 
758  integer, public :: tcmin = -160 ! minimum temperature (degC) in lookup table
759  integer, public :: tcmax = 100 ! maximum temperature (degC) in lookup table
760  integer :: esres = 10 ! table resolution (increments per degree)
761  integer :: nsize ! (tcmax-tcmin)*esres+1 ! lookup table size
762  integer :: nlim ! nsize-1
763 
764  integer :: stdoutunit=0
765 !-----------------------------------------------------------------------
766 ! variables needed by temp_check
767  real(r8_kind) :: tmin, dtinv, teps
768 
769 ! The default values below preserve the behavior of omsk and earlier revisions.
770  logical :: show_bad_value_count_by_slice=.true.
771  logical :: show_all_bad_values=.false.
772  logical :: use_exact_qs = .false.
773  logical :: do_simple =.false.
774  logical :: construct_table_wrt_liq = .false.
775  logical :: construct_table_wrt_liq_and_ice = .false.
776 
777  namelist / sat_vapor_pres_nml / show_bad_value_count_by_slice, show_all_bad_values, &
778  use_exact_qs, do_simple, &
779  construct_table_wrt_liq, &
780  construct_table_wrt_liq_and_ice
781 
782 contains
783 
784  subroutine sat_vapor_pres_init(err_msg)
785 
786 ! =================================================================
787 ! + +
788 ! + construction of the es table +
789 ! + +
790 ! + this table is constructed from es equations from the +
791 ! + smithsonian tables. the es input is computed from values +
792 ! + (in one-tenth of a degree increments) of es over ice +
793 ! + from -153c to 0c and values of es over water from 0c to 102c. +
794 ! + output table contains these data interleaved with their +
795 ! + derivatives with respect to temperature except between -20c +
796 ! + and 0c where blended (over water and over ice) es values and +
797 ! + derivatives are calculated. +
798 ! + note: all es computation is done in pascals +
799 ! =================================================================
800 
801  character(len=*), intent(out), optional :: err_msg
802  character(len=128) :: err_msg_local
803  integer :: iunit, ierr, io
804 
805 ! return silently if this routine has already been called
806  if (module_is_initialized) return
807 
808 !---- read namelist input ----
809  read (input_nml_file, sat_vapor_pres_nml, iostat=io)
810  ierr = check_nml_error(io,'sat_vapor_pres_nml')
811 
812 ! write version number and namelist to log file
813  call write_version_number("SAT_VAPOR_PRES_MOD", version)
814  iunit = stdlog()
815  stdoutunit = stdout()
816  if (mpp_pe() == mpp_root_pe()) write (iunit, nml=sat_vapor_pres_nml)
817 
818  if(do_simple) then
819  tcmin = -173
820  tcmax = 350
821  endif
822  nsize = (tcmax-tcmin)*esres+1
823  nlim = nsize-1
824  call sat_vapor_pres_init_k(nsize, real(tcmin,r8_kind), real(tcmax,r8_kind), &
825  real(TFREEZE,r8_kind), real(HLV,r8_kind),&
826  real(RVGAS,r8_kind), real(ES0,r8_kind), err_msg_local, use_exact_qs, do_simple,&
827  construct_table_wrt_liq, &
828  construct_table_wrt_liq_and_ice, &
829  teps, tmin, dtinv)
830  if ( err_msg_local == '' ) then
831  if(present(err_msg)) err_msg = ''
832  else
833  if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
834  endif
835 
836  module_is_initialized = .true.
837 
838 end subroutine sat_vapor_pres_init
839 
840 #include "sat_vapor_pres_r4.fh"
841 #include "sat_vapor_pres_r8.fh"
842 
843 !#######################################################################
844 !#######################################################################
845 !-------------------------------------------------------------------
846 ! Computation of the es values
847 !
848 ! Saturation vapor pressure (es) values are computed from
849 ! equations in the Smithsonian meteorological tables page 350.
850 ! For temperatures < 0C, sat vapor pres is computed over ice.
851 ! For temperatures > -20C, sat vapor pres is computed over water.
852 ! Between -20C and 0C the returned value is blended (over water
853 ! and over ice). All sat vapor pres values are returned in pascals.
854 !
855 ! Reference: Smithsonian meteorological tables, page 350.
856 !-------------------------------------------------------------------
857 
858 ! <FUNCTION NAME="compute_es_1d" INTERFACE="compute_es">
859 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(:)"></IN>
860 ! <OUT NAME="es" UNITS="pascal" TYPE="real" DIM="(:)"></OUT>
861 ! </FUNCTION>
862 !function compute_es_1d (tem) result (es)
863 !real, intent(in) :: tem(:)
864 !real :: es(size(tem,1))
865 
866 !es = compute_es_k(tem, TFREEZE)
867 
868 !end function compute_es_1d
869 !--------------------------------------------------------
870 
871 ! <FUNCTION NAME="compute_es_0d" INTERFACE="compute_es">
872 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(scalar)"></IN>
873 ! <OUT NAME="es" UNITS="pascal" TYPE="real" DIM="(scalar)"></OUT>
874 ! </FUNCTION>
875 !function compute_es_0d (tem) result (es)
876 !real, intent(in) :: tem
877 !real :: es
878 !real, dimension(1) :: tem1, es1
879 
880 ! tem1(1) = tem
881 ! es1 = compute_es_1d (tem1)
882 ! es = es1(1)
883 
884 !end function compute_es_0d
885 
886 !--------------------------
887 
888 ! <FUNCTION NAME="compute_es_2d" INTERFACE="compute_es">
889 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(:,:)"></IN>
890 ! <OUT NAME="es" UNITS="pascal" TYPE="real" DIM="(:,:)"></OUT>
891 ! </FUNCTION>
892 !function compute_es_2d (tem) result (es)
893 !real, intent(in) :: tem(:,:)
894 !real, dimension(size(tem,1),size(tem,2)) :: es
895 !integer :: j
896 
897 ! do j = 1, size(tem,2)
898 ! es(:,j) = compute_es_1d (tem(:,j))
899 ! enddo
900 
901 !end function compute_es_2d
902 
903 !--------------------------
904 ! <FUNCTION NAME="compute_es_3d" INTERFACE="compute_es">
905 ! <IN NAME="temp" UNIT="degrees Kelvin" TYPE="real" DIM="(:,:,:)"></IN>
906 ! <OUT NAME="es" UNITS="pascal" TYPE="real" DIM="(:,:,:)"></OUT>
907 ! </FUNCTION>
908 !function compute_es_3d (tem) result (es)
909 !real, intent(in) :: tem(:,:,:)
910 !real, dimension(size(tem,1),size(tem,2),size(tem,3)) :: es
911 !integer :: j, k
912 
913 ! do k = 1, size(tem,3)
914 ! do j = 1, size(tem,2)
915 ! es(:,j,k) = compute_es_1d (tem(:,j,k))
916 ! enddo
917 ! enddo
918 
919 !end function compute_es_3d
920 
921 !#######################################################################
922 end module sat_vapor_pres_mod
923 !#######################################################################
924 
925 ! <INFO>
926 
927 ! <REFERENCE>
928 ! Smithsonian Meteorological Tables Page 350.
929 ! </REFERENCE>
930 
931 ! <BUG>
932 ! No error checking is done to make sure that the size of the
933 ! input and output fields match.
934 ! </BUG>
935 
936 ! <NOTE>
937 ! 1. <B>Vectorization</B><BR/>
938 ! To create a vector version the lookup routines need to be modified.
939 ! The local variables: tmp, del, ind, should be changed to arrays
940 ! with the same size and order as input array temp.
941 !
942 ! 2. <B>Construction of the <TT>ES</TT> tables</B><BR/>
943 ! The tables are constructed using the saturation vapor pressure (<TT>ES</TT>)
944 ! equations in the Smithsonian tables. The tables are valid between
945 ! -160C to +100C with increments at 1/10 degree. Between -160C and -20C
946 ! values of <TT>ES</TT> over ice are used, between 0C and 100C values of<TT> ES</TT>
947 ! over water are used, between -20C and 0C blended values of <TT>ES</TT>
948 ! (over water and over ice) are used.
949 !
950 ! There are three tables constructed: <TT>ES</TT>, first derivative
951 ! (<TT>ES'</TT>), and
952 ! second derivative (<TT>ES</TT>''). The ES table is constructed directly from
953 ! the equations in the Smithsonian tables. The <TT>ES</TT>' table is constructed
954 ! by bracketing temperature values at +/- 0.01 degrees. The <TT>ES</TT>'' table
955 ! is estimated by using centered differencing of the <TT>ES</TT>' table.
956 !
957 ! 3. <B>Determination of <TT>es</TT> and <TT>es'</TT> from lookup tables</B><BR/>
958 ! Values of the saturation vapor pressure (<TT>es</TT>) and the
959 ! derivative (<TT>es'</TT>) are determined at temperature (T) from the lookup
960 ! tables (<TT>ES</TT>, <TT>ES'</TT>, <TT>ES''</TT>)
961 ! using the following formula.
962 !<PRE>
963 ! es (T) = ES(t) + ES'(t) * dt + 0.5 * ES''(t) * dt**2
964 ! es'(T) = ES'(t) + ES''(t) * dt
965 !
966 ! where t = lookup table temperature closest to T
967 ! dt = T - t
968 !</PRE>
969 !
970 ! 4. Internal (private) parameters<BR/>
971 ! These parameters can be modified to increase/decrease the size/range
972 ! of the lookup tables.
973 !<PRE>
974 !! tcmin The minimum temperature (in deg C) in the lookup tables.
975 !! [integer, default: tcmin = -160]
976 !!
977 !! tcmax The maximum temperature (in deg C) in the lookup tables.
978 !! [integer, default: tcmin = +100]
979 !!</PRE>
980 !! </NOTE>
981 !
982 !! <TESTPROGRAM NAME="test_sat_vapor_pres">
983 !<PRE>
984 !use sat_vapor_pres_mod
985 !implicit none
986 !
987 !integer, parameter :: ipts=500, jpts=100, kpts=50, nloop=1
988 !real, dimension(ipts,jpts,kpts) :: t,es,esn,des,desn
989 !integer :: n
990 !
991 !! generate temperatures between 120K and 340K
992 ! call random_number (t)
993 ! t = 130. + t * 200.
994 !
995 !! initialize the tables (optional)
996 ! call sat_vapor_pres_init
997 !
998 !! compute actual es and "almost" actual des
999 ! es = compute_es (t)
1000 ! des = compute_des (t)
1001 !
1002 !do n = 1, nloop
1003 !! es and des
1004 ! call lookup_es (t, esn)
1005 ! call lookup_des (t,desn)
1006 !enddo
1007 !
1008 !! terminate, print deviation from actual
1009 ! print *, 'size=',ipts,jpts,kpts,nloop
1010 ! print *, 'err es = ', sum((esn-es)**2)
1011 ! print *, 'err des = ', sum((desn-des)**2)
1012 !
1013 !contains
1014 !
1015 !!----------------------------------
1016 !! routine to estimate derivative
1017 !
1018 ! function compute_des (tem) result (des)
1019 ! real, intent(in) :: tem(:,:,:)
1020 ! real, dimension(size(tem,1),size(tem,2),size(tem,3)) :: des,esp,esm
1021 ! real, parameter :: tdel = .01
1022 ! esp = compute_es (tem+tdel)
1023 ! esm = compute_es (tem-tdel)
1024 ! des = (esp-esm)/(2*tdel)
1025 ! end function compute_des
1026 !!----------------------------------
1027 !
1028 !end program test_sat_vapor_pres
1029 !</PRE>
1030 ! </TESTPROGRAM>
1031 ! </INFO>
1032 !> @}
1033 ! close documentation grouping
integer function, public check_nml_error(IOSTAT, NML_NAME)
Checks the iostat argument that is returned after reading a namelist and determines if the error code...
Definition: fms.F90:523
subroutine, public write_version_number(version, tag, unit)
Prints to the log file (or a specified unit) the version id string and tag name.
Definition: fms.F90:701
logical function, public fms_error_handler(routine, message, err_msg)
Facilitates the control of fatal error conditions.
Definition: fms.F90:468
subroutine, public error_mesg(routine, message, level)
Print notes, warnings and error messages; terminates program for warning and error messages....
Definition: fms.F90:441
integer function stdout()
This function returns the current standard fortran unit numbers for output.
Definition: mpp_util.inc:42
integer function stdlog()
This function returns the current standard fortran unit numbers for log messages. Log messages,...
Definition: mpp_util.inc:58
integer function mpp_pe()
Returns processor ID.
Definition: mpp_util.inc:406
For the given temperatures, pressures and optionally vapor mixing ratio, returns the vapor mixing rat...
For the given temperatures, pressures and optionally vapor specific humidity, returns the specific hu...
Provided for backward compatibility (to be removed soon)
Provided for backward compatibility (to be removed soon)
For the given temperatures, returns the derivative of saturation vapor pressure with respect to tempe...
For the given temperatures, returns the saturation vapor pressures.
For the given temperatures, returns the saturation vapor pressure and the derivative of saturation va...