PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_compute_function_thermo.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1994-2021 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!-----------------------------------------------------------------
7
8!$ACDC singlecolumn
9
10IMPLICIT NONE
11CONTAINS
12SUBROUTINE compute_function_thermo (D, CST, PALP, PBETA, PGAM, PLTT, PC, PT, PEXN, PCP, &
13 & PLOCPEXN, PAMOIST, PATHETA, PRT, PPABST, KRR)
14 ! ########################################################################
15 !!
16 !!**** *COMPUTE_FUNCTION_THERMO* routine to compute several thermo functions
17 !
18 !! AUTHOR
19 !! ------
20 !!
21 !! JP Pinty *LA*
22 !!
23 !! MODIFICATIONS
24 !! -------------
25 !! Original 24/02/03
26 !!
27 !-------------------------------------------------------------------------------
28 !
29 !* 0. DECLARATIONS
30 ! ------------
31 !
32 USE yomhook, ONLY: lhook, dr_hook, jphook
33 USE modd_cst, ONLY: cst_t
34 USE modd_dimphyex, ONLY: dimphyex_t
35 ! These macro are handled by pft_tool.py --craybyPassDOCONCURRENT applied on Cray Rules
36#ifdef MNH_COMPILER_CCE
37 !$mnh_undef(LOOP)
38 !$mnh_undef(OPENACC)
39#endif
40 !
41 IMPLICIT NONE
42 !
43 !* 0.1 Declarations of dummy arguments
44 !
45 TYPE(dimphyex_t), INTENT(IN) :: D ! PHYEX variables dimensions structure
46 INTEGER, INTENT(IN) :: KRR
47 REAL, INTENT(IN) :: PALP, PBETA, PGAM, PLTT, PC
48 REAL, INTENT(IN), DIMENSION(D%NIJT, D%NKT) :: PT, PEXN, PCP
49 !
50 REAL, INTENT(OUT), DIMENSION(D%NIJT, D%NKT) :: PLOCPEXN
51 REAL, INTENT(OUT), DIMENSION(D%NIJT, D%NKT) :: PAMOIST, PATHETA
52 REAL, INTENT(INOUT) :: PRT(D%NIJT, D%NKT, KRR)
53 TYPE(cst_t), INTENT(IN) :: CST
54 REAL, INTENT(IN) :: PPABST(D%NIJT, D%NKT)
55
56 REAL :: ZDRVSATDT(D%NIJT, D%NKT)
57 REAL :: ZRVSAT(D%NIJT, D%NKT)
58 REAL :: ZEPS
59 REAL(KIND=jphook) :: zhook_handle2
60 INTEGER :: JK, JIJ, IIJB, IIJE, IKT
61 !
62 !-------------------------------------------------------------------------------
63 !
64 IF (lhook) CALL dr_hook('TURB:COMPUTE_FUNCTION_THERMO', 0, zhook_handle2)
65
66 ikt = d%NKT
67 iije = d%NIJE
68 iijb = d%NIJB
69 zeps = cst%XMV / cst%XMD
70 !
71 !* 1.1 Lv/Cph at t
72 !
73 ! present(ZRVSAT,ZDRVSATDT) ! present(PLOCPEXN) ! present(ZDRVSATDT)
74!$acc kernels present_crm( PLOCPEXN )
75!$mnh_expand_array( JIJ=IIJB:IIJE,JK=1:IKT )
76 plocpexn(iijb:iije, 1:ikt) = (pltt + (cst%XCPV - pc)*(pt(iijb:iije, 1:ikt) - cst%XTT)) / pcp(iijb:iije, 1:ikt)
77!$mnh_end_expand_array ( JIJ=IIJB:IIJE,JK=1:IKT )
78!$acc end kernels
79 !
80!$acc kernels present_cr( ZRVSAT,ZDRVSATDT )
81!$mnh_expand_array( JIJ=IIJB:IIJE,JK=1:IKT )
82 !* 1.2 Saturation vapor pressure at t
83 !
84 zrvsat(iijb:iije, 1:ikt) = exp(palp - pbeta / pt(iijb:iije, 1:ikt) - pgam*log(pt(iijb:iije, 1:ikt)))
85 !
86 !* 1.3 saturation mixing ratio at t
87 !
88 !YS Added protection (AROME 2024-03-12 crashs)
89 zrvsat(iijb:iije, 1:ikt) = zrvsat(iijb:iije, 1:ikt)*zeps / max(1.e-3, ppabst(iijb:iije, 1:ikt) - zrvsat(iijb:iije, 1:ikt))
90 !
91 !* 1.4 compute the saturation mixing ratio derivative (rvs')
92 !
93 zdrvsatdt(iijb:iije, 1:ikt) = (pbeta / pt(iijb:iije, 1:ikt) - pgam) / pt(iijb:iije, 1:ikt)*zrvsat(iijb:iije, 1:ikt)*(1. + &
94 & zrvsat(iijb:iije, 1:ikt) / zeps)
95 !
96 !* 1.5 compute Amoist
97 !
98 pamoist(iijb:iije, 1:ikt) = 0.5 / (1.0 + zdrvsatdt(iijb:iije, 1:ikt)*plocpexn(iijb:iije, 1:ikt))
99!$mnh_end_expand_array ( JIJ=IIJB:IIJE,JK=1:IKT )
100!$acc end kernels
101 !
102 !* 1.6 compute Atheta
103 !
104!$acc kernels
105!$mnh_expand_array( JIJ=IIJB:IIJE,JK=1:IKT )
106 patheta(iijb:iije, 1:ikt) = pamoist(iijb:iije, 1:ikt)*pexn(iijb:iije, 1:ikt)*((zrvsat(iijb:iije, 1:ikt) &
107 & - prt(iijb:iije, 1:ikt, 1))*plocpexn(iijb:iije, 1:ikt) / (1. + zdrvsatdt(iijb:iije, 1:ikt)*&
108 & plocpexn(iijb:iije, 1:ikt))*(zrvsat(iijb:iije, 1:ikt)*(1. + zrvsat(iijb:iije, 1:ikt) / zeps)*&
109 & (-2.*pbeta / pt(iijb:iije, 1:ikt) + pgam) / pt(iijb:iije, 1:ikt)**2 + &
110 & zdrvsatdt(iijb:iije, 1:ikt)*(1. + 2.*zrvsat(iijb:iije, 1:ikt) / zeps)*(pbeta / pt(iijb:iije, 1:ikt) - pgam) / &
111 & pt(iijb:iije,1:ikt)) - zdrvsatdt(iijb:iije, 1:ikt))
112!$mnh_end_expand_array ( JIJ=IIJB:IIJE,JK=1:IKT )
113!$acc end kernels
114 !
115 !* 1.7 Lv/Cph/Exner at t-1
116 !
117!$acc kernels
118!$mnh_expand_array( JIJ=IIJB:IIJE,JK=1:IKT )
119 plocpexn(iijb:iije, 1:ikt) = plocpexn(iijb:iije, 1:ikt) / pexn(iijb:iije, 1:ikt)
120!$mnh_end_expand_array ( JIJ=IIJB:IIJE,JK=1:IKT )
121!$acc end kernels
122 !
123 IF (lhook) CALL dr_hook('TURB:COMPUTE_FUNCTION_THERMO', 1, zhook_handle2)
124 END SUBROUTINE compute_function_thermo
126
127
subroutine compute_function_thermo(d, cst, palp, pbeta, pgam, pltt, pc, pt, pexn, pcp, plocpexn, pamoist, patheta, prt, ppabst, krr)