forked from ESCOMP/CLUBB_CESM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats_zm_module.F90
2525 lines (2113 loc) · 92.1 KB
/
stats_zm_module.F90
1
2
3
4
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
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
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
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
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
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
!-----------------------------------------------------------------------
! $Id$
!===============================================================================
module stats_zm_module
implicit none
private ! Default Scope
public :: stats_init_zm
! Constant parameters
integer, parameter, public :: nvarmax_zm = 300 ! Maximum variables allowed
contains
!-----------------------------------------------------------------------
subroutine stats_init_zm( vars_zm, l_error )
! Description:
! Initializes array indices for stats_zm
! Note:
! All code that is within subroutine stats_init_zm, including variable
! allocation code, is not called if l_stats is false. This subroutine is
! called only when l_stats is true.
!-----------------------------------------------------------------------
use constants_clubb, only: &
fstderr ! Constant(s)
use stats_variables, only: &
stats_zm, &
iwp2, &
irtp2, &
ithlp2, &
irtpthlp, &
iwprtp, &
iwpthlp, &
iwp3_zm, &
ithlp3_zm, &
irtp3_zm, &
iwp4, &
iwpthvp, &
irtpthvp, &
ithlpthvp, &
itau_zm, &
iKh_zm, &
iK_hm, &
iwprcp, &
irc_coef_zm, &
ithlprcp, &
irtprcp, &
ircp2, &
iSkw_zm, &
iSkthl_zm, &
iSkrt_zm
use stats_variables, only: &
iupwp, &
ivpwp, &
irho_zm, &
isigma_sqd_w, &
irho_ds_zm, &
ithv_ds_zm, &
iem, &
ishear, &
imean_w_up, &
imean_w_down, &
iFrad, &
iFrad_LW, &
iFrad_SW, &
iFrad_LW_up, &
iFrad_SW_up, &
iFrad_LW_down, &
iFrad_SW_down, &
iFprec, &
iFcsed, &
istability_correction
use stats_variables, only: &
iup2, &
ivp2, &
iup2_bt, &
iup2_ta, &
iup2_tp, &
iup2_ma, &
iup2_dp1, &
iup2_dp2, &
iup2_pr1, &
iup2_pr2, &
iup2_sdmp, &
iup2_pd, &
iup2_cl, &
iup2_sf, &
iup2_splat, &
ivp2_bt, &
ivp2_ta, &
ivp2_tp, &
ivp2_ma, &
ivp2_dp1, &
ivp2_dp2, &
ivp2_pr1, &
ivp2_pr2, &
ivp2_sdmp, &
ivp2_pd, &
ivp2_cl, &
ivp2_sf, &
ivp2_splat
use stats_variables, only: &
icoef_wp4_implicit
use stats_variables, only: &
iwpNcp
use stats_variables, only: &
iVNr, &
iVrr, &
iVNc, &
iVrc, &
iVNi, &
iVri, &
iVNs, &
iVrs, &
iVrg, &
iVrrprrp, &
iVNrpNrp, &
iVrrprrp_expcalc, &
iVNrpNrp_expcalc
use stats_variables, only: &
iwp2_bt, &
iwp2_ma, &
iwp2_ta, &
iwp2_ac, &
iwp2_bp, &
iwp2_pr1, &
iwp2_pr2, &
iwp2_pr3, &
iwp2_dp1, &
iwp2_dp2, &
iwp2_sdmp, &
iwp2_pd, &
iwp2_cl, &
iwp2_sf, &
iwp2_splat
use stats_variables, only: &
iwprtp_bt, &
iwprtp_ma, &
iwprtp_ta, &
iwprtp_tp, &
iwprtp_ac, &
iwprtp_bp, &
iwprtp_pr1, &
iwprtp_pr2, &
iwprtp_pr3, &
iwprtp_dp1, &
iwprtp_mfl, &
iwprtp_cl, &
iwprtp_sicl, &
iwprtp_pd, &
iwprtp_forcing, &
iwprtp_mc, &
iwpthlp_bt, &
iwpthlp_ma, &
iwpthlp_ta
use stats_variables, only: &
iwpthlp_tp, &
iwpthlp_ac, &
iwpthlp_bp, &
iwpthlp_pr1, &
iwpthlp_pr2, &
iwpthlp_pr3, &
iwpthlp_dp1, &
iwpthlp_mfl, &
iwpthlp_cl, &
iwpthlp_sicl, &
iwpthlp_forcing, &
iwpthlp_mc
use stats_variables, only: &
iupwp_bt, &
iupwp_ma, &
iupwp_ta, &
iupwp_tp, &
iupwp_ac, &
iupwp_bp, &
iupwp_pr1, &
iupwp_pr2, &
iupwp_pr3, &
iupwp_pr4, &
iupwp_dp1, &
iupwp_mfl, &
iupwp_cl, &
ivpwp_bt, &
ivpwp_ma, &
ivpwp_ta, &
ivpwp_tp, &
ivpwp_ac, &
ivpwp_bp, &
ivpwp_pr1, &
ivpwp_pr2, &
ivpwp_pr3, &
ivpwp_pr4, &
ivpwp_dp1, &
ivpwp_mfl, &
ivpwp_cl
use stats_variables, only: &
irtp2_bt, &
irtp2_ma, &
irtp2_ta, &
irtp2_tp, &
irtp2_dp1, &
irtp2_dp2, &
irtp2_cl, &
irtp2_pd, &
irtp2_sf, &
irtp2_forcing, &
irtp2_mc, &
ithlp2_bt, &
ithlp2_ma, &
ithlp2_ta, &
ithlp2_tp, &
ithlp2_dp1, &
ithlp2_dp2, &
ithlp2_cl, &
ithlp2_pd
use stats_variables, only: &
ithlp2_sf, &
ithlp2_forcing, &
ithlp2_mc, &
irtpthlp_bt, &
irtpthlp_ma, &
irtpthlp_ta, &
irtpthlp_tp1, &
irtpthlp_tp2, &
irtpthlp_dp1, &
irtpthlp_dp2, &
irtpthlp_cl, &
irtpthlp_sf, &
irtpthlp_forcing, &
irtpthlp_mc
use stats_variables, only: &
iwpthlp_entermfl, & ! Variable(s)
iwpthlp_exit_mfl, &
iwpthlp_mfl_min, &
iwpthlp_mfl_max, &
iwprtp_enter_mfl, &
iwprtp_exit_mfl, &
iwprtp_mfl_min, &
iwprtp_mfl_max
use stats_variables, only: &
iwm_zm, & ! Variable
icloud_frac_zm, &
iice_supersat_frac_zm, &
ircm_zm, &
irtm_zm, &
ithlm_zm
use stats_variables, only: &
iw_1_zm, & ! Variable(s)
iw_2_zm, &
ivarnce_w_1_zm, &
ivarnce_w_2_zm, &
imixt_frac_zm
use stats_variables, only: &
isclrprtp, &
isclrp2, &
isclrpthvp, &
isclrpthlp, &
isclrprcp, &
iwpsclrp, &
iwp2sclrp, &
iwpsclrp2, &
iwpsclrprtp, &
iwpsclrpthlp, &
iwpedsclrp
use stats_variables, only: &
ia3_coef, &
iwp3_on_wp2, &
iSkw_velocity, &
igamma_Skw_fnc, &
iC6rt_Skw_fnc, &
iC6thl_Skw_fnc, &
iC7_Skw_fnc, &
iC1_Skw_fnc, &
ibrunt_vaisala_freq_sqd, &
iRichardson_num, &
ishear_sqd, &
ihydrometp2, &
iwphydrometp, &
irtphmp, &
ithlphmp, &
ihmxphmyp
use stats_variables, only: &
irtp2_from_chi
use stats_variables, only: &
ilh_rtp2_mc, &
ilh_thlp2_mc, &
ilh_wprtp_mc, &
ilh_wpthlp_mc, &
ilh_rtpthlp_mc
use stats_type_utilities, only: &
stat_assign ! Procedure
use parameters_model, only: &
hydromet_dim, & ! Variable(s)
sclr_dim, &
edsclr_dim
use array_index, only: &
hydromet_list, & ! Variable(s)
l_mix_rat_hm
implicit none
! External
intrinsic :: trim
! Input Variable
character(len= * ), dimension(nvarmax_zm), intent(in) :: vars_zm ! stats_zm variable names
! Input / Output Variable
logical, intent(inout) :: l_error
! Local Varables
integer :: tot_zm_loops
integer :: hm_idx, hmx_idx, hmy_idx
character(len=10) :: hm_type, hmx_type, hmy_type
integer :: i, j, k
character(len=50) :: sclr_idx
! The default initialization for array indices for stats_zm is zero (see module
! stats_variables)
allocate( ihydrometp2(1:hydromet_dim) )
allocate( iwphydrometp(1:hydromet_dim) )
allocate( irtphmp(1:hydromet_dim) )
allocate( ithlphmp(1:hydromet_dim) )
allocate( ihmxphmyp(1:hydromet_dim,1:hydromet_dim) )
allocate( iK_hm(1:hydromet_dim) )
ihydrometp2(:) = 0
iwphydrometp(:) = 0
irtphmp(:) = 0
ithlphmp(:) = 0
ihmxphmyp(:,:) = 0
iK_hm(:) = 0
! Allocate and then zero out passive scalar arrays on the stats_zm grid (fluxes,
! variances and other high-order moments)
allocate(isclrprtp(1:sclr_dim))
allocate(isclrp2(1:sclr_dim))
allocate(isclrpthvp(1:sclr_dim))
allocate(isclrpthlp(1:sclr_dim))
allocate(isclrprcp(1:sclr_dim))
allocate(iwpsclrp(1:sclr_dim))
allocate(iwp2sclrp(1:sclr_dim))
allocate(iwpsclrp2(1:sclr_dim))
allocate(iwpsclrprtp(1:sclr_dim))
allocate(iwpsclrpthlp(1:sclr_dim))
allocate(iwpedsclrp(1:edsclr_dim))
isclrprtp(:) = 0
isclrp2(:) = 0
isclrpthvp(:) = 0
isclrpthlp(:) = 0
isclrprcp(:) = 0
iwpsclrp(:) = 0
iwp2sclrp(:) = 0
iwpsclrp2(:) = 0
iwpsclrprtp(:) = 0
iwpsclrpthlp(:) = 0
iwpedsclrp(:) = 0
! Assign pointers for statistics variables stats_zm using stat_assign
tot_zm_loops = stats_zm%num_output_fields
if ( any( vars_zm == "hydrometp2" ) ) then
! Correct for number of variables found under "hydrometp2".
! Subtract 1 from the loop size for each hydrometeor.
tot_zm_loops = tot_zm_loops - hydromet_dim
! Add 1 for "hydrometp2" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wphydrometp" ) ) then
! Correct for number of variables found under "wphydrometp".
! Subtract 1 from the loop size for each hydrometeor.
tot_zm_loops = tot_zm_loops - hydromet_dim
! Add 1 for "wphydrometp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "rtphmp" ) ) then
! Correct for number of variables found under "rtphmp".
! Subtract 1 from the loop size for each hydrometeor.
tot_zm_loops = tot_zm_loops - hydromet_dim
! Add 1 for "rtphmp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "thlphmp" ) ) then
! Correct for number of variables found under "thlphmp".
! Subtract 1 from the loop size for each hydrometeor.
tot_zm_loops = tot_zm_loops - hydromet_dim
! Add 1 for "thlphmp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "hmxphmyp" ) ) then
! Correct for number of variables found under "hmxphmyp".
! Subtract the number of overall covariances of two hydrometeors, which
! is found by: (1/2) * hydromet_dim * ( hydromet_dim - 1 );
! from the loop size.
tot_zm_loops = tot_zm_loops - hydromet_dim * ( hydromet_dim - 1 ) / 2
! Add 1 for "hmxphmyp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "K_hm" ) ) then
! Correct for number of variables found under "K_hm".
! Subtract 1 from the loop size for each hydrometeor.
tot_zm_loops = tot_zm_loops - hydromet_dim
! Add 1 for "K_hm" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "sclrprtp" ) ) then
! Correct for number of variables found under "sclrprtp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "sclrprtp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "sclrp2" ) ) then
! Correct for number of variables found under "sclrp2".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "sclrp2" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "sclrpthvp" ) ) then
! Correct for number of variables found under "sclrpthvp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "sclrpthvp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "sclrpthlp" ) ) then
! Correct for number of variables found under "sclrpthlp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "sclrpthlp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "sclrprcp" ) ) then
! Correct for number of variables found under "sclrprcp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "sclrprcp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wpsclrp" ) ) then
! Correct for number of variables found under "wpsclrp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "wpsclrp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wpsclrp2" ) ) then
! Correct for number of variables found under "wpsclrp2".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "wpsclrp2" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wp2sclrp" ) ) then
! Correct for number of variables found under "wp2sclrp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "wp2sclrp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wpsclrprtp" ) ) then
! Correct for number of variables found under "wpsclrprtp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "wpsclrprtp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wpsclrpthlp" ) ) then
! Correct for number of variables found under "wpsclrpthlp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - sclr_dim
! Add 1 for "wpsclrpthlp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
if ( any( vars_zm == "wpedsclrp" ) ) then
! Correct for number of variables found under "wpedsclrp".
! Subtract 1 from the loop size for each scalar.
tot_zm_loops = tot_zm_loops - edsclr_dim
! Add 1 for "wpedsclrp" to the loop size.
tot_zm_loops = tot_zm_loops + 1
endif
k = 1
do i = 1, tot_zm_loops
select case ( trim( vars_zm(i) ) )
case ('wp2')
iwp2 = k
call stat_assign( var_index=iwp2, var_name="wp2", &
var_description="w'^2, Variance of vertical air velocity [m^2/s^2]", &
var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rtp2')
irtp2 = k
call stat_assign( var_index=irtp2, var_name="rtp2", &
var_description="rt'^2, Variance of rt [(kg/kg)^2]", var_units="(kg/kg)^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('thlp2')
ithlp2 = k
call stat_assign( var_index=ithlp2, var_name="thlp2", &
var_description="thl'^2, Variance of thl [K^2]", var_units="K^2", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('rtpthlp')
irtpthlp = k
call stat_assign( var_index=irtpthlp, var_name="rtpthlp", &
var_description="rt'thl', Covariance of rt and thl [(kg K)/kg]", &
var_units="(kg K)/kg", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('wprtp')
iwprtp = k
call stat_assign( var_index=iwprtp, var_name="wprtp", &
var_description="w'rt', Vertical turbulent flux of rt [(kg/kg) m/s]", &
var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('wpthlp')
iwpthlp = k
call stat_assign( var_index=iwpthlp, var_name="wpthlp", &
var_description="w'thl', Vertical turbulent flux of thl [K m/s]", &
var_units="(m K)/s", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('wp3_zm')
iwp3_zm = k
call stat_assign( var_index=iwp3_zm, var_name="wp3_zm", &
var_description="w'^3 interpolated to moment. levels [m^3/s^3]", &
var_units="(m^3)/(s^3)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('thlp3_zm')
ithlp3_zm = k
call stat_assign( var_index=ithlp3_zm, var_name="thlp3_zm", &
var_description="thl'^3 interpolated to moment. levels [K^3]", &
var_units="K^3", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rtp3_zm')
irtp3_zm = k
call stat_assign( var_index=irtp3_zm, var_name="rtp3_zm", &
var_description="rt'^3 interpolated to moment. levels [kg^3/kg^3]", &
var_units="(kg^3)/(kg^3)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('wp4')
iwp4 = k
call stat_assign( var_index=iwp4, var_name="wp4", var_description="w'^4 [m^4/s^4]", &
var_units="(m^4)/(s^4)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('wpthvp')
iwpthvp = k
call stat_assign( var_index=iwpthvp, var_name="wpthvp", &
var_description="Buoyancy flux [K m/s]", var_units="K m/s", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('rtpthvp')
irtpthvp = k
call stat_assign( var_index=irtpthvp, var_name="rtpthvp", &
var_description="rt'thv' [(kg/kg) K]", var_units="(kg/kg) K", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('thlpthvp')
ithlpthvp = k
call stat_assign( var_index=ithlpthvp, var_name="thlpthvp", &
var_description="thl'thv' [K^2]", var_units="K^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('tau_zm')
itau_zm = k
call stat_assign( var_index=itau_zm, var_name="tau_zm", &
var_description="Time-scale tau on momentum levels [s]", var_units="s", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Kh_zm')
iKh_zm = k
call stat_assign( var_index=iKh_zm, var_name="Kh_zm", &
var_description="Eddy diffusivity on momentum levels [m^2/s]", var_units="m^2/s", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('K_hm')
do hm_idx = 1, hydromet_dim, 1
hm_type = hydromet_list(hm_idx)
iK_hm(hm_idx) = k
call stat_assign( var_index=iK_hm(hm_idx), &
var_name="K_hm_"//trim( hm_type(1:2) ), &
var_description="Eddy. diff. coef. of " &
// trim(hm_type(1:2)) &
// " [m^2/s]", &
var_units="[m^2/s]", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
end do
case ('wprcp')
iwprcp = k
call stat_assign( var_index=iwprcp, var_name="wprcp", &
var_description="w' rc' [(m/s) (kg/kg)]", var_units="(m/s) (kg/kg)", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rc_coef_zm')
irc_coef_zm = k
call stat_assign( var_index=irc_coef_zm, var_name="rc_coef_zm", &
var_description="Coefficient of X'r_c' [K/(kg/kg)]", &
var_units="K/(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('thlprcp')
ithlprcp = k
call stat_assign( var_index=ithlprcp, var_name="thlprcp", &
var_description="thl' rc' [K (kg/kg)]", var_units="K (kg/kg)", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('rtprcp')
irtprcp = k
call stat_assign( var_index=irtprcp, var_name="rtprcp", &
var_description="rt'rc' [(kg^2)/(kg^2)]", var_units="(kg^2)/(kg^2)", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rcp2')
ircp2 = k
call stat_assign( var_index=ircp2, var_name="rcp2", &
var_description="rc'^2 [(kg^2)/(kg^2)]", var_units="(kg^2)/(kg^2)", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('upwp')
iupwp = k
call stat_assign( var_index=iupwp, var_name="upwp", &
var_description="u'w', Vertical east-west momentum flux [m^2/s^2]", &
var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('vpwp')
ivpwp = k
call stat_assign( var_index=ivpwp, var_name="vpwp", &
var_description="v'w', Vertical north-south momentum flux [m^2/s^2]", &
var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rho_zm')
irho_zm = k
call stat_assign( var_index=irho_zm, var_name="rho_zm", &
var_description="Density on momentum levels [kg/m^3]", var_units="kg m^{-3}", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('sigma_sqd_w')
isigma_sqd_w = k
call stat_assign( var_index=isigma_sqd_w, var_name="sigma_sqd_w", &
var_description="Nondimensionalized w variance of Gaussian component [-]", &
var_units="-", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rho_ds_zm')
irho_ds_zm = k
call stat_assign( var_index=irho_ds_zm, var_name="rho_ds_zm", &
var_description="Dry, static, base-state density [kg/m^3]", var_units="kg m^{-3}", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('thv_ds_zm')
ithv_ds_zm = k
call stat_assign( var_index=ithv_ds_zm, var_name="thv_ds_zm", &
var_description="Dry, base-state theta_v [K]", var_units="K", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('em')
iem = k
call stat_assign( var_index=iem, var_name="em", &
var_description="Turbulent kinetic energy, usu. 0.5*(u'^2+v'^2+w'^2) [m^2/s^2]", &
var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('shear') ! Brian
ishear = k
call stat_assign( var_index=ishear, var_name="shear", &
var_description="Wind shear production term [m^2/s^3]", var_units="m^2/s^3", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('mean_w_up')
imean_w_up = k
call stat_assign( var_index=imean_w_up, var_name="mean_w_up", &
var_description="Mean w >= w_ref [m/s]", var_units="m/s", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('mean_w_down')
imean_w_down = k
call stat_assign( var_index=imean_w_down, var_name="mean_w_down", &
var_description="Mean w <= w_ref [m/s]", var_units="m/s", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('Frad')
iFrad = k
call stat_assign( var_index=iFrad, var_name="Frad", &
var_description="Total (sw+lw) net (up+down) radiative flux [W/m^2]", &
var_units="W/m^2", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_LW') ! Brian
iFrad_LW = k
call stat_assign( var_index=iFrad_LW, var_name="Frad_LW", &
var_description="Net long-wave radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_SW') ! Brian
iFrad_SW = k
call stat_assign( var_index=iFrad_SW, var_name="Frad_SW", &
var_description="Net short-wave radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_LW_up') ! Brian
iFrad_LW_up = k
call stat_assign( var_index=iFrad_LW_up, var_name="Frad_LW_up", &
var_description="Long-wave upwelling radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_SW_up') ! Brian
iFrad_SW_up = k
call stat_assign( var_index=iFrad_SW_up, var_name="Frad_SW_up", &
var_description="Short-wave upwelling radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_LW_down') ! Brian
iFrad_LW_down = k
call stat_assign( var_index=iFrad_LW_down, var_name="Frad_LW_down", &
var_description="Long-wave downwelling radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Frad_SW_down') ! Brian
iFrad_SW_down = k
call stat_assign( var_index=iFrad_SW_down, var_name="Frad_SW_down", &
var_description="Short-wave downwelling radiative flux [W/m^2]", var_units="W/m^2", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('Fprec') ! Brian
iFprec = k
call stat_assign( var_index=iFprec, var_name="Fprec", &
var_description="Rain flux [W/m^2]", var_units="W/m^2", l_silhs=.false., &
grid_kind=stats_zm )
k = k + 1
case ('Fcsed') ! Brian
iFcsed = k
call stat_assign( var_index=iFcsed, var_name="Fcsed", &
var_description="cloud water sedimentation flux [kg/(s*m^2)]", &
var_units="kg/(s*m^2)", l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case('hydrometp2')
do hm_idx = 1, hydromet_dim, 1
hm_type = hydromet_list(hm_idx)
! The overall variance of the hydrometeor.
ihydrometp2(hm_idx) = k
if ( l_mix_rat_hm(hm_idx) ) then
call stat_assign( var_index=ihydrometp2(hm_idx), &
var_name=trim( hm_type(1:2) )//"p2", &
var_description="<" &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// "'^2> [(kg/kg)^2]", &
var_units="(kg/kg)^2", &
l_silhs=.false., grid_kind=stats_zm )
else ! Concentration
call stat_assign( var_index=ihydrometp2(hm_idx), &
var_name=trim( hm_type(1:2) )//"p2", &
var_description="<" &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// "'^2> [(num/kg)^2]", &
var_units="(num/kg)^2", &
l_silhs=.false., grid_kind=stats_zm )
endif ! l_mix_rat_hm(hm_idx)
k = k + 1
enddo ! hm_idx = 1, hydromet_dim, 1
case ('wphydrometp')
do hm_idx = 1, hydromet_dim, 1
hm_type = hydromet_list(hm_idx)
iwphydrometp(hm_idx) = k
if ( l_mix_rat_hm(hm_idx) ) then
call stat_assign( var_index=iwphydrometp(hm_idx), &
var_name="wp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of w and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [(m/s) kg/kg]", &
var_units="(m/s) kg/kg", &
l_silhs=.false., grid_kind=stats_zm )
else ! Concentration
call stat_assign( var_index=iwphydrometp(hm_idx), &
var_name="wp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of w and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [(m/s) num/kg]", &
var_units="(m/s) num/kg", &
l_silhs=.false., grid_kind=stats_zm )
endif ! l_mix_rat_hm(hm_idx)
k = k + 1
enddo ! hm_idx = 1, hydromet_dim, 1
case ('wpNcp')
iwpNcp = k
call stat_assign( var_index=iwpNcp, var_name="wpNcp", &
var_description="Covariance of w and " &
// "N_c [(m/s) num/kg]", &
var_units="(m/s) num/kg", &
l_silhs=.false., grid_kind=stats_zm )
k = k + 1
case ('rtphmp')
do hm_idx = 1, hydromet_dim, 1
hm_type = hydromet_list(hm_idx)
irtphmp(hm_idx) = k
if ( l_mix_rat_hm(hm_idx) ) then
call stat_assign( var_index=irtphmp(hm_idx), &
var_name="rtp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of r_t and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [kg^2/kg^2]", &
var_units="kg^2/kg^2", &
l_silhs=.false., grid_kind=stats_zm )
else ! Concentration
call stat_assign( var_index=irtphmp(hm_idx), &
var_name="rtp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of r_t and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [(kg/kg) num/kg]", &
var_units="(kg/kg) num/kg", &
l_silhs=.false., grid_kind=stats_zm )
endif ! l_mix_rat_hm(hm_idx)
k = k + 1
enddo ! hm_idx = 1, hydromet_dim, 1
case ('thlphmp')
do hm_idx = 1, hydromet_dim, 1
hm_type = hydromet_list(hm_idx)
ithlphmp(hm_idx) = k
if ( l_mix_rat_hm(hm_idx) ) then
call stat_assign( var_index=ithlphmp(hm_idx), &
var_name="thlp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of th_l and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [K kg/kg]", &
var_units="K kg/kg", &
l_silhs=.false., grid_kind=stats_zm )
else ! Concentration
call stat_assign( var_index=ithlphmp(hm_idx), &
var_name="thlp"//trim( hm_type(1:2) )//"p", &
var_description="Covariance of th_l and " &
// hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
// " [K num/kg]", &
var_units="K num/kg", &
l_silhs=.false., grid_kind=stats_zm )
endif ! l_mix_rat_hm(hm_idx)
k = k + 1
enddo ! hm_idx = 1, hydromet_dim, 1
case ('hmxphmyp')
do hmx_idx = 1, hydromet_dim, 1
hmx_type = hydromet_list(hmx_idx)
do hmy_idx = hmx_idx+1, hydromet_dim, 1
hmy_type = hydromet_list(hmy_idx)
! The covariance (overall) of hmx and hmy.
ihmxphmyp(hmy_idx,hmx_idx) = k
if ( l_mix_rat_hm(hmx_idx) .and. l_mix_rat_hm(hmy_idx) ) then
! Both hydrometeors are mixing ratios.
call stat_assign( var_index=ihmxphmyp(hmy_idx,hmx_idx), &
var_name=trim( hmx_type(1:2) )//"p" &
// trim( hmy_type(1:2) )//"p", &
var_description="Covariance of " &