PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_thermo.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
2!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
3!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4!MNH_LIC for details. version 1.
5!-----------------------------------------------------------------
6! #######################
8! #######################
9!
10!!**** *MODE_THERMO_MONO* - module for routines SM_FOES,SM_PMR_HU
11!!
12!! PURPOSE
13!! -------
14! The purpose of this executive module is to package
15! the routine SM_FOES, SM_PMR_HU without use of comlib parallel routine
16!
17!
18!
19!!
20!!** IMPLICIT ARGUMENTS
21!! ------------------
22!! NONE
23!!
24!! REFERENCE
25!! ---------
26!!
27!!
28!! AUTHOR
29!! ------
30!! V. Ducrocq * Meteo France *
31!!
32!! MODIFICATIONS
33!! -------------
34!! Original 28/08/94
35!! J.Escobar : 5/10/2018 : add FLUSH , for better logging in case of PB
36! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
37!--------------------------------------------------------------------------------
38!
39!* 0. DECLARATIONS
40! ------------
41!
42!-------------------------------------------------------------------------------
43USE yomhook , ONLY : lhook, dr_hook, jphook
44IMPLICIT NONE
45
46PRIVATE
47
49
50INTERFACE sm_foes
51 MODULE PROCEDURE sm_foes_0d
52 MODULE PROCEDURE sm_foes_1d
53 MODULE PROCEDURE sm_foes_2d
54 MODULE PROCEDURE sm_foes_2d_mask
55 MODULE PROCEDURE sm_foes_3d
56END INTERFACE
57INTERFACE qsat
58 MODULE PROCEDURE qsatw_3d
59 MODULE PROCEDURE qsatw_2d
60 MODULE PROCEDURE qsatw_2d_mask
61 MODULE PROCEDURE qsatw_1d
62 MODULE PROCEDURE qsatw_0d
63END INTERFACE
64INTERFACE dqsat
65 MODULE PROCEDURE dqsatw_o_dt_2d_mask
66 MODULE PROCEDURE dqsatw_o_dt_1d
67 MODULE PROCEDURE dqsatw_o_dt_3d
68END INTERFACE
69INTERFACE qsati
70 MODULE PROCEDURE qsati_3d
71 MODULE PROCEDURE qsati_2d
72 MODULE PROCEDURE qsati_2d_mask
73 MODULE PROCEDURE qsati_1d
74 MODULE PROCEDURE qsati_0d
75END INTERFACE
76INTERFACE dqsati
77 MODULE PROCEDURE dqsati_o_dt_2d_mask
78 MODULE PROCEDURE dqsati_o_dt_1d
79 MODULE PROCEDURE dqsati_o_dt_3d
80END INTERFACE
81INTERFACE sm_pmr_hu
82 MODULE PROCEDURE sm_pmr_hu_1d
83 MODULE PROCEDURE sm_pmr_hu_3d
84END INTERFACE
85CONTAINS
86!-------------------------------------------------------------------------------
87! ####################################
88 FUNCTION sm_foes_3d(PT) RESULT(PFOES)
89! ####################################
90!
91!!**** *SM_FOES_3D * - function to compute saturation vapor pressure from
92!! temperature
93!!
94!! PURPOSE
95!! -------
96! The purpose of this function is to compute the saturation vapor
97! pressure from temperature
98!
99!
100!!** METHOD
101!! ------
102!! Given temperature T (PT), the saturation vapor pressure es(T)
103!! (FOES(PT)) is computed by integration of the Clapeyron equation
104!! from the triple point temperature Tt (XTT) and the saturation vapor
105!! pressure of the triple point es(Tt) (XESTT), i.e
106!!
107!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
108!!
109!! with :
110!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
111!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
112!! gammaw (XGAMW) = (Cl -Cpv) /Rv
113!!
114!! EXTERNAL
115!! --------
116!! NONE
117!!
118!! IMPLICIT ARGUMENTS
119!! ------------------
120!! Module MODD_CST : comtains physical constants
121!! XALPW : Constant for saturation vapor pressure function
122!! XBETAW : Constant for saturation vapor pressure function
123!! XGAMW : Constant for saturation vapor pressure function
124!!
125!! REFERENCE
126!! ---------
127!! Book2 of documentation of Meso-NH
128!!
129!!
130!! AUTHOR
131!! ------
132!! V. Ducrocq * Meteo France *
133!!
134!! MODIFICATIONS
135!! -------------
136!! Original 28/08/94
137!-------------------------------------------------------------------------------
138!
139!* 0. DECLARATIONS
140! ------------
141!
142USE modd_cst, ONLY: xalpw, xbetaw, xgamw
143!
144IMPLICIT NONE
145!
146!* 0.1 Declarations of arguments and results
147!
148!
149REAL, DIMENSION(:,:,:), INTENT(IN) :: pt ! Temperature
150 ! (Kelvin)
151REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: pfoes ! saturation vapor
152 ! pressure
153 ! (Pascal)
154!
155!* 0.2 Declarations of local variables
156!
157!-------------------------------------------------------------------------------
158!
159!* 1. COMPUTE SATURATION VAPOR PRESSURE
160! ---------------------------------
161!
162REAL(kind=jphook) :: zhook_handle
163IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_3D',0,zhook_handle)
164pfoes(:,:,:) = exp( xalpw - xbetaw/pt(:,:,:) - xgamw*log(pt(:,:,:)) )
165!-------------------------------------------------------------------------------
166!
167IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_3D',1,zhook_handle)
168END FUNCTION sm_foes_3d
169! ####################################
170 FUNCTION sm_foes_1d(PT) RESULT(PFOES)
171! ####################################
172!
173!!**** *SM_FOES_1D * - function to compute saturation vapor pressure from
174!! temperature
175!!
176!! PURPOSE
177!! -------
178! The purpose of this function is to compute the saturation vapor
179! pressure from temperature
180!
181!
182!!** METHOD
183!! ------
184!! Given temperature T (PT), the saturation vapor pressure es(T)
185!! (FOES(PT)) is computed by integration of the Clapeyron equation
186!! from the triple point temperature Tt (XTT) and the saturation vapor
187!! pressure of the triple point es(Tt) (XESTT), i.e
188!!
189!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
190!!
191!! with :
192!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
193!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
194!! gammaw (XGAMW) = (Cl -Cpv) /Rv
195!!
196!! EXTERNAL
197!! --------
198!! NONE
199!!
200!! IMPLICIT ARGUMENTS
201!! ------------------
202!! Module MODD_CST : comtains physical constants
203!! XALPW : Constant for saturation vapor pressure function
204!! XBETAW : Constant for saturation vapor pressure function
205!! XGAMW : Constant for saturation vapor pressure function
206!!
207!! REFERENCE
208!! ---------
209!! Book2 of documentation of Meso-NH
210!!
211!!
212!! AUTHOR
213!! ------
214!! V. Ducrocq * Meteo France *
215!!
216!! MODIFICATIONS
217!! -------------
218!! Original 28/08/94
219!-------------------------------------------------------------------------------
220!
221!* 0. DECLARATIONS
222! ------------
223!
224USE modd_cst, ONLY: xalpw, xbetaw, xgamw
225!
226IMPLICIT NONE
227!
228!* 0.1 Declarations of arguments and results
229!
230!
231REAL, DIMENSION(:), INTENT(IN) :: pt ! Temperature
232 ! (Kelvin)
233REAL, DIMENSION(SIZE(PT)) :: pfoes ! saturation vapor
234 ! pressure
235 ! (Pascal)
236!
237!* 0.2 Declarations of local variables
238!
239!-------------------------------------------------------------------------------
240!
241!* 1. COMPUTE SATURATION VAPOR PRESSURE
242! ---------------------------------
243!
244REAL(kind=jphook) :: zhook_handle
245IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_1D',0,zhook_handle)
246pfoes(:) = exp( xalpw - xbetaw/pt(:) - xgamw*log(pt(:)) )
247!-------------------------------------------------------------------------------
248!
249IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_1D',1,zhook_handle)
250END FUNCTION sm_foes_1d
251!-------------------------------------------------------------------------------
252! ####################################################
253 FUNCTION sm_pmr_hu_3d(PP,PTV,PHU,PR,KITERMAX) RESULT(PMR)
254! ####################################################
255!
256!!**** *SM_PMR_HU_3D * - function to compute vapor mixing ratio
257!!
258!! PURPOSE
259!! -------
260! The purpose of this function is to compute the vapor mixing ratio
261! from pressure, virtual temperature and relative humidity
262!
263!
264!!** METHOD
265!! ------
266!! Given Pressure (PP), Virtual temperature (PTV) and Relative
267!! humidity (PHU), the vapor mixing ratio is computed by iterating
268!! the following procedure :
269!! T ----> es(T)
270!! es(T) ,HU ----> es(Td)
271!! es(Td), P ----> r
272!! r , Tv ----> T
273!!
274!! at the beginning T=Tv
275!!
276!! EXTERNAL
277!! --------
278!! SM_FOES : to compute saturation vapor pressure
279!!
280!! IMPLICIT ARGUMENTS
281!! ------------------
282!! Module MODD_CST : comtains physical constants
283!! XRV : gas constant for vapor
284!! XRD : gas constant for dry air
285!!
286!! REFERENCE
287!! ---------
288!! Book2 of documentation of Meso-NH
289!!
290!!
291!! AUTHOR
292!! ------
293!! V. Ducrocq * Meteo France *
294!!
295!! MODIFICATIONS
296!! -------------
297!! Original 30/08/94
298!! Modification 16/03/95 remove the EPSILON function
299!! Modification 15/09/97 (V. Masson) add solid and liquid water phases
300!! in thetav computation
301!! Modification 22/01/2019 (P. Wautelet) use standard FLUSH statement
302!! instead of non standard intrinsics!!
303!-------------------------------------------------------------------------------
304!
305!* 0. DECLARATIONS
306! ------------
307!
308USE modd_cst, ONLY: xeps_dt, xrd, xrv
309USE mode_msg, ONLY: print_msg
310USE modd_io, ONLY:nverb_fatal
311!
312IMPLICIT NONE
313!
314!* 0.1 Declarations of arguments and results
315!
316!
317REAL, DIMENSION(:,:,:), INTENT(IN) :: pp ! Pressure
318 ! (Pa)
319REAL, DIMENSION(:,:,:), INTENT(IN) :: ptv ! Virtual Temperature
320 ! (Kelvin)
321REAL, DIMENSION(:,:,:), INTENT(IN) :: phu ! Relative humidity
322 ! (percent)
323REAL, DIMENSION(:,:,:,:), INTENT(IN) :: pr ! vapor, liquid and
324 ! solid water mixing
325 ! ratio
326
327INTEGER, INTENT(IN), OPTIONAL :: kitermax ! maximum number
328 ! of iterations
329 ! (default 10)
330!
331REAL, DIMENSION(SIZE(PP,1),SIZE(PP,2),SIZE(PP,3)) :: pmr ! vapor mixing ratio
332!
333!* 0.2 Declarations of local variables
334!
335REAL, DIMENSION(SIZE(PP,1),SIZE(PP,2),SIZE(PP,3)) :: zt ! temperature
336REAL, DIMENSION(SIZE(PP,1),SIZE(PP,2),SIZE(PP,3)) :: zdt ! increment of
337 ! temperature between two iterations
338REAL :: zrdsrv ! Rd/Rv
339REAL, DIMENSION(SIZE(PP,1),SIZE(PP,2),SIZE(PP,3)) :: zestd ! es(Td)
340REAL, DIMENSION(SIZE(PP,1),SIZE(PP,2),SIZE(PP,3)) :: zrslw ! total solid and liquid water mixing ratio
341INTEGER :: itermax ! Maximum number
342 ! of iteration
343INTEGER :: iter ! iteration number of
344REAL :: zeps ! a small number
345INTEGER, DIMENSION(3) :: imaxloc ! localisation of
346 ! a maximum
347INTEGER :: jrr ! loop counter
348CHARACTER(LEN=20) :: hitermax, hzeps, hmaxvalzdt, hpmrimaxloc, hztimaxloc
349!-------------------------------------------------------------------------------
350!
351!* 1. COMPUTE VAPOR MIXING RATIO
352! --------------------------
353!
354REAL(kind=jphook) :: zhook_handle
355IF (lhook) CALL dr_hook('MODE_THERMO:SM_PMR_HU_3D',0,zhook_handle)
356itermax = 10
357IF (PRESENT(kitermax)) itermax=kitermax
358zrdsrv = xrd /xrv
359zeps = xeps_dt
360!
361zrslw(:,:,:)=0.
362DO jrr=2,SIZE(pr,4)
363 zrslw(:,:,:)=zrslw(:,:,:)+pr(:,:,:,jrr)
364END DO
365!
366zt(:,:,:) = ptv(:,:,:)
367DO iter=1,itermax
368 zestd(:,:,:) = phu(:,:,:) * sm_foes(zt(:,:,:)) * 0.01
369 pmr(:,:,:) = zrdsrv * zestd(:,:,:) /(pp(:,:,:) - zestd(:,:,:))
370 zdt(:,:,:) = zt(:,:,:)
371 zt(:,:,:) = ptv(:,:,:) * (1.+pmr(:,:,:)+zrslw(:,:,:)) / (1.+ pmr(:,:,:)/zrdsrv)
372 zdt(:,:,:) = abs(zdt(:,:,:) - zt(:,:,:))
373END DO
374!-------------------------------------------------------------------------------
375!
376!* 2. NO CONVERGENCE
377! --------------
378!
379IF ( any(zdt > zeps) ) THEN
380 WRITE(hitermax, '(i10)') itermax
381 WRITE(hzeps, '(f10.4)') zeps
382 imaxloc = maxloc(zdt)
383 WRITE(hmaxvalzdt, '(f10.4)') maxval(zdt)
384 WRITE(hpmrimaxloc, '(f10.4)') pmr(imaxloc(1),imaxloc(2),imaxloc(3))
385 WRITE(hztimaxloc, '(f10.4)') zt(imaxloc(1),imaxloc(2),imaxloc(3))
386 CALL print_msg(nverb_fatal, 'GEN', 'SM_PMR_HU_1D', &
387 &['ERROR IN FUNCTION SM_PMR_HU (module MODE_THERMO)', &
388 & 'FUNCTION FAILS TO CONVERGE AFTER ' // trim(hitermax) // ' ITERATIONS', &
389 & 'EPS = ' // trim(hzeps), &
390 & 'MAXIMUM RESIDUAL DT :' // trim(hmaxvalzdt), &
391 & 'MR AT THIS MAXIMUM : ' // trim(hpmrimaxloc), &
392 & 'T AT THIS MAXIMUM : ' // trim(hztimaxloc), &
393 & 'JOB ABORTED ', &
394 & 'failed to converge'])
395END IF
396!-------------------------------------------------------------------------------
397IF (lhook) CALL dr_hook('MODE_THERMO:SM_PMR_HU_3D',1,zhook_handle)
398END FUNCTION sm_pmr_hu_3d
399! ################################################################
400 FUNCTION sm_pmr_hu_1d(PP,PTV,PHU,PR,KITERMAX) RESULT(PMR)
401! ################################################################
402!
403!!**** *SM_PMR_HU_1D * - function to compute vapor mixing ratio
404!!
405!! PURPOSE
406!! -------
407! The purpose of this function is to compute the vapor mixing ratio
408! from pressure, virtual temperature and relative humidity
409!
410!
411!!** METHOD
412!! ------
413!! Given Pressure (PP), Virtual temperature (PTV) and Relative
414!! humidity (PHU), the vapor mixing ratio is computed by iterating
415!! the following procedure :
416!! T ----> es(T)
417!! es(T) ,HU ----> es(Td)
418!! es(Td), P ----> r
419!! r , Tv ----> T
420!!
421!! at the beginning T=Tv
422!!
423!! EXTERNAL
424!! --------
425!! SM_FOES : to compute saturation vapor pressure
426!!
427!! IMPLICIT ARGUMENTS
428!! ------------------
429!! Module MODD_CST : comtains physical constants
430!! XRV : gas constant for vapor
431!! XRD : gas constant for dry air
432!!
433!! REFERENCE
434!! ---------
435!! Book2 of documentation of Meso-NH
436!!
437!!
438!! AUTHOR
439!! ------
440!! V. Ducrocq * Meteo France *
441!!
442!! MODIFICATIONS
443!! -------------
444!! Original 30/08/94
445!! Modification 16/03/95 remove the EPSILON function
446!! Modification 15/09/97 (V. Masson) add solid and liquid water phases
447!! in thetav computation
448!-------------------------------------------------------------------------------
449!
450!* 0. DECLARATIONS
451! ------------
452!
453USE modd_cst, ONLY: xrd, xrv
454USE mode_msg, ONLY: print_msg
455USE modd_io, ONLY:nverb_fatal
456!
457IMPLICIT NONE
458!
459!* 0.1 Declarations of arguments and results
460!
461!
462REAL, DIMENSION(:), INTENT(IN) :: pp ! Pressure
463 ! (Pa)
464REAL, DIMENSION(:), INTENT(IN) :: ptv ! Virtual Temperature
465 ! (Kelvin)
466REAL, DIMENSION(:), INTENT(IN) :: phu ! Relative humidity
467 ! (percent)
468REAL, DIMENSION(:,:), INTENT(IN) :: pr ! vapor, liquid and solid
469 ! water mixing ratio
470INTEGER, INTENT(IN), OPTIONAL :: kitermax ! maximum number
471 ! of iterations
472 ! (default 10)
473!
474REAL, DIMENSION(SIZE(PP)) :: pmr ! vapor mixing ratio
475!
476!* 0.2 Declarations of local variables
477!
478REAL, DIMENSION(SIZE(PP)) :: zt ! temperature
479REAL, DIMENSION(SIZE(PP)) :: zdt ! increment of
480 ! temperature between two iterations
481REAL :: zrdsrv ! Rd/Rv
482REAL, DIMENSION(SIZE(PP)) :: zestd ! es(Td)
483REAL, DIMENSION(SIZE(PP)) :: zrslw ! total solid and liquid water mixing ratio
484INTEGER :: itermax ! Maximum number
485 ! of iteration
486INTEGER :: iter ! iteration number of
487REAL :: zeps ! a small number
488INTEGER,DIMENSION(1) :: imaxloc ! localisation of
489 ! a maximum
490CHARACTER(LEN=20) :: hitermax, hzeps, hmaxvalzdt, hpmrimaxloc, hztimaxloc
491!-------------------------------------------------------------------------------
492!
493!* 1. COMPUTE VAPOR MIXING RATIO
494! --------------------------
495!
496REAL(kind=jphook) :: zhook_handle
497IF (lhook) CALL dr_hook('MODE_THERMO:SM_PMR_HU_1D',0,zhook_handle)
498itermax = 10
499IF (PRESENT(kitermax)) itermax=kitermax
500zrdsrv = xrd /xrv
501zeps = 1.e-5
502!
503IF (SIZE(pr,2)>1) THEN
504 zrslw(:)=sum(pr(:,2:),dim=2)
505ELSE
506 zrslw(:)=0.
507END IF
508!
509zt(:) = ptv(:)
510DO iter=1,itermax
511 zestd(:) = phu(:) * sm_foes(zt(:)) * 0.01
512 pmr(:) = zrdsrv * zestd(:) /(pp(:) - zestd(:))
513 zdt(:) = zt(:)
514 zt(:) = ptv(:) * (1.+pmr(:)+zrslw(:)) / (1.+ pmr(:)/zrdsrv)
515 zdt(:) = abs(zdt(:) - zt(:))
516END DO
517!-------------------------------------------------------------------------------
518!
519!* 2. NO CONVERGENCE
520! --------------
521!
522IF (any(zdt>zeps)) THEN
523 WRITE(hitermax, '(i10)') itermax
524 WRITE(hzeps, '(f10.4)') zeps
525 imaxloc = maxloc(zdt)
526 WRITE(hmaxvalzdt, '(f10.4)') maxval(zdt)
527 WRITE(hpmrimaxloc, '(f10.4)') pmr(imaxloc)
528 WRITE(hztimaxloc, '(f10.4)') zt(imaxloc)
529 CALL print_msg(nverb_fatal, 'GEN', 'SM_PMR_HU_1D', &
530 &['ERROR IN FUNCTION SM_PMR_HU (module MODE_THERMO)', &
531 & 'FUNCTION FAILS TO CONVERGE AFTER ' // trim(hitermax) // ' ITERATIONS', &
532 & 'EPS = ' // trim(hzeps), &
533 & 'MAXIMUM RESIDUAL DT :' // trim(hmaxvalzdt), &
534 & 'MR AT THIS MAXIMUM : ' // trim(hpmrimaxloc), &
535 & 'T AT THIS MAXIMUM : ' // trim(hztimaxloc), &
536 & 'JOB ABORTED ', &
537 & 'failed to converge'])
538END IF
539!-------------------------------------------------------------------------------
540IF (lhook) CALL dr_hook('MODE_THERMO:SM_PMR_HU_1D',1,zhook_handle)
541END FUNCTION sm_pmr_hu_1d
542! ####################################
543 FUNCTION sm_foes_0d(PT) RESULT(PFOES)
544! ####################################
545!
546!!**** *SM_FOES_0D * - function to compute saturation vapor pressure from
547!! temperature
548!!
549!! PURPOSE
550!! -------
551! The purpose of this function is to compute the saturation vapor
552! pressure from temperature
553!
554!
555!!** METHOD
556!! ------
557!! Given temperature T (PT), the saturation vapor pressure es(T)
558!! (FOES(PT)) is computed by integration of the Clapeyron equation
559!! from the triple point temperature Tt (XTT) and the saturation vapor
560!! pressure of the triple point es(Tt) (XESTT), i.e
561!!
562!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
563!!
564!! with :
565!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
566!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
567!! gammaw (XGAMW) = (Cl -Cpv) /Rv
568!!
569!! EXTERNAL
570!! --------
571!! NONE
572!!
573!! IMPLICIT ARGUMENTS
574!! ------------------
575!! Module MODD_CST : comtains physical constants
576!! XALPW : Constant for saturation vapor pressure function
577!! XBETAW : Constant for saturation vapor pressure function
578!! XGAMW : Constant for saturation vapor pressure function
579!!
580!! REFERENCE
581!! ---------
582!! Book2 of documentation of Meso-NH
583!!
584!!
585!! AUTHOR
586!! ------
587!! V. Ducrocq * Meteo France *
588!!
589!! MODIFICATIONS
590!! -------------
591!! Original 28/08/94
592!! 24/12/97 (V. Masson) version for 0D arrays
593!-------------------------------------------------------------------------------
594!
595!* 0. DECLARATIONS
596! ------------
597!
598USE modd_cst, ONLY: xalpw, xbetaw, xgamw
599!
600IMPLICIT NONE
601!
602!* 0.1 Declarations of arguments and results
603!
604!
605REAL, INTENT(IN) :: pt ! Temperature
606 ! (Kelvin)
607REAL :: pfoes ! saturation vapor
608 ! pressure
609 ! (Pascal)
610!
611!* 0.2 Declarations of local variables
612!
613!-------------------------------------------------------------------------------
614!
615!* 1. COMPUTE SATURATION VAPOR PRESSURE
616! ---------------------------------
617!
618REAL(kind=jphook) :: zhook_handle
619IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_0D',0,zhook_handle)
620pfoes = exp( xalpw - xbetaw/pt - xgamw*log(pt) )
621!-------------------------------------------------------------------------------
622!
623IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_0D',1,zhook_handle)
624END FUNCTION sm_foes_0d
625!
626!-------------------------------------------------------------------------------
627! ####################################
628 FUNCTION sm_foes_2d(PT) RESULT(PFOES)
629! ####################################
630!
631!!**** *SM_FOES_2D * - function to compute saturation vapor pressure from
632!! temperature
633!!
634!! PURPOSE
635!! -------
636! The purpose of this function is to compute the saturation vapor
637! pressure from temperature
638!
639!
640!!** METHOD
641!! ------
642!! Given temperature T (PT), the saturation vapor pressure es(T)
643!! (FOES(PT)) is computed by integration of the Clapeyron equation
644!! from the triple point temperature Tt (XTT) and the saturation vapor
645!! pressure of the triple point es(Tt) (XESTT), i.e
646!!
647!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
648!!
649!! with :
650!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
651!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
652!! gammaw (XGAMW) = (Cl -Cpv) /Rv
653!!
654!! EXTERNAL
655!! --------
656!! NONE
657!!
658!! IMPLICIT ARGUMENTS
659!! ------------------
660!! Module MODD_CST : comtains physical constants
661!! XALPW : Constant for saturation vapor pressure function
662!! XBETAW : Constant for saturation vapor pressure function
663!! XGAMW : Constant for saturation vapor pressure function
664!!
665!! REFERENCE
666!! ---------
667!! Book2 of documentation of Meso-NH
668!!
669!!
670!! AUTHOR
671!! ------
672!! V. Ducrocq * Meteo France *
673!!
674!! MODIFICATIONS
675!! -------------
676!! Original 28/08/94
677!! 24/12/97 (V. Masson) version for 2D arrays
678!-------------------------------------------------------------------------------
679!
680!* 0. DECLARATIONS
681! ------------
682!
683USE modd_cst, ONLY: xalpw, xbetaw, xgamw
684!
685IMPLICIT NONE
686!
687!* 0.1 Declarations of arguments and results
688!
689!
690REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
691 ! (Kelvin)
692REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pfoes ! saturation vapor
693 ! pressure
694 ! (Pascal)
695!
696!* 0.2 Declarations of local variables
697!
698!-------------------------------------------------------------------------------
699!
700!* 1. COMPUTE SATURATION VAPOR PRESSURE
701! ---------------------------------
702!
703REAL(kind=jphook) :: zhook_handle
704IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_2D',0,zhook_handle)
705pfoes(:,:) = exp( xalpw - xbetaw/pt(:,:) - xgamw*log(pt(:,:)) )
706!-------------------------------------------------------------------------------
707!
708IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_2D',1,zhook_handle)
709END FUNCTION sm_foes_2d
710!
711!-------------------------------------------------------------------------------
712!
713! ################################################
714 FUNCTION sm_foes_2d_mask(OMASK,PT) RESULT(PFOES)
715! ################################################
716!
717!!**** *SM_FOES_2D * - function to compute saturation vapor pressure from
718!! temperature
719!!
720!! PURPOSE
721!! -------
722! The purpose of this function is to compute the saturation vapor
723! pressure from temperature
724!
725!
726!!** METHOD
727!! ------
728!! Given temperature T (PT), the saturation vapor pressure es(T)
729!! (FOES(PT)) is computed by integration of the Clapeyron equation
730!! from the triple point temperature Tt (XTT) and the saturation vapor
731!! pressure of the triple point es(Tt) (XESTT), i.e
732!!
733!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
734!!
735!! with :
736!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
737!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
738!! gammaw (XGAMW) = (Cl -Cpv) /Rv
739!!
740!! EXTERNAL
741!! --------
742!! NONE
743!!
744!! IMPLICIT ARGUMENTS
745!! ------------------
746!! Module MODD_CST : comtains physical constants
747!! XALPW : Constant for saturation vapor pressure function
748!! XBETAW : Constant for saturation vapor pressure function
749!! XGAMW : Constant for saturation vapor pressure function
750!!
751!! REFERENCE
752!! ---------
753!! Book2 of documentation of Meso-NH
754!!
755!!
756!! AUTHOR
757!! ------
758!! V. Ducrocq * Meteo France *
759!!
760!! MODIFICATIONS
761!! -------------
762!! Original 28/08/94
763!! 24/12/97 (V. Masson) version for 2D arrays
764!-------------------------------------------------------------------------------
765!
766!* 0. DECLARATIONS
767! ------------
768!
769USE modd_cst, ONLY: xalpw, xbetaw, xgamw
770!
771IMPLICIT NONE
772!
773!* 0.1 Declarations of arguments and results
774!
775!
776LOGICAL, DIMENSION(:,:), INTENT(IN) :: omask ! Localization mask
777REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
778 ! (Kelvin)
779REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pfoes ! saturation vapor
780 ! pressure
781 ! (Pascal)
782!
783!* 0.2 Declarations of local variables
784!
785!-------------------------------------------------------------------------------
786!
787!* 1. COMPUTE SATURATION VAPOR PRESSURE
788! ---------------------------------
789!
790REAL(kind=jphook) :: zhook_handle
791IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_2D_MASK',0,zhook_handle)
792WHERE (omask(:,:))
793 pfoes(:,:) = exp( xalpw - xbetaw/pt(:,:) - xgamw*log(pt(:,:)) )
794END WHERE
795!-------------------------------------------------------------------------------
796!
797IF (lhook) CALL dr_hook('MODE_THERMO:SM_FOES_2D_MASK',1,zhook_handle)
798END FUNCTION sm_foes_2d_mask
799!
800!-------------------------------------------------------------------------------
801!
802! ######################################
803 FUNCTION qsatw_3d(PT,PP) RESULT(PQSAT)
804! ######################################
805!
806!!**** *QSATW * - function to compute saturation vapor humidity from
807!! temperature
808!!
809!! PURPOSE
810!! -------
811! The purpose of this function is to compute the saturation vapor
812! pressure from temperature
813!
814!
815!!** METHOD
816!! ------
817!! Given temperature T (PT), the saturation vapor pressure es(T)
818!! (FOES(PT)) is computed by integration of the Clapeyron equation
819!! from the triple point temperature Tt (XTT) and the saturation vapor
820!! pressure of the triple point es(Tt) (XESTT), i.e
821!!
822!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
823!!
824!! with :
825!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
826!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
827!! gammaw (XGAMW) = (Cl -Cpv) /Rv
828!!
829!! Then, the specific humidity at saturation is deduced.
830!!
831!!
832!! EXTERNAL
833!! --------
834!! NONE
835!!
836!! IMPLICIT ARGUMENTS
837!! ------------------
838!! Module MODD_CST : comtains physical constants
839!! XALPW : Constant for saturation vapor pressure function
840!! XBETAW : Constant for saturation vapor pressure function
841!! XGAMW : Constant for saturation vapor pressure function
842!!
843!! REFERENCE
844!! ---------
845!! Book2 of documentation of Meso-NH
846!!
847!!
848!! AUTHOR
849!! ------
850!! V. Masson * Meteo France *
851!!
852!! MODIFICATIONS
853!! -------------
854!! Original 21/09/98
855!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
856!-------------------------------------------------------------------------------
857!
858!* 0. DECLARATIONS
859! ------------
860!
861USE modd_cst, ONLY: xalpw, xbetaw, xgamw, xrd, xrv
862!
863IMPLICIT NONE
864!
865!* 0.1 Declarations of arguments and results
866!
867!
868REAL, DIMENSION(:,:,:), INTENT(IN) :: pt ! Temperature
869 ! (Kelvin)
870REAL, DIMENSION(:,:,:), INTENT(IN) :: pp ! Pressure
871 ! (Pa)
872REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: pqsat ! saturation vapor
873 ! specific humidity
874 ! with respect to
875 ! water (kg/kg)
876!
877!* 0.2 Declarations of local variables
878!
879REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: zfoes ! saturation vapor
880 ! pressure
881 ! (Pascal)
882!
883!-------------------------------------------------------------------------------
884!
885!* 1. COMPUTE SATURATION VAPOR PRESSURE
886! ---------------------------------
887!
888REAL(kind=jphook) :: zhook_handle
889IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_3D',0,zhook_handle)
890zfoes(:,:,:) = min(exp( xalpw - xbetaw/pt(:,:,:) - xgamw*log(pt(:,:,:)) ), 0.99*pp(:,:,:))
891!
892!* 2. COMPUTE SATURATION HUMIDITY
893! ---------------------------
894!
895pqsat(:,:,:) = xrd/xrv*zfoes(:,:,:)/pp(:,:,:) &
896 / (1.+(xrd/xrv-1.)*zfoes(:,:,:)/pp(:,:,:))
897!-------------------------------------------------------------------------------
898!
899IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_3D',1,zhook_handle)
900END FUNCTION qsatw_3d
901!
902!-------------------------------------------------------------------------------
903!
904! ######################################
905 FUNCTION qsatw_2d(PT,PP) RESULT(PQSAT)
906! ######################################
907!
908!!**** *QSATW * - function to compute saturation vapor humidity from
909!! temperature
910!!
911!! PURPOSE
912!! -------
913! The purpose of this function is to compute the saturation vapor
914! pressure from temperature
915!
916!
917!!** METHOD
918!! ------
919!! Given temperature T (PT), the saturation vapor pressure es(T)
920!! (FOES(PT)) is computed by integration of the Clapeyron equation
921!! from the triple point temperature Tt (XTT) and the saturation vapor
922!! pressure of the triple point es(Tt) (XESTT), i.e
923!!
924!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
925!!
926!! with :
927!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
928!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
929!! gammaw (XGAMW) = (Cl -Cpv) /Rv
930!!
931!! Then, the specific humidity at saturation is deduced.
932!!
933!!
934!! EXTERNAL
935!! --------
936!! NONE
937!!
938!! IMPLICIT ARGUMENTS
939!! ------------------
940!! Module MODD_CST : comtains physical constants
941!! XALPW : Constant for saturation vapor pressure function
942!! XBETAW : Constant for saturation vapor pressure function
943!! XGAMW : Constant for saturation vapor pressure function
944!!
945!! REFERENCE
946!! ---------
947!! Book2 of documentation of Meso-NH
948!!
949!!
950!! AUTHOR
951!! ------
952!! V. Masson * Meteo France *
953!!
954!! MODIFICATIONS
955!! -------------
956!! Original 21/09/98
957!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
958!-------------------------------------------------------------------------------
959!
960!* 0. DECLARATIONS
961! ------------
962!
963USE modd_cst, ONLY: xalpw, xbetaw, xgamw, xrd, xrv
964!
965IMPLICIT NONE
966!
967!* 0.1 Declarations of arguments and results
968!
969!
970REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
971 ! (Kelvin)
972REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
973 ! (Pa)
974REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pqsat ! saturation vapor
975 ! specific humidity
976 ! with respect to
977 ! water (kg/kg)
978!
979!* 0.2 Declarations of local variables
980!
981REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
982 ! pressure
983 ! (Pascal)
984!
985!-------------------------------------------------------------------------------
986!
987!* 1. COMPUTE SATURATION VAPOR PRESSURE
988! ---------------------------------
989!
990REAL(kind=jphook) :: zhook_handle
991IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_2D',0,zhook_handle)
992zfoes(:,:) = min(exp( xalpw - xbetaw/pt(:,:) - xgamw*log(pt(:,:)) ), 0.99*pp(:,:))
993!
994!* 2. COMPUTE SATURATION HUMIDITY
995! ---------------------------
996!
997pqsat(:,:) = xrd/xrv*zfoes(:,:)/pp(:,:) &
998 / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:))
999!-------------------------------------------------------------------------------
1000!
1001IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_2D',1,zhook_handle)
1002END FUNCTION qsatw_2d
1003!
1004!-------------------------------------------------------------------------------
1005!
1006! #################################################
1007 FUNCTION qsatw_2d_mask(OMASK,PT,PP) RESULT(PQSAT)
1008! #################################################
1009!
1010!!**** *QSATW * - function to compute saturation vapor humidity from
1011!! temperature
1012!!
1013!! PURPOSE
1014!! -------
1015! The purpose of this function is to compute the saturation vapor
1016! pressure from temperature
1017!
1018!
1019!!** METHOD
1020!! ------
1021!! Given temperature T (PT), the saturation vapor pressure es(T)
1022!! (FOES(PT)) is computed by integration of the Clapeyron equation
1023!! from the triple point temperature Tt (XTT) and the saturation vapor
1024!! pressure of the triple point es(Tt) (XESTT), i.e
1025!!
1026!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1027!!
1028!! with :
1029!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1030!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1031!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1032!!
1033!! Then, the specific humidity at saturation is deduced.
1034!!
1035!!
1036!! EXTERNAL
1037!! --------
1038!! NONE
1039!!
1040!! IMPLICIT ARGUMENTS
1041!! ------------------
1042!! Module MODD_CST : comtains physical constants
1043!! XALPW : Constant for saturation vapor pressure function
1044!! XBETAW : Constant for saturation vapor pressure function
1045!! XGAMW : Constant for saturation vapor pressure function
1046!!
1047!! REFERENCE
1048!! ---------
1049!! Book2 of documentation of Meso-NH
1050!!
1051!!
1052!! AUTHOR
1053!! ------
1054!! V. Masson * Meteo France *
1055!!
1056!! MODIFICATIONS
1057!! -------------
1058!! Original 21/09/98
1059!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
1060!-------------------------------------------------------------------------------
1061!
1062!* 0. DECLARATIONS
1063! ------------
1064!
1065USE modd_cst, ONLY: xalpw, xbetaw, xgamw, xrd, xrv
1066!
1067IMPLICIT NONE
1068!
1069!* 0.1 Declarations of arguments and results
1070!
1071!
1072LOGICAL, DIMENSION(:,:), INTENT(IN) :: omask ! Localization mask
1073REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
1074 ! (Kelvin)
1075REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
1076 ! (Pa)
1077REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pqsat ! saturation vapor
1078 ! specific humidity
1079 ! with respect to
1080 ! water (kg/kg)
1081!
1082!* 0.2 Declarations of local variables
1083!
1084REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
1085 ! pressure
1086 ! (Pascal)
1087!
1088!-------------------------------------------------------------------------------
1089!
1090REAL(kind=jphook) :: zhook_handle
1091IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_2D_MASK',0,zhook_handle)
1092WHERE (omask(:,:))
1093!
1094!* 1. COMPUTE SATURATION VAPOR PRESSURE
1095! ---------------------------------
1096!
1097 zfoes(:,:) = min(exp( xalpw - xbetaw/pt(:,:) - xgamw*log(pt(:,:)) ), 0.99*pp(:,:))
1098!
1099!* 2. COMPUTE SATURATION HUMIDITY
1100! ---------------------------
1101!
1102 pqsat(:,:) = xrd/xrv*zfoes(:,:)/pp(:,:) &
1103 / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:))
1104ELSEWHERE
1105!
1106!* 3. BOGUS VALUE
1107! -----------
1108!
1109 pqsat(:,:) = 0.
1110END WHERE
1111!-------------------------------------------------------------------------------
1112!
1113IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_2D_MASK',1,zhook_handle)
1114END FUNCTION qsatw_2d_mask
1115!
1116!-------------------------------------------------------------------------------
1117!
1118! ######################################
1119 FUNCTION qsatw_1d(PT,PP) RESULT(PQSAT)
1120! ######################################
1121!
1122!!**** *QSATW * - function to compute saturation vapor humidity from
1123!! temperature
1124!!
1125!! PURPOSE
1126!! -------
1127! The purpose of this function is to compute the saturation vapor
1128! pressure from temperature
1129!
1130!
1131!!** METHOD
1132!! ------
1133!! Given temperature T (PT), the saturation vapor pressure es(T)
1134!! (FOES(PT)) is computed by integration of the Clapeyron equation
1135!! from the triple point temperature Tt (XTT) and the saturation vapor
1136!! pressure of the triple point es(Tt) (XESTT), i.e
1137!!
1138!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1139!!
1140!! with :
1141!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1142!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1143!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1144!!
1145!! Then, the specific humidity at saturation is deduced.
1146!!
1147!!
1148!! EXTERNAL
1149!! --------
1150!! NONE
1151!!
1152!! IMPLICIT ARGUMENTS
1153!! ------------------
1154!! Module MODD_CST : comtains physical constants
1155!! XALPW : Constant for saturation vapor pressure function
1156!! XBETAW : Constant for saturation vapor pressure function
1157!! XGAMW : Constant for saturation vapor pressure function
1158!!
1159!! REFERENCE
1160!! ---------
1161!! Book2 of documentation of Meso-NH
1162!!
1163!!
1164!! AUTHOR
1165!! ------
1166!! V. Masson * Meteo France *
1167!!
1168!! MODIFICATIONS
1169!! -------------
1170!! Original 21/09/98
1171!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
1172!-------------------------------------------------------------------------------
1173!
1174!* 0. DECLARATIONS
1175! ------------
1176!
1177USE modd_cst, ONLY: xalpw, xbetaw, xgamw, xrd, xrv
1178!
1179IMPLICIT NONE
1180!
1181!* 0.1 Declarations of arguments and results
1182!
1183!
1184REAL, DIMENSION(:), INTENT(IN) :: pt ! Temperature
1185 ! (Kelvin)
1186REAL, DIMENSION(:), INTENT(IN) :: pp ! Pressure
1187 ! (Pa)
1188REAL, DIMENSION(SIZE(PT,1)) :: pqsat ! saturation vapor
1189 ! specific humidity
1190 ! with respect to
1191 ! water (kg/kg)
1192!
1193!* 0.2 Declarations of local variables
1194!
1195REAL, DIMENSION(SIZE(PT,1)) :: zfoes ! saturation vapor
1196 ! pressure
1197 ! (Pascal)
1198!
1199!-------------------------------------------------------------------------------
1200!
1201!* 1. COMPUTE SATURATION VAPOR PRESSURE
1202! ---------------------------------
1203!
1204REAL(kind=jphook) :: zhook_handle
1205IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_1D',0,zhook_handle)
1206zfoes(:) = min(exp( xalpw - xbetaw/pt(:) - xgamw*log(pt(:)) ), 0.99*pp(:))
1207!
1208!* 2. COMPUTE SATURATION HUMIDITY
1209! ---------------------------
1210!
1211pqsat(:) = xrd/xrv*zfoes(:)/pp(:) &
1212 / (1.+(xrd/xrv-1.)*zfoes(:)/pp(:))
1213!-------------------------------------------------------------------------------
1214!
1215IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_1D',1,zhook_handle)
1216END FUNCTION qsatw_1d
1217!
1218!-------------------------------------------------------------------------------
1219!
1220! ######################################
1221 FUNCTION qsatw_0d(PT,PP) RESULT(PQSAT)
1222! ######################################
1223!
1224!!**** *QSATW * - function to compute saturation vapor humidity from
1225!! temperature
1226!!
1227!! PURPOSE
1228!! -------
1229! The purpose of this function is to compute the saturation vapor
1230! pressure from temperature
1231!
1232!
1233!!** METHOD
1234!! ------
1235!! Given temperature T (PT), the saturation vapor pressure es(T)
1236!! (FOES(PT)) is computed by integration of the Clapeyron equation
1237!! from the triple point temperature Tt (XTT) and the saturation vapor
1238!! pressure of the triple point es(Tt) (XESTT), i.e
1239!!
1240!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1241!!
1242!! with :
1243!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1244!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1245!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1246!!
1247!! Then, the specific humidity at saturation is deduced.
1248!!
1249!!
1250!! EXTERNAL
1251!! --------
1252!! NONE
1253!!
1254!! IMPLICIT ARGUMENTS
1255!! ------------------
1256!! Module MODD_CST : comtains physical constants
1257!! XALPW : Constant for saturation vapor pressure function
1258!! XBETAW : Constant for saturation vapor pressure function
1259!! XGAMW : Constant for saturation vapor pressure function
1260!!
1261!! REFERENCE
1262!! ---------
1263!! Book2 of documentation of Meso-NH
1264!!
1265!!
1266!! AUTHOR
1267!! ------
1268!! V. Masson * Meteo France *
1269!!
1270!! MODIFICATIONS
1271!! -------------
1272!! Original 21/09/98
1273!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
1274!-------------------------------------------------------------------------------
1275!
1276!* 0. DECLARATIONS
1277! ------------
1278!
1279USE modd_cst, ONLY: xalpw, xbetaw, xgamw, xrd, xrv
1280!
1281IMPLICIT NONE
1282!
1283!* 0.1 Declarations of arguments and results
1284!
1285!
1286REAL, INTENT(IN) :: pt ! Temperature
1287 ! (Kelvin)
1288REAL, INTENT(IN) :: pp ! Pressure
1289 ! (Pa)
1290REAL :: pqsat ! saturation vapor
1291 ! specific humidity
1292 ! with respect to
1293 ! water (kg/kg)
1294!
1295!* 0.2 Declarations of local variables
1296!
1297REAL :: zfoes ! saturation vapor
1298 ! pressure
1299 ! (Pascal)
1300!
1301!-------------------------------------------------------------------------------
1302!
1303!* 1. COMPUTE SATURATION VAPOR PRESSURE
1304! ---------------------------------
1305!
1306REAL(kind=jphook) :: zhook_handle
1307IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_0D',0,zhook_handle)
1308zfoes = min(exp( xalpw - xbetaw/pt - xgamw*log(pt) ), 0.99*pp)
1309!
1310!* 2. COMPUTE SATURATION HUMIDITY
1311! ---------------------------
1312!
1313pqsat = xrd/xrv*zfoes/pp / (1.+(xrd/xrv-1.)*zfoes/pp)
1314!-------------------------------------------------------------------------------
1315!
1316IF (lhook) CALL dr_hook('MODE_THERMO:QSATW_0D',1,zhook_handle)
1317END FUNCTION qsatw_0d
1318!
1319!-------------------------------------------------------------------------------
1320!
1321! ##############################################################
1322 FUNCTION dqsatw_o_dt_2d_mask(OMASK,PT,PP,PQSAT) RESULT(PDQSAT)
1323! ##############################################################
1324!
1325!!**** *QSATW * - function to compute saturation vapor humidity from
1326!! temperature
1327!!
1328!! PURPOSE
1329!! -------
1330! The purpose of this function is to compute the saturation vapor
1331! pressure from temperature
1332!
1333!
1334!!** METHOD
1335!! ------
1336!! Given temperature T (PT), the saturation vapor pressure es(T)
1337!! (FOES(PT)) is computed by integration of the Clapeyron equation
1338!! from the triple point temperature Tt (XTT) and the saturation vapor
1339!! pressure of the triple point es(Tt) (XESTT), i.e
1340!!
1341!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1342!!
1343!! with :
1344!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1345!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1346!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1347!!
1348!! Then, the specific humidity at saturation is deduced.
1349!!
1350!! Finally, dqsat / dT (T) is computed.
1351!!
1352!!
1353!! EXTERNAL
1354!! --------
1355!! NONE
1356!!
1357!! IMPLICIT ARGUMENTS
1358!! ------------------
1359!! Module MODD_CST : comtains physical constants
1360!! XALPW : Constant for saturation vapor pressure function
1361!! XBETAW : Constant for saturation vapor pressure function
1362!! XGAMW : Constant for saturation vapor pressure function
1363!!
1364!! REFERENCE
1365!! ---------
1366!! Book2 of documentation of Meso-NH
1367!!
1368!!
1369!! AUTHOR
1370!! ------
1371!! V. Masson * Meteo France *
1372!!
1373!! MODIFICATIONS
1374!! -------------
1375!! Original 21/09/98
1376!-------------------------------------------------------------------------------
1377!
1378!* 0. DECLARATIONS
1379! ------------
1380!
1381USE modd_cst, ONLY: xbetaw, xgamw, xrd, xrv
1382!
1383IMPLICIT NONE
1384!
1385!* 0.1 Declarations of arguments and results
1386!
1387!
1388LOGICAL, DIMENSION(:,:), INTENT(IN) :: omask ! Localization mask
1389REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
1390 ! (Kelvin)
1391REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
1392 ! (Pa)
1393REAL, DIMENSION(:,:), INTENT(IN) :: pqsat ! saturation vapor
1394 ! specific humidity
1395 ! with respect to
1396 ! water (kg/kg))
1397REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pdqsat ! derivative according
1398 ! to temperature of
1399 ! saturation vapor
1400 ! specific humidity
1401 ! with respect to
1402 ! water (kg/kg))
1403!
1404!* 0.2 Declarations of local variables
1405!
1406REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
1407 ! pressure
1408 ! (Pascal)
1409!
1410!-------------------------------------------------------------------------------
1411!
1412REAL(kind=jphook) :: zhook_handle
1413IF (lhook) CALL dr_hook('MODE_THERMO:DQSATW_O_DT_2D_MASK',0,zhook_handle)
1414WHERE (omask(:,:))
1415!
1416!* 1. COMPUTE SATURATION VAPOR PRESSURE
1417! ---------------------------------
1418!
1419 zfoes(:,:) = pp(:,:) / (1.+xrd/xrv*(1./pqsat(:,:)-1.))
1420!
1421!* 2. DERIVATION ACCORDING TO TEMPERATURE
1422! -----------------------------------
1423!
1424 pdqsat(:,:) = pqsat(:,:) / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:) ) &
1425 * (xbetaw/pt(:,:)**2 - xgamw/pt(:,:))
1426ELSEWHERE
1427!
1428!* 3. BOGUS VALUE
1429! -----------
1430!
1431 pdqsat(:,:) = 0.
1432END WHERE
1433!-------------------------------------------------------------------------------
1434!
1435IF (lhook) CALL dr_hook('MODE_THERMO:DQSATW_O_DT_2D_MASK',1,zhook_handle)
1436END FUNCTION dqsatw_o_dt_2d_mask
1437!
1438!-------------------------------------------------------------------------------
1439! ##############################################################
1440 FUNCTION dqsatw_o_dt_1d(PT,PP,PQSAT) RESULT(PDQSAT)
1441! ##############################################################
1442!
1443!!**** *QSATW * - function to compute saturation vapor humidity from
1444!! temperature
1445!!
1446!! PURPOSE
1447!! -------
1448! The purpose of this function is to compute the saturation vapor
1449! pressure from temperature
1450!
1451!
1452!!** METHOD
1453!! ------
1454!! Given temperature T (PT), the saturation vapor pressure es(T)
1455!! (FOES(PT)) is computed by integration of the Clapeyron equation
1456!! from the triple point temperature Tt (XTT) and the saturation vapor
1457!! pressure of the triple point es(Tt) (XESTT), i.e
1458!!
1459!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1460!!
1461!! with :
1462!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1463!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1464!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1465!!
1466!! Then, the specific humidity at saturation is deduced.
1467!!
1468!! Finally, dqsat / dT (T) is computed.
1469!!
1470!!
1471!! EXTERNAL
1472!! --------
1473!! NONE
1474!!
1475!! IMPLICIT ARGUMENTS
1476!! ------------------
1477!! Module MODD_CST : comtains physical constants
1478!! XALPW : Constant for saturation vapor pressure function
1479!! XBETAW : Constant for saturation vapor pressure function
1480!! XGAMW : Constant for saturation vapor pressure function
1481!!
1482!! REFERENCE
1483!! ---------
1484!! Book2 of documentation of Meso-NH
1485!!
1486!!
1487!! AUTHOR
1488!! ------
1489!! V. Masson * Meteo France *
1490!!
1491!! MODIFICATIONS
1492!! -------------
1493!! Original 21/09/98
1494!-------------------------------------------------------------------------------
1495!
1496!* 0. DECLARATIONS
1497! ------------
1498!
1499USE modd_cst, ONLY: xbetaw, xgamw, xrd, xrv
1500!
1501IMPLICIT NONE
1502!
1503!* 0.1 Declarations of arguments and results
1504!
1505!
1506REAL, DIMENSION(:), INTENT(IN) :: pt ! Temperature
1507 ! (Kelvin)
1508REAL, DIMENSION(:), INTENT(IN) :: pp ! Pressure
1509 ! (Pa)
1510REAL, DIMENSION(:), INTENT(IN) :: pqsat ! saturation vapor
1511 ! specific humidity
1512 ! with respect to
1513 ! water (kg/kg))
1514REAL, DIMENSION(SIZE(PT)) :: pdqsat ! derivative according
1515 ! to temperature of
1516 ! saturation vapor
1517 ! specific humidity
1518 ! with respect to
1519 ! water (kg/kg))
1520!
1521!* 0.2 Declarations of local variables
1522!
1523REAL, DIMENSION(SIZE(PT)) :: zfoes ! saturation vapor
1524 ! pressure
1525 ! (Pascal)
1526!
1527!-------------------------------------------------------------------------------
1528!
1529!
1530!* 1. COMPUTE SATURATION VAPOR PRESSURE
1531! ---------------------------------
1532!
1533REAL(kind=jphook) :: zhook_handle
1534IF (lhook) CALL dr_hook('MODE_THERMO:DQSATW_O_DT_1D',0,zhook_handle)
1535zfoes(:) = pp(:) / (1.+xrd/xrv*(1./pqsat(:)-1.))
1536!
1537!* 2. DERIVATION ACCORDING TO TEMPERATURE
1538! -----------------------------------
1539!
1540pdqsat(:) = pqsat(:) / (1.+(xrd/xrv-1.)*zfoes(:)/pp(:) ) &
1541 * (xbetaw/pt(:)**2 - xgamw/pt(:))
1542!
1543!-------------------------------------------------------------------------------
1544!
1545IF (lhook) CALL dr_hook('MODE_THERMO:DQSATW_O_DT_1D',1,zhook_handle)
1546END FUNCTION dqsatw_o_dt_1d
1547!
1548!-------------------------------------------------------------------------------
1549! ##############################################################
1550 FUNCTION dqsatw_o_dt_3d(PT,PP,PQSAT) RESULT(PDQSAT)
1551! ##############################################################
1552!
1553!!**** *QSATW * - function to compute saturation vapor humidity from
1554!! temperature
1555!!
1556!! PURPOSE
1557!! -------
1558! The purpose of this function is to compute the saturation vapor
1559! pressure from temperature
1560!
1561!
1562!!** METHOD
1563!! ------
1564!! Given temperature T (PT), the saturation vapor pressure es(T)
1565!! (FOES(PT)) is computed by integration of the Clapeyron equation
1566!! from the triple point temperature Tt (XTT) and the saturation vapor
1567!! pressure of the triple point es(Tt) (XESTT), i.e
1568!!
1569!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1570!!
1571!! with :
1572!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1573!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1574!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1575!!
1576!! Then, the specific humidity at saturation is deduced.
1577!!
1578!! Finally, dqsat / dT (T) is computed.
1579!!
1580!!
1581!! EXTERNAL
1582!! --------
1583!! NONE
1584!!
1585!! IMPLICIT ARGUMENTS
1586!! ------------------
1587!! Module MODD_CST : comtains physical constants
1588!! XALPW : Constant for saturation vapor pressure function
1589!! XBETAW : Constant for saturation vapor pressure function
1590!! XGAMW : Constant for saturation vapor pressure function
1591!!
1592!! REFERENCE
1593!! ---------
1594!! Book2 of documentation of Meso-NH
1595!!
1596!!
1597!! AUTHOR
1598!! ------
1599!! V. Masson * Meteo France *
1600!!
1601!! MODIFICATIONS
1602!! -------------
1603!! Original 21/09/98
1604!-------------------------------------------------------------------------------
1605!
1606!* 0. DECLARATIONS
1607! ------------
1608!
1609USE modd_cst, ONLY: xbetaw, xgamw, xrd, xrv
1610!
1611IMPLICIT NONE
1612!
1613!* 0.1 Declarations of arguments and results
1614!
1615!
1616REAL, DIMENSION(:,:,:), INTENT(IN) :: pt ! Temperature
1617 ! (Kelvin)
1618REAL, DIMENSION(:,:,:), INTENT(IN) :: pp ! Pressure
1619 ! (Pa)
1620REAL, DIMENSION(:,:,:), INTENT(IN) :: pqsat ! saturation vapor
1621 ! specific humidity
1622 ! with respect to
1623 ! water (kg/kg))
1624REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: pdqsat ! derivative according
1625 ! to temperature of
1626 ! saturation vapor
1627 ! specific humidity
1628 ! with respect to
1629 ! water (kg/kg))
1630!
1631!* 0.2 Declarations of local variables
1632!
1633REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: zfoes ! saturation vapor
1634 ! pressure
1635 ! (Pascal)
1636!
1637!-------------------------------------------------------------------------------
1638!
1639!
1640!* 1. COMPUTE SATURATION VAPOR PRESSURE
1641! ---------------------------------
1642!
1643zfoes(:,:,:) = pp(:,:,:) / (1.+xrd/xrv*(1./pqsat(:,:,:)-1.))
1644!
1645!* 2. DERIVATION ACCORDING TO TEMPERATURE
1646! -----------------------------------
1647!
1648pdqsat(:,:,:) = pqsat(:,:,:) / (1.+(xrd/xrv-1.)*zfoes(:,:,:)/pp(:,:,:) ) &
1649 * (xbetaw/pt(:,:,:)**2 - xgamw/pt(:,:,:))
1650!
1651!-------------------------------------------------------------------------------
1652!
1653END FUNCTION dqsatw_o_dt_3d
1654!
1655!-------------------------------------------------------------------------------
1656!-------------------------------------------------------------------------------
1657!
1658! ##############################################################
1659 FUNCTION dqsati_o_dt_2d_mask(OMASK,PT,PP,PQSAT) RESULT(PDQSAT)
1660! ##############################################################
1661!
1662!!**** *QSATW * - function to compute saturation vapor humidity from
1663!! temperature (with respect to ice)
1664!!
1665!! PURPOSE
1666!! -------
1667! The purpose of this function is to compute the saturation vapor
1668! pressure from temperature
1669!
1670!
1671!!** METHOD
1672!! ------
1673!! Given temperature T (PT), the saturation vapor pressure es(T)
1674!! (FOES(PT)) is computed by integration of the Clapeyron equation
1675!! from the triple point temperature Tt (XTT) and the saturation vapor
1676!! pressure of the triple point es(Tt) (XESTT), i.e
1677!!
1678!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1679!!
1680!! with :
1681!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1682!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1683!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1684!!
1685!! Then, the specific humidity at saturation is deduced.
1686!!
1687!! Finally, dqsat / dT (T) is computed.
1688!!
1689!!
1690!! EXTERNAL
1691!! --------
1692!! NONE
1693!!
1694!! IMPLICIT ARGUMENTS
1695!! ------------------
1696!! Module MODD_CST : comtains physical constants
1697!! XALPW : Constant for saturation vapor pressure function
1698!! XBETAW : Constant for saturation vapor pressure function
1699!! XGAMW : Constant for saturation vapor pressure function
1700!!
1701!! REFERENCE
1702!! ---------
1703!! Book2 of documentation of Meso-NH
1704!!
1705!!
1706!! AUTHOR
1707!! ------
1708!! V. Masson * Meteo France *
1709!!
1710!! MODIFICATIONS
1711!! -------------
1712!! Original 21/09/98
1713!-------------------------------------------------------------------------------
1714!
1715!* 0. DECLARATIONS
1716! ------------
1717!
1718USE modd_cst, ONLY: xbetai, xgami, xrd, xrv
1719!
1720IMPLICIT NONE
1721!
1722!* 0.1 Declarations of arguments and results
1723!
1724!
1725LOGICAL, DIMENSION(:,:), INTENT(IN) :: omask ! Localization mask
1726REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
1727 ! (Kelvin)
1728REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
1729 ! (Pa)
1730REAL, DIMENSION(:,:), INTENT(IN) :: pqsat ! saturation vapor
1731 ! specific humidity
1732 ! with respect to
1733 ! water (kg/kg))
1734REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pdqsat ! derivative according
1735 ! to temperature of
1736 ! saturation vapor
1737 ! specific humidity
1738 ! with respect to
1739 ! water (kg/kg))
1740!
1741!* 0.2 Declarations of local variables
1742!
1743REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
1744 ! pressure
1745 ! (Pascal)
1746!
1747!-------------------------------------------------------------------------------
1748!
1749REAL(kind=jphook) :: zhook_handle
1750IF (lhook) CALL dr_hook('MODE_THERMO:DQSATI_O_DT_2D_MASK',0,zhook_handle)
1751WHERE (omask(:,:))
1752!
1753!* 1. COMPUTE SATURATION VAPOR PRESSURE
1754! ---------------------------------
1755!
1756 zfoes(:,:) = pp(:,:) / (1.+xrd/xrv*(1./pqsat(:,:)-1.))
1757!
1758!* 3. DERIVATION ACCORDING TO TEMPERATURE
1759! -----------------------------------
1760!
1761 pdqsat(:,:) = pqsat(:,:) / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:) ) &
1762 * (xbetai/pt(:,:)**2 - xgami/pt(:,:))
1763ELSEWHERE
1764!
1765!* 3. BOGUS VALUE
1766! -----------
1767!
1768 pdqsat(:,:) = 0.
1769END WHERE
1770!-------------------------------------------------------------------------------
1771!
1772IF (lhook) CALL dr_hook('MODE_THERMO:DQSATI_O_DT_2D_MASK',1,zhook_handle)
1773END FUNCTION dqsati_o_dt_2d_mask
1774!
1775!-------------------------------------------------------------------------------
1776!-------------------------------------------------------------------------------
1777! ##############################################################
1778 FUNCTION dqsati_o_dt_1d(PT,PP,PQSAT) RESULT(PDQSAT)
1779! ##############################################################
1780!
1781!!**** *QSATW * - function to compute saturation vapor humidity from
1782!! temperature (with respect to ice)
1783!!
1784!! PURPOSE
1785!! -------
1786! The purpose of this function is to compute the saturation vapor
1787! pressure from temperature
1788!
1789!
1790!!** METHOD
1791!! ------
1792!! Given temperature T (PT), the saturation vapor pressure es(T)
1793!! (FOES(PT)) is computed by integration of the Clapeyron equation
1794!! from the triple point temperature Tt (XTT) and the saturation vapor
1795!! pressure of the triple point es(Tt) (XESTT), i.e
1796!!
1797!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1798!!
1799!! with :
1800!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1801!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1802!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1803!!
1804!! Then, the specific humidity at saturation is deduced.
1805!!
1806!! Finally, dqsat / dT (T) is computed.
1807!!
1808!!
1809!! EXTERNAL
1810!! --------
1811!! NONE
1812!!
1813!! IMPLICIT ARGUMENTS
1814!! ------------------
1815!! Module MODD_CST : comtains physical constants
1816!! XALPW : Constant for saturation vapor pressure function
1817!! XBETAW : Constant for saturation vapor pressure function
1818!! XGAMW : Constant for saturation vapor pressure function
1819!!
1820!! REFERENCE
1821!! ---------
1822!! Book2 of documentation of Meso-NH
1823!!
1824!!
1825!! AUTHOR
1826!! ------
1827!! V. Masson * Meteo France *
1828!!
1829!! MODIFICATIONS
1830!! -------------
1831!! Original 21/09/98
1832!-------------------------------------------------------------------------------
1833!
1834!* 0. DECLARATIONS
1835! ------------
1836!
1837USE modd_cst, ONLY: xbetai, xgami, xrd, xrv
1838!
1839IMPLICIT NONE
1840!
1841!* 0.1 Declarations of arguments and results
1842!
1843!
1844REAL, DIMENSION(:), INTENT(IN) :: pt ! Temperature
1845 ! (Kelvin)
1846REAL, DIMENSION(:), INTENT(IN) :: pp ! Pressure
1847 ! (Pa)
1848REAL, DIMENSION(:), INTENT(IN) :: pqsat ! saturation vapor
1849 ! specific humidity
1850 ! with respect to
1851 ! water (kg/kg))
1852REAL, DIMENSION(SIZE(PT)) :: pdqsat ! derivative according
1853 ! to temperature of
1854 ! saturation vapor
1855 ! specific humidity
1856 ! with respect to
1857 ! water (kg/kg))
1858!
1859!* 0.2 Declarations of local variables
1860!
1861REAL, DIMENSION(SIZE(PT)) :: zfoes ! saturation vapor
1862 ! pressure
1863 ! (Pascal)
1864!
1865!-------------------------------------------------------------------------------
1866!
1867!
1868!* 1. COMPUTE SATURATION VAPOR PRESSURE
1869! ---------------------------------
1870!
1871REAL(kind=jphook) :: zhook_handle
1872IF (lhook) CALL dr_hook('MODE_THERMO:DQSATI_O_DT_1D',0,zhook_handle)
1873zfoes(:) = pp(:) / (1.+xrd/xrv*(1./pqsat(:)-1.))
1874!
1875!* 3. DERIVATION ACCORDING TO TEMPERATURE
1876! -----------------------------------
1877!
1878pdqsat(:) = pqsat(:) / (1.+(xrd/xrv-1.)*zfoes(:)/pp(:) ) &
1879 * (xbetai/pt(:)**2 - xgami/pt(:))
1880!
1881!-------------------------------------------------------------------------------
1882!
1883IF (lhook) CALL dr_hook('MODE_THERMO:DQSATI_O_DT_1D',1,zhook_handle)
1884END FUNCTION dqsati_o_dt_1d
1885!
1886!-------------------------------------------------------------------------------
1887!-------------------------------------------------------------------------------
1888! ##############################################################
1889 FUNCTION dqsati_o_dt_3d(PT,PP,PQSAT) RESULT(PDQSAT)
1890! ##############################################################
1891!
1892!!**** *QSATW * - function to compute saturation vapor humidity from
1893!! temperature (with respect to ice)
1894!!
1895!! PURPOSE
1896!! -------
1897! The purpose of this function is to compute the saturation vapor
1898! pressure from temperature
1899!
1900!
1901!!** METHOD
1902!! ------
1903!! Given temperature T (PT), the saturation vapor pressure es(T)
1904!! (FOES(PT)) is computed by integration of the Clapeyron equation
1905!! from the triple point temperature Tt (XTT) and the saturation vapor
1906!! pressure of the triple point es(Tt) (XESTT), i.e
1907!!
1908!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
1909!!
1910!! with :
1911!! alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
1912!! betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
1913!! gammaw (XGAMW) = (Cl -Cpv) /Rv
1914!!
1915!! Then, the specific humidity at saturation is deduced.
1916!!
1917!! Finally, dqsat / dT (T) is computed.
1918!!
1919!!
1920!! EXTERNAL
1921!! --------
1922!! NONE
1923!!
1924!! IMPLICIT ARGUMENTS
1925!! ------------------
1926!! Module MODD_CST : comtains physical constants
1927!! XALPW : Constant for saturation vapor pressure function
1928!! XBETAW : Constant for saturation vapor pressure function
1929!! XGAMW : Constant for saturation vapor pressure function
1930!!
1931!! REFERENCE
1932!! ---------
1933!! Book2 of documentation of Meso-NH
1934!!
1935!!
1936!! AUTHOR
1937!! ------
1938!! V. Masson * Meteo France *
1939!!
1940!! MODIFICATIONS
1941!! -------------
1942!! Original 21/09/98
1943!-------------------------------------------------------------------------------
1944!
1945!* 0. DECLARATIONS
1946! ------------
1947!
1948USE modd_cst, ONLY: xbetai, xgami, xrd, xrv
1949!
1950IMPLICIT NONE
1951!
1952!* 0.1 Declarations of arguments and results
1953!
1954!
1955REAL, DIMENSION(:,:,:), INTENT(IN) :: pt ! Temperature
1956 ! (Kelvin)
1957REAL, DIMENSION(:,:,:), INTENT(IN) :: pp ! Pressure
1958 ! (Pa)
1959REAL, DIMENSION(:,:,:), INTENT(IN) :: pqsat ! saturation vapor
1960 ! specific humidity
1961 ! with respect to
1962 ! water (kg/kg))
1963REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: pdqsat ! derivative according
1964 ! to temperature of
1965 ! saturation vapor
1966 ! specific humidity
1967 ! with respect to
1968 ! water (kg/kg))
1969!
1970!* 0.2 Declarations of local variables
1971!
1972REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: zfoes ! saturation vapor
1973 ! pressure
1974 ! (Pascal)
1975!
1976!-------------------------------------------------------------------------------
1977!
1978!
1979!* 1. COMPUTE SATURATION VAPOR PRESSURE
1980! ---------------------------------
1981!
1982zfoes(:,:,:) = pp(:,:,:) / (1.+xrd/xrv*(1./pqsat(:,:,:)-1.))
1983!
1984!* 3. DERIVATION ACCORDING TO TEMPERATURE
1985! -----------------------------------
1986!
1987pdqsat(:,:,:) = pqsat(:,:,:) / (1.+(xrd/xrv-1.)*zfoes(:,:,:)/pp(:,:,:) ) &
1988 * (xbetai/pt(:,:,:)**2 - xgami/pt(:,:,:))
1989!
1990!-------------------------------------------------------------------------------
1991!
1992END FUNCTION dqsati_o_dt_3d
1993!
1994!-------------------------------------------------------------------------------
1995!-------------------------------------------------------------------------------
1996!
1997! ######################################
1998 FUNCTION qsati_3d(PT,PP) RESULT(PQSAT)
1999! ######################################
2000!
2001!!**** *QSATI * - function to compute saturation vapor humidity from
2002!! temperature
2003!!
2004!! PURPOSE
2005!! -------
2006! The purpose of this function is to compute the saturation vapor
2007! pressure from temperature
2008!
2009!
2010!!** METHOD
2011!! ------
2012!! Given temperature T (PT), the saturation vapor pressure es(T)
2013!! (FOES(PT)) is computed by integration of the Clapeyron equation
2014!! from the triple point temperature Tt (XTT) and the saturation vapor
2015!! pressure of the triple point es(Tt) (XESTT), i.e
2016!!
2017!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
2018!!
2019!! with :
2020!! alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
2021!! betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
2022!! gammaw (XGAMI) = (Cl -Cpv) /Rv
2023!!
2024!! Then, the specific humidity at saturation is deduced.
2025!!
2026!!
2027!! EXTERNAL
2028!! --------
2029!! NONE
2030!!
2031!! IMPLICIT ARGUMENTS
2032!! ------------------
2033!! Module MODD_CST : comtains physical constants
2034!! XALPI : Constant for saturation vapor pressure function
2035!! XBETAI : Constant for saturation vapor pressure function
2036!! XGAMI : Constant for saturation vapor pressure function
2037!!
2038!! REFERENCE
2039!! ---------
2040!! Book2 of documentation of Meso-NH
2041!!
2042!!
2043!! AUTHOR
2044!! ------
2045!! V. Masson * Meteo France *
2046!!
2047!! MODIFICATIONS
2048!! -------------
2049!! Original 21/09/98
2050!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
2051!-------------------------------------------------------------------------------
2052!
2053!* 0. DECLARATIONS
2054! ------------
2055!
2056USE modd_cst, ONLY: xalpi, xbetai, xgami, xrd, xrv
2057!
2058IMPLICIT NONE
2059!
2060!* 0.1 Declarations of arguments and results
2061!
2062!
2063REAL, DIMENSION(:,:,:), INTENT(IN) :: pt ! Temperature
2064 ! (Kelvin)
2065REAL, DIMENSION(:,:,:), INTENT(IN) :: pp ! Pressure
2066 ! (Pa)
2067REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: pqsat ! saturation vapor
2068 ! specific humidity
2069 ! with respect to
2070 ! water (kg/kg)
2071!
2072!* 0.2 Declarations of local variables
2073!
2074REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2),SIZE(PT,3)) :: zfoes ! saturation vapor
2075 ! pressure
2076 ! (Pascal)
2077!
2078!-------------------------------------------------------------------------------
2079!
2080!* 1. COMPUTE SATURATION VAPOR PRESSURE
2081! ---------------------------------
2082!
2083REAL(kind=jphook) :: zhook_handle
2084IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_3D',0,zhook_handle)
2085zfoes(:,:,:) = min(exp( xalpi - xbetai/pt(:,:,:) - xgami*log(pt(:,:,:)) ), 0.99*pp(:,:,:))
2086!
2087!* 2. COMPUTE SATURATION HUMIDITY
2088! ---------------------------
2089!
2090pqsat(:,:,:) = xrd/xrv*zfoes(:,:,:)/pp(:,:,:) &
2091 / (1.+(xrd/xrv-1.)*zfoes(:,:,:)/pp(:,:,:))
2092!-------------------------------------------------------------------------------
2093!
2094IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_3D',1,zhook_handle)
2095END FUNCTION qsati_3d
2096!
2097!-------------------------------------------------------------------------------
2098!
2099! ######################################
2100 FUNCTION qsati_2d(PT,PP) RESULT(PQSAT)
2101! ######################################
2102!
2103!!**** *QSATI * - function to compute saturation vapor humidity from
2104!! temperature
2105!!
2106!! PURPOSE
2107!! -------
2108! The purpose of this function is to compute the saturation vapor
2109! pressure from temperature
2110!
2111!
2112!!** METHOD
2113!! ------
2114!! Given temperature T (PT), the saturation vapor pressure es(T)
2115!! (FOES(PT)) is computed by integration of the Clapeyron equation
2116!! from the triple point temperature Tt (XTT) and the saturation vapor
2117!! pressure of the triple point es(Tt) (XESTT), i.e
2118!!
2119!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
2120!!
2121!! with :
2122!! alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
2123!! betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
2124!! gammaw (XGAMI) = (Cl -Cpv) /Rv
2125!!
2126!! Then, the specific humidity at saturation is deduced.
2127!!
2128!!
2129!! EXTERNAL
2130!! --------
2131!! NONE
2132!!
2133!! IMPLICIT ARGUMENTS
2134!! ------------------
2135!! Module MODD_CST : comtains physical constants
2136!! XALPI : Constant for saturation vapor pressure function
2137!! XBETAI : Constant for saturation vapor pressure function
2138!! XGAMI : Constant for saturation vapor pressure function
2139!!
2140!! REFERENCE
2141!! ---------
2142!! Book2 of documentation of Meso-NH
2143!!
2144!!
2145!! AUTHOR
2146!! ------
2147!! V. Masson * Meteo France *
2148!!
2149!! MODIFICATIONS
2150!! -------------
2151!! Original 21/09/98
2152!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
2153!-------------------------------------------------------------------------------
2154!
2155!* 0. DECLARATIONS
2156! ------------
2157!
2158USE modd_cst, ONLY: xalpi, xbetai, xgami, xrd, xrv
2159!
2160IMPLICIT NONE
2161!
2162!* 0.1 Declarations of arguments and results
2163!
2164!
2165REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
2166 ! (Kelvin)
2167REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
2168 ! (Pa)
2169REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pqsat ! saturation vapor
2170 ! specific humidity
2171 ! with respect to
2172 ! water (kg/kg)
2173!
2174!* 0.2 Declarations of local variables
2175!
2176REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
2177 ! pressure
2178 ! (Pascal)
2179!
2180!-------------------------------------------------------------------------------
2181!
2182!* 1. COMPUTE SATURATION VAPOR PRESSURE
2183! ---------------------------------
2184!
2185REAL(kind=jphook) :: zhook_handle
2186IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_2D',0,zhook_handle)
2187zfoes(:,:) = min(exp( xalpi - xbetai/pt(:,:) - xgami*log(pt(:,:)) ), 0.99*pp(:,:))
2188!
2189!* 2. COMPUTE SATURATION HUMIDITY
2190! ---------------------------
2191!
2192pqsat(:,:) = xrd/xrv*zfoes(:,:)/pp(:,:) &
2193 / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:))
2194!-------------------------------------------------------------------------------
2195!
2196IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_2D',1,zhook_handle)
2197END FUNCTION qsati_2d
2198!
2199!-------------------------------------------------------------------------------
2200!
2201! #################################################
2202 FUNCTION qsati_2d_mask(OMASK,PT,PP) RESULT(PQSAT)
2203! #################################################
2204!
2205!!**** *QSATI * - function to compute saturation vapor humidity from
2206!! temperature
2207!!
2208!! PURPOSE
2209!! -------
2210! The purpose of this function is to compute the saturation vapor
2211! pressure from temperature
2212!
2213!
2214!!** METHOD
2215!! ------
2216!! Given temperature T (PT), the saturation vapor pressure es(T)
2217!! (FOES(PT)) is computed by integration of the Clapeyron equation
2218!! from the triple point temperature Tt (XTT) and the saturation vapor
2219!! pressure of the triple point es(Tt) (XESTT), i.e
2220!!
2221!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
2222!!
2223!! with :
2224!! alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
2225!! betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
2226!! gammaw (XGAMI) = (Cl -Cpv) /Rv
2227!!
2228!! Then, the specific humidity at saturation is deduced.
2229!!
2230!!
2231!! EXTERNAL
2232!! --------
2233!! NONE
2234!!
2235!! IMPLICIT ARGUMENTS
2236!! ------------------
2237!! Module MODD_CST : comtains physical constants
2238!! XALPI : Constant for saturation vapor pressure function
2239!! XBETAI : Constant for saturation vapor pressure function
2240!! XGAMI : Constant for saturation vapor pressure function
2241!!
2242!! REFERENCE
2243!! ---------
2244!! Book2 of documentation of Meso-NH
2245!!
2246!!
2247!! AUTHOR
2248!! ------
2249!! V. Masson * Meteo France *
2250!!
2251!! MODIFICATIONS
2252!! -------------
2253!! Original 21/09/98
2254!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
2255!-------------------------------------------------------------------------------
2256!
2257!* 0. DECLARATIONS
2258! ------------
2259!
2260USE modd_cst, ONLY: xalpi, xbetai, xgami, xrd, xrv
2261!
2262IMPLICIT NONE
2263!
2264!* 0.1 Declarations of arguments and results
2265!
2266!
2267LOGICAL, DIMENSION(:,:), INTENT(IN) :: omask ! Localization mask
2268REAL, DIMENSION(:,:), INTENT(IN) :: pt ! Temperature
2269 ! (Kelvin)
2270REAL, DIMENSION(:,:), INTENT(IN) :: pp ! Pressure
2271 ! (Pa)
2272REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: pqsat ! saturation vapor
2273 ! specific humidity
2274 ! with respect to
2275 ! water (kg/kg)
2276!
2277!* 0.2 Declarations of local variables
2278!
2279REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2)) :: zfoes ! saturation vapor
2280 ! pressure
2281 ! (Pascal)
2282!
2283!-------------------------------------------------------------------------------
2284!
2285REAL(kind=jphook) :: zhook_handle
2286IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_2D_MASK',0,zhook_handle)
2287WHERE (omask(:,:))
2288!
2289!* 1. COMPUTE SATURATION VAPOR PRESSURE
2290! ---------------------------------
2291!
2292 zfoes(:,:) = min(exp( xalpi - xbetai/pt(:,:) - xgami*log(pt(:,:)) ), 0.99*pp(:,:))
2293!
2294!* 2. COMPUTE SATURATION HUMIDITY
2295! ---------------------------
2296!
2297 pqsat(:,:) = xrd/xrv*zfoes(:,:)/pp(:,:) &
2298 / (1.+(xrd/xrv-1.)*zfoes(:,:)/pp(:,:))
2299ELSEWHERE
2300!
2301!* 3. BOGUS VALUE
2302! -----------
2303!
2304 pqsat(:,:) = 0.
2305END WHERE
2306!-------------------------------------------------------------------------------
2307!
2308IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_2D_MASK',1,zhook_handle)
2309END FUNCTION qsati_2d_mask
2310!
2311!-------------------------------------------------------------------------------
2312!
2313! ######################################
2314 FUNCTION qsati_1d(PT,PP) RESULT(PQSAT)
2315! ######################################
2316!
2317!!**** *QSATI * - function to compute saturation vapor humidity from
2318!! temperature
2319!!
2320!! PURPOSE
2321!! -------
2322! The purpose of this function is to compute the saturation vapor
2323! pressure from temperature
2324!
2325!
2326!!** METHOD
2327!! ------
2328!! Given temperature T (PT), the saturation vapor pressure es(T)
2329!! (FOES(PT)) is computed by integration of the Clapeyron equation
2330!! from the triple point temperature Tt (XTT) and the saturation vapor
2331!! pressure of the triple point es(Tt) (XESTT), i.e
2332!!
2333!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
2334!!
2335!! with :
2336!! alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
2337!! betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
2338!! gammaw (XGAMI) = (Cl -Cpv) /Rv
2339!!
2340!! Then, the specific humidity at saturation is deduced.
2341!!
2342!!
2343!! EXTERNAL
2344!! --------
2345!! NONE
2346!!
2347!! IMPLICIT ARGUMENTS
2348!! ------------------
2349!! Module MODD_CST : comtains physical constants
2350!! XALPI : Constant for saturation vapor pressure function
2351!! XBETAI : Constant for saturation vapor pressure function
2352!! XGAMI : Constant for saturation vapor pressure function
2353!!
2354!! REFERENCE
2355!! ---------
2356!! Book2 of documentation of Meso-NH
2357!!
2358!!
2359!! AUTHOR
2360!! ------
2361!! V. Masson * Meteo France *
2362!!
2363!! MODIFICATIONS
2364!! -------------
2365!! Original 21/09/98
2366!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
2367!-------------------------------------------------------------------------------
2368!
2369!* 0. DECLARATIONS
2370! ------------
2371!
2372USE modd_cst, ONLY: xalpi, xbetai, xgami, xrd, xrv
2373!
2374IMPLICIT NONE
2375!
2376!* 0.1 Declarations of arguments and results
2377!
2378!
2379REAL, DIMENSION(:), INTENT(IN) :: pt ! Temperature
2380 ! (Kelvin)
2381REAL, DIMENSION(:), INTENT(IN) :: pp ! Pressure
2382 ! (Pa)
2383REAL, DIMENSION(SIZE(PT,1)) :: pqsat ! saturation vapor
2384 ! specific humidity
2385 ! with respect to
2386 ! water (kg/kg)
2387!
2388!* 0.2 Declarations of local variables
2389!
2390REAL, DIMENSION(SIZE(PT,1)) :: zfoes ! saturation vapor
2391 ! pressure
2392 ! (Pascal)
2393!
2394!-------------------------------------------------------------------------------
2395!
2396!* 1. COMPUTE SATURATION VAPOR PRESSURE
2397! ---------------------------------
2398!
2399REAL(kind=jphook) :: zhook_handle
2400IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_1D',0,zhook_handle)
2401zfoes(:) = min(exp( xalpi - xbetai/pt(:) - xgami*log(pt(:)) ), 0.99*pp(:))
2402!
2403!* 2. COMPUTE SATURATION HUMIDITY
2404! ---------------------------
2405!
2406pqsat(:) = xrd/xrv*zfoes(:)/pp(:) &
2407 / (1.+(xrd/xrv-1.)*zfoes(:)/pp(:))
2408!-------------------------------------------------------------------------------
2409!
2410IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_1D',1,zhook_handle)
2411END FUNCTION qsati_1d
2412!
2413!-------------------------------------------------------------------------------
2414!
2415! ######################################
2416 FUNCTION qsati_0d(PT,PP) RESULT(PQSAT)
2417! ######################################
2418!
2419!!**** *QSATI * - function to compute saturation vapor humidity from
2420!! temperature
2421!!
2422!! PURPOSE
2423!! -------
2424! The purpose of this function is to compute the saturation vapor
2425! pressure from temperature
2426!
2427!
2428!!** METHOD
2429!! ------
2430!! Given temperature T (PT), the saturation vapor pressure es(T)
2431!! (FOES(PT)) is computed by integration of the Clapeyron equation
2432!! from the triple point temperature Tt (XTT) and the saturation vapor
2433!! pressure of the triple point es(Tt) (XESTT), i.e
2434!!
2435!! es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
2436!!
2437!! with :
2438!! alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt)
2439!! betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
2440!! gammaw (XGAMI) = (Cl -Cpv) /Rv
2441!!
2442!! Then, the specific humidity at saturation is deduced.
2443!!
2444!!
2445!! EXTERNAL
2446!! --------
2447!! NONE
2448!!
2449!! IMPLICIT ARGUMENTS
2450!! ------------------
2451!! Module MODD_CST : comtains physical constants
2452!! XALPI : Constant for saturation vapor pressure function
2453!! XBETAI : Constant for saturation vapor pressure function
2454!! XGAMI : Constant for saturation vapor pressure function
2455!!
2456!! REFERENCE
2457!! ---------
2458!! Book2 of documentation of Meso-NH
2459!!
2460!!
2461!! AUTHOR
2462!! ------
2463!! V. Masson * Meteo France *
2464!!
2465!! MODIFICATIONS
2466!! -------------
2467!! Original 21/09/98
2468!! S. Riette april 2011 : protection in high statosphere where ZFOES > PP
2469!-------------------------------------------------------------------------------
2470!
2471!* 0. DECLARATIONS
2472! ------------
2473!
2474USE modd_cst, ONLY: xalpi, xbetai, xgami, xrd, xrv
2475!
2476IMPLICIT NONE
2477!
2478!* 0.1 Declarations of arguments and results
2479!
2480!
2481REAL, INTENT(IN) :: pt ! Temperature
2482 ! (Kelvin)
2483REAL, INTENT(IN) :: pp ! Pressure
2484 ! (Pa)
2485REAL :: pqsat ! saturation vapor
2486 ! specific humidity
2487 ! with respect to
2488 ! water (kg/kg)
2489!
2490!* 0.2 Declarations of local variables
2491!
2492REAL :: zfoes ! saturation vapor
2493 ! pressure
2494 ! (Pascal)
2495!
2496!-------------------------------------------------------------------------------
2497!
2498!* 1. COMPUTE SATURATION VAPOR PRESSURE
2499! ---------------------------------
2500!
2501REAL(kind=jphook) :: zhook_handle
2502IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_0D',0,zhook_handle)
2503zfoes = min(exp( xalpi - xbetai/pt - xgami*log(pt) ), 0.99*pp)
2504!
2505!* 2. COMPUTE SATURATION HUMIDITY
2506! ---------------------------
2507!
2508pqsat = xrd/xrv*zfoes/pp / (1.+(xrd/xrv-1.)*zfoes/pp)
2509!-------------------------------------------------------------------------------
2510!
2511IF (lhook) CALL dr_hook('MODE_THERMO:QSATI_0D',1,zhook_handle)
2512END FUNCTION qsati_0d
2513!
2514!-------------------------------------------------------------------------------
2515END MODULE mode_thermo
real, pointer xeps_dt
Definition modd_cst.F90:184
real, pointer xgamw
Definition modd_cst.F90:163
real, pointer xalpi
Definition modd_cst.F90:164
real, pointer xrv
Definition modd_cst.F90:153
real, pointer xbetaw
Definition modd_cst.F90:163
real, pointer xalpw
Definition modd_cst.F90:163
real, pointer xbetai
Definition modd_cst.F90:164
real, pointer xgami
Definition modd_cst.F90:164
real, pointer xrd
Definition modd_cst.F90:153
integer, parameter nverb_fatal
Definition modd_io.F90:6