forked from ESCOMP/PUMAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
micro_mg1_0.F90
3742 lines (2930 loc) · 133 KB
/
micro_mg1_0.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
module micro_mg1_0
!---------------------------------------------------------------------------------
! Purpose:
! MG microphysics
!
! Author: Andrew Gettelman, Hugh Morrison.
! Contributions from: Xiaohong Liu and Steve Ghan
! December 2005-May 2010
! Description in: Morrison and Gettelman, 2008. J. Climate (MG2008)
! Gettelman et al., 2010 J. Geophys. Res. - Atmospheres (G2010)
! for questions contact Hugh Morrison, Andrew Gettelman
! e-mail: [email protected], [email protected]
!
! NOTE: Modified to allow other microphysics packages (e.g. CARMA) to do ice
! microphysics in cooperation with the MG liquid microphysics. This is
! controlled by the do_cldice variable.
!
! NOTE: If do_cldice is false, then MG microphysics should not update CLDICE
! or NUMICE; however, it is assumed that the other microphysics scheme will have
! updated CLDICE and NUMICE. The other microphysics should handle the following
! processes that would have been done by MG:
! - Detrainment (liquid and ice)
! - Homogeneous ice nucleation
! - Heterogeneous ice nucleation
! - Bergeron process
! - Melting of ice
! - Freezing of cloud drops
! - Autoconversion (ice -> snow)
! - Growth/Sublimation of ice
! - Sedimentation of ice
!---------------------------------------------------------------------------------
! modification for sub-columns, HM, (orig 8/11/10)
! This is done using the logical 'microp_uniform' set to .true. = uniform for subcolumns
!---------------------------------------------------------------------------------
! Procedures required:
! 1) An implementation of the gamma function (if not intrinsic).
! 2) saturation vapor pressure to specific humidity formula
! 3) svp over water
! 4) svp over ice
#ifndef HAVE_GAMMA_INTRINSICS
use shr_spfn_mod, only: gamma => shr_spfn_gamma
#endif
use wv_sat_methods, only: &
svp_water => wv_sat_svp_water, &
svp_ice => wv_sat_svp_ice, &
svp_to_qsat => wv_sat_svp_to_qsat
use phys_control, only: phys_getopts
implicit none
private
save
! Note: The liu_in option has been removed, as there was a serious bug with this
! option being set to false. The code now behaves as if the default liu_in=.true.
! is always on. Addition/reinstatement of ice nucleation options will likely be
! done outside of this module.
public :: &
micro_mg_init, &
micro_mg_get_cols, &
micro_mg_tend
integer, parameter :: r8 = selected_real_kind(12) ! 8 byte real
real(r8) :: g !gravity
real(r8) :: r !Dry air Gas constant
real(r8) :: rv !water vapor gas contstant
real(r8) :: cpp !specific heat of dry air
real(r8) :: rhow !density of liquid water
real(r8) :: tmelt ! Freezing point of water (K)
real(r8) :: xxlv ! latent heat of vaporization
real(r8) :: xlf !latent heat of freezing
real(r8) :: xxls !latent heat of sublimation
real(r8) :: rhosn ! bulk density snow
real(r8) :: rhoi ! bulk density ice
real(r8) :: ac,bc,as,bs,ai,bi,ar,br !fall speed parameters
real(r8) :: ci,di !ice mass-diameter relation parameters
real(r8) :: cs,ds !snow mass-diameter relation parameters
real(r8) :: cr,dr !drop mass-diameter relation parameters
real(r8) :: f1s,f2s !ventilation param for snow
real(r8) :: Eii !collection efficiency aggregation of ice
real(r8) :: Ecr !collection efficiency cloud droplets/rain
real(r8) :: f1r,f2r !ventilation param for rain
real(r8) :: DCS !autoconversion size threshold
real(r8) :: qsmall !min mixing ratio
real(r8) :: bimm,aimm !immersion freezing
real(r8) :: rhosu !typical 850mn air density
real(r8) :: mi0 ! new crystal mass
real(r8) :: rin ! radius of contact nuclei
real(r8) :: pi ! pi
! Additional constants to help speed up code
real(r8) :: cons1
real(r8) :: cons4
real(r8) :: cons5
real(r8) :: cons6
real(r8) :: cons7
real(r8) :: cons8
real(r8) :: cons11
real(r8) :: cons13
real(r8) :: cons14
real(r8) :: cons16
real(r8) :: cons17
real(r8) :: cons22
real(r8) :: cons23
real(r8) :: cons24
real(r8) :: cons25
real(r8) :: cons27
real(r8) :: cons28
real(r8) :: lammini
real(r8) :: lammaxi
real(r8) :: lamminr
real(r8) :: lammaxr
real(r8) :: lammins
real(r8) :: lammaxs
! parameters for snow/rain fraction for convective clouds
real(r8) :: tmax_fsnow ! max temperature for transition to convective snow
real(r8) :: tmin_fsnow ! min temperature for transition to convective snow
!needed for findsp
real(r8) :: tt0 ! Freezing temperature
real(r8) :: csmin,csmax,minrefl,mindbz
real(r8) :: rhmini ! Minimum rh for ice cloud fraction > 0.
logical :: use_hetfrz_classnuc ! option to use heterogeneous freezing
character(len=16) :: micro_mg_precip_frac_method ! type of precipitation fraction method
real(r8) :: micro_mg_berg_eff_factor ! berg efficiency factor
! Switches for specification rather than prediction of droplet and crystal number
! note: number will be adjusted as needed to keep mean size within bounds,
! even when specified droplet or ice number is used
!
! If constant cloud ice number is set (nicons = .true.),
! then all microphysical processes except mass transfer due to ice nucleation
! (mnuccd) are based on the fixed cloud ice number. Calculation of
! mnuccd follows from the prognosed ice crystal number ni.
logical :: nccons ! nccons=.true. to specify constant cloud droplet number
logical :: nicons ! nicons=.true. to specify constant cloud ice number
! parameters for specified ice and droplet number concentration
! note: these are local in-cloud values, not grid-mean
real(r8) :: ncnst ! droplet num concentration when nccons=.true. (m-3)
real(r8) :: ninst ! ice num concentration when nicons=.true. (m-3)
!===============================================================================
contains
!===============================================================================
subroutine micro_mg_init( &
kind, gravit, rair, rh2o, cpair, &
rhoh2o, tmelt_in, latvap, latice, &
rhmini_in, micro_mg_dcs, use_hetfrz_classnuc_in, &
micro_mg_precip_frac_method_in, micro_mg_berg_eff_factor_in, &
nccons_in, nicons_in, ncnst_in, ninst_in, errstring)
!-----------------------------------------------------------------------
!
! Purpose:
! initialize constants for the morrison microphysics
!
! Author: Andrew Gettelman Dec 2005
!
!-----------------------------------------------------------------------
integer, intent(in) :: kind ! Kind used for reals
real(r8), intent(in) :: gravit
real(r8), intent(in) :: rair
real(r8), intent(in) :: rh2o
real(r8), intent(in) :: cpair
real(r8), intent(in) :: rhoh2o
real(r8), intent(in) :: tmelt_in ! Freezing point of water (K)
real(r8), intent(in) :: latvap
real(r8), intent(in) :: latice
real(r8), intent(in) :: rhmini_in ! Minimum rh for ice cloud fraction > 0.
real(r8), intent(in) :: micro_mg_dcs
logical, intent(in) :: use_hetfrz_classnuc_in
character(len=16),intent(in) :: micro_mg_precip_frac_method_in ! type of precipitation fraction method
real(r8), intent(in) :: micro_mg_berg_eff_factor_in ! berg efficiency factor
logical, intent(in) :: nccons_in
logical, intent(in) :: nicons_in
real(r8), intent(in) :: ncnst_in
real(r8), intent(in) :: ninst_in
character(128), intent(out) :: errstring ! Output status (non-blank for error return)
integer k
integer l,m, iaer
real(r8) surften ! surface tension of water w/respect to air (N/m)
real(r8) arg
!-----------------------------------------------------------------------
errstring = ' '
if( kind .ne. r8 ) then
errstring = 'micro_mg_init: KIND of reals does not match'
return
end if
!declarations for morrison codes (transforms variable names)
g= gravit !gravity
r= rair !Dry air Gas constant: note units(phys_constants are in J/K/kmol)
rv= rh2o !water vapor gas contstant
cpp = cpair !specific heat of dry air
rhow = rhoh2o !density of liquid water
tmelt = tmelt_in
rhmini = rhmini_in
micro_mg_precip_frac_method = micro_mg_precip_frac_method_in
micro_mg_berg_eff_factor = micro_mg_berg_eff_factor_in
nccons = nccons_in
nicons = nicons_in
ncnst = ncnst_in
ninst = ninst_in
! latent heats
xxlv = latvap ! latent heat vaporization
xlf = latice ! latent heat freezing
xxls = xxlv + xlf ! latent heat of sublimation
! flags
use_hetfrz_classnuc = use_hetfrz_classnuc_in
! parameters for snow/rain fraction for convective clouds
tmax_fsnow = tmelt
tmin_fsnow = tmelt-5._r8
! parameters below from Reisner et al. (1998)
! density parameters (kg/m3)
rhosn = 250._r8 ! bulk density snow (++ ceh)
rhoi = 500._r8 ! bulk density ice
rhow = 1000._r8 ! bulk density liquid
! fall speed parameters, V = aD^b
! V is in m/s
! droplets
ac = 3.e7_r8
bc = 2._r8
! snow
as = 11.72_r8
bs = 0.41_r8
! cloud ice
ai = 700._r8
bi = 1._r8
! rain
ar = 841.99667_r8
br = 0.8_r8
! particle mass-diameter relationship
! currently we assume spherical particles for cloud ice/snow
! m = cD^d
pi= 3.1415927_r8
! cloud ice mass-diameter relationship
ci = rhoi*pi/6._r8
di = 3._r8
! snow mass-diameter relationship
cs = rhosn*pi/6._r8
ds = 3._r8
! drop mass-diameter relationship
cr = rhow*pi/6._r8
dr = 3._r8
! ventilation parameters for snow
! hall and prupacher
f1s = 0.86_r8
f2s = 0.28_r8
! collection efficiency, aggregation of cloud ice and snow
Eii = 0.1_r8
! collection efficiency, accretion of cloud water by rain
Ecr = 1.0_r8
! ventilation constants for rain
f1r = 0.78_r8
f2r = 0.32_r8
! autoconversion size threshold for cloud ice to snow (m)
Dcs = micro_mg_dcs
! smallest mixing ratio considered in microphysics
qsmall = 1.e-18_r8
! immersion freezing parameters, bigg 1953
bimm = 100._r8
aimm = 0.66_r8
! typical air density at 850 mb
rhosu = 85000._r8/(rair * tmelt)
! mass of new crystal due to aerosol freezing and growth (kg)
mi0 = 4._r8/3._r8*pi*rhoi*(10.e-6_r8)*(10.e-6_r8)*(10.e-6_r8)
! radius of contact nuclei aerosol (m)
rin = 0.1e-6_r8
! freezing temperature
tt0=273.15_r8
pi=4._r8*atan(1.0_r8)
!Range of cloudsat reflectivities (dBz) for analytic simulator
csmin= -30._r8
csmax= 26._r8
mindbz = -99._r8
! minrefl = 10._r8**(mindbz/10._r8)
minrefl = 1.26e-10_r8
! Define constants to help speed up code (limit calls to gamma function)
cons1=gamma(1._r8+di)
cons4=gamma(1._r8+br)
cons5=gamma(4._r8+br)
cons6=gamma(1._r8+ds)
cons7=gamma(1._r8+bs)
cons8=gamma(4._r8+bs)
cons11=gamma(3._r8+bs)
cons13=gamma(5._r8/2._r8+br/2._r8)
cons14=gamma(5._r8/2._r8+bs/2._r8)
cons16=gamma(1._r8+bi)
cons17=gamma(4._r8+bi)
cons22=(4._r8/3._r8*pi*rhow*(25.e-6_r8)**3)
cons23=dcs**3
cons24=dcs**2
cons25=dcs**bs
cons27=xxlv**2
cons28=xxls**2
lammaxi = 1._r8/10.e-6_r8
lammini = 1._r8/(2._r8*dcs)
lammaxr = 1._r8/20.e-6_r8
lamminr = 1._r8/500.e-6_r8
lammaxs = 1._r8/10.e-6_r8
lammins = 1._r8/2000.e-6_r8
end subroutine micro_mg_init
!===============================================================================
!microphysics routine for each timestep goes here...
subroutine micro_mg_tend ( &
microp_uniform, pcols, pver, ncol, top_lev, deltatin,&
tn, qn, qc, qi, nc, &
ni, p, pdel, cldn, liqcldf, &
relvar, accre_enhan, &
icecldf, rate1ord_cw2pr_st, naai, npccnin, &
rndst, nacon, tlat, qvlat, qctend, &
qitend, nctend, nitend, effc, effc_fn, &
effi, prect, preci, nevapr, evapsnow, am_evp_st, &
prain, prodsnow, cmeout, deffi, pgamrad, &
lamcrad, qsout, dsout, rflx, sflx, &
qrout, reff_rain, reff_snow, qcsevap, qisevap, &
qvres, cmeiout, vtrmc, vtrmi, qcsedten, &
qisedten, prao, prco, mnuccco, mnuccto, &
msacwio, psacwso, bergso, bergo, melto, &
homoo, qcreso, prcio, praio, qireso, &
mnuccro, pracso, meltsdt, frzrdt, mnuccdo, &
nrout, nsout, refl, arefl, areflz, &
frefl, csrfl, acsrfl, fcsrfl, rercld, &
ncai, ncal, qrout2, qsout2, nrout2, &
nsout2, drout2, dsout2, freqs, freqr, &
nfice, prer_evap, do_cldice, errstring, &
tnd_qsnow, tnd_nsnow, re_ice, &
frzimm, frzcnt, frzdep)
! input arguments
logical, intent(in) :: microp_uniform ! True = configure uniform for sub-columns False = use w/o sub-columns (standard)
integer, intent(in) :: pcols ! size of column (first) index
integer, intent(in) :: pver ! number of layers in columns
integer, intent(in) :: ncol ! number of columns
integer, intent(in) :: top_lev ! top level microphys is applied
real(r8), intent(in) :: deltatin ! time step (s)
real(r8), intent(in) :: tn(pcols,pver) ! input temperature (K)
real(r8), intent(in) :: qn(pcols,pver) ! input h20 vapor mixing ratio (kg/kg)
real(r8), intent(in) :: relvar(pcols,pver) ! relative variance of cloud water (-)
real(r8), intent(in) :: accre_enhan(pcols,pver) ! optional accretion enhancement factor (-)
! note: all input cloud variables are grid-averaged
real(r8), intent(inout) :: qc(pcols,pver) ! cloud water mixing ratio (kg/kg)
real(r8), intent(inout) :: qi(pcols,pver) ! cloud ice mixing ratio (kg/kg)
real(r8), intent(inout) :: nc(pcols,pver) ! cloud water number conc (1/kg)
real(r8), intent(inout) :: ni(pcols,pver) ! cloud ice number conc (1/kg)
real(r8), intent(in) :: p(pcols,pver) ! air pressure (pa)
real(r8), intent(in) :: pdel(pcols,pver) ! pressure difference across level (pa)
real(r8), intent(in) :: cldn(pcols,pver) ! cloud fraction
real(r8), intent(in) :: icecldf(pcols,pver) ! ice cloud fraction
real(r8), intent(in) :: liqcldf(pcols,pver) ! liquid cloud fraction
real(r8), intent(out) :: rate1ord_cw2pr_st(pcols,pver) ! 1st order rate for direct cw to precip conversion
! used for scavenging
! Inputs for aerosol activation
real(r8), intent(in) :: naai(pcols,pver) ! ice nulceation number (from microp_aero_ts)
real(r8), intent(in) :: npccnin(pcols,pver) ! ccn activated number tendency (from microp_aero_ts)
real(r8), intent(in) :: rndst(pcols,pver,4) ! radius of 4 dust bins for contact freezing (from microp_aero_ts)
real(r8), intent(in) :: nacon(pcols,pver,4) ! number in 4 dust bins for contact freezing (from microp_aero_ts)
! Used with CARMA cirrus microphysics
! (or similar external microphysics model)
logical, intent(in) :: do_cldice ! Prognosing cldice
! output arguments
real(r8), intent(out) :: tlat(pcols,pver) ! latent heating rate (W/kg)
real(r8), intent(out) :: qvlat(pcols,pver) ! microphysical tendency qv (1/s)
real(r8), intent(out) :: qctend(pcols,pver) ! microphysical tendency qc (1/s)
real(r8), intent(out) :: qitend(pcols,pver) ! microphysical tendency qi (1/s)
real(r8), intent(out) :: nctend(pcols,pver) ! microphysical tendency nc (1/(kg*s))
real(r8), intent(out) :: nitend(pcols,pver) ! microphysical tendency ni (1/(kg*s))
real(r8), intent(out) :: effc(pcols,pver) ! droplet effective radius (micron)
real(r8), intent(out) :: effc_fn(pcols,pver) ! droplet effective radius, assuming nc = 1.e8 kg-1
real(r8), intent(out) :: effi(pcols,pver) ! cloud ice effective radius (micron)
real(r8), intent(out) :: prect(pcols) ! surface precip rate (m/s)
real(r8), intent(out) :: preci(pcols) ! cloud ice/snow precip rate (m/s)
real(r8), intent(out) :: nevapr(pcols,pver) ! evaporation rate of rain + snow
real(r8), intent(out) :: evapsnow(pcols,pver)! sublimation rate of snow
real(r8), intent(out) :: am_evp_st(pcols,pver)! stratiform evaporation area
real(r8), intent(out) :: prain(pcols,pver) ! production of rain + snow
real(r8), intent(out) :: prodsnow(pcols,pver)! production of snow
real(r8), intent(out) :: cmeout(pcols,pver) ! evap/sub of cloud
real(r8), intent(out) :: deffi(pcols,pver) ! ice effective diameter for optics (radiation)
real(r8), intent(out) :: pgamrad(pcols,pver) ! ice gamma parameter for optics (radiation)
real(r8), intent(out) :: lamcrad(pcols,pver) ! slope of droplet distribution for optics (radiation)
real(r8), intent(out) :: qsout(pcols,pver) ! snow mixing ratio (kg/kg)
real(r8), intent(out) :: dsout(pcols,pver) ! snow diameter (m)
real(r8), intent(out) :: rflx(pcols,pver+1) ! grid-box average rain flux (kg m^-2 s^-1)
real(r8), intent(out) :: sflx(pcols,pver+1) ! grid-box average snow flux (kg m^-2 s^-1)
real(r8), intent(out) :: qrout(pcols,pver) ! grid-box average rain mixing ratio (kg/kg)
real(r8), intent(inout) :: reff_rain(pcols,pver) ! rain effective radius (micron)
real(r8), intent(inout) :: reff_snow(pcols,pver) ! snow effective radius (micron)
real(r8), intent(out) :: qcsevap(pcols,pver) ! cloud water evaporation due to sedimentation
real(r8), intent(out) :: qisevap(pcols,pver) ! cloud ice sublimation due to sublimation
real(r8), intent(out) :: qvres(pcols,pver) ! residual condensation term to ensure RH < 100%
real(r8), intent(out) :: cmeiout(pcols,pver) ! grid-mean cloud ice sub/dep
real(r8), intent(out) :: vtrmc(pcols,pver) ! mass-weighted cloud water fallspeed
real(r8), intent(out) :: vtrmi(pcols,pver) ! mass-weighted cloud ice fallspeed
real(r8), intent(out) :: qcsedten(pcols,pver) ! qc sedimentation tendency
real(r8), intent(out) :: qisedten(pcols,pver) ! qi sedimentation tendency
! microphysical process rates for output (mixing ratio tendencies)
real(r8), intent(out) :: prao(pcols,pver) ! accretion of cloud by rain
real(r8), intent(out) :: prco(pcols,pver) ! autoconversion of cloud to rain
real(r8), intent(out) :: mnuccco(pcols,pver) ! mixing rat tend due to immersion freezing
real(r8), intent(out) :: mnuccto(pcols,pver) ! mixing ratio tend due to contact freezing
real(r8), intent(out) :: msacwio(pcols,pver) ! mixing ratio tend due to H-M splintering
real(r8), intent(out) :: psacwso(pcols,pver) ! collection of cloud water by snow
real(r8), intent(out) :: bergso(pcols,pver) ! bergeron process on snow
real(r8), intent(out) :: bergo(pcols,pver) ! bergeron process on cloud ice
real(r8), intent(out) :: melto(pcols,pver) ! melting of cloud ice
real(r8), intent(out) :: homoo(pcols,pver) ! homogeneos freezign cloud water
real(r8), intent(out) :: qcreso(pcols,pver) ! residual cloud condensation due to removal of excess supersat
real(r8), intent(out) :: prcio(pcols,pver) ! autoconversion of cloud ice to snow
real(r8), intent(out) :: praio(pcols,pver) ! accretion of cloud ice by snow
real(r8), intent(out) :: qireso(pcols,pver) ! residual ice deposition due to removal of excess supersat
real(r8), intent(out) :: mnuccro(pcols,pver) ! mixing ratio tendency due to heterogeneous freezing of rain to snow (1/s)
real(r8), intent(out) :: pracso (pcols,pver) ! mixing ratio tendency due to accretion of rain by snow (1/s)
real(r8), intent(out) :: meltsdt(pcols,pver) ! latent heating rate due to melting of snow (W/kg)
real(r8), intent(out) :: frzrdt (pcols,pver) ! latent heating rate due to homogeneous freezing of rain (W/kg)
real(r8), intent(out) :: mnuccdo(pcols,pver) ! mass tendency from ice nucleation
real(r8), intent(out) :: nrout(pcols,pver) ! rain number concentration (1/m3)
real(r8), intent(out) :: nsout(pcols,pver) ! snow number concentration (1/m3)
real(r8), intent(out) :: refl(pcols,pver) ! analytic radar reflectivity
real(r8), intent(out) :: arefl(pcols,pver) !average reflectivity will zero points outside valid range
real(r8), intent(out) :: areflz(pcols,pver) !average reflectivity in z.
real(r8), intent(out) :: frefl(pcols,pver)
real(r8), intent(out) :: csrfl(pcols,pver) !cloudsat reflectivity
real(r8), intent(out) :: acsrfl(pcols,pver) !cloudsat average
real(r8), intent(out) :: fcsrfl(pcols,pver)
real(r8), intent(out) :: rercld(pcols,pver) ! effective radius calculation for rain + cloud
real(r8), intent(out) :: ncai(pcols,pver) ! output number conc of ice nuclei available (1/m3)
real(r8), intent(out) :: ncal(pcols,pver) ! output number conc of CCN (1/m3)
real(r8), intent(out) :: qrout2(pcols,pver)
real(r8), intent(out) :: qsout2(pcols,pver)
real(r8), intent(out) :: nrout2(pcols,pver)
real(r8), intent(out) :: nsout2(pcols,pver)
real(r8), intent(out) :: drout2(pcols,pver) ! mean rain particle diameter (m)
real(r8), intent(out) :: dsout2(pcols,pver) ! mean snow particle diameter (m)
real(r8), intent(out) :: freqs(pcols,pver)
real(r8), intent(out) :: freqr(pcols,pver)
real(r8), intent(out) :: nfice(pcols,pver)
real(r8), intent(out) :: prer_evap(pcols,pver)
real(r8) :: nevapr2(pcols,pver)
character(128), intent(out) :: errstring ! Output status (non-blank for error return)
! Tendencies calculated by external schemes that can replace MG's native
! process tendencies.
! Used with CARMA cirrus microphysics
! (or similar external microphysics model)
real(r8), intent(in) :: tnd_qsnow(:,:) ! snow mass tendency (kg/kg/s)
real(r8), intent(in) :: tnd_nsnow(:,:) ! snow number tendency (#/kg/s)
real(r8), intent(in) :: re_ice(:,:) ! ice effective radius (m)
! From external ice nucleation.
real(r8), intent(in) :: frzimm(:,:) ! Number tendency due to immersion freezing (1/cm3)
real(r8), intent(in) :: frzcnt(:,:) ! Number tendency due to contact freezing (1/cm3)
real(r8), intent(in) :: frzdep(:,:) ! Number tendency due to deposition nucleation (1/cm3)
! local workspace
! all units mks unless otherwise stated
! Additional constants to help speed up code
real(r8) :: cons2
real(r8) :: cons3
real(r8) :: cons9
real(r8) :: cons10
real(r8) :: cons12
real(r8) :: cons15
real(r8) :: cons18
real(r8) :: cons19
real(r8) :: cons20
! temporary variables for sub-stepping
real(r8) :: t1(pcols,pver)
real(r8) :: q1(pcols,pver)
real(r8) :: qc1(pcols,pver)
real(r8) :: qi1(pcols,pver)
real(r8) :: nc1(pcols,pver)
real(r8) :: ni1(pcols,pver)
real(r8) :: tlat1(pcols,pver)
real(r8) :: qvlat1(pcols,pver)
real(r8) :: qctend1(pcols,pver)
real(r8) :: qitend1(pcols,pver)
real(r8) :: nctend1(pcols,pver)
real(r8) :: nitend1(pcols,pver)
real(r8) :: prect1(pcols)
real(r8) :: preci1(pcols)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
real(r8) :: deltat ! sub-time step (s)
real(r8) :: omsm ! number near unity for round-off issues
real(r8) :: dto2 ! dt/2 (s)
real(r8) :: mincld ! minimum allowed cloud fraction
real(r8) :: q(pcols,pver) ! water vapor mixing ratio (kg/kg)
real(r8) :: t(pcols,pver) ! temperature (K)
real(r8) :: rho(pcols,pver) ! air density (kg m-3)
real(r8) :: dv(pcols,pver) ! diffusivity of water vapor in air
real(r8) :: mu(pcols,pver) ! viscocity of air
real(r8) :: sc(pcols,pver) ! schmidt number
real(r8) :: kap(pcols,pver) ! thermal conductivity of air
real(r8) :: rhof(pcols,pver) ! air density correction factor for fallspeed
real(r8) :: cldmax(pcols,pver) ! precip fraction assuming maximum overlap
real(r8) :: cldm(pcols,pver) ! cloud fraction
real(r8) :: icldm(pcols,pver) ! ice cloud fraction
real(r8) :: lcldm(pcols,pver) ! liq cloud fraction
real(r8) :: icwc(pcols) ! in cloud water content (liquid+ice)
real(r8) :: calpha(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cbeta(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cbetah(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cgamma(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cgamah(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: rcgama(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cmec1(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cmec2(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cmec3(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: cmec4(pcols) ! parameter for cond/evap (Zhang et al. 2003)
real(r8) :: qtmp ! dummy qv
real(r8) :: dum ! temporary dummy variable
real(r8) :: cme(pcols,pver) ! total (liquid+ice) cond/evap rate of cloud
real(r8) :: cmei(pcols,pver) ! dep/sublimation rate of cloud ice
real(r8) :: cwml(pcols,pver) ! cloud water mixing ratio
real(r8) :: cwmi(pcols,pver) ! cloud ice mixing ratio
real(r8) :: nnuccd(pver) ! ice nucleation rate from deposition/cond.-freezing
real(r8) :: mnuccd(pver) ! mass tendency from ice nucleation
real(r8) :: qcld ! total cloud water
real(r8) :: lcldn(pcols,pver) ! fractional coverage of new liquid cloud
real(r8) :: lcldo(pcols,pver) ! fractional coverage of old liquid cloud
real(r8) :: nctend_mixnuc(pcols,pver)
real(r8) :: arg ! argument of erfc
! for calculation of rate1ord_cw2pr_st
real(r8) :: qcsinksum_rate1ord(pver) ! sum over iterations of cw to precip sink
real(r8) :: qcsum_rate1ord(pver) ! sum over iterations of cloud water
real(r8) :: alpha
real(r8) :: dum1,dum2 !general dummy variables
real(r8) :: npccn(pver) ! droplet activation rate
real(r8) :: qcic(pcols,pver) ! in-cloud cloud liquid mixing ratio
real(r8) :: qiic(pcols,pver) ! in-cloud cloud ice mixing ratio
real(r8) :: qniic(pcols,pver) ! in-precip snow mixing ratio
real(r8) :: qric(pcols,pver) ! in-precip rain mixing ratio
real(r8) :: ncic(pcols,pver) ! in-cloud droplet number conc
real(r8) :: niic(pcols,pver) ! in-cloud cloud ice number conc
real(r8) :: nsic(pcols,pver) ! in-precip snow number conc
real(r8) :: nric(pcols,pver) ! in-precip rain number conc
real(r8) :: lami(pver) ! slope of cloud ice size distr
real(r8) :: n0i(pver) ! intercept of cloud ice size distr
real(r8) :: lamc(pver) ! slope of cloud liquid size distr
real(r8) :: n0c(pver) ! intercept of cloud liquid size distr
real(r8) :: lams(pver) ! slope of snow size distr
real(r8) :: n0s(pver) ! intercept of snow size distr
real(r8) :: lamr(pver) ! slope of rain size distr
real(r8) :: n0r(pver) ! intercept of rain size distr
real(r8) :: cdist1(pver) ! size distr parameter to calculate droplet freezing
! combined size of precip & cloud drops
real(r8) :: arcld(pcols,pver) ! averaging control flag
real(r8) :: Actmp !area cross section of drops
real(r8) :: Artmp !area cross section of rain
real(r8) :: pgam(pver) ! spectral width parameter of droplet size distr
real(r8) :: lammax ! maximum allowed slope of size distr
real(r8) :: lammin ! minimum allowed slope of size distr
real(r8) :: nacnt ! number conc of contact ice nuclei
real(r8) :: mnuccc(pver) ! mixing ratio tendency due to freezing of cloud water
real(r8) :: nnuccc(pver) ! number conc tendency due to freezing of cloud water
real(r8) :: mnucct(pver) ! mixing ratio tendency due to contact freezing of cloud water
real(r8) :: nnucct(pver) ! number conc tendency due to contact freezing of cloud water
real(r8) :: msacwi(pver) ! mixing ratio tendency due to HM ice multiplication
real(r8) :: nsacwi(pver) ! number conc tendency due to HM ice multiplication
real(r8) :: prc(pver) ! qc tendency due to autoconversion of cloud droplets
real(r8) :: nprc(pver) ! number conc tendency due to autoconversion of cloud droplets
real(r8) :: nprc1(pver) ! qr tendency due to autoconversion of cloud droplets
real(r8) :: nsagg(pver) ! ns tendency due to self-aggregation of snow
real(r8) :: dc0 ! mean size droplet size distr
real(r8) :: ds0 ! mean size snow size distr (area weighted)
real(r8) :: eci ! collection efficiency for riming of snow by droplets
real(r8) :: psacws(pver) ! mixing rat tendency due to collection of droplets by snow
real(r8) :: npsacws(pver) ! number conc tendency due to collection of droplets by snow
real(r8) :: uni ! number-weighted cloud ice fallspeed
real(r8) :: umi ! mass-weighted cloud ice fallspeed
real(r8) :: uns(pver) ! number-weighted snow fallspeed
real(r8) :: ums(pver) ! mass-weighted snow fallspeed
real(r8) :: unr(pver) ! number-weighted rain fallspeed
real(r8) :: umr(pver) ! mass-weighted rain fallspeed
real(r8) :: unc ! number-weighted cloud droplet fallspeed
real(r8) :: umc ! mass-weighted cloud droplet fallspeed
real(r8) :: pracs(pver) ! mixing rat tendency due to collection of rain by snow
real(r8) :: npracs(pver) ! number conc tendency due to collection of rain by snow
real(r8) :: mnuccr(pver) ! mixing rat tendency due to freezing of rain
real(r8) :: nnuccr(pver) ! number conc tendency due to freezing of rain
real(r8) :: pra(pver) ! mixing rat tendnency due to accretion of droplets by rain
real(r8) :: npra(pver) ! nc tendnency due to accretion of droplets by rain
real(r8) :: nragg(pver) ! nr tendency due to self-collection of rain
real(r8) :: prci(pver) ! mixing rat tendency due to autoconversion of cloud ice to snow
real(r8) :: nprci(pver) ! number conc tendency due to autoconversion of cloud ice to snow
real(r8) :: prai(pver) ! mixing rat tendency due to accretion of cloud ice by snow
real(r8) :: nprai(pver) ! number conc tendency due to accretion of cloud ice by snow
real(r8) :: qvs ! liquid saturation vapor mixing ratio
real(r8) :: qvi ! ice saturation vapor mixing ratio
real(r8) :: dqsdt ! change of sat vapor mixing ratio with temperature
real(r8) :: dqsidt ! change of ice sat vapor mixing ratio with temperature
real(r8) :: ab ! correction factor for rain evap to account for latent heat
real(r8) :: qclr ! water vapor mixing ratio in clear air
real(r8) :: abi ! correction factor for snow sublimation to account for latent heat
real(r8) :: epss ! 1/ sat relaxation timescale for snow
real(r8) :: epsr ! 1/ sat relaxation timescale for rain
real(r8) :: pre(pver) ! rain mixing rat tendency due to evaporation
real(r8) :: prds(pver) ! snow mixing rat tendency due to sublimation
real(r8) :: qce ! dummy qc for conservation check
real(r8) :: qie ! dummy qi for conservation check
real(r8) :: nce ! dummy nc for conservation check
real(r8) :: nie ! dummy ni for conservation check
real(r8) :: ratio ! parameter for conservation check
real(r8) :: dumc(pcols,pver) ! dummy in-cloud qc
real(r8) :: dumnc(pcols,pver) ! dummy in-cloud nc
real(r8) :: dumi(pcols,pver) ! dummy in-cloud qi
real(r8) :: dumni(pcols,pver) ! dummy in-cloud ni
real(r8) :: dums(pcols,pver) ! dummy in-cloud snow mixing rat
real(r8) :: dumns(pcols,pver) ! dummy in-cloud snow number conc
real(r8) :: dumr(pcols,pver) ! dummy in-cloud rain mixing rat
real(r8) :: dumnr(pcols,pver) ! dummy in-cloud rain number conc
! below are parameters for cloud water and cloud ice sedimentation calculations
real(r8) :: fr(pver)
real(r8) :: fnr(pver)
real(r8) :: fc(pver)
real(r8) :: fnc(pver)
real(r8) :: fi(pver)
real(r8) :: fni(pver)
real(r8) :: fs(pver)
real(r8) :: fns(pver)
real(r8) :: faloutr(pver)
real(r8) :: faloutnr(pver)
real(r8) :: faloutc(pver)
real(r8) :: faloutnc(pver)
real(r8) :: falouti(pver)
real(r8) :: faloutni(pver)
real(r8) :: falouts(pver)
real(r8) :: faloutns(pver)
real(r8) :: faltndr
real(r8) :: faltndnr
real(r8) :: faltndc
real(r8) :: faltndnc
real(r8) :: faltndi
real(r8) :: faltndni
real(r8) :: faltnds
real(r8) :: faltndns
real(r8) :: faltndqie
real(r8) :: faltndqce
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
real(r8) :: relhum(pcols,pver) ! relative humidity
real(r8) :: csigma(pcols) ! parameter for cond/evap of cloud water/ice
real(r8) :: rgvm ! max fallspeed for all species
real(r8) :: arn(pcols,pver) ! air density corrected rain fallspeed parameter
real(r8) :: asn(pcols,pver) ! air density corrected snow fallspeed parameter
real(r8) :: acn(pcols,pver) ! air density corrected cloud droplet fallspeed parameter
real(r8) :: ain(pcols,pver) ! air density corrected cloud ice fallspeed parameter
real(r8) :: nsubi(pver) ! evaporation of cloud ice number
real(r8) :: nsubc(pver) ! evaporation of droplet number
real(r8) :: nsubs(pver) ! evaporation of snow number
real(r8) :: nsubr(pver) ! evaporation of rain number
real(r8) :: mtime ! factor to account for droplet activation timescale
real(r8) :: dz(pcols,pver) ! height difference across model vertical level
!! add precip flux variables for sub-stepping
real(r8) :: rflx1(pcols,pver+1)
real(r8) :: sflx1(pcols,pver+1)
! returns from function/subroutine calls
real(r8) :: tsp(pcols,pver) ! saturation temp (K)
real(r8) :: qsp(pcols,pver) ! saturation mixing ratio (kg/kg)
real(r8) :: qsphy(pcols,pver) ! saturation mixing ratio (kg/kg): hybrid rh
real(r8) :: qs(pcols) ! liquid-ice weighted sat mixing rat (kg/kg)
real(r8) :: es(pcols) ! liquid-ice weighted sat vapor press (pa)
real(r8) :: esl(pcols,pver) ! liquid sat vapor pressure (pa)
real(r8) :: esi(pcols,pver) ! ice sat vapor pressure (pa)
! sum of source/sink terms for diagnostic precip
real(r8) :: qnitend(pcols,pver) ! snow mixing ratio source/sink term
real(r8) :: nstend(pcols,pver) ! snow number concentration source/sink term
real(r8) :: qrtend(pcols,pver) ! rain mixing ratio source/sink term
real(r8) :: nrtend(pcols,pver) ! rain number concentration source/sink term
real(r8) :: qrtot ! vertically-integrated rain mixing rat source/sink term
real(r8) :: nrtot ! vertically-integrated rain number conc source/sink term
real(r8) :: qstot ! vertically-integrated snow mixing rat source/sink term
real(r8) :: nstot ! vertically-integrated snow number conc source/sink term
! new terms for Bergeron process
real(r8) :: dumnnuc ! provisional ice nucleation rate (for calculating bergeron)
real(r8) :: ninew ! provisional cloud ice number conc (for calculating bergeron)
real(r8) :: qinew ! provisional cloud ice mixing ratio (for calculating bergeron)
real(r8) :: qvl ! liquid sat mixing ratio
real(r8) :: epsi ! 1/ sat relaxation timecale for cloud ice
real(r8) :: prd ! provisional deposition rate of cloud ice at water sat
real(r8) :: berg(pcols,pver) ! mixing rat tendency due to bergeron process for cloud ice
real(r8) :: bergs(pver) ! mixing rat tendency due to bergeron process for snow
!bergeron terms
real(r8) :: bergtsf !bergeron timescale to remove all liquid
real(r8) :: rhin !modified RH for vapor deposition
! diagnostic rain/snow for output to history
! values are in-precip (local) !!!!
real(r8) :: drout(pcols,pver) ! rain diameter (m)
!averageed rain/snow for history
real(r8) :: dumfice
!ice nucleation, droplet activation
real(r8) :: dum2i(pcols,pver) ! number conc of ice nuclei available (1/kg)
real(r8) :: dum2l(pcols,pver) ! number conc of CCN (1/kg)
real(r8) :: ncmax
real(r8) :: nimax
real(r8) :: qcvar ! 1/relative variance of sub-grid qc
! loop array variables
integer i,k,nstep,n, l
integer ii,kk, m
! loop variables for sub-step solution
integer iter,it,ltrue(pcols)
! used in contact freezing via dust particles
real(r8) tcnt, viscosity, mfp
real(r8) slip1, slip2, slip3, slip4
! real(r8) dfaer1, dfaer2, dfaer3, dfaer4
! real(r8) nacon1,nacon2,nacon3,nacon4
real(r8) ndfaer1, ndfaer2, ndfaer3, ndfaer4
real(r8) nslip1, nslip2, nslip3, nslip4
! used in ice effective radius
real(r8) bbi, cci, ak, iciwc, rvi
! used in Bergeron processe and water vapor deposition
real(r8) Tk, deles, Aprpr, Bprpr, Cice, qi0, Crate, qidep
! mean cloud fraction over the time step
real(r8) cldmw(pcols,pver)
! used in secondary ice production
real(r8) ni_secp
! variabels to check for RH after rain evap
real(r8) :: esn
real(r8) :: qsn
real(r8) :: ttmp
real(r8) :: rainrt(pcols,pver) ! rain rate for reflectivity calculation
real(r8) :: rainrt1(pcols,pver)
real(r8) :: tmp
real(r8) dmc,ssmc,dstrn ! variables for modal scheme.
real(r8), parameter :: cdnl = 0.e6_r8 ! cloud droplet number limiter
! heterogeneous freezing
real(r8) :: mnudep(pver) ! mixing ratio tendency due to deposition of water vapor
real(r8) :: nnudep(pver) ! number conc tendency due to deposition of water vapor
real(r8) :: con1 ! work cnstant
real(r8) :: r3lx ! Mean volume radius (m)
real(r8) :: mi0l
real(r8) :: frztmp
logical :: do_clubb_sgs
!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
! Return error message
errstring = ' '
call phys_getopts(do_clubb_sgs_out = do_clubb_sgs)
! initialize output fields for number conc qand ice nucleation
ncai(1:ncol,1:pver)=0._r8
ncal(1:ncol,1:pver)=0._r8
!Initialize rain size
rercld(1:ncol,1:pver)=0._r8
arcld(1:ncol,1:pver)=0._r8
!initialize radiation output variables
pgamrad(1:ncol,1:pver)=0._r8 ! liquid gamma parameter for optics (radiation)
lamcrad(1:ncol,1:pver)=0._r8 ! slope of droplet distribution for optics (radiation)
deffi (1:ncol,1:pver)=0._r8 ! slope of droplet distribution for optics (radiation)
!initialize radiation output variables
!initialize water vapor tendency term output
qcsevap(1:ncol,1:pver)=0._r8
qisevap(1:ncol,1:pver)=0._r8
qvres (1:ncol,1:pver)=0._r8
cmeiout (1:ncol,1:pver)=0._r8
vtrmc (1:ncol,1:pver)=0._r8
vtrmi (1:ncol,1:pver)=0._r8
qcsedten (1:ncol,1:pver)=0._r8
qisedten (1:ncol,1:pver)=0._r8
prao(1:ncol,1:pver)=0._r8
prco(1:ncol,1:pver)=0._r8
mnuccco(1:ncol,1:pver)=0._r8
mnuccto(1:ncol,1:pver)=0._r8
msacwio(1:ncol,1:pver)=0._r8
psacwso(1:ncol,1:pver)=0._r8
bergso(1:ncol,1:pver)=0._r8
bergo(1:ncol,1:pver)=0._r8
melto(1:ncol,1:pver)=0._r8
homoo(1:ncol,1:pver)=0._r8
qcreso(1:ncol,1:pver)=0._r8
prcio(1:ncol,1:pver)=0._r8
praio(1:ncol,1:pver)=0._r8
qireso(1:ncol,1:pver)=0._r8
mnuccro(1:ncol,1:pver)=0._r8
pracso (1:ncol,1:pver)=0._r8
meltsdt(1:ncol,1:pver)=0._r8
frzrdt (1:ncol,1:pver)=0._r8
mnuccdo(1:ncol,1:pver)=0._r8
rflx(:,:)=0._r8
sflx(:,:)=0._r8
effc(:,:)=0._r8
effc_fn(:,:)=0._r8
effi(:,:)=0._r8
! assign variable deltat for sub-stepping...
deltat=deltatin
! parameters for scheme
omsm=0.99999_r8
dto2=0.5_r8*deltat
mincld=0.0001_r8
! initialize multi-level fields
q(1:ncol,1:pver)=qn(1:ncol,1:pver)
t(1:ncol,1:pver)=tn(1:ncol,1:pver)
! initialize time-varying parameters
do k=1,pver
do i=1,ncol
rho(i,k)=p(i,k)/(r*t(i,k))
dv(i,k) = 8.794E-5_r8*t(i,k)**1.81_r8/p(i,k)
mu(i,k) = 1.496E-6_r8*t(i,k)**1.5_r8/(t(i,k)+120._r8)
sc(i,k) = mu(i,k)/(rho(i,k)*dv(i,k))
kap(i,k) = 1.414e3_r8*1.496e-6_r8*t(i,k)**1.5_r8/(t(i,k)+120._r8)
! air density adjustment for fallspeed parameters
! includes air density correction factor to the
! power of 0.54 following Heymsfield and Bansemer 2007
rhof(i,k)=(rhosu/rho(i,k))**0.54_r8
arn(i,k)=ar*rhof(i,k)
asn(i,k)=as*rhof(i,k)
acn(i,k)=ac*rhof(i,k)
ain(i,k)=ai*rhof(i,k)
! get dz from dp and hydrostatic approx
! keep dz positive (define as layer k-1 - layer k)
dz(i,k)= pdel(i,k)/(rho(i,k)*g)
end do
end do
! initialization
qc(1:ncol,1:top_lev-1) = 0._r8
qi(1:ncol,1:top_lev-1) = 0._r8
nc(1:ncol,1:top_lev-1) = 0._r8
ni(1:ncol,1:top_lev-1) = 0._r8
t1(1:ncol,1:pver) = t(1:ncol,1:pver)
q1(1:ncol,1:pver) = q(1:ncol,1:pver)
qc1(1:ncol,1:pver) = qc(1:ncol,1:pver)
qi1(1:ncol,1:pver) = qi(1:ncol,1:pver)
nc1(1:ncol,1:pver) = nc(1:ncol,1:pver)
ni1(1:ncol,1:pver) = ni(1:ncol,1:pver)
! initialize tendencies to zero
tlat1(1:ncol,1:pver)=0._r8
qvlat1(1:ncol,1:pver)=0._r8
qctend1(1:ncol,1:pver)=0._r8
qitend1(1:ncol,1:pver)=0._r8
nctend1(1:ncol,1:pver)=0._r8
nitend1(1:ncol,1:pver)=0._r8
! initialize precip output
qrout(1:ncol,1:pver)=0._r8
qsout(1:ncol,1:pver)=0._r8
nrout(1:ncol,1:pver)=0._r8
nsout(1:ncol,1:pver)=0._r8
dsout(1:ncol,1:pver)=0._r8
drout(1:ncol,1:pver)=0._r8
reff_rain(1:ncol,1:pver)=0._r8
reff_snow(1:ncol,1:pver)=0._r8
! initialize variables for trop_mozart
nevapr(1:ncol,1:pver) = 0._r8
nevapr2(1:ncol,1:pver) = 0._r8
evapsnow(1:ncol,1:pver) = 0._r8
prain(1:ncol,1:pver) = 0._r8
prodsnow(1:ncol,1:pver) = 0._r8
cmeout(1:ncol,1:pver) = 0._r8
am_evp_st(1:ncol,1:pver) = 0._r8
! for refl calc
rainrt1(1:ncol,1:pver) = 0._r8