Newer
Older

RODIER Quentin
committed
!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
! ##################
MODULE MODI_SHUMAN_MF
! ##################
!
INTERFACE
!
FUNCTION DZF_MF(KKA,KKU,KKL,PA) RESULT(PDZF)
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at flux
! side
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PDZF ! result at mass
! localization
END FUNCTION DZF_MF
!
FUNCTION DZM_MF(KKA,KKU,KKL,PA) RESULT(PDZM)
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at mass
! localization
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PDZM ! result at flux
! side
END FUNCTION DZM_MF
!
FUNCTION MZF_MF(KKA,KKU,KKL,PA) RESULT(PMZF)
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at flux
! side
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PMZF ! result at mass
! localization
END FUNCTION MZF_MF
!
FUNCTION MZM_MF(KKA,KKU,KKL,PA) RESULT(PMZM)
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PMZM ! result at flux localization
END FUNCTION MZM_MF
!
FUNCTION GZ_M_W_MF(KKA,KKU,KKL,PY,PDZZ) RESULT(PGZ_M_W)
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PDZZ ! Metric coefficient d*zz
REAL, DIMENSION(:,:), INTENT(IN) :: PY ! variable at mass localization
REAL, DIMENSION(SIZE(PY,1),SIZE(PY,2)) :: PGZ_M_W ! result at flux side
END FUNCTION GZ_M_W_MF
!
END INTERFACE
!
END MODULE MODI_SHUMAN_MF
!
! ###############################
FUNCTION MZF_MF(KKA,KKU,KKL,PA) RESULT(PMZF)
! ###############################
!
!!**** *MZF* - SHUMAN_MF operator : mean operator in z direction for a
!! variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the z direction (K index) for a field PA localized at a z-flux
! point (w point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PMZF(:,:,k) is defined by 0.5*(PA(:,:,k)+PA(:,:,k+1))
!! At k=size(PA,3), PMZF(:,:,k) is defined by PA(:,:,k).
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN_MF operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! optimisation 20/08/00 J. Escobar
!! S. Riette, Jan 2012: Simplification and suppression of array overflow
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at flux
! side
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PMZF ! result at mass
! localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JK ! Loop index in z direction
!
!
!-------------------------------------------------------------------------------
!
!* 1. DEFINITION OF MZF
! ------------------
!
DO JK=2,SIZE(PA,2)-1
PMZF(:,JK) = 0.5*( PA(:,JK)+PA(:,JK+KKL) )
END DO
PMZF(:,KKA) = 0.5*( PA(:,KKA)+PA(:,KKA+KKL) )
PMZF(:,KKU) = PA(:,KKU)
!
!-------------------------------------------------------------------------------
!
END FUNCTION MZF_MF
! ###############################
FUNCTION MZM_MF(KKA,KKU,KKL,PA) RESULT(PMZM)
! ###############################
!
!!**** *MZM* - SHUMAN_MF operator : mean operator in z direction for a
!! mass variable
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a mean
! along the z direction (K index) for a field PA localized at a mass
! point. The result is localized at a z-flux point (w point).
!
!!** METHOD
!! ------
!! The result PMZM(:,:,k) is defined by 0.5*(PA(:,:,k)+PA(:,:,k-1))
!! At k=1, PMZM(:,:,1) is defined by PA(:,:,1).
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN_MF operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 04/07/94
!! optimisation 20/08/00 J. Escobar
!! S. Riette, Jan 2012: Simplification and suppression of array overflow
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at mass localization
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PMZM ! result at flux localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JK ! Loop index in z direction
!
!
!-------------------------------------------------------------------------------
!
!* 1. DEFINITION OF MZM
! ------------------
!
DO JK=2,SIZE(PA,2)-1
PMZM(:,JK) = 0.5*( PA(:,JK)+PA(:,JK-KKL) )
END DO
PMZM(:,KKA) = PA(:,KKA)
PMZM(:,KKU) = 0.5*( PA(:,KKU)+PA(:,KKU-KKL) )
!
!-------------------------------------------------------------------------------
!
END FUNCTION MZM_MF
! ###############################
FUNCTION DZF_MF(KKA,KKU,KKL,PA) RESULT(PDZF)
! ###############################
!
!!**** *DZF* - SHUMAN_MF operator : finite difference operator in z direction
!! for a variable at a flux side
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the z direction (K index) for a field PA localized at a z-flux
! point (w point). The result is localized at a mass point.
!
!!** METHOD
!! ------
!! The result PDZF(:,:,k) is defined by (PA(:,:,k+1)-PA(:,:,k))
!! At k=size(PA,3), PDZF(:,:,k) is defined by 0.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN_MF operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! optimisation 20/08/00 J. Escobar
!! S. Riette, Jan 2012: Simplification and suppression of array overflow
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at flux
! side
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PDZF ! result at mass
! localization
!
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JK ! Loop index in z direction
!
!-------------------------------------------------------------------------------
!
!* 1. DEFINITION OF DZF
! ------------------
!
DO JK=2,SIZE(PA,2)-1
PDZF(:,JK) = PA(:,JK+KKL) - PA(:,JK)
END DO
PDZF(:,KKA) = PA(:,KKA+KKL) - PA(:,KKA)
PDZF(:,KKU) = 0.
!
!-------------------------------------------------------------------------------
!
END FUNCTION DZF_MF
! ###############################
FUNCTION DZM_MF(KKA,KKU,KKL,PA) RESULT(PDZM)
! ###############################
!
!!**** *DZM* - SHUMAN_MF operator : finite difference operator in z direction
!! for a variable at a mass localization
!!
!! PURPOSE
!! -------
! The purpose of this function is to compute a finite difference
! along the z direction (K index) for a field PA localized at a mass
! point. The result is localized at a z-flux point (w point).
!
!!** METHOD
!! ------
!! The result PDZM(:,j,:) is defined by (PA(:,:,k)-PA(:,:,k-1))
!! At k=1, PDZM(:,:,k) is defined by 0.
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!! Book2 of documentation of Meso-NH (SHUMAN_MF operators)
!! Technical specifications Report of The Meso-NH (chapters 3)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 05/07/94
!! optimisation 20/08/00 J. Escobar
!! S. Riette, Jan 2012: Simplification and suppression of array overflow
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PA ! variable at mass
! localization
REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2)) :: PDZM ! result at flux
! side
!
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER :: JK ! Loop index in z direction
!
!-------------------------------------------------------------------------------
!
!* 1. DEFINITION OF DZM
! ------------------
!
DO JK=2,SIZE(PA,2)-1
PDZM(:,JK) = PA(:,JK) - PA(:,JK-KKL)
END DO
PDZM(:,KKA) = 0.
PDZM(:,KKU) = PA(:,KKU) - PA(:,KKU-KKL)
!
!-------------------------------------------------------------------------------
!
END FUNCTION DZM_MF
! ###############################
FUNCTION GZ_M_W_MF(KKA,KKU,KKL,PY,PDZZ) RESULT(PGZ_M_W)
! ###############################
!
!!**** *GZ_M_W * - Compute the gradient along z direction for a
!! variable localized at a mass point
!!
!! PURPOSE
!! -------
!
!!** METHOD
!! ------
! dzm(PY)
! PGZ_M_W = -------
! d*zz
!!
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! NONE
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!! S.Riette moving of code previously in compute_mf_cloud code
!!
!! MODIFICATIONS
!! -------------
!! Original 25 Aug 2011
!! S. Riette, Jan 2012: Simplification and suppression of array overflow
!!
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
!!
!
!-------------------------------------------------------------------------------
!
IMPLICIT NONE
!
!* 0.1 Declarations of argument and result
! ------------------------------------
!
INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes
INTEGER, INTENT(IN) :: KKL ! +1 if grid goes from ground to atmosphere top, -1 otherwise
REAL, DIMENSION(:,:), INTENT(IN) :: PDZZ ! Metric coefficient d*zz
REAL, DIMENSION(:,:), INTENT(IN) :: PY ! variable at mass localization
REAL, DIMENSION(SIZE(PY,1),SIZE(PY,2)) :: PGZ_M_W ! result at flux side
!
!* 0.2 Declarations of local variables
! -------------------------------
!
INTEGER JK
!-------------------------------------------------------------------------------
!
!* 1. COMPUTE THE GRADIENT ALONG Z
! -----------------------------
!
DO JK=2,SIZE(PY,2)-1
PGZ_M_W(:,JK) = (PY(:,JK) - PY(:,JK-KKL)) / PDZZ(:,JK)
END DO
PGZ_M_W(:,KKA) = 0.
PGZ_M_W(:,KKU) = (PY(:,KKU) - PY(:,KKU-KKL)) / PDZZ(:,KKU)
!
!-------------------------------------------------------------------------------
!
END FUNCTION GZ_M_W_MF