GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/rrtm/sucst.F90 Lines: 156 156 100.0 %
Date: 2023-06-30 12:51:15 Branches: 26 36 72.2 %

Line Branch Exec Source
1
1
SUBROUTINE SUCST(KULOUT,KDAT,KSSS,KPRINTLEV)
2
3
!**** *SUCST * - Routine to initialize the constants of the model.
4
5
!     Purpose.
6
!     --------
7
!           Initialize and print the common YOMCST + initialize
8
!         date and time of YOMRIP.
9
10
!**   Interface.
11
!     ----------
12
!        *CALL* *SUCST (..)
13
14
!        Explicit arguments :
15
!        --------------------
16
17
!        KULOUT  - logical unit for the output
18
!        KDAT    - date in the form AAAAMMDD
19
!        KSSS    - number of seconds in the day
20
!        KPRINTLEV - printing level
21
22
!        Implicit arguments :
23
!        --------------------
24
!        COMMON YOMCST
25
!        COMMON YOMRIP
26
27
!     Method.
28
!     -------
29
!        See documentation
30
31
!     Externals.
32
!     ----------
33
34
!     Reference.
35
!     ----------
36
!        ECMWF Research Department documentation of the IFS
37
38
!     Author.
39
!     -------
40
!        Mats Hamrud and Philippe Courtier  *ECMWF*
41
42
!     Modifications.
43
!     --------------
44
!        Original : 87-10-15
45
!        Additions : 90-07-30 (J.-F. Geleyn)
46
!                    91-11-15 (M. Deque)
47
!                    96-08-12 M.Hamrud - Reduce printing
48
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
49
!     ------------------------------------------------------------------
50
51
USE PARKIND1  ,ONLY : JPIM     ,JPRB
52
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
53
54
USE YOMCST   , ONLY : RPI      ,RCLUM    ,RHPLA    ,RKBOL    ,&
55
 & RNAVO    ,RDAY     ,REA      ,REPSM    ,RSIYEA   ,&
56
 & RSIDAY   ,ROMEGA   ,RA       ,RG       ,R1SA     ,&
57
 & RSIGMA   ,RI0      ,R        ,RMD      ,RMV      ,&
58
 & RMO3     ,RD       ,RV       ,RCPD     ,RCPV     ,&
59
 & RMCO2    ,RMCH4    ,RMN2O    ,RMCO     ,RMHCHO   ,&
60
 & RMSO2    ,RMNO2    ,RMSF6    ,RMRA     ,&
61
 & RCVD     ,RCVV     ,RKAPPA   ,RETV     ,RCW      ,&
62
 & RCS      ,RLVTT    ,RLSTT    ,RLVZER   ,RLSZER   ,&
63
 & RLMLT    ,RTT      ,RATM     ,RDT      ,RESTT    ,&
64
 & RALPW    ,RBETW    ,RGAMW    ,RALPS    ,RBETS    ,&
65
 & RGAMS    ,RALPD    ,RBETD    ,RGAMD
66
USE YOMRIP   , ONLY : RTIMST   ,RTIMTR
67
68
IMPLICIT NONE
69
70
INTEGER(KIND=JPIM),INTENT(IN)    :: KULOUT
71
INTEGER(KIND=JPIM),INTENT(IN)    :: KDAT
72
INTEGER(KIND=JPIM),INTENT(IN)    :: KSSS
73
INTEGER(KIND=JPIM),INTENT(IN)    :: KPRINTLEV
74
INTEGER(KIND=JPIM) :: IA, ID, IDAT, IM, ISSS, J
75
76
REAL(KIND=JPRB) :: ZDE, ZET, ZJU, ZRS, ZRSREL, ZTETA, ZTI
77
REAL(KIND=JPRB) :: ZHOOK_HANDLE
78
79
#include "fctast.h"
80
#include "fcttrm.h"
81
#include "fcttim.h"
82
!      -----------------------------------------------------------------
83
84
!*       1.    DEFINE FUNDAMENTAL CONSTANTS.
85
!              -----------------------------
86
87
1
print*,'DANS SUCST CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'
88
1
IF (LHOOK) CALL DR_HOOK('SUCST',0,ZHOOK_HANDLE)
89
1
RPI=2.0_JPRB*ASIN(1.0_JPRB)
90
1
RCLUM=299792458._JPRB
91
1
RHPLA=6.6260755E-34_JPRB
92
1
RKBOL=1.380658E-23_JPRB
93
1
RNAVO=6.0221367E+23_JPRB
94
95
!     ------------------------------------------------------------------
96
97
!*       2.    DEFINE ASTRONOMICAL CONSTANTS.
98
!              ------------------------------
99
100
1
RDAY=86400._JPRB
101
1
REA=149597870000._JPRB
102
1
REPSM=0.409093_JPRB
103
104
1
RSIYEA=365.25_JPRB*RDAY*2.0_JPRB*RPI/6.283076_JPRB
105
1
RSIDAY=RDAY/(1.0_JPRB+RDAY/RSIYEA)
106
1
ROMEGA=2.0_JPRB*RPI/RSIDAY
107
108
1
IDAT=KDAT
109
1
ISSS=KSSS
110
1
ID=NDD(IDAT)
111
1
IM=NMM(IDAT)
112
1
IA=NCCAA(IDAT)
113
1
ZJU=RJUDAT(IA,IM,ID)
114
1
ZTI=RTIME(IA,IM,ID,ISSS)
115
1
RTIMST=ZTI
116
1
RTIMTR=ZTI
117
1
ZTETA=RTETA(ZTI)
118
1
ZRS=RRS(ZTETA)
119
1
ZDE=RDS(ZTETA)
120
1
ZET=RET(ZTETA)
121
1
ZRSREL=ZRS/REA
122
123
!     ------------------------------------------------------------------
124
125
!*       3.    DEFINE GEOIDE.
126
!              --------------
127
128
1
RG=9.80665_JPRB
129
1
RA=6371229._JPRB
130
1
R1SA=REAL(1.0_JPRB/REAL(RA,KIND(1.0_JPRB)),KIND(R1SA))
131
132
!     ------------------------------------------------------------------
133
134
!*       4.    DEFINE RADIATION CONSTANTS.
135
!              ---------------------------
136
137
1
RSIGMA=2.0_JPRB * RPI**5 * RKBOL**4 /(15._JPRB* RCLUM**2 * RHPLA**3)
138
1
RI0=1370._JPRB
139
140
!     ------------------------------------------------------------------
141
142
!*       5.    DEFINE THERMODYNAMIC CONSTANTS, GAS PHASE.
143
!              ------------------------------------------
144
145
1
R=RNAVO*RKBOL
146
1
RMD=28.9644_JPRB
147
1
RMV=18.0153_JPRB
148
1
RMO3=47.9942_JPRB
149
1
RD=1000._JPRB*R/RMD
150
1
RV=1000._JPRB*R/RMV
151
1
RCPD=3.5_JPRB*RD
152
1
RCVD=RCPD-RD
153
1
RCPV=4._JPRB *RV
154
1
RCVV=RCPV-RV
155
1
RKAPPA=RD/RCPD
156
1
RETV=RV/RD-1.0_JPRB
157
1
RMCO2=44.0095_JPRB
158
1
RMCH4=16.04_JPRB
159
1
RMN2O=44.013_JPRB
160
1
RMSF6=146.05_JPRB
161
1
RMRA=222._JPRB
162
1
RMCO=28.01_JPRB
163
1
RMHCHO=30.03_JPRB
164
1
RMNO2=46.01_JPRB
165
1
RMSO2=64.07_JPRB
166
167
!     ------------------------------------------------------------------
168
169
!*       6.    DEFINE THERMODYNAMIC CONSTANTS, LIQUID PHASE.
170
!              ---------------------------------------------
171
172
1
RCW=4218._JPRB
173
174
!     ------------------------------------------------------------------
175
176
!*       7.    DEFINE THERMODYNAMIC CONSTANTS, SOLID PHASE.
177
!              --------------------------------------------
178
179
1
RCS=2106._JPRB
180
181
!     ------------------------------------------------------------------
182
183
!*       8.    DEFINE THERMODYNAMIC CONSTANTS, TRANSITION OF PHASE.
184
!              ----------------------------------------------------
185
186
1
RTT=273.16_JPRB
187
1
RDT=11.82_JPRB
188
1
RLVTT=2.5008E+6_JPRB
189
1
RLSTT=2.8345E+6_JPRB
190
1
RLVZER=RLVTT+RTT*(RCW-RCPV)
191
1
RLSZER=RLSTT+RTT*(RCS-RCPV)
192
1
RLMLT=RLSTT-RLVTT
193
1
RATM=100000._JPRB
194
195
!     ------------------------------------------------------------------
196
197
!*       9.    SATURATED VAPOUR PRESSURE.
198
!              --------------------------
199
200
1
RESTT=611.14_JPRB
201
1
RGAMW=(RCW-RCPV)/RV
202
1
RBETW=RLVTT/RV+RGAMW*RTT
203
1
RALPW=LOG(RESTT)+RBETW/RTT+RGAMW*LOG(RTT)
204
1
print *,'SUCST: RESTT,RBETW,RTT,RGAMW',RESTT,RBETW,RTT,RGAMW
205
1
print *,'SUCST: RALPW',RALPW
206
1
RGAMS=(RCS-RCPV)/RV
207
1
RBETS=RLSTT/RV+RGAMS*RTT
208
1
RALPS=LOG(RESTT)+RBETS/RTT+RGAMS*LOG(RTT)
209
1
print *,'SUCST: RESTT,RBETS,RTT,RGAMS',RESTT,RBETS,RTT,RGAMS
210
1
print *,'SUCST: RALPS',RALPS
211
1
RGAMS=(RCS-RCPV)/RV
212
1
RGAMD=RGAMS-RGAMW
213
1
RBETD=RBETS-RBETW
214
1
RALPD=RALPS-RALPW
215
216
!     ------------------------------------------------------------------
217
218
!*      10.    PRINTS
219
220
1
print*,'KPRINTLEV ',KPRINTLEV
221
1
print*,'KULOUT ',KULOUT
222
223
1
IF (KPRINTLEV >= 1) THEN
224
1
  WRITE(KULOUT,'(''0*** Constants of the ICM   ***'')')
225
1
  WRITE(KULOUT,'('' *** Fundamental constants ***'')')
226
1
  WRITE(KULOUT,'(''           PI = '',E13.7,'' -'')')RPI
227
1
  WRITE(KULOUT,'(''            c = '',E13.7,''m s-1'')')RCLUM
228
1
  WRITE(KULOUT,'(''            h = '',E13.7,''J s'')')RHPLA
229
1
  WRITE(KULOUT,'(''            K = '',E13.7,''J K-1'')')RKBOL
230
1
  WRITE(KULOUT,'(''            N = '',E13.7,''mol-1'')')RNAVO
231
1
  WRITE(KULOUT,'('' *** Astronomical constants ***'')')
232
1
  WRITE(KULOUT,'(''          day = '',E13.7,'' s'')')RDAY
233
1
  WRITE(KULOUT,'('' half g. axis = '',E13.7,'' m'')')REA
234
1
  WRITE(KULOUT,'('' mean anomaly = '',E13.7,'' -'')')REPSM
235
1
  WRITE(KULOUT,'('' sideral year = '',E13.7,'' s'')')RSIYEA
236
1
  WRITE(KULOUT,'(''  sideral day = '',E13.7,'' s'')')RSIDAY
237
1
  WRITE(KULOUT,'(''        omega = '',E13.7,'' s-1'')')ROMEGA
238
239
1
  WRITE(KULOUT,'('' The initial date of the run is :'')')
240
1
  WRITE(KULOUT,'(1X,I8,1X,I5,5X,I4,1X,I2,1X,I2)')IDAT,ISSS,IA,IM,ID
241
1
  WRITE(KULOUT,'('' The Julian date is : '',F11.2)') ZJU
242
1
  WRITE(KULOUT,'('' Time of the model  : '',F15.2,'' s'')')ZTI
243
1
  WRITE(KULOUT,'('' Distance Earth-Sun : '',E13.7,'' m'')')ZRS
244
1
  WRITE(KULOUT,'('' Relative Dist. E-S : '',E13.7,'' m'')')ZRSREL
245
1
  WRITE(KULOUT,'('' Declination        : '',F12.5)') ZDE
246
1
  WRITE(KULOUT,'('' Eq. of time        : '',F12.5,'' s'')')ZET
247
1
  WRITE(KULOUT,'('' ***         Geoide         ***'')')
248
1
  WRITE(KULOUT,'(''      Gravity = '',E13.7,'' m s-2'')')RG
249
1
  WRITE(KULOUT,'('' Earth radius = '',E13.7,'' m'')')RA
250
1
  WRITE(KULOUT,'('' Inverse E.R. = '',E13.7,'' m'')')R1SA
251
1
  WRITE(KULOUT,'('' ***        Radiation       ***'')')
252
1
  WRITE(KULOUT,'('' Stefan-Bol.  = '',E13.7,'' W m-2 K-4'')')  RSIGMA
253
1
  WRITE(KULOUT,'('' Solar const. = '',E13.7,'' W m-2'')')RI0
254
1
  WRITE(KULOUT,'('' *** Thermodynamic, gas     ***'')')
255
1
  WRITE(KULOUT,'('' Perfect gas  = '',e13.7)') R
256
1
  WRITE(KULOUT,'('' Dry air mass = '',e13.7)') RMD
257
1
  WRITE(KULOUT,'('' Vapour  mass = '',e13.7)') RMV
258
1
  WRITE(KULOUT,'('' Ozone   mass = '',e13.7)') RMO3
259
1
  WRITE(KULOUT,'('' Dry air cst. = '',e13.7)') RD
260
1
  WRITE(KULOUT,'('' Vapour  cst. = '',e13.7)') RV
261
1
  WRITE(KULOUT,'(''         Cpd  = '',e13.7)') RCPD
262
1
  WRITE(KULOUT,'(''         Cvd  = '',e13.7)') RCVD
263
1
  WRITE(KULOUT,'(''         Cpv  = '',e13.7)') RCPV
264
1
  WRITE(KULOUT,'(''         Cvv  = '',e13.7)') RCVV
265
1
  WRITE(KULOUT,'(''      Rd/Cpd  = '',e13.7)') RKAPPA
266
1
  WRITE(KULOUT,'(''     Rv/Rd-1  = '',e13.7)') RETV
267
1
  WRITE(KULOUT,'('' *** Thermodynamic, liquid  ***'')')
268
1
  WRITE(KULOUT,'(''         Cw   = '',E13.7)') RCW
269
1
  WRITE(KULOUT,'('' *** thermodynamic, solid   ***'')')
270
1
  WRITE(KULOUT,'(''         Cs   = '',E13.7)') RCS
271
1
  WRITE(KULOUT,'('' *** Thermodynamic, trans.  ***'')')
272
1
  WRITE(KULOUT,'('' Fusion point  = '',E13.7)') RTT
273
1
  WRITE(KULOUT,'('' RTT-Tx(ew-ei) = '',E13.7)') RDT
274
1
  WRITE(KULOUT,'(''        RLvTt  = '',E13.7)') RLVTT
275
1
  WRITE(KULOUT,'(''        RLsTt  = '',E13.7)') RLSTT
276
1
  WRITE(KULOUT,'(''        RLv0   = '',E13.7)') RLVZER
277
1
  WRITE(KULOUT,'(''        RLs0   = '',E13.7)') RLSZER
278
1
  WRITE(KULOUT,'(''        RLMlt  = '',E13.7)') RLMLT
279
1
  WRITE(KULOUT,'('' Normal press. = '',E13.7)') RATM
280
1
  WRITE(KULOUT,'('' Latent heat :  '')')
281

10
  WRITE(KULOUT,'(10(1X,E10.4))') (10._JPRB*J,J=-4,4)
282

10
  WRITE(KULOUT,'(10(1X,E10.4))') (RLV(RTT+10._JPRB*J),J=-4,4)
283

10
  WRITE(KULOUT,'(10(1X,E10.4))') (RLS(RTT+10._JPRB*J),J=-4,4)
284
1
  WRITE(KULOUT,'('' *** Thermodynamic, satur.  ***'')')
285
1
  WRITE(KULOUT,'('' Fusion point = '',E13.7)') RTT
286
1
  WRITE(KULOUT,'(''      es(Tt)  = '',e13.7)') RESTT
287
1
  WRITE(KULOUT,'('' es(T) :  '')')
288

10
  WRITE(KULOUT,'(10(1X,E10.4))') (10._JPRB*J,J=-4,4)
289

10
  WRITE(KULOUT,'(10(1X,E10.4))') (ESW(RTT+10._JPRB*J),J=-4,4)
290

10
  WRITE(KULOUT,'(10(1X,E10.4))') (ESS(RTT+10._JPRB*J),J=-4,4)
291
!  call flush(0)       !!!!! A REVOIR (MPL) les 7 lignes qui suivent
292
10
   do j=1,9
293
9
     print*,'TEST J',j
294
9
     print*,'RTT...',RTT+10._JPRB*(J-5)
295
10
     print*,'ES(RTT...',ES(RTT+10._JPRB*(J-5))
296
   enddo
297
1
  call flush(0)
298
299

10
  WRITE(KULOUT,'(10(1X,E10.4))') (ES (RTT+10._JPRB*J),J=-4,4)
300
ENDIF
301
302
!     ------------------------------------------------------------------
303
304
1
IF (LHOOK) CALL DR_HOOK('SUCST',1,ZHOOK_HANDLE)
305
1
END SUBROUTINE SUCST
306