Newer
Older
!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
!-----------------------------------------------------------------
!--------------- special set of characters for RCS information
!-----------------------------------------------------------------
! $Source$ $Revision$
! masdev4_7 BUG1 2007/06/15 17:47:18
!-----------------------------------------------------------------
!################################
MODULE MODI_WRITE_LFIFM1_FOR_DIAG
!################################
INTERFACE
SUBROUTINE WRITE_LFIFM1_FOR_DIAG(HFMFILE,HDADFILE)
!* 0.1 Declarations of arguments
!
CHARACTER(LEN=28), INTENT(IN) :: HFMFILE ! Name of FM-file to write
CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of
! its DAD model
!
END SUBROUTINE WRITE_LFIFM1_FOR_DIAG
END INTERFACE
END MODULE MODI_WRITE_LFIFM1_FOR_DIAG
!
! ##################################################
SUBROUTINE WRITE_LFIFM1_FOR_DIAG(HFMFILE,HDADFILE)
! ##################################################
!
!!**** *WRITE_LFIFM1* - routine to write a LFIFM file for model 1
!!
!! PURPOSE
!! -------
! The purpose of this routine is to write an initial LFIFM File
! of name HFMFILE//'.lfi' with the FM routines.
!
!!** METHOD
!! ------
!! The data are written in the LFIFM file :
!! - dimensions
!! - grid variables
!! - configuration variables
!! - prognostic variables at time t and t-dt
!! - 1D anelastic reference state
!!
!! The localization on the model grid is also indicated :
!!
!! IGRID = 1 for mass grid point
!! IGRID = 2 for U grid point
!! IGRID = 3 for V grid point
!! IGRID = 4 for w grid point
!! IGRID = 0 for meaningless case
!!
!!
!! EXTERNAL
!! --------
!! FMWRIT : FM-routine to write a record
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_DIM1 : contains dimensions
!! Module MODD_TIME1 : contains time variables and uses MODD_TIME
!! Module MODD_GRID : contains spatial grid variables for all models
!! Module MODD_GRID1 : contains spatial grid variables
!! Module MODD_REF : contains reference state variables
!! Module MODD_LUNIT1: contains logical unit variables.
!! Module MODD_CONF : contains configuration variables for all models
!! Module MODD_CONF1 : contains configuration variables
!! Module MODD_FIELD1 : contains prognostic variables
!! Module MODD_GR_FIELD1 : contains surface prognostic variables
!! Module MODD_LSFIELD1 : contains Larger Scale variables
!! Module MODD_PARAM1 : contains parameterization options
!! Module MODD_TURB1 : contains turbulence options
!! Module MODD_FRC : contains forcing variables
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq *Meteo France*
!!
!! MODIFICATIONS
!! -------------
!! Original 06/05/94
!! V. Ducrocq 27/06/94
!! J.Stein 20/10/94 (name of the FMFILE)
!! J.Stein 06/12/94 add the LS fields
!! J.P. Lafore 09/01/95 add the DRYMASST
!! J.Stein 20/01/95 add TKE and change the ycomment for the water
!! variables
!! J.Stein 23/01/95 add a TKE switch and MODD_PARAM1
!! J.Stein 16/03/95 remove R from the historical variables
!! J.Stein 20/03/95 add the EPS var.
!! J.Stein 30/06/95 add the variables related to the subgrid condens
!! S. Belair 01/09/95 add surface variables and ground parameters
!! J.-P. Pinty 15/09/95 add the radiation parameters
!! J.Stein 23/01/96 add the TSZ0 option for the surface scheme
!! M.Georgelin 13/12/95 add the forcing variables
!! J.-P. Pinty 15/02/96 add external control for the forcing
!! J.Stein P.Bougeault 15/03/96 add the cloud fraction and change the
!! surface parameters for TSZ0 option
!! J.Stein P.Jabouille 30/04/96 add the storage type
!! J.Stein P.Jabouille 20/05/96 switch for XSIGS and XSRC
!! J.Stein 10/10/96 change Xsrc into XSRCM and XRCT
!! J.P. Lafore 30/07/96 add HFMFILE and HDADFILE writing
!! corresponding to MY_NAME and DAD_NAME (for nesting)
!! V.Masson 08/10/96 add LTHINSHELL
!! J.-P. Pinty 15/12/96 add the microphysics (ice)
!! J.-P. Pinty 11/01/97 add the deep convection
!! J.-P. Pinty 27/01/97 split the recording of the SV array
!! J.-P. Pinty 29/01/97 set recording of PRCONV and PACCONV in mm/h and
!! mm respectively
!! J. Viviand 04/02/97 convert precipitation rates in mm/h
!! P. Hereil 04/12/97 add the calculation of cloud top and moist PV
!! P.Hereil N Asencio 3/02/98 add the calculation of precipitation on large scale grid mesh
!! N Asencio 2/10/98 suppress flux calculation if start file
!! V Masson 25/11/98 places dummy arguments in module MODD_DIAG_FLAG
!! V Masson 04/01/00 removes TSZ0 option
!! J.-P. Pinty 29/11/02 add C3R5, ICE2, ICE4, CELEC
!! V Masson 01/2004 removes surface (externalization)
!! P. Tulet 01/2005 add dust, orilam
!! M. Leriche 04/2007 add aqueous concentration in M
!! O. Caumont 03/2008 add simulation of radar observations
!! O. Caumont 14/09/2009 modifications to allow for polar outputs (radar diagnostics)
!! October 2009 (G. Tanguy) add ILENCH=LEN(YCOMMENT) after
!! change of YCOMMENT
!! G. Tanguy 10/2009 add possibility to run radar after
!! PREP_REAL_CASE with AROME
!! O. Caumont 01/2011 [radar diagnostics] add control check for NMAX; revise comments
!! O. Caumont 05/2011 [radar diagnostics] change output format
!! G.Tanguy/ JP Pinty/ JP Chabureau 18/05/2011 : add lidar simulator
!! S.Bielli 12/2012 : add latitude and longitude
!! F. Duffourg 02/2013 : add new fields

ESCOBAR MUNOZ Juan
committed
!! J.Escobar 21/03/2013: for HALOK get correctly local array dim/bound
!! J. escobar 27/03/2014 : write LAT/LON only in not CARTESIAN case
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
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_DIM_n
USE MODD_CONF
USE MODD_CONF_n
USE MODD_GRID
USE MODD_GRID_n
USE MODD_METRICS_n
USE MODD_TIME
USE MODD_TIME_n
USE MODD_DYN_n
USE MODD_FIELD_n
USE MODD_GR_FIELD_n
USE MODD_LSFIELD_n
USE MODD_PARAM_n
USE MODD_CURVCOR_n
USE MODD_REF
USE MODD_REF_n
USE MODD_LUNIT_n
USE MODD_TURB_n
USE MODD_RADIATIONS_n
USE MODD_FRC
USE MODD_PRECIP_n
USE MODD_CST
USE MODD_CLOUDPAR
USE MODD_DEEP_CONVECTION_n
USE MODD_PARAM_KAFR_n
USE MODD_NESTING
USE MODD_PARAMETERS
USE MODD_DIAG_FLAG
USE MODD_NSV
USE MODD_CH_M9_n, ONLY : CNAMES, NEQAQ
USE MODD_RAIN_C2R2_DESCR, ONLY : C2R2NAMES
USE MODD_ICE_C1R3_DESCR, ONLY : C1R3NAMES
USE MODD_ELEC_DESCR, ONLY : CELECNAMES
USE MODD_RAIN_C2R2_PARAM
USE MODD_ICE_C1R3_PARAM
USE MODD_PARAM_ICE, ONLY : LSEDIC
USE MODD_PARAM_C2R2, ONLY : LSEDC
USE MODD_PARAM_C1R3
USE MODD_LG, ONLY : CLGNAMES
USE MODD_PASPOL, ONLY : LPASPOL
USE MODD_CONDSAMP, ONLY : LCONDSAMP
!
USE MODD_DIAG_FLAG
USE MODD_RADAR, ONLY: XLAT_RAD,XELEV,&
XSTEP_RAD,NBRAD,NBELEV,NBAZIM,NBSTEPMAX,&
NCURV_INTERPOL,LATT,LCART_RAD,NPTS_H,NPTS_V,XGRID,&
LREFR,LDNDZ,NMAX,CNAME_RAD,&
XLON_RAD,XALT_RAD,XLAM_RAD,XDT_RAD,LWBSCS,LWREFL
!
USE MODI_RADAR_SIMULATOR
!
USE MODD_DUST
USE MODD_CSTS_DUST
USE MODD_SALT
USE MODD_CH_AEROSOL
USE MODD_CH_AERO_n
USE MODD_CH_MNHC_n
USE MODE_DUST_PSD
USE MODE_SALT_PSD
USE MODE_AERO_PSD
USE MODI_GRADIENT_M
USE MODI_GRADIENT_W
USE MODI_GRADIENT_U
USE MODI_GRADIENT_V
USE MODI_SHUMAN
USE MODI_RADAR_RAIN_ICE
USE MODI_INI_RADAR
USE MODI_COMPUTE_MEAN_PRECIP
USE MODI_UV_TO_ZONAL_AND_MERID
USE MODI_CALCSOUND
USE MODI_FREE_ATM_PROFILE
USE MODI_GPS_ZENITH
USE MODI_GATHER_ll
!
USE MODE_GRIDPROJ
USE MODE_FMWRIT
USE MODE_ll
USE MODE_IO_ll
USE MODE_THERMO
USE MODE_MODELN_HANDLER
USE MODI_LIDAR
!
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!
CHARACTER(LEN=28), INTENT(IN) :: HFMFILE ! Name of FM-file to write
CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of
! its DAD model
!
!* 0.2 Declarations of local variables
!
INTEGER :: IRESP ! return-code for the file routines
INTEGER :: IGRID ! IGRID : grid indicator
INTEGER :: ILENCH ! ILENCH : length of comment string
!
CHARACTER(LEN=28) :: YFMFILE ! Temporary variable to store FM-file name
CHARACTER(LEN=16) :: YRECFM ! Name of the article to be written
CHARACTER(LEN=100):: YCOMMENT ! Comment string
!
CHARACTER(LEN=2) :: YSTORAGE_TYPE ! type of the new DIAG file ('DI')
!
CHARACTER(LEN=3) :: YFRC ! to mark the time of the forcing
CHARACTER(LEN=31) :: YFGRI ! file name for GPS stations
!
INTEGER :: IIU,IJU,IKU,IIB,IJB,IKB,IIE,IJE,IKE ! Arrays bounds
!
INTEGER :: IRR
INTEGER :: JLOOP,JI,JJ,JK,JSV,JT,JH,JV,JEL ! loop index
INTEGER :: IMI ! Current model index
!
REAL :: ZRV_OV_RD ! XRV / XRD
REAL :: ZGAMREF ! Standard atmosphere lapse rate (K/m)
REAL :: ZX0D ! work real scalar
REAL :: ZLATOR, ZLONOR ! geographical coordinates of 1st mass point
REAL :: ZXHATM, ZYHATM ! conformal coordinates of 1st mass point
REAL, DIMENSION(:), ALLOCATABLE :: ZXHAT_ll ! Position x in the conformal
! plane (array on the complete domain)
REAL, DIMENSION(:), ALLOCATABLE :: ZYHAT_ll ! Position y in the conformal
! plane (array on the complete domain)
!
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZPOVO
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZTEMP
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZVOX,ZVOY,ZVOZ
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZCORIOZ
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZWORK31,ZWORK32
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZWORK33,ZWORK34
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2)) :: ZWORK21,ZWORK22
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2)) :: ZWORK23,ZWORK24
REAL,DIMENSION(:,:,:,:,:), ALLOCATABLE :: ZWORK42 ! reflectivity on a cartesian grid (PREFL_CART)
REAL,DIMENSION(:,:,:), ALLOCATABLE :: ZWORK43 ! latlon coordinates of cartesian grid points (PLATLON)
REAL,DIMENSION(:,:,:), ALLOCATABLE :: ZPHI,ZTHETAE,ZTHETAV
INTEGER, DIMENSION(:,:), ALLOCATABLE :: IWORK1
integer :: ICURR,INBOUT
!
REAL,DIMENSION(SIZE(XSVT,1),SIZE(XSVT,2),SIZE(XSVT,3),NSP+NCARB+NSOA,JPMODE):: ZPTOTA
REAL,DIMENSION(SIZE(XSVT,1),SIZE(XSVT,2),SIZE(XSVT,3),NMODE_DST*2):: ZSDSTDEP
REAL,DIMENSION(SIZE(XSVT,1),SIZE(XSVT,2),SIZE(XSVT,3),NMODE_SLT*2):: ZSSLTDEP
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
REAL,DIMENSION(:,:,:,:), ALLOCATABLE :: ZSIG_DST, ZRG_DST, ZN0_DST
REAL,DIMENSION(:,:,:,:), ALLOCATABLE :: ZSIG_SLT, ZRG_SLT, ZN0_SLT
REAL,DIMENSION(:,:,:), ALLOCATABLE :: ZRHOT, ZTMP ! work array
!ECRITURE DANS UN FICHIER ASCII DE RESULTATS
!INITIALISATION DU NOM DE FICHIER CREE EN PARALLELE AVEC CELUI LFI
INTEGER :: ILURS
CHARACTER(LEN=32) :: YRS
CHARACTER(LEN=3),DIMENSION(:),ALLOCATABLE :: YRAD
CHARACTER(LEN=2*INT(NBSTEPMAX*XSTEP_RAD/XGRID)*2*9+1), DIMENSION(:), ALLOCATABLE :: CLATLON
CHARACTER(LEN=2*9) :: CBUFFER
CHARACTER(LEN=4) :: YELEV
CHARACTER(LEN=3) :: YGRID_SIZE
INTEGER :: IEL,IIELV
CHARACTER(LEN=5) :: YVIEW ! Upward or Downward integration
INTEGER :: IACCMODE
!-------------------------------------------------------------------------------
INTEGER :: IAUX ! work variable
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2),SIZE(XTHT,3)) :: ZWORK35,ZWORK36
REAL,DIMENSION(SIZE(XTHT,1),SIZE(XTHT,2)) :: ZWORK25,ZWORK26
REAL :: ZEAU ! Mean precipitable water
INTEGER, DIMENSION(SIZE(XZZ,1),SIZE(XZZ,2)) ::IKTOP ! level in which is the altitude 3000m
REAL, DIMENSION(SIZE(XZZ,1),SIZE(XZZ,2),SIZE(XZZ,3)) :: ZDELTAZ ! interval (m) between two levels K
!
!-------------------------------------------------------------------------------
!
!* 0. ARRAYS BOUNDS INITIALIZATION
!

ESCOBAR MUNOZ Juan
committed
CALL GET_DIM_EXT_ll ('B',IIU,IJU)
CALL GET_INDICE_ll (IIB,IJB,IIE,IJE)
!!$IIB=1+JPHEXT
!!$IJB=1+JPHEXT
!!$IIU=NIMAX+2*JPHEXT
!!$IJU=NJMAX+2*JPHEXT
!!$IIE=IIU-JPHEXT
!!$IJE=IJU-JPHEXT
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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
IKU=NKMAX+2*JPVEXT
IKB=1+JPVEXT
IKE=IKU-JPVEXT
IMI = GET_CURRENT_MODEL_INDEX()
!-------------------------------------------------------------------------------
!
!* 1. WRITES IN THE LFI FILE
! ----------------------
!
!* 1.0 HFMFILE and HDADFILE :
!
YRECFM='MASDEV'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',NMASDEV,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='BUGFIX'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',NBUGFIX,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='BIBUSER'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',CBIBUSER,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='PROGRAM'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',CPROGRAM,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='L1D'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',L1D,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='L2D'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',L2D,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='PACK'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',LPACK,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='MY_NAME'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',HFMFILE,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='DAD_NAME'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',HDADFILE,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (LEN_TRIM(HDADFILE)>0) THEN
CALL FMWRIT(HFMFILE,'DXRATIO',CLUOUT,'--',NDXRATIO_ALL(1),0,ILENCH,YCOMMENT,IRESP)
CALL FMWRIT(HFMFILE,'DYRATIO',CLUOUT,'--',NDYRATIO_ALL(1),0,ILENCH,YCOMMENT,IRESP)
CALL FMWRIT(HFMFILE,'XOR',CLUOUT,'--',NXOR_ALL(1),0,ILENCH,YCOMMENT,IRESP)
CALL FMWRIT(HFMFILE,'YOR',CLUOUT,'--',NYOR_ALL(1),0,ILENCH,YCOMMENT,IRESP)
END IF
!
YRECFM='SURF'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',CSURF,IGRID,ILENCH,YCOMMENT,IRESP)
!
!* 1.1 Type and Dimensions :
!
YRECFM='STORAGE_TYPE'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
YSTORAGE_TYPE='DI'
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',YSTORAGE_TYPE,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='IMAX'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',NIMAX_ll,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='JMAX'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',NJMAX_ll,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='KMAX'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',NKMAX,IGRID,ILENCH,YCOMMENT,IRESP)
!
!* 1.2 Grid variables :
!
IF (.NOT.LCARTESIAN) THEN
YRECFM='RPK'
YCOMMENT='projection parameter'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XRPK,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LONORI'
YCOMMENT='longitude of the origin point (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLONORI,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LATORI'
YCOMMENT='latitude of the origin point (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLATORI,IGRID,ILENCH,YCOMMENT,IRESP)
!
!* diagnostic of 1st mass point
!
ALLOCATE(ZXHAT_ll(NIMAX_ll+ 2 * JPHEXT),ZYHAT_ll(NJMAX_ll+2 * JPHEXT))
CALL GATHERALL_FIELD_ll('XX',XXHAT,ZXHAT_ll,IRESP) !//
CALL GATHERALL_FIELD_ll('YY',XYHAT,ZYHAT_ll,IRESP) !//
ZXHATM = 0.5 * (ZXHAT_ll(1)+ZXHAT_ll(2))
ZYHATM = 0.5 * (ZYHAT_ll(1)+ZYHAT_ll(2))
CALL SM_LATLON(XLATORI,XLONORI,ZXHATM,ZYHATM,ZLATOR,ZLONOR)
DEALLOCATE(ZXHAT_ll,ZYHAT_ll)
!
YRECFM='LONOR'
YCOMMENT='longitude of the mass point 1-1 (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',ZLONOR,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LATOR'
YCOMMENT='latitude of the mass point 1-1 (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',ZLATOR,IGRID,ILENCH,YCOMMENT,IRESP)
!
END IF
!
YRECFM='THINSHELL'
YCOMMENT=' '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',LTHINSHELL,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LAT0'
YCOMMENT='reference latitude for conformal projection (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLAT0,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LON0'
YCOMMENT='reference longitude for conformal projection (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLON0,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='BETA'
YCOMMENT='rotation angle (DEGREES)'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XBETA,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='XHAT'
YCOMMENT='Position x in the conformal or cartesian plane (METERS)'
IGRID=2
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XX',XXHAT,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='YHAT'
YCOMMENT='Position y in the conformal or cartesian plane (METERS)'
IGRID=3
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'YY',XYHAT,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='ZHAT'
YCOMMENT='height level without orography (METERS)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XZHAT,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='ZS'
YCOMMENT='orography (METERS)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XZS,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='ZSMT'
YCOMMENT='smooth orography (METERS)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XZSMT,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='SLEVE'
YCOMMENT=' '
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',LSLEVE,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (LSLEVE) THEN
YRECFM='LEN1'
YCOMMENT=' '
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLEN1,IGRID,ILENCH,YCOMMENT,IRESP)
YRECFM='LEN2'
YCOMMENT=' '
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XLEN2,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
YRECFM='DTCUR'
YCOMMENT=' '
ILENCH=LEN(YCOMMENT)
IGRID=0
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',TDTCUR,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='DTEXP' ! array of rank 3 for date is written in file
YCOMMENT=' '
ILENCH=LEN(YCOMMENT)
IGRID=0
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',TDTEXP,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='DTMOD' ! array of rank 3 for date is written in file
YCOMMENT=' '
ILENCH=LEN(YCOMMENT)
IGRID=0
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',TDTMOD,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='DTSEG' ! array of rank 3 for date is written in file
IGRID=0
YCOMMENT=' '
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',TDTSEG,IGRID,ILENCH,YCOMMENT,IRESP)
!
!* 1.3 Configuration variables :
!
YRECFM='CARTESIAN'
YCOMMENT='Logical for cartesian geometry '
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',LCARTESIAN,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LBOUSS'
YCOMMENT='Logical for Boussinesq'
IGRID=0
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',LBOUSS,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (LCARTESIAN .AND. LWIND_ZM) THEN
LWIND_ZM=.FALSE.
PRINT*,'YOU ARE IN CARTESIAN GEOMETRY SO LWIND_ZM IS FORCED TO FALSE'
END IF
!* 1.4 Reference state variables :
!
YRECFM='RHOREFZ'
YCOMMENT='rhodz for reference state without orography (kg/m3)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XRHODREFZ,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='THVREFZ'
YCOMMENT='thetavz for reference state without orography (K)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XTHVREFZ,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='EXNTOP'
YCOMMENT='Exner function at model top'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'--',XEXNTOP,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='RHODREF'
YCOMMENT='Dry density for reference state with orography (kg/m3)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XRHODREF,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='THVREF'
YCOMMENT='Thetav for reference state with orography (K)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XTHVREF,IGRID,ILENCH,YCOMMENT,IRESP)
!
!
!* 1.5 Variables necessary for plots
!
! PABST,THT,POVOM for cross sections at constant pressure
! level or constant theta level or constant PV level
!
IF (INDEX(CISO,'PR') /= 0) THEN
YCOMMENT='X_Y_Z_ABSolute Pressure (Pa)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XPABST,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
IF (INDEX(CISO,'TK') /= 0) THEN
YCOMMENT='X_Y_Z_potential temperature (K)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XTHT,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
ZCORIOZ(:,:,:)=SPREAD( XCORIOZ(:,:),DIM=3,NCOPIES=IKU )
ZVOX(:,:,:)=GY_W_VW(1,IKU,1,XWT,XDYY,XDZZ,XDZY)-GZ_V_VW(1,IKU,1,XVT,XDZZ)
ZVOY(:,:,:)=GZ_U_UW(1,IKU,1,XUT,XDZZ)-GX_W_UW(1,IKU,1,XWT,XDXX,XDZZ,XDZX)
ZVOZ(:,:,:)=GX_V_UV(1,IKU,1,XVT,XDXX,XDZZ,XDZX)-GY_U_UV(1,IKU,1,XUT,XDYY,XDZZ,XDZY)
ZVOZ(:,:,2)=ZVOZ(:,:,3)
ZVOZ(:,:,1)=ZVOZ(:,:,3)
ZWORK31(:,:,:)=GX_M_M(1,IKU,1,XTHT,XDXX,XDZZ,XDZX)
ZWORK32(:,:,:)=GY_M_M(1,IKU,1,XTHT,XDYY,XDZZ,XDZY)
ZWORK33(:,:,:)=GZ_M_M(1,IKU,1,XTHT,XDZZ)
ZPOVO(:,:,:)= ZWORK31(:,:,:)*MZF(1,IKU,1,MYF(ZVOX(:,:,:))) &
+ ZWORK32(:,:,:)*MZF(1,IKU,1,MXF(ZVOY(:,:,:))) &
+ ZWORK33(:,:,:)*(MYF(MXF(ZVOZ(:,:,:))) + ZCORIOZ(:,:,:))
ZPOVO(:,:,:)= ZPOVO(:,:,:)*1E6/XRHODREF(:,:,:)
ZPOVO(:,:,1) =-1.E+11
ZPOVO(:,:,IKU)=-1.E+11
IF (INDEX(CISO,'EV') /= 0) THEN
YRECFM='POVOM'
YCOMMENT='X_Y_Z_POtential VOrticity (PVU)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZPOVO,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
!
IF (LVAR_RS) THEN
YCOMMENT='X_Y_Z_U component of wind (m/s)'
IGRID=2
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XUT,IGRID,ILENCH,YCOMMENT,IRESP)
YCOMMENT='X_Y_Z_V component of wind (m/s)'
IGRID=3
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XVT,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (LWIND_ZM) THEN
YCOMMENT='X_Y_Z_Zonal and Meridian components of horizontal wind (M/S)'
HFMFILE=HFMFILE,HRECU='UM_ZM',HRECV='VM_ZM',HCOMMENT=YCOMMENT)
END IF
!
YCOMMENT='X_Y_Z_vertical wind (m/s)'
IGRID=4
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XWT,IGRID,ILENCH,YCOMMENT,IRESP)
!
! write mixing ratio for water vapor required to plot radio-soundings
!
IF (LUSERV) THEN
YCOMMENT='X_Y_Z_Vapor mixing Ratio (KG/KG)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XRT(:,:,:,1),IGRID,ILENCH, &
YCOMMENT,IRESP)
END IF
END IF
!
!* Latitude and Longitude arrays
!
IF (.NOT.LCARTESIAN) THEN
YRECFM='LAT'
YCOMMENT='X_Y_latitude (degrees)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XLAT,IGRID,ILENCH,YCOMMENT,IRESP)
!
YRECFM='LON'
YCOMMENT='X_Y_longitude (degrees)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XLON,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
!
!-------------------------------------------------------------------------------
!
!* 1.6 Other pronostic variables
!
ZTEMP(:,:,:)=XTHT(:,:,:)*(XPABST(:,:,:)/ XP00) **(XRD/XCPD)
!
IF (LVAR_TURB) THEN
IF (CTURB /= 'NONE') THEN
YCOMMENT='X_Y_Z_Turbulent Kinetic Energy (M**2/S**2)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XTKET,IGRID,ILENCH,YCOMMENT,IRESP)
YCOMMENT='X_Y_Z_normalized 2nd_order moment s_r_c/2Sigma_s2 (KG/KG**2)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XSRCT,IGRID,ILENCH,YCOMMENT,IRESP)
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
!
YRECFM='SIGS'
YCOMMENT='X_Y_Z_Sigma_s from turbulence scheme (KG/KG**2)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XSIGS,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
!
IF(CTOM=='TM06') THEN
YRECFM='BL_DEPTH'
YCOMMENT='X_Y_BL_DEPTH (M)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',XBL_DEPTH,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
END IF
END IF
!
!* Rains
!
IF (LVAR_PR .AND. LUSERR .AND. SIZE(XINPRR)>0 ) THEN
!
! explicit species
!
ZWORK21(:,:) = XINPRR(:,:)*3.6E6
YRECFM ='INPRR'
YCOMMENT ='X_Y_INstantaneous PRecipitation Rate (MM/H)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK31(:,:,:) = XINPRR3D(:,:,:)
YRECFM = 'INPRR3D'
YCOMMENT = 'X_Y_INstantaneous 3D Rain Precipitation flux (M/S)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK31,IGRID,ILENCH, &
YCOMMENT,IRESP) ! unit conversion
!
ZWORK31(:,:,:) = XEVAP3D(:,:,:)
YRECFM = 'EVAP3D'
YCOMMENT = 'X_Y_INstantaneous 3D Rain Evaporation flux (KG/KG/S)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK31,IGRID,ILENCH, &
YCOMMENT,IRESP) ! unit conversion
!
ZWORK21(:,:) = XACPRR(:,:)*1.E3
YRECFM ='ACPRR'
YCOMMENT ='X_Y_ACcumulated PRecipitation Rate (MM)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (CCLOUD(1:3) == 'ICE' .OR. CCLOUD == 'C2R2' .OR. CCLOUD == 'C3R5' .OR.&
CCLOUD == 'KHKO') THEN
IF (SIZE(XINPRC) /= 0 ) THEN
ZWORK21(:,:) = XINPRC(:,:)*3.6E6
YRECFM ='INPRC'
YCOMMENT ='X_Y_INstantaneous Cloud PRecipitation Rate (MM/H)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XACPRC(:,:)*1.E3
YRECFM ='ACPRC'
YCOMMENT ='X_Y_ACcumulated Cloud PRecipitation Rate (MM)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
END IF
IF (CCLOUD(1:3) == 'ICE' .OR. CCLOUD == 'C3R5') THEN
ZWORK21(:,:) = XINPRS(:,:)*3.6E6
YRECFM = 'INPRS'
YCOMMENT = 'X_Y_INstantaneaous PRecipitation rate for Snow (MM/H)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XACPRS(:,:)*1.0E3
YRECFM = 'ACPRS'
YCOMMENT = 'X_Y_ACccumuated PRecipitation rate for Snow (MM)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XINPRG(:,:)*3.6E6
YRECFM = 'INPRG'
YCOMMENT = 'X_Y_INstantaneaous PRecipitation rate for Graupel (MM/H)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XACPRG(:,:)*1.0E3
YRECFM = 'ACPRG'
YCOMMENT = 'X_Y_ACccumuated PRecipitation rate for Graupel (MM)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
IF (SIZE(XINPRH) /= 0 ) THEN
ZWORK21(:,:) = XINPRH(:,:)*3.6E6
YRECFM = 'INPRH'
YCOMMENT = 'X_Y_INstantaneaous PRecipitation rate for Hail (MM/H)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XACPRH(:,:)*1.0E3
YRECFM = 'ACPRH'
YCOMMENT = 'X_Y_ACccumuated PRecipitation rate for Hail (MM)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
ENDIF
!
ZWORK21(:,:) = (XINPRR(:,:) + XINPRS(:,:) + XINPRG(:,:))*3.6E6
IF (SIZE(XINPRC) /= 0 ) &
ZWORK21(:,:) = ZWORK21(:,:) + XINPRC(:,:)*3.6E6
IF (SIZE(XINPRH) /= 0 ) &
ZWORK21(:,:) = ZWORK21(:,:) + XINPRH(:,:)*3.6E6
YRECFM = 'INPRT'
YCOMMENT = 'X_Y_Total INstantaneaous PRecipitation rate (MM/H)'
YCOMMENT = 'X_Y_INPRT (MM/H)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = (XACPRR(:,:) + XACPRS(:,:) + XACPRG(:,:))*1.0E3
IF (SIZE(XINPRC) /= 0 ) &
ZWORK21(:,:) = ZWORK21(:,:) + XACPRC(:,:)*1.0E3
IF (SIZE(XINPRH) /= 0 ) &
ZWORK21(:,:) = ZWORK21(:,:) + XACPRH(:,:)*1.0E3
!
YRECFM = 'ACPRT'
YCOMMENT = 'X_Y_Total ACcumulated PRecipitation rate (MM)'
YCOMMENT = 'X_Y_ACPRT (MM)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
END IF
!
!* Convective rain
!
IF (CDCONV /= 'NONE') THEN
ZWORK21(:,:) = XPRCONV(:,:)*3.6E6
YRECFM ='PRCONV'
YCOMMENT ='X_Y_CONVective instantaneous Precipitation Rate (MM/H)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XPACCONV(:,:)*1.E3
YRECFM ='PACCONV'
YCOMMENT ='X_Y_CONVective ACcumulated Precipitation rate (MM)'
IGRID =1
ILENCH =LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
!
ZWORK21(:,:) = XPRSCONV(:,:)*3.6E6
YRECFM ='PRSCONV'
YCOMMENT ='X_Y_CONVective instantaneous Precipitation Rate for Snow (MM/H)'
IGRID = 1
ILENCH = LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK21,IGRID,ILENCH,YCOMMENT,IRESP)
END IF
END IF
IF (LVAR_PR ) THEN
!Precipitable water in kg/m**2
ZWORK21(:,:) = 0.
ZWORK22(:,:) = 0.
ZWORK23(:,:) = 0.
ZWORK31(:,:,:) = DZF(1,IKU,1,XZZ(:,:,:))
DO JK = IKB,IKE
!* Calcul de qtot
IF (CCLOUD(1:3) == 'ICE' ) THEN
ZWORK23(IIB:IIE,IJB:IJE) = XRT(IIB:IIE,IJB:IJE,JK,1) + &
XRT(IIB:IIE,IJB:IJE,JK,2) + XRT(IIB:IIE,IJB:IJE,JK,3) + &
XRT(IIB:IIE,IJB:IJE,JK,4) + XRT(IIB:IIE,IJB:IJE,JK,5) + &
XRT(IIB:IIE,IJB:IJE,JK,6)
ZWORK23(IIB:IIE,IJB:IJE) = XRT(IIB:IIE,IJB:IJE,JK,1)
ENDIF
!* Calcul de l'eau precipitable
ZWORK21(IIB:IIE,IJB:IJE)=XRHODREF(IIB:IIE,IJB:IJE,JK)* &
ZWORK23(IIB:IIE,IJB:IJE)* ZWORK31(IIB:IIE,IJB:IJE,JK)
!* Sum
ZWORK22(IIB:IIE,IJB:IJE) = ZWORK22(IIB:IIE,IJB:IJE)+ZWORK21(IIB:IIE,IJB:IJE)
ZWORK21(:,:) = 0.
ZWORK23(:,:) = 0.
END DO
!* Precipitable water in kg/m**2
YRECFM='PRECIP_WAT'
YCOMMENT='(kg/m)'
IGRID=1
ILENCH=LEN(YCOMMENT)
CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,'XY',ZWORK22,IGRID,ILENCH,YCOMMENT,IRESP)
ENDIF
!
!
!* Flux d'humidit et d'hydromtores
IF (LHU_FLX) THEN
ZWORK35(:,:,:) = XRHODREF(:,:,:) * XRT(:,:,:,1)
ZWORK31(:,:,:) = MXM(ZWORK35(:,:,:)) * XUT(:,:,:)
ZWORK32(:,:,:) = MYM(ZWORK35(:,:,:)) * XVT(:,:,:)
ZWORK36(:,:,:) = ZWORK35(:,:,:) + XRHODREF(:,:,:) * (XRT(:,:,:,2) + &
XRT(:,:,:,3) + XRT(:,:,:,4) + XRT(:,:,:,5) + XRT(:,:,:,6))
ZWORK33(:,:,:) = MXM(ZWORK36(:,:,:)) * XUT(:,:,:)
ZWORK34(:,:,:) = MYM(ZWORK36(:,:,:)) * XVT(:,:,:)
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
ENDIF
ZWORK35(:,:,:) = GX_U_M(1,IKU,1,ZWORK31,XDXX,XDZZ,XDZX) + GY_V_M(1,IKU,1,ZWORK32,XDYY,XDZZ,XDZY)
ZWORK36(:,:,:) = GX_U_M(1,IKU,1,ZWORK33,XDXX,XDZZ,XDZX) + GY_V_M(1,IKU,1,ZWORK34,XDYY,XDZZ,XDZY)
!
! Integration sur 3000 m
!
IKTOP(:,:)=0
DO JK=1,IKU-1
WHERE (((XZZ(:,:,JK) -XZS(:,:))<= 3000.0) .AND. ((XZZ(:,:,JK+1) -XZS(:,:))> 3000.0))
IKTOP(:,:)=JK
END WHERE
END DO
ZDELTAZ(:,:,:)=DZF(1,IKU,1,XZZ)
ZWORK21(:,:) = 0.
ZWORK22(:,:) = 0.
ZWORK25(:,:) = 0.
DO JJ=1,IJU
DO JI=1,IIU
IAUX=IKTOP(JI,JJ)
DO JK=IKB,IAUX-1
ZWORK21(JI,JJ) = ZWORK21(JI,JJ) + ZWORK31(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ZWORK22(JI,JJ) = ZWORK22(JI,JJ) + ZWORK32(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ZWORK25(JI,JJ) = ZWORK25(JI,JJ) + ZWORK35(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ENDDO
IF (IAUX >= IKB) THEN
ZDELTAZ(JI,JJ,IAUX)= 3000. - (XZZ(JI,JJ,IAUX) -XZS(JI,JJ))
ZWORK21(JI,JJ) = ZWORK21(JI,JJ) + ZWORK31(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)
ZWORK22(JI,JJ) = ZWORK22(JI,JJ) + ZWORK32(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)
ZWORK25(JI,JJ) = ZWORK25(JI,JJ) + ZWORK35(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)
ENDIF
ENDDO
ENDDO
IF (CCLOUD(1:3) == 'ICE' ) THEN
ZWORK23(:,:) = 0.
ZWORK24(:,:) = 0.
ZWORK26(:,:) = 0.
DO JJ=1,IJU
DO JI=1,IIU
IAUX=IKTOP(JI,JJ)
DO JK=IKB,IAUX-1
ZWORK23(JI,JJ) = ZWORK23(JI,JJ) + ZWORK33(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ZWORK24(JI,JJ) = ZWORK24(JI,JJ) + ZWORK34(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ZWORK26(JI,JJ) = ZWORK26(JI,JJ) + ZWORK36(JI,JJ,JK) * ZDELTAZ(JI,JJ,JK)
ENDDO
IF (IAUX >= IKB) THEN
ZDELTAZ(JI,JJ,IAUX)= 3000. - (XZZ(JI,JJ,IAUX) -XZS(JI,JJ))
ZWORK23(JI,JJ) = ZWORK23(JI,JJ) + ZWORK33(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)
ZWORK24(JI,JJ) = ZWORK24(JI,JJ) + ZWORK34(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)
ZWORK26(JI,JJ) = ZWORK26(JI,JJ) + ZWORK36(JI,JJ,IAUX) * ZDELTAZ(JI,JJ,IAUX)