-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrm_physics.F90
2495 lines (2194 loc) · 129 KB
/
crm_physics.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
#define CBRAIN
module crm_physics
!-----------------------------------------------------------------------
! Purpose:
!
! Provides the CAM interface to the crm code.
!
! Revision history:
! June, 2009, Minghuai Wang:
! crm_physics_tend
! July, 2009, Minghuai Wang: m2005_effradius
!
!---------------------------------------------------------------------------
use shr_kind_mod, only: r8 => shr_kind_r8
use ppgrid, only: pcols, pver, pverp
#ifdef CRM
use cam_abortutils, only: endrun
use physics_types, only: physics_state, physics_tend
use constituents, only: cnst_add, cnst_get_ind, cnst_set_spec_class, cnst_spec_class_cldphysics, &
cnst_spec_class_gas, cnst_name, cnst_longname, sflxnam, apcnst, bpcnst, pcnst
#ifdef m2005
use module_ecpp_ppdriver2, only: papampollu_init
use crmx_ecppvars, only: NCLASS_CL,ncls_ecpp_in,NCLASS_PR
#endif
implicit none
private
save
character(len=2) :: spcam_direction='NS' ! SPCAM 2D orientation
public :: crm_physics_tend, crm_physics_register, crm_physics_init
public :: crm_implements_cnst, crm_init_cnst
public :: m2005_effradius
integer :: crm_u_idx, crm_v_idx, crm_w_idx, crm_t_idx
integer :: crm_qt_idx, crm_nc_idx, crm_qr_idx, crm_nr_idx, crm_qi_idx, crm_ni_idx
integer :: crm_qs_idx, crm_ns_idx, crm_qg_idx, crm_ng_idx, crm_qc_idx, crm_qp_idx, crm_qn_idx
integer :: crm_t_rad_idx, crm_qv_rad_idx, crm_qc_rad_idx, crm_qi_rad_idx, crm_cld_rad_idx
integer :: crm_nc_rad_idx, crm_ni_rad_idx, crm_qs_rad_idx, crm_ns_rad_idx, crm_qrad_idx
integer :: crm_qaerwat_idx, crm_dgnumwet_idx
integer :: prec_dp_idx, snow_dp_idx, prec_sh_idx, snow_sh_idx
integer :: prec_sed_idx, snow_sed_idx, prec_pcw_idx, snow_pcw_idx
integer :: cldo_idx, cld_idx, cldtop_idx
integer :: rei_idx, rel_idx, rprdtot_idx, nevapr_idx, prain_idx
integer :: wsedl_idx, dei_idx, des_idx, mu_idx, lambdac_idx
integer :: rate1_cw2pr_st_idx
integer :: qme_idx, icwmrdp_idx, rprddp_idx, icwmrsh_idx, rprdsh_idx
integer :: nevapr_shcu_idx, nevapr_dpcu_idx, ast_idx
integer :: fice_idx,acldy_cen_idx, cmfmc_sh_idx
integer :: clubb_buffer_idx, tk_crm_idx, tke_idx, kvm_idx, kvh_idx, pblh_idx, tpert_idx
integer :: sh_frac_idx, dp_frac_idx
integer :: &
ixcldliq, &! cloud liquid amount index
ixcldice, &! cloud ice amount index
ixnumliq, &! cloud liquid number index
ixnumice ! cloud ice water index
integer :: nmodes
integer, parameter :: ncnst = 4 ! Number of constituents
integer :: ncnst_use
character(len=8), parameter :: & ! Constituent names
cnst_names(ncnst) = (/'CLDLIQ', 'CLDICE','NUMLIQ','NUMICE'/)
logical :: use_spcam, prog_modal_aero, do_clubb_sgs
logical :: is_spcam_m2005, is_spcam_sam1mom
integer :: crm_nx_ny
#endif
!========================================================================================================
contains
!========================================================================================================
!---------------------------------------------------------------------------------------------------------
subroutine crm_physics_register()
#ifdef CRM
!-------------------------------------------------------------------------------------------------------
!
! Purpose: add necessary fileds into physics buffer
!
!--------------------------------------------------------------------------------------------------------
use spmd_utils, only: masterproc
use physconst, only: mwdry, cpair
use physics_buffer, only: dyn_time_lvls, pbuf_add_field, dtype_r8
use phys_control, only: phys_getopts, cam_physpkg_is
use crmdims, only: crm_nx, crm_ny, crm_nz, crm_dx, crm_dy, crm_dt, nclubbvars
use cam_history_support,only: add_hist_coord
use crmx_setparm_mod, only: setparm
use rad_constituents, only: rad_cnst_get_info
is_spcam_m2005 = cam_physpkg_is('spcam_m2005')
is_spcam_sam1mom = cam_physpkg_is('spcam_sam1mom')
call phys_getopts( use_spcam_out = use_spcam)
call phys_getopts( prog_modal_aero_out = prog_modal_aero)
call phys_getopts( do_clubb_sgs_out = do_clubb_sgs)
call rad_cnst_get_info(0, nmodes=nmodes)
! Register microphysics constituents and save indices.
ncnst_use = 2
call cnst_add(cnst_names(1), mwdry, cpair, 0._r8, ixcldliq, &
longname='Grid box averaged cloud liquid amount', is_convtran1=.true.)
call cnst_add(cnst_names(2), mwdry, cpair, 0._r8, ixcldice, &
longname='Grid box averaged cloud ice amount', is_convtran1=.true.)
if (is_spcam_m2005) then
call cnst_add(cnst_names(3), mwdry, cpair, 0._r8, ixnumliq, &
longname='Grid box averaged cloud liquid number', is_convtran1=.false.)
call cnst_add(cnst_names(4), mwdry, cpair, 0._r8, ixnumice, &
longname='Grid box averaged cloud ice number', is_convtran1=.false.)
ncnst_use = 4
end if
if(masterproc) then
print*,'_________________________________________'
print*,'_ Super-parameterization run ____________'
print*,'crm_nx=',crm_nx,' crm_ny=',crm_ny,' crm_nz=',crm_nz
print*,'crm_dx=',crm_dx,' crm_dy=',crm_dy,' crm_dt=',crm_dt
if (is_spcam_sam1mom) print*,'Microphysics: SAM1MOM'
if (is_spcam_m2005) print*,'Microphysics: M2005'
print*,'_________________________________________'
end if
if (do_clubb_sgs) then
call pbuf_add_field('CLUBB_BUFFER','global', dtype_r8, (/pcols,crm_nx,crm_ny,crm_nz+1,nclubbvars/), clubb_buffer_idx)
call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx)
call pbuf_add_field('kvm', 'global', dtype_r8, (/pcols, pverp/), kvm_idx)
call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx)
call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols, pverp/), pblh_idx)
call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols, pverp/), tpert_idx)
end if
call setparm()
call pbuf_add_field('CRM_U', 'global', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_u_idx)
call pbuf_add_field('CRM_V', 'global', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_v_idx)
call pbuf_add_field('CRM_W', 'global', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_w_idx)
call pbuf_add_field('CRM_T', 'global', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_t_idx)
call pbuf_add_field('CLDO', 'global', dtype_r8, (/pcols, pver, dyn_time_lvls/), cldo_idx)
call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols, pver, dyn_time_lvls/), cld_idx)
call pbuf_add_field('AST', 'global', dtype_r8, (/pcols, pver, dyn_time_lvls/), ast_idx)
call pbuf_add_field('CRM_T_RAD', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_t_rad_idx)
call pbuf_add_field('CRM_QV_RAD', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_qv_rad_idx)
call pbuf_add_field('CRM_QC_RAD', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_qc_rad_idx)
call pbuf_add_field('CRM_QI_RAD', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_qi_rad_idx)
call pbuf_add_field('CRM_CLD_RAD', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_cld_rad_idx)
call pbuf_add_field('CRM_QRAD', 'global', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz/), crm_qrad_idx)
call pbuf_add_field('PREC_DP', 'physpkg', dtype_r8, (/pcols/), prec_dp_idx)
call pbuf_add_field('SNOW_DP', 'physpkg', dtype_r8, (/pcols/), snow_dp_idx)
call pbuf_add_field('PREC_SH', 'physpkg', dtype_r8, (/pcols/), prec_sh_idx)
call pbuf_add_field('SNOW_SH', 'physpkg', dtype_r8, (/pcols/), snow_sh_idx)
call pbuf_add_field('PREC_SED', 'physpkg', dtype_r8, (/pcols/), prec_sed_idx)
call pbuf_add_field('SNOW_SED', 'physpkg', dtype_r8, (/pcols/), snow_sed_idx)
call pbuf_add_field('PREC_PCW', 'physpkg', dtype_r8, (/pcols/), prec_pcw_idx)
call pbuf_add_field('SNOW_PCW', 'physpkg', dtype_r8, (/pcols/), snow_pcw_idx)
call pbuf_add_field('CLDTOP', 'physpkg', dtype_r8, (/pcols,1/), cldtop_idx )
call pbuf_add_field('RPRDTOT', 'physpkg' ,dtype_r8, (/pcols,pver/), rprdtot_idx )
call pbuf_add_field('ICWMRSH', 'physpkg' ,dtype_r8, (/pcols,pver/), icwmrsh_idx )
call pbuf_add_field('RPRDSH', 'physpkg' ,dtype_r8, (/pcols,pver/), rprdsh_idx )
call pbuf_add_field('NEVAPR_SHCU', 'physpkg' ,dtype_r8, (/pcols,pver/), nevapr_shcu_idx )
call pbuf_add_field('ICWMRDP', 'physpkg', dtype_r8, (/pcols,pver/), icwmrdp_idx)
call pbuf_add_field('RPRDDP', 'physpkg', dtype_r8, (/pcols,pver/), rprddp_idx)
call pbuf_add_field('NEVAPR_DPCU', 'physpkg', dtype_r8, (/pcols,pver/), nevapr_dpcu_idx)
call pbuf_add_field('REI', 'physpkg', dtype_r8, (/pcols,pver/), rei_idx)
call pbuf_add_field('REL', 'physpkg', dtype_r8, (/pcols,pver/), rel_idx)
call pbuf_add_field('NEVAPR', 'physpkg', dtype_r8, (/pcols,pver/), nevapr_idx)
call pbuf_add_field('PRAIN', 'physpkg', dtype_r8, (/pcols,pver/), prain_idx)
call pbuf_add_field('WSEDL', 'physpkg', dtype_r8, (/pcols,pver/), wsedl_idx)
call pbuf_add_field('QME', 'physpkg', dtype_r8, (/pcols,pver/), qme_idx)
call pbuf_add_field('DEI', 'physpkg', dtype_r8, (/pcols,pver/), dei_idx)
call pbuf_add_field('DES', 'physpkg', dtype_r8, (/pcols,pver/), des_idx)
call pbuf_add_field('MU', 'physpkg', dtype_r8, (/pcols,pver/), mu_idx)
call pbuf_add_field('LAMBDAC', 'physpkg', dtype_r8, (/pcols,pver/), lambdac_idx)
call pbuf_add_field('CMFMC_SH', 'physpkg' ,dtype_r8, (/pcols,pverp/), cmfmc_sh_idx )
call pbuf_add_field('FICE', 'physpkg', dtype_r8, (/pcols,pver/), fice_idx)
if (prog_modal_aero) then
call pbuf_add_field('RATE1_CW2PR_ST','physpkg', dtype_r8, (/pcols,pver/), rate1_cw2pr_st_idx)
call pbuf_add_field('CRM_QAERWAT', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz, nmodes/), crm_qaerwat_idx)
call pbuf_add_field('CRM_DGNUMWET', 'physpkg', dtype_r8, (/pcols,crm_nx, crm_ny, crm_nz, nmodes/), crm_dgnumwet_idx)
endif
if (is_spcam_m2005) then
call pbuf_add_field('CRM_NC_RAD', 'physpkg', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_nc_rad_idx)
call pbuf_add_field('CRM_NI_RAD', 'physpkg', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_ni_rad_idx)
call pbuf_add_field('CRM_QS_RAD', 'physpkg', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qs_rad_idx)
call pbuf_add_field('CRM_NS_RAD', 'physpkg', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_ns_rad_idx)
! Fields for crm_micro array
call pbuf_add_field('CRM_QT', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qt_idx)
call pbuf_add_field('CRM_NC', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_nc_idx)
call pbuf_add_field('CRM_QR', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qr_idx)
call pbuf_add_field('CRM_NR', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_nr_idx)
call pbuf_add_field('CRM_QI', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qi_idx)
call pbuf_add_field('CRM_NI', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_ni_idx)
call pbuf_add_field('CRM_QS', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qs_idx)
call pbuf_add_field('CRM_NS', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_ns_idx)
call pbuf_add_field('CRM_QG', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qg_idx)
call pbuf_add_field('CRM_NG', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_ng_idx)
call pbuf_add_field('CRM_QC', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qc_idx)
else
call pbuf_add_field('CRM_QT', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qt_idx)
call pbuf_add_field('CRM_QP', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qp_idx)
call pbuf_add_field('CRM_QN', 'global', dtype_r8, (/pcols, crm_nx, crm_ny, crm_nz/), crm_qn_idx)
endif
if (is_spcam_m2005) then
call pbuf_add_field('TK_CRM', 'global', dtype_r8, (/pcols, pver/), tk_crm_idx)
! total (all sub-classes) cloudy fractional area in previous time step
call pbuf_add_field('ACLDY_CEN', 'global', dtype_r8, (/pcols,pver/), acldy_cen_idx)
endif
! Adding crm dimensions to cam history
call add_hist_coord('crm_nx' ,crm_nx, 'CRM NX')
call add_hist_coord('crm_ny' ,crm_ny, 'CRM NY')
call add_hist_coord('crm_nz' ,crm_nz, 'CRM NZ')
call add_hist_coord('crm_z1' ,crm_nz+1,'CRM_Z1')
call add_hist_coord('pverp' ,pverp, 'pverp ')
call add_hist_coord('pver' ,pver, 'pver ')
! ifdef needed because of NCLASS_CL
#ifdef m2005
call add_hist_coord('NCLASS_CL' ,NCLASS_CL,'NCLASS_CL')
call add_hist_coord('ncls_ecpp_in' ,ncls_ecpp_in,'ncls_ecpp_in')
call add_hist_coord('NCLASS_PR' ,NCLASS_PR,'NCLASS_PR')
#endif
#endif
end subroutine crm_physics_register
!=========================================================================================================
subroutine crm_physics_init(pbuf2d)
!-------------------------------------------------------------------------------------------------------
!
! Purpose: initialize some variables, and add necessary fileds into output fields
!
!--------------------------------------------------------------------------------------------------------
use physics_buffer, only: physics_buffer_desc, pbuf_set_field, pbuf_get_index
#ifdef CRM
use physconst, only: tmelt, cpair, rh2o, latvap, latice
use constituents, only: pcnst, cnst_species_class, cnst_spec_class_gas
use cam_history, only: addfld, add_default, horiz_only
use crmdims, only: crm_nx, crm_ny, crm_nz
use ndrop, only: ndrop_init
use gas_wetdep_opts, only: gas_wetdep_method
use micro_mg_utils, only: micro_mg_utils_init
use time_manager, only: is_first_step
use cam_history, only: fieldname_len
#ifdef MODAL_AERO
use modal_aero_data, only: cnst_name_cw, ntot_amode, &
lmassptr_amode, lmassptrcw_amode, &
nspec_amode, numptr_amode, numptrcw_amode
#endif
#endif
type(physics_buffer_desc), pointer :: pbuf2d(:,:)
#ifdef CRM
integer :: l, lphase, lspec
character(len=fieldname_len+3) :: fieldname
character(128) :: long_name
character(8) :: unit
! local variables
integer :: i, m, mm
integer :: icldphy ! index for cloud physic species (water vapor and cloud hydrometers)
character(len=128):: errstring ! return status (non-blank for error return)
crm_nx_ny = crm_nx*crm_ny
!-------------------------
! Make sure gas_wetdep_method is set to 'MOZ' as 'NEU' is not currently supported by SPCAM
! 'MOZ' for spcam_sam1mom
! 'OFF' for spcam_m2005
if (is_spcam_sam1mom) then
if (gas_wetdep_method /= 'MOZ') call endrun( "crm_physics: gas_wetdep_method must be set to 'MOZ' ")
elseif (is_spcam_m2005) then
if (gas_wetdep_method /= 'OFF') call endrun( "crm_physics: gas_wetdep_method must be set to 'OFF' ")
else
call endrun( "crm_physics: don't know how gas_wetdep_method should be set")
endif
!-------------------------
! Initialize the micro_mg_utils
! Value of dcs in MG 1.0 is 400.e-6_r8
call micro_mg_utils_init(r8, rh2o, cpair, tmelt, latvap, latice, 400.e-6_r8, errstring)
!-------------------------
! Register general history fields
do m = 1, ncnst_use
call cnst_get_ind(cnst_names(m), mm)
if ( any(mm == (/ ixcldliq, ixcldice /)) ) then
! mass mixing ratios
call addfld(cnst_name(mm), (/ 'lev' /), 'A', 'kg/kg ', cnst_longname(mm))
call addfld(sflxnam(mm), horiz_only, 'A', 'kg/m2/s ', trim(cnst_name(mm))//' surface flux')
else if ( any(mm == (/ ixnumliq, ixnumice /)) ) then
! number concentrations
call addfld(cnst_name(mm), (/ 'lev' /), 'A', '1/kg ', cnst_longname(mm))
call addfld(sflxnam(mm), horiz_only, 'A', '1/m2/s ', trim(cnst_name(mm))//' surface flux')
else
call endrun( "crm_physics: Could not call addfld for constituent with unknown units.")
endif
end do
do m=1, pcnst
if(cnst_name(m) == 'DMS') then
call addfld('DMSCONV', (/ 'lev' /), 'A', 'kg/kg/s', 'DMS tendency from ZM convection')
end if
if(cnst_name(m) == 'SO2') then
call addfld('SO2CONV', (/ 'lev' /), 'A', 'kg/kg/s', 'SO2 tendency from ZM convection')
end if
end do
call addfld ('CRM_TK', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'm^2/s', 'Eddy viscosity from CRM')
call addfld ('CRM_TKH', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'm^2/s', 'Eddy viscosity from CRM')
call addfld ('SPCLD3D ', (/ 'lev' /), 'A', 'fraction', 'cloud fraction on GCM grids')
call addfld ('MU_CRM ', (/ 'lev' /), 'A', 'Pa/s', 'mass flux up from CRM')
call addfld ('MD_CRM ', (/ 'lev' /), 'A', 'Pa/s', 'mass flux down from CRM')
call addfld ('DU_CRM ', (/ 'lev' /), 'A', '/s', 'detrainment from updraft from CRM')
call addfld ('EU_CRM ', (/ 'lev' /), 'A', '/s', 'entraiment rate from updraft')
call addfld ('ED_CRM ', (/ 'lev' /), 'A', '/s', 'entraiment rate from downdraft')
call addfld ('SPQRL ', (/ 'lev' /), 'A', 'K/s', 'long-wave heating rate')
call addfld ('SPQRS ', (/ 'lev' /), 'A', 'K/s', 'short-wave heating rate')
call addfld ('LENGC ', (/ 'ilev' /), 'A', 'm ', 'Mixing length scale for the calcuation of vertical difusivity')
call addfld ('SPKVH ',(/ 'ilev' /), 'A', 'm2/s ', 'Vertical diffusivity used in dropmixnuc in the MMF call')
call addfld ('SPLCLOUD ',(/ 'lev' /), 'A', ' ', 'Liquid cloud fraction')
call add_default ('SPKVH ', 1, ' ')
call add_default ('SPLCLOUD ', 1, ' ')
call addfld ('SPCLDTOT', horiz_only, 'A', 'fraction', 'Vertically-integrated total cloud from CRM' )
call addfld ('SPCLDLOW', horiz_only, 'A', 'fraction', 'Vertically-integrated low cloud from CRM' )
call addfld ('SPCLDMED', horiz_only, 'A', 'fraction', 'Vertically-integrated mid-level cloud from CRM' )
call addfld ('SPCLDHGH', horiz_only, 'A', 'fraction', 'Vertically-integrated high cloud from CRM' )
call add_default ('SPCLDTOT', 1, ' ')
call add_default ('SPCLDLOW', 1, ' ')
call add_default ('SPCLDMED', 1, ' ')
call add_default ('SPCLDHGH', 1, ' ')
call addfld(apcnst(ixcldliq), (/ 'lev' /), 'A', 'kg/kg ', trim(cnst_name(ixcldliq))//' after physics' )
call addfld(bpcnst(ixcldliq), (/ 'lev' /), 'A', 'kg/kg ', trim(cnst_name(ixcldliq))//' before physics' )
call addfld(apcnst(ixcldice), (/ 'lev' /), 'A', 'kg/kg ', trim(cnst_name(ixcldice))//' after physics' )
call addfld(bpcnst(ixcldice), (/ 'lev' /), 'A', 'kg/kg ', trim(cnst_name(ixcldice))//' before physics' )
#ifdef CBRAIN
call addfld ('NN_BP2BC_DT',(/ 'lev' /), 'A', 'K ','T increment due to NN BP-->BC' )
call addfld ('NN_BP2BC_DQ',(/ 'lev' /), 'A', 'kg/kg ','Q increment due to NN BP-->BC' )
call addfld ('NN_BP2BC_DQC',(/ 'lev' /), 'A', 'kg/kg','QC increment due to NN BP-->BC' )
call addfld ('NN_BP2BC_DQI',(/ 'lev' /), 'A', 'kg/kg','QI increment due to NN BP-->BC' )
call addfld ('SP_BP2BC_DT',(/ 'lev' /), 'A', 'K ','T increment due to SP BP-->BC' )
call addfld ('SP_BP2BC_DQ',(/ 'lev' /), 'A', 'kg/kg ','Q increment due to SP BP-->BC' )
call addfld ('SP_BP2BC_DQC',(/ 'lev' /), 'A', 'kg/kg ','QC increment due to SP BP-->BC' )
call addfld ('SP_BP2BC_DQI',(/ 'lev' /), 'A', 'kg/kg ','QI increment due to SP BP-->BC' )
#endif
call addfld ('PRES ',(/ 'lev' /), 'A', 'Pa ','Pressure' )
call addfld ('DPRES ',(/ 'lev' /), 'A', 'Pa ','Pressure thickness of layer' )
call addfld ('SPDT ',(/ 'lev' /), 'A', 'K/s ','T tendency due to CRM' )
call addfld ('SPDQ ',(/ 'lev' /), 'A', 'kg/kg/s ','Q tendency due to CRM' )
call addfld ('SPDQC ',(/ 'lev' /), 'A', 'kg/kg/s ','QC tendency due to CRM' )
call addfld ('SPDQI ',(/ 'lev' /), 'A', 'kg/kg/s ','QI tendency due to CRM' )
call addfld ('SPMC ',(/ 'lev' /), 'A', 'kg/m2/s ','Total mass flux from CRM' )
call addfld ('SPMCUP ',(/ 'lev' /), 'A', 'kg/m2/s ','Updraft mass flux from CRM' )
call addfld ('SPMCDN ',(/ 'lev' /), 'A', 'kg/m2/s ','Downdraft mass flux from CRM' )
call addfld ('SPMCUUP ',(/ 'lev' /), 'A', 'kg/m2/s ','Unsaturated updraft mass flux from CRM' )
call addfld ('SPMCUDN ',(/ 'lev' /), 'A', 'kg/m2/s ','Unsaturated downdraft mass flux from CRM')
call addfld ('SPQC ',(/ 'lev' /), 'A', 'kg/kg ','Cloud water from CRM' )
call addfld ('SPQI ',(/ 'lev' /), 'A', 'kg/kg ','Cloud ice from CRM' )
call addfld ('SPQS ',(/ 'lev' /), 'A', 'kg/kg ','Snow from CRM' )
call addfld ('SPQG ',(/ 'lev' /), 'A', 'kg/kg ','Graupel from CRM' )
call addfld ('SPQR ',(/ 'lev' /), 'A', 'kg/kg ','Rain from CRM' )
call addfld ('SPQTFLX ',(/ 'lev' /), 'A', 'kg/m2/s ','Nonprecip. water flux from CRM' )
call addfld ('SPUFLX ',(/ 'lev' /), 'A', 'm2/s2 ','x-momentum flux from CRM' )
call addfld ('SPVFLX ',(/ 'lev' /), 'A', 'm2/s2 ','y-momentum flux from CRM' )
call addfld ('SPQTFLXS',(/ 'lev' /), 'A', 'kg/m2/s ','SGS Nonprecip. water flux from CRM' )
call addfld ('SPTKE ',(/ 'lev' /), 'A', 'kg/m/s2 ','Total TKE in CRM' )
call addfld ('SPTKES ',(/ 'lev' /), 'A', 'kg/m/s2 ','SGS TKE in CRM' )
call addfld ('SPTK ',(/ 'lev' /), 'A', 'm2/s ','SGS TK in CRM' )
call addfld ('SPQPFLX ',(/ 'lev' /), 'A', 'kg/m2/s ','Precip. water flux from CRM' )
call addfld ('SPPFLX ',(/ 'lev' /), 'A', 'm/s ','Precipitation flux from CRM' )
call addfld ('SPQTLS ',(/ 'lev' /), 'A', 'kg/kg/s ','L.S. Vapor Tendency from CRM' )
call addfld ('SPQTTR ',(/ 'lev' /), 'A', 'kg/kg/s ','Nonprec. water transport from CRM' )
call addfld ('SPQPTR ',(/ 'lev' /), 'A', 'kg/kg/s ','Prec. water transport from CRM' )
call addfld ('SPQPEVP ',(/ 'lev' /), 'A', 'kg/kg/s ','Prec. water evaporation from CRM' )
call addfld ('SPQPFALL',(/ 'lev' /), 'A', 'kg/kg/s ','Prec. water fall-out from CRM' )
call addfld ('SPQPSRC ',(/ 'lev' /), 'A', 'kg/kg/s ','Prec. water source from CRM' )
call addfld ('SPTLS ',(/ 'lev' /), 'A', 'kg/kg/s ','L.S. LIWSE Tendency from CRM' )
call addfld ('TIMINGF ', horiz_only, 'A', ' ','CRM CPU usage efficiency: 1 - ideal' )
call addfld ('CLOUDTOP',(/ 'lev' /), 'A', ' ','Cloud Top PDF' )
!-------------------------
! Register m2005 history fields
if (is_spcam_m2005) then
call addfld ('SPNC ',(/ 'lev' /), 'A', '/kg ','Cloud water dropet number from CRM')
call addfld ('SPNI ',(/ 'lev' /), 'A', '/kg ','Cloud ice crystal number from CRM')
call addfld ('SPNS ',(/ 'lev' /), 'A', '/kg ','Snow particle number from CRM')
call addfld ('SPNG ',(/ 'lev' /), 'A', '/kg ','Graupel particle number from CRM')
call addfld ('SPNR ',(/ 'lev' /), 'A', '/kg ','Rain particle number from CRM')
call add_default ('SPNC ', 1, ' ')
call add_default ('SPNI ', 1, ' ')
call add_default ('SPNS ', 1, ' ')
call add_default ('SPNG ', 1, ' ')
call add_default ('SPNR ', 1, ' ')
call addfld ('CRM_FLIQ ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '1 ','Frequency of Occurrence of Liquid' )
call addfld ('CRM_FICE ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '1 ','Frequency of Occurrence of Ice' )
call addfld ('CRM_FRAIN',(/'crm_nx','crm_ny','crm_nz'/), 'A', '1 ','Frequency of Occurrence of Rain' )
call addfld ('CRM_FSNOW',(/'crm_nx','crm_ny','crm_nz'/), 'A', '1 ','Frequency of Occurrence of Snow' )
call addfld ('CRM_FGRAP',(/'crm_nx','crm_ny','crm_nz'/), 'A', '1 ','Frequency of Occurrence of Graupel' )
call addfld ('CRM_QS ',(/'crm_nx','crm_ny','crm_nz'/), 'A', 'kg/kg ','Snow mixing ratio from CRM' )
call addfld ('CRM_QG ',(/'crm_nx','crm_ny','crm_nz'/), 'A', 'kg/kg ','Graupel mixing ratio from CRM' )
call addfld ('CRM_QR ',(/'crm_nx','crm_ny','crm_nz'/), 'A', 'kg/kg ','Rain mixing ratio from CRM' )
call addfld ('CRM_NC ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/kg ','Cloud water dropet number from CRM' )
call addfld ('CRM_NI ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/kg ','Cloud ice crystal number from CRM' )
call addfld ('CRM_NS ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/kg ','Snow particle number from CRM' )
call addfld ('CRM_NG ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/kg ','Graupel particle number from CRM' )
call addfld ('CRM_NR ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/kg ','Rain particle number from CRM' )
! below is for *instantaneous* crm output
call addfld ('CRM_AUT ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Autoconversion cloud waterfrom CRM' )
call addfld ('CRM_ACC ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Accretion cloud water from CRM' )
call addfld ('CRM_EVPC ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Evaporation cloud water from CRM' )
call addfld ('CRM_EVPR ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Evaporation rain from CRM' )
call addfld ('CRM_MLT ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Melting ice snow graupel from CRM' )
call addfld ('CRM_SUB ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Sublimation ice snow graupel from CRM' )
call addfld ('CRM_DEP ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Deposition ice snow graupel from CRM' )
call addfld ('CRM_CON ',(/'crm_nx','crm_ny','crm_nz'/), 'A', '/s ','Condensation cloud water from CRM' )
! below is for *gcm-grid and time-step-avg* process output
call addfld ('A_AUT ',(/ 'lev' /), 'A', '/s ','Avg autoconversion cloud water from CRM' )
call addfld ('A_ACC ',(/ 'lev' /), 'A', '/s ','Avg accretion cloud water from CRM' )
call addfld ('A_EVPC ',(/ 'lev' /), 'A', '/s ','Avg evaporation cloud water from CRM' )
call addfld ('A_EVPR ',(/ 'lev' /), 'A', '/s ','Avg evaporation rain from CRM' )
call addfld ('A_MLT ',(/ 'lev' /), 'A', '/s ','Avg melting ice snow graupel from CRM' )
call addfld ('A_SUB ',(/ 'lev' /), 'A', '/s ','Avg sublimation ice snow graupel from CRM' )
call addfld ('A_DEP ',(/ 'lev' /), 'A', '/s ','Avg deposition ice snow graupel from CRM' )
call addfld ('A_CON ',(/ 'lev' /), 'A', '/s ','Avg condensation cloud water from CRM' )
call addfld ('CRM_REL ', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', 'cloud scale droplet effective radius')
call addfld ('CRM_REI ', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', 'cloud scale ice crystal effective radius')
call addfld ('CRM_DEI ', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', 'cloud scale Mitchell ice effective diameter')
call addfld ('CRM_DES ', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', 'cloud scale snow effective diameter')
call addfld ('CRM_MU ', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', &
'cloud scale droplet size distribution shape parameter for radiation')
call addfld ('CRM_LAMBDA',(/'crm_nx','crm_ny','crm_nz'/), 'A', 'micrometers', &
'cloud scale slope of droplet distribution for radiation')
call addfld ('CRM_TAU ', (/'crm_nx','crm_ny','crm_nz'/), 'A', '1', 'cloud scale cloud optical depth' )
call addfld ('CRM_WVAR' , (/'crm_nx','crm_ny','crm_nz'/), 'A', 'm/s', 'vertical velocity variance from CRM')
call addfld ('CRM_FSNT', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net TOA shortwave fluxes at CRM grids')
call addfld ('CRM_FSNTC', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net TOA clear-sky shortwave fluxes at CRM grids')
call addfld ('CRM_FSNS', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net surface shortwave fluxes at CRM grids')
call addfld ('CRM_FSNSC', (/'crm_nx','crm_ny'/), 'A', 'unitless', &
'net surface clear-sky shortwave fluxes at CRM grids')
call addfld ('CRM_FLNT', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net TOA longwave fluxes at CRM grids')
call addfld ('CRM_FLNTC', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net TOA clear-sky longwave fluxes at CRM grids')
call addfld ('CRM_FLNS', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'net surface longwave fluxes at CRM grids')
call addfld ('CRM_FLNSC', (/'crm_nx','crm_ny'/), 'A', 'unitless', &
'net surface clear-sky longwave fluxes at CRM grids')
call addfld ('CRM_AODVIS', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'Aerosol optical depth at 550nm in CRM grids',&
flag_xyfill=.true.)
call addfld ('CRM_AOD400', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'Aerosol optical depth at 400nm in CRM grids',&
flag_xyfill=.true.)
call addfld ('CRM_AOD700', (/'crm_nx','crm_ny'/), 'A', 'unitless', 'Aerosol optical depth at 700nm in CRM grids', &
flag_xyfill=.true.)
call addfld ('CRM_AODVISZ',(/'crm_nx','crm_ny','crm_nz'/), 'A', 'unitless', &
'Aerosol optical depth at each layer at 500nm in CRM grids', flag_xyfill=.true.)
call addfld ('AOD400', horiz_only, 'A', 'unitless', 'Aerosol optical depth at 400nm', &
flag_xyfill=.true.)
call addfld ('AOD700', horiz_only, 'A', 'unitless', 'Aerosol optical depth at 700nm', &
flag_xyfill=.true.)
call add_default ('AOD400', 1, ' ')
call add_default ('AOD700', 1, ' ')
endif
!-------------------------
! Register CLUBB history fields
if (do_clubb_sgs) then
call addfld ('UP2 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^2/s^2', 'u prime ^2 from clubb')
call addfld ('VP2 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^2/s^2', 'v prime ^2 from clubb')
call addfld ('WPRTP ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'mkg/skg', 'w prime * rt prime from clubb')
call addfld ('WPTHLP ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'mK/s', 'w prime * th_l prime from clubb')
call addfld ('WP2 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^2/s^2', 'w prime ^2 from clubb')
call addfld ('WP3 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^3/s^3', 'w prime ^3 from clubb')
call addfld ('RTP2 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', '(kg/kg)2', 'r_t prime ^2 from clubb')
call addfld ('THLP2 ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'K^2', 'th_l_prime ^2 from clubb')
call addfld ('RTPTHLP ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'kgK/kg', 'r_t prime * th_l prime from clubb')
call addfld ('UPWP ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^2/s^2', 'u prime * w prime from clubb')
call addfld ('VPWP ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'm^2/s^2', 'v prime * w prime from clubb')
call addfld ('CRM_CLD ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'fraction', 'cloud fraction from clubb')
call addfld ('T_TNDCY ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'K/s', 't tendency from clubb')
call addfld ('QV_TNDCY ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'kg/kg/s', 'water vapor tendency from clubb')
call addfld ('QC_TNDCY ', (/'crm_nx','crm_ny','crm_z1'/), 'A', 'kg/kg/s', 'liquid condensate tendency from clubb')
call addfld ('CLUBB_TK', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'm^2/s', 'Eddy viscosity from clubb')
call addfld ('CLUBB_TKH', (/'crm_nx','crm_ny','crm_nz'/), 'A', 'm^2/s', 'Eddy viscosity from clubb')
call addfld ('CRM_RELVAR', (/'crm_nx','crm_ny','crm_nz'/), 'A', '', 'cloud water relative variance from clubb')
call addfld ('ACCRE_ENHAN', (/'crm_nx','crm_ny','crm_nz'/), 'A', '', 'Accretion enhancment from clubb')
call addfld ('QCLVAR', (/'crm_nx','crm_ny','crm_nz'/), 'A', '(kg/kg)^2', 'cloud water variance from clubb')
! add GCM-scale output
call addfld ('SPUP2', (/ 'lev' /), 'A', 'm^2/s^2', 'u prime ^2 from clubb on GCM grids')
call addfld ('SPVP2', (/ 'lev' /), 'A', 'm^2/s^2', 'v prime ^2 from clubb on GCM grids')
call addfld ('SPWPRTP', (/ 'lev' /), 'A', 'mkg/skg', 'w prime * rt prime from clubb on GCM grids')
call addfld ('SPWPTHLP', (/ 'lev' /), 'A', 'mK/s', 'w prime * th_l prime from clubb on GCM grids')
call addfld ('SPWP2', (/ 'lev' /), 'A', 'm^2/s^2', 'w prime ^2 from clubb on GCM grids')
call addfld ('SPWP3', (/ 'lev' /), 'A', 'm^3/s^3', 'w prime ^3 from clubb on GCM grids')
call addfld ('SPRTP2', (/ 'lev' /), 'A', '(kg/kg)2', 'r_t prime ^2 from clubb on GCM grids')
call addfld ('SPTHLP2', (/ 'lev' /), 'A', 'K^2', 'th_l_prime ^2 from clubb on GCM grids')
call addfld ('SPRTPTHLP', (/ 'lev' /), 'A', 'kgK/kg', 'r_t prime * th_l prime from clubb on GCM grids')
call addfld ('SPUPWP', (/ 'lev' /), 'A', 'm^2/s^2', 'u prime * w prime from clubb on GCM grids')
call addfld ('SPVPWP', (/ 'lev' /), 'A', 'm^2/s^2', 'v prime * w prime from clubb on GCM grids')
call addfld ('SPCRM_CLD ', (/ 'lev' /), 'A', 'fraction', 'cloud fraction from clubb on GCM grids')
call addfld ('SPT_TNDCY ', (/ 'lev' /), 'A', 'K/s', 't tendency from clubb on GCM grids')
call addfld ('SPQV_TNDCY ', (/ 'lev' /), 'A', 'kg/kg/s', 'water vapor tendency from clubb on GCM grids')
call addfld ('SPQC_TNDCY ', (/ 'lev' /), 'A', 'kg/kg/s', 'liquid condensate tendency from clubb on GCM grids')
call addfld ('SPCLUBB_TK', (/ 'lev' /), 'A', 'm^2/s', 'Eddy viscosity from clubb on GCM grids')
call addfld ('SPCLUBB_TKH', (/ 'lev' /), 'A', 'm^2/s', 'Eddy viscosity from clubb on GCM grids')
call addfld ('SPRELVAR', (/ 'lev' /), 'A', '', 'cloud water relative variance from clubb on GCM grids')
call addfld ('SPACCRE_ENHAN',(/ 'lev' /), 'A', '', 'Accretion enhancment from clubb on GCM grids')
call addfld ('SPQCLVAR', (/ 'lev' /), 'A', '', 'cloud water variance from clubb on GCM grids')
endif
!-------------------------
! Register ECPP history fields
! ifdef needed because of ECPP parameters such as NCLASS_CL and ncls_ecpp_in and papampollu_init
#ifdef m2005
if (is_spcam_m2005) then
call papampollu_init ()
call addfld ('ABND ', (/'ilev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'fraction', &
'cloud fraction for each sub-sub class for full time period at layer boundary')
call addfld ('ABND_TF ', (/'ilev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'fraction', &
'cloud fraction for each sub-sub class for end-portion of time period at layer boundary')
call addfld ('MASFBND ', (/'ilev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/m2/s', &
'sub-class vertical mass flux (kg/m2/s) at layer boundary')
call addfld ('ACEN ', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'fraction', &
'cloud fraction for each sub-sub class for full time period at layer center')
call addfld ('ACEN_TF ', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'fraction', &
'cloud fraction for each sub-sub class for end-portion of time period at layer center')
call addfld ('RHCEN ', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'fraction', &
'relative humidity for each sub-sub calss at layer center')
call addfld ('QCCEN ', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/kg', &
'cloud water for each sub-sub class at layer center')
call addfld ('QICEN ', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/kg', &
'cloud ice for each sub-sub class at layer center')
call addfld ('QSINK_AFCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', '/s', &
'cloud water loss rate from precip. using cloud water after precip. for each sub-sub class at layer center')
call addfld ('QSINK_BFCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', '/s', &
'cloud water loss rate from precip. using cloud water before precip. for each sub-sub class at layer center')
call addfld ('QSINK_AVGCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', '/s', &
'cloud water loss rate from precip. using averaged cloud water and precip. rate for each sub-sub class at layer center')
call addfld ('PRAINCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/kg/s', &
' cloud water loss rate from precipitation (kg/kg/s) for each sub-sub class at layer center')
call addfld ('PRECRCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/m2/s', &
'liquid (rain) precipitation rate for each sub-sub class at layer center')
call addfld ('PRECSCEN', (/'lev ','NCLASS_CL ','ncls_ecpp_in','NCLASS_PR '/), 'A', 'kg/m2/s', &
'solid (snow, graupel,...) precipitation rate for each sub-sub class at layer center')
call addfld ('WUPTHRES', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity threshold for updraft')
call addfld ('WDNTHRES', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity threshold for dndraft')
call addfld ('WWQUI_CEN', (/ 'lev' /), 'A', 'm2/s2', 'vertical velocity variance in the quiescent class, layer center')
call addfld ('WWQUI_CLD_CEN', (/ 'lev' /), 'A', 'm2/s2', &
'vertical velocity variance in the cloudy quiescent class, layer center')
call addfld ('WWQUI_BND', (/ 'ilev' /), 'A', 'm2/s2', &
'vertical velocity variance in the quiescent class, layer boundary')
call addfld ('WWQUI_CLD_BND', (/ 'ilev' /), 'A', 'm2/s2', &
'vertical velocity variance in the cloudy quiescent class, layer boundary')
endif
#endif
!-------------------------
! Register modal aerosol history fields
! ifdef needed because of use of cnst_name_cw which not defined if not modal aerosols
#ifdef MODAL_AERO
if (prog_modal_aero) then
call ndrop_init()
do m=1, pcnst
if(cnst_species_class(m).eq.cnst_spec_class_gas) then
fieldname = trim(cnst_name(m)) // '_mixnuc1sp'
long_name = trim(cnst_name(m)) // ' dropmixnuc mixnuc column tendency in the mmf one '
call addfld( fieldname, horiz_only, 'A', unit, long_name)
call add_default( fieldname, 1, ' ' )
end if
end do
endif
#endif
! These variables do not vary in CRM
call pbuf_set_field (pbuf2d, prec_dp_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, prec_sh_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, snow_sh_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, snow_dp_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, prec_sed_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, snow_sed_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, prec_pcw_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, snow_pcw_idx, 0.0_r8)
call addfld ('CRM_U ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'm/s ', 'CRM x-wind' )
call addfld ('CRM_V ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'm/s ', 'CRM y-wind' )
call addfld ('CRM_W ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'm/s ', 'CRM z-wind' )
call addfld ('CRM_T ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'K ', 'CRM Temperature' )
call addfld ('CRM_QV ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'kg/kg ', 'CRM Water Vapor' )
call addfld ('CRM_QC ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'kg/kg ', 'CRM Cloud Water' )
call addfld ('CRM_QI ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'kg/kg ', 'CRM Cloud Ice' )
call addfld ('CRM_QPC ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'kg/kg ', 'CRM Precipitating Water' )
call addfld ('CRM_QPI ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'kg/kg ', 'CRM Precipitating Ice' )
call addfld ('CRM_PREC',(/'crm_nx','crm_ny'/), 'I', 'm/s ', 'CRM Precipitation Rate' )
call addfld ('CRM_QRS ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'K/s ', 'CRM Shortwave radiative heating rate')
call addfld ('CRM_QRL ',(/'crm_nx','crm_ny', 'crm_nz'/), 'I', 'K/s ', 'CRM Longwave radiative heating rate' )
call add_default ('SPDT ', 1, ' ')
call add_default ('SPDQ ', 1, ' ')
call add_default ('SPDQC ', 1, ' ')
call add_default ('SPDQI ', 1, ' ')
call add_default ('SPMC ', 1, ' ')
call add_default ('SPMCUP ', 1, ' ')
call add_default ('SPMCDN ', 1, ' ')
call add_default ('SPMCUUP ', 1, ' ')
call add_default ('SPMCUDN ', 1, ' ')
call add_default ('SPQC ', 1, ' ')
call add_default ('SPQI ', 1, ' ')
call add_default ('SPQS ', 1, ' ')
call add_default ('SPQG ', 1, ' ')
call add_default ('SPQR ', 1, ' ')
call add_default ('SPQTFLX ', 1, ' ')
call add_default ('SPQTFLXS', 1, ' ')
call add_default ('SPTKE ', 1, ' ')
call add_default ('SPTKES ', 1, ' ')
call add_default ('SPTK ', 1, ' ')
call add_default ('SPQPFLX ', 1, ' ')
call add_default ('SPPFLX ', 1, ' ')
call add_default ('SPQTLS ', 1, ' ')
call add_default ('SPQTTR ', 1, ' ')
call add_default ('SPQPTR ', 1, ' ')
call add_default ('SPQPEVP ', 1, ' ')
call add_default ('SPQPFALL', 1, ' ')
call add_default ('SPQPSRC ', 1, ' ')
call add_default ('SPTLS ', 1, ' ')
call add_default ('CLOUDTOP', 1, ' ')
call add_default ('TIMINGF ', 1, ' ')
sh_frac_idx = pbuf_get_index('SH_FRAC')
dp_frac_idx = pbuf_get_index('DP_FRAC')
call pbuf_set_field (pbuf2d, sh_frac_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, dp_frac_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, cmfmc_sh_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, rprdsh_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, icwmrsh_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, nevapr_shcu_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, icwmrdp_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, fice_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, prain_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, rprdtot_idx, 0.0_r8)
call pbuf_set_field (pbuf2d, nevapr_idx, 0.0_r8)
if (is_first_step()) then
call pbuf_set_field (pbuf2d, ast_idx, 0.0_r8)
end if
#endif
end subroutine crm_physics_init
!=========================================================================================================
function crm_implements_cnst(name)
! Return true if specified constituent is implemented by the
! microphysics package
character(len=*), intent(in) :: name ! constituent name
logical :: crm_implements_cnst ! return value
#ifdef CRM
!-----------------------------------------------------------------------
crm_implements_cnst = any(name == cnst_names)
#endif
end function crm_implements_cnst
!===============================================================================
subroutine crm_init_cnst(name, q)
! Initialize the microphysics constituents, if they are
! not read from the initial file.
character(len=*), intent(in) :: name ! constituent name
real(r8), intent(out) :: q(:,:) ! mass mixing ratio (gcol, plev)
!-----------------------------------------------------------------------
#ifdef CRM
if (crm_implements_cnst(name)) q = 0.0_r8
#endif
end subroutine crm_init_cnst
!===============================================================================
!---------------------------------------------------------------------------------------------------------
subroutine crm_physics_tend(ztodt, state, tend, ptend, pbuf, cam_in)
!------------------------------------------------------------------------------------------
! Purpose: to update state from CRM physics.
!
! Revision history:
!
! June, 2009, Minghuai Wang:
! These codes are taken out from tphysbc.F90
! in the spcam3.5, developed by Marat Khairoutdinov
! ([email protected]). Here we try to follow the procedure
! in 'Interface to Column Physics and Chemistry packages' to implement
! the CRM physics.
! July, 13, 2009, Minghuai Wang:
! Hydrometer numbers are outputed from SAM when Morrison's microphysics is used,
! and will be used in the radiative transfer code to calculate radius.
! July, 15, 2009, Minghuai Wang:
! Get modal aerosol, and use it in the SAM.
!
!-------------------------------------------------------------------------------------------
#ifdef CRM
use shr_spfn_mod, only: gamma => shr_spfn_gamma
use time_manager, only: is_first_step, get_nstep
use cam_history, only: outfld
use perf_mod
use crmdims, only: crm_nx, crm_ny, crm_nz
use physconst, only: cpair, latvap, gravit
use constituents, only: pcnst, cnst_get_ind
use crmx_crm_module, only: crm
use crmx_microphysics, only: nmicro_fields
use physconst, only: latvap
use check_energy, only: check_energy_chng
use phys_grid, only: get_rlat_all_p, get_rlon_all_p, get_lon_all_p, get_lat_all_p
use modal_aero_calcsize, only: modal_aero_calcsize_sub
use micro_mg_utils, only: size_dist_param_liq, mg_liq_props, mincld, qsmall
#ifdef MODAL_AERO
use crmclouds_camaerosols, only: crmclouds_mixnuc_tend, spcam_modal_aero_wateruptake_dr
use ndrop, only: loadaer
#endif
#ifdef m2005
use module_ecpp_ppdriver2, only: parampollu_driver2
use crmx_ecppvars, only: NCLASS_CL, ncls_ecpp_in, NCLASS_PR
use module_data_ecpp1, only: dtstep_pp_input
#endif
#ifdef SPCAM_CLUBB_SGS
use cloud_cover_diags, only: cloud_cover_diags_out
use pkg_cldoptics, only: cldovrlap
#endif
#endif
use physics_buffer, only: physics_buffer_desc, pbuf_old_tim_idx, pbuf_get_index, dyn_time_lvls, pbuf_get_field
use physics_types, only: physics_state, physics_tend, physics_ptend, physics_update, physics_ptend_init, &
physics_state_copy, physics_ptend_sum, physics_ptend_scale
use camsrfexch, only: cam_in_t
real(r8), intent(in) :: ztodt ! 2 delta t (model time increment)
type(physics_state), intent(in) :: state
type(physics_tend), intent(in) :: tend
type(physics_ptend ), intent(out) :: ptend
type(physics_buffer_desc),pointer :: pbuf(:)
type (cam_in_t), intent(in) :: cam_in
#ifdef CRM
type(physics_state) :: state_loc ! local copy of state
type(physics_tend) :: tend_loc ! local copy of tend
type(physics_ptend) :: ptend_loc ! local copy of ptend
! convective precipitation variables
real(r8), pointer :: prec_dp(:) ! total precipitation from ZM convection [m/s]
real(r8), pointer :: snow_dp(:) ! snow from ZM convection [m/s]
real(r8), pointer :: nc_rad(:,:,:,:) ! rad cloud water droplet number [#/kg]
real(r8), pointer :: ni_rad(:,:,:,:) ! rad cloud ice crystal number [#/kg]
real(r8), pointer :: qs_rad(:,:,:,:) ! rad cloud snow mass [kg/kg]
real(r8), pointer :: ns_rad(:,:,:,:) ! rad cloud snow crystal number [#/kg]
real(r8), pointer :: cld_rad(:,:,:,:) ! cloud fraction
real(r8), pointer :: t_rad (:,:,:,:) ! rad temperuture
real(r8), pointer :: qv_rad(:,:,:,:) ! rad vapor
real(r8), pointer :: qc_rad(:,:,:,:) ! rad cloud water
real(r8), pointer :: qi_rad(:,:,:,:) ! rad cloud ice
real(r8), pointer :: crm_qrad(:,:,:,:)
real(r8), pointer :: clubb_buffer (:,:,:,:,:)
real(r8),pointer :: cldtop_pbuf(:) ! cloudtop location for pbuf
real(r8),pointer :: tk_crm_ecpp(:,:)
real(r8),pointer :: acldy_cen_tbeg(:,:) ! cloud fraction
real(r8), pointer, dimension(:,:) :: cldo
!
!--------------------------- Local variables -----------------------------------------------------------
!
integer lchnk ! chunk identifier
integer ncol ! number of atmospheric columns
integer nstep ! time steps
real(r8) qc_crm (pcols,crm_nx, crm_ny, crm_nz)
real(r8) qi_crm (pcols,crm_nx, crm_ny, crm_nz)
real(r8) qpc_crm(pcols,crm_nx, crm_ny, crm_nz)
real(r8) qpi_crm(pcols,crm_nx, crm_ny, crm_nz)
real(r8),allocatable :: crm_cld(:,:,:,:)
real(r8),allocatable :: clubb_tk(:,:,:,:)
real(r8),allocatable :: clubb_tkh(:,:,:,:)
real(r8),allocatable :: relvar(:,:,:,:)
real(r8),allocatable :: accre_enhan(:,:,:,:)
real(r8),allocatable :: qclvar(:,:,:,:)
real(r8) crm_tk(pcols,crm_nx, crm_ny, crm_nz)
real(r8) crm_tkh(pcols,crm_nx, crm_ny, crm_nz)
real(r8) cld3d_crm(pcols, crm_nx, crm_ny, crm_nz) ! 3D instaneous cloud fraction
real(r8) prec_crm(pcols,crm_nx, crm_ny)
real(r8) mctot(pcols,pver) ! total cloud mass flux
real(r8) mcup(pcols,pver) ! cloud updraft mass flux
real(r8) mcdn(pcols,pver) ! cloud downdraft mass flux
real(r8) mcuup(pcols,pver) ! unsaturated updraft mass flux
real(r8) mcudn(pcols,pver) ! unsaturated downdraft mass flux
real(r8) spqc(pcols,pver) ! cloud water
real(r8) spqi(pcols,pver) ! cloud ice
real(r8) spqs(pcols,pver) ! snow
real(r8) spqg(pcols,pver) ! graupel
real(r8) spqr(pcols,pver) ! rain
real(r8) spnc(pcols,pver) ! cloud water droplet (#/kg)
real(r8) spni(pcols,pver) ! cloud ice crystal number (#/kg)
real(r8) spns(pcols,pver) ! snow particle number (#/kg)
real(r8) spng(pcols,pver) ! graupel particle number (#/kg)
real(r8) spnr(pcols,pver) ! rain particle number (#/kg)
real(r8) wvar_crm (pcols,crm_nx, crm_ny, crm_nz) ! vertical velocity variance (m/s)
real(r8) aut_crm (pcols,crm_nx, crm_ny, crm_nz) ! Cloud water autoconversion (1/s)
real(r8) acc_crm (pcols,crm_nx, crm_ny, crm_nz) ! Cloud water accretion by rain (1/s)
real(r8) evpc_crm (pcols,crm_nx, crm_ny, crm_nz) ! Cloud water evaporation (1/s)
real(r8) evpr_crm (pcols,crm_nx, crm_ny, crm_nz) ! Rain evaporation (1/s)
real(r8) mlt_crm (pcols,crm_nx, crm_ny, crm_nz) ! Ice, snow, graupel melting (1/s)
real(r8) sub_crm (pcols,crm_nx, crm_ny, crm_nz) ! Ice, snow, graupel sublimation (1/s)
real(r8) dep_crm (pcols,crm_nx, crm_ny, crm_nz) ! Ice, snow, graupel deposition (1/s)
real(r8) con_crm (pcols,crm_nx, crm_ny, crm_nz) ! Cloud water condensation (1/s)
real(r8) aut_crm_a (pcols,pver) ! Cloud water autoconversion (1/s)
real(r8) acc_crm_a (pcols,pver) ! Cloud water accretion by rain (1/s)
real(r8) evpc_crm_a (pcols,pver) ! Cloud water evaporation (1/s)
real(r8) evpr_crm_a (pcols,pver) ! Rain evaporation (1/s)
real(r8) mlt_crm_a (pcols,pver) ! Ice, snow, graupel melting (1/s)
real(r8) sub_crm_a (pcols,pver) ! Ice, snow, graupel sublimation (1/s)
real(r8) dep_crm_a (pcols,pver) ! Ice, snow, graupel deposition (1/s)
real(r8) con_crm_a (pcols,pver) ! Cloud water condensation (1/s)
real(r8) flux_qt(pcols,pver) ! nonprecipitating water flux
real(r8) flux_u(pcols,pver) ! x-momentum flux
real(r8) flux_v(pcols,pver) ! y-momentum flux
real(r8) fluxsgs_qt(pcols,pver) ! sgs nonprecipitating water flux
real(r8) tkez(pcols,pver) ! tke profile [kg/m/s2]
real(r8) tkesgsz(pcols,pver) ! sgs tke profile [kg/m/s2]
real(r8) flux_qp(pcols,pver) ! precipitating water flux
real(r8) precflux(pcols,pver) ! precipitation flux
real(r8) qt_ls(pcols,pver) ! water tendency due to large-scale
real(r8) qt_trans(pcols,pver) ! nonprecip water tendency due to transport
real(r8) qp_trans(pcols,pver) ! precip water tendency due to transport
real(r8) qp_fall(pcols,pver) ! precip water tendency due to fall-out
real(r8) qp_evp(pcols,pver) ! precip water tendency due to evap
real(r8) qp_src(pcols,pver) ! precip water tendency due to conversion
real(r8) t_ls(pcols,pver) ! tendency of crm's liwse due to large-scale
real(r8) cldtop(pcols,pver)
real(r8) cwp (pcols,pver) ! in-cloud cloud (total) water path (kg/m2)
real(r8) gicewp(pcols,pver) ! grid-box cloud ice water path (g/m2)
real(r8) gliqwp(pcols,pver) ! grid-box cloud liquid water path (g/m2)
real(r8) gwp (pcols,pver) ! grid-box cloud (total) water path (kg/m2)
real(r8) tgicewp(pcols) ! Vertically integrated ice water path (kg/m2
real(r8) tgliqwp(pcols) ! Vertically integrated liquid water path (kg/m2)
real(r8) cicewp(pcols,pver) ! in-cloud cloud ice water path (kg/m2)
real(r8) cliqwp(pcols,pver) ! in-cloud cloud liquid water path (kg/m2)
real(r8) tgwp (pcols) ! Vertically integrated (total) cloud water path (kg/m2)
real(r8) precc(pcols) ! convective precipitation [m/s]
real(r8) precl(pcols) ! large scale precipitation [m/s]
real(r8) precsc(pcols) ! convecitve snow [m/s]
real(r8) precsl(pcols) ! convective snow [m/s]
real(r8) cltot(pcols) ! Diagnostic total cloud cover
real(r8) cllow(pcols) ! Diagnostic low cloud cover
real(r8) clmed(pcols) ! Diagnostic mid cloud cover
real(r8) clhgh(pcols) ! Diagnostic hgh cloud cover
real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables
real(r8) ul(pver)
real(r8) vl(pver)
real(r8) :: mu_crm(pcols,pver)
real(r8) :: md_crm(pcols,pver)
real(r8) :: du_crm(pcols,pver)
real(r8) :: eu_crm(pcols,pver)
real(r8) :: ed_crm(pcols,pver)
real(r8) :: tk_crm(pcols,pver)
real(r8) :: jt_crm(pcols)
real(r8) :: mx_crm(pcols)
real(r8) :: ideep_crm(pcols)
integer itim
real(r8), pointer, dimension(:,:) :: cld ! cloud fraction
real(r8),allocatable :: na(:) ! aerosol number concentration [/m3]
real(r8),allocatable :: va(:) ! aerosol voume concentration [m3/m3]
real(r8),allocatable :: hy(:) ! aerosol bulk hygroscopicity
real(r8),allocatable :: naermod(:,:) ! Aerosol number concentration [/m3]
real(r8),allocatable :: vaerosol(:,:) ! aerosol volume concentration [m3/m3]
real(r8),allocatable :: hygro(:,:) ! hygroscopicity of aerosol mode
integer phase ! phase to determine whether it is interstitial, cloud-borne, or the sum.
real(r8) cs(pcols, pver) ! air density [kg/m3]
real(r8),allocatable :: qicecen(:,:,:,:,:) ! cloud ice (kg/kg)
real(r8),allocatable :: qlsink_afcen(:,:,:,:,:) ! cloud water loss rate from precipitation calculated
! cloud water before precipitatinog (/s)
real(r8),allocatable :: qlsink_bfcen(:,:,:,:,:) ! cloud water loss rate from precipitation calculated
! cloud water before precipitatinog (/s)
real(r8),allocatable :: qlsink_avgcen(:,:,:,:,:) ! cloud water loss rate from precipitation calculated
! from praincen and qlcoudcen averaged over
! ntavg1_ss time step (/s)
real(r8),allocatable :: praincen(:,:,:,:,:) ! cloud water loss rate from precipitation (kg/kg/s)
real(r8),allocatable :: wupthresh_bnd(:,:)
real(r8),allocatable :: wdownthresh_bnd(:,:)
! CRM column radiation stuff:
real(r8) prectend(pcols) ! tendency in precipitating water and ice
real(r8) precstend(pcols) ! tendency in precipitating ice
real(r8) icesink(pcols) ! sink of
real(r8) tau00 ! surface stress
real(r8) wnd ! surface wnd
real(r8) bflx ! surface buoyancy flux (Km/s)
real(r8) taux_crm(pcols) ! zonal CRM surface stress perturbation
real(r8) tauy_crm(pcols) ! merid CRM surface stress perturbation
real(r8) z0m(pcols) ! surface momentum roughness length
real(r8), pointer, dimension(:,:) :: qrs, qrl ! rad heating rates
real(r8), pointer, dimension(:,:,:,:) :: crm_u
real(r8), pointer, dimension(:,:,:,:) :: crm_v
real(r8), pointer, dimension(:,:,:,:) :: crm_w
real(r8), pointer, dimension(:,:,:,:) :: crm_t
real(r8), pointer, dimension(:,:,:,:) :: crm_qt
real(r8), pointer, dimension(:,:,:,:) :: crm_qp
real(r8), pointer, dimension(:,:,:,:) :: crm_qn
real(r8), pointer, dimension(:,:,:,:) :: crm_nc
real(r8), pointer, dimension(:,:,:,:) :: crm_qr
real(r8), pointer, dimension(:,:,:,:) :: crm_nr
real(r8), pointer, dimension(:,:,:,:) :: crm_qi
real(r8), pointer, dimension(:,:,:,:) :: crm_ni
real(r8), pointer, dimension(:,:,:,:) :: crm_qs
real(r8), pointer, dimension(:,:,:,:) :: crm_ns
real(r8), pointer, dimension(:,:,:,:) :: crm_qg
real(r8), pointer, dimension(:,:,:,:) :: crm_ng
real(r8), pointer, dimension(:,:,:,:) :: crm_qc
real(r8), allocatable, dimension(:,:,:,:,:) :: crm_micro
integer :: pblh_idx
real(r8), pointer, dimension(:) :: pblh
real(r8), pointer, dimension(:,:) :: wsedl
real(r8),allocatable :: acen(:,:,:,:,:) ! cloud fraction for each sub-sub class for full time period
real(r8),allocatable :: acen_tf(:,:,:,:,:) ! cloud fraction for end-portion of time period
real(r8),allocatable :: rhcen(:,:,:,:,:) ! relative humidity (0-1)
real(r8),allocatable :: qcloudcen(:,:,:,:,:) ! cloud water (kg/kg)
real(r8),allocatable :: qlsinkcen(:,:,:,:,:) ! cloud water loss rate from precipitation (/s??)
real(r8),allocatable :: precrcen(:,:,:,:,:) ! liquid (rain) precipitation rate (kg/m2/s)
real(r8),allocatable :: precsolidcen(:,:,:,:,:) ! solid (rain) precipitation rate (kg/m2/s)
real(r8),allocatable :: wwqui_cen(:,:) ! vertical velocity variance in quiescent class (m2/s2)
real(r8),allocatable :: wwqui_cloudy_cen(:,:) ! vertical velocity variance in quiescent, and cloudy class (m2/s2)
! at layer boundary
real(r8),allocatable :: abnd(:,:,:,:,:) ! cloud fraction for each sub-sub class for full time period
real(r8),allocatable :: abnd_tf(:,:,:,:,:) ! cloud fraction for end-portion of time period
real(r8),allocatable :: massflxbnd(:,:,:,:,:) ! sub-class vertical mass flux (kg/m2/s) at layer bottom boundary.
real(r8),allocatable :: wwqui_bnd(:,:) ! vertical velocity variance in quiescent class (m2/s2)