-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule_mp_morr_two_moment.f90
6874 lines (5820 loc) · 240 KB
/
module_mp_morr_two_moment.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
!WRF:MODEL_LAYER:PHYSICS
!
! THIS MODULE CONTAINS THE TWO-MOMENT MICROPHYSICS CODE DESCRIBED BY
! MORRISON ET AL. (2009, MWR)
! CHANGES FOR V3.2, RELATIVE TO MOST RECENT (BUG-FIX) CODE FOR V3.1
! 1) ADDED ACCELERATED MELTING OF GRAUPEL/SNOW DUE TO COLLISION WITH RAIN, FOLLOWING LIN ET AL. (1983)
! 2) INCREASED MINIMUM LAMBDA FOR RAIN, AND ADDED RAIN DROP BREAKUP FOLLOWING MODIFIED VERSION
! OF VERLINDE AND COTTON (1993)
! 3) CHANGE MINIMUM ALLOWED MIXING RATIOS IN DRY CONDITIONS (RH < 90%), THIS IMPROVES RADAR REFLECTIIVITY
! IN LOW REFLECTIVITY REGIONS
! 4) BUG FIX TO MAXIMUM ALLOWED PARTICLE FALLSPEEDS AS A FUNCTION OF AIR DENSITY
! 5) BUG FIX TO CALCULATION OF LIQUID WATER SATURATION VAPOR PRESSURE (CHANGE IS VERY MINOR)
! 6) INCLUDE WRF CONSTANTS PER SUGGESTION OF JIMY
! bug fix, 5/12/10
! 7) bug fix for saturation vapor pressure in low pressure, to avoid division by zero
! 8) include 'EP2' WRF constant for saturation mixing ratio calculation, instead of hardwire constant
! CHANGES FOR V3.3
! 1) MODIFICATION FOR COUPLING WITH WRF-CHEM (PREDICTED DROPLET NUMBER CONCENTRATION) AS AN OPTION
! 2) MODIFY FALLSPEED BELOW THE LOWEST LEVEL OF PRECIPITATION, WHICH PREVENTS
! POTENTIAL FOR SPURIOUS ACCUMULATION OF PRECIPITATION DURING SUB-STEPPING FOR SEDIMENTATION
! 3) BUG FIX TO LATENT HEAT RELEASE DUE TO COLLISIONS OF CLOUD ICE WITH RAIN
! 4) CLEAN UP OF COMMENTS IN THE CODE
! additional minor bug fixes and small changes, 5/30/2011
! minor revisions by A. Ackerman April 2011:
! 1) replaced kinematic with dynamic viscosity
! 2) replaced scaling by air density for cloud droplet sedimentation
! with viscosity-dependent Stokes expression
! 3) use Ikawa and Saito (1991) air-density scaling for cloud ice
! 4) corrected typo in 2nd digit of ventilation constant F2R
! additional fixes:
! 5) TEMPERATURE FOR ACCELERATED MELTING DUE TO COLLIIONS OF SNOW AND GRAUPEL
! WITH RAIN SHOULD USE CELSIUS, NOT KELVIN (BUG REPORTED BY K. VAN WEVERBERG)
! 6) NPRACS IS NOT SUBTRACTED FROM SNOW NUMBER CONCENTRATION, SINCE
! DECREASE IN SNOW NUMBER IS ALREADY ACCOUNTED FOR BY NSMLTS
! 7) fix for switch for running w/o graupel/hail (cloud ice and snow only)
! hm bug fix 3/16/12
! 1) very minor change to limits on autoconversion source of rain number when cloud water is depleted
! WRFV3.5
! hm/A. Ackerman bug fix 11/08/12
! 1) for accelerated melting from collisions, should use rain mass collected by snow, not snow mass
! collected by rain
! 2) minor changes to some comments
! 3) reduction of maximum-allowed ice concentration from 10 cm-3 to 0.3
! cm-3. This was done to address the problem of excessive and persistent
! anvil cirrus produced by the scheme.
! CHANGES FOR WRFV3.5.1
! 1) added output for snow+cloud ice and graupel time step and accumulated
! surface precipitation
! 2) bug fix to option w/o graupel/hail (IGRAUP = 1), include PRACI, PGSACW,
! and PGRACS as sources for snow instead of graupel/hail, bug reported by
! Hailong Wang (PNNL)
! 3) very minor fix to immersion freezing rate formulation (negligible impact)
! 4) clarifications to code comments
! 5) minor change to shedding of rain, remove limit so that the number of
! collected drops can smaller than number of shed drops
! 6) change of specific heat of liquid water from 4218 to 4187 J/kg/K
! CHANGES FOR WRFV3.6.1
! 1) minor bug fix to melting of snow and graupel, an extra factor of air density (RHO) was removed
! from the calculation of PSMLT and PGMLT
! 2) redundant initialization of PSMLT (non answer-changing)
! CHANGES FOR WRFV3.8.1
! 1) changes and cleanup of code comments
! 2) correction to universal gas constant (very small change)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! THIS SCHEME IS A BULK DOUBLE-MOMENT SCHEME THAT PREDICTS MIXING
! RATIOS AND NUMBER CONCENTRATIONS OF FIVE HYDROMETEOR SPECIES:
! CLOUD DROPLETS, CLOUD (SMALL) ICE, RAIN, SNOW, AND GRAUPEL/HAIL.
#define KVALUE 20
#define JVALUE 11
#define IVALUE 20
#ifdef MARS_MORR_DEBUG
#define CALL_DEBUG(a,b) call debugval(a,b)
#endif
MODULE MODULE_MP_MORR_TWO_MOMENT
USE module_wrf_error
! USE module_utility, ONLY: WRFU_Clock, WRFU_Alarm ! GT
! USE module_domain, ONLY : HISTORY_ALARM, Is_alarm_tstep ! GT
! USE WRF PHYSICS CONSTANTS
use module_model_constants, ONLY: CP, G, R => r_d, RV => r_v, EP_2
#ifdef WRF_MARS
use module_model_constants, only: co2_molmass, co2_molrad, N_avogadro, kboltz => bk, &
mass_h2o, mass_co2, h2o_molrad, PI_S,SQRTPI
use module_planet_utilities, only : esat, tfrost_co2, prep_gaussian_weights
#endif
! USE module_state_description
IMPLICIT NONE
#if ( WRF_MARS == 1 )
REAL, PARAMETER :: PI = PI_S
#else
REAL, PARAMETER :: PI = 3.1415926535897932384626434
#endif
REAL, PARAMETER :: xxx = 0.9189385332046727417803297
PUBLIC :: MP_MORR_TWO_MOMENT
#ifdef WRF_MARS
PUBLIC :: constrain_mars_waterice, constrain_mars_dust, average_mass_of_particle
#endif
PUBLIC :: POLYSVP
PRIVATE :: GAMMA, DERF1
PRIVATE :: PI, xxx
PRIVATE :: MORR_TWO_MOMENT_MICRO
#ifdef WRF_MARS
! set this to true to get error messages if we're getting anything other than
! a vapour<->ice<-cloud system (it shouldn't rain on Mars - at least not today!)
LOGICAL, PARAMETER :: debug = .true.
! should probably have a namelist flag that comes through that allows this code to
! only treat dust for if we're running the two-moment dust but with water off
! - can't do the inverse of this since there is no homogeneous nucleation (i.e.
! homogeneous nuc is so hard in the Mars environment that it probably does not
! happen)
#endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! SWITCHES FOR MICROPHYSICS SCHEME
! IACT = 1, USE POWER-LAW CCN SPECTRA, NCCN = CS^K
! IACT = 2, USE LOGNORMAL AEROSOL SIZE DIST TO DERIVE CCN SPECTRA
! IACT = 3, ACTIVATION CALCULATED IN MODULE_MIXACTIVATE
INTEGER, PRIVATE :: IACT
! INUM = 0, PREDICT DROPLET CONCENTRATION
! INUM = 1, ASSUME CONSTANT DROPLET CONCENTRATION
! !!!NOTE: PREDICTED DROPLET CONCENTRATION NOT AVAILABLE IN THIS VERSION
! CONTACT HUGH MORRISON ([email protected]) FOR FURTHER INFORMATION
INTEGER, PRIVATE :: INUM
! FOR INUM = 1, SET CONSTANT DROPLET CONCENTRATION (CM-3)
REAL, PRIVATE :: NDCNST
! SWITCH FOR LIQUID-ONLY RUN
! ILIQ = 0, INCLUDE ICE
! ILIQ = 1, LIQUID ONLY, NO ICE
INTEGER, PRIVATE :: ILIQ
! SWITCH FOR ICE NUCLEATION
! INUC = 0, USE FORMULA FROM RASMUSSEN ET AL. 2002 (MID-LATITUDE)
! = 1, USE MPACE OBSERVATIONS
#ifdef WRF_MARS
! = 2, USE HETEROGENEOUS NUC ON DUST FOR MARS INC. CZICZO [2013] CONTACT PARAM VAR WITH T
! = 3, pseudo homogeneous ice nucleation following simple water scheme
! = 4, pseudo heterogeneous ice nucleation with growth
! = 5, pseudo heterogeneous ice nucleation requiring dust presence, with growth
! = 6, heterogeneous ice nucleation, omg.
logical, private :: mars_heterogeneous, mars_growth, mars_dust_scavenging, &
nucleation_monolayer, nucleation_surface_diffusion
real, private :: nucleation_m
#endif
INTEGER, PRIVATE :: INUC
! IBASE = 1, NEGLECT DROPLET ACTIVATION AT LATERAL CLOUD EDGES DUE TO
! UNRESOLVED ENTRAINMENT AND MIXING, ACTIVATE
! AT CLOUD BASE OR IN REGION WITH LITTLE CLOUD WATER USING
! NON-EQULIBRIUM SUPERSATURATION,
! IN CLOUD INTERIOR ACTIVATE USING EQUILIBRIUM SUPERSATURATION
! IBASE = 2, ASSUME DROPLET ACTIVATION AT LATERAL CLOUD EDGES DUE TO
! UNRESOLVED ENTRAINMENT AND MIXING DOMINATES,
! ACTIVATE DROPLETS EVERYWHERE IN THE CLOUD USING NON-EQUILIBRIUM
! SUPERSATURATION, BASED ON THE
! LOCAL SUB-GRID AND/OR GRID-SCALE VERTICAL VELOCITY
! AT THE GRID POINT
! NOTE: ONLY USED FOR PREDICTED DROPLET CONCENTRATION (INUM = 0) IN NON-WRF-CHEM VERSION OF CODE
INTEGER, PRIVATE :: IBASE
! INCLUDE SUB-GRID VERTICAL VELOCITY IN DROPLET ACTIVATION
! ISUB = 0, INCLUDE SUB-GRID W (RECOMMENDED FOR LOWER RESOLUTION)
! ISUB = 1, EXCLUDE SUB-GRID W, ONLY USE GRID-SCALE W
! NOTE: ONLY USED FOR PREDICTED DROPLET CONCENTRATION (INUM = 0) IN NON-WRF-CHEM VERSION OF CODE
INTEGER, PRIVATE :: ISUB
! SWITCH FOR GRAUPEL/NO GRAUPEL
! IGRAUP = 0, INCLUDE GRAUPEL
! IGRAUP = 1, NO GRAUPEL
INTEGER, PRIVATE :: IGRAUP
! HM ADDED NEW OPTION FOR HAIL
! SWITCH FOR HAIL/GRAUPEL
! IHAIL = 0, DENSE PRECIPITATING ICE IS GRAUPEL
! IHAIL = 1, DENSE PRECIPITATING GICE IS HAIL
INTEGER, PRIVATE :: IHAIL
! CLOUD MICROPHYSICS CONSTANTS
REAL, PRIVATE :: AI,AC,AS,AR,AG ! 'A' PARAMETER IN FALLSPEED-DIAM RELATIONSHIP
REAL, PRIVATE :: BI,BC,BS,BR,BG ! 'B' PARAMETER IN FALLSPEED-DIAM RELATIONSHIP
! REAL, PRIVATE :: R ! GAS CONSTANT FOR AIR
! REAL, PRIVATE :: RV ! GAS CONSTANT FOR WATER VAPOR
! REAL, PRIVATE :: CP ! SPECIFIC HEAT AT CONSTANT PRESSURE FOR DRY AIR
REAL, PRIVATE :: RHOSU ! STANDARD AIR DENSITY AT 850 MB
REAL, PRIVATE :: RHOW ! DENSITY OF LIQUID WATER
REAL, PRIVATE :: RHOI ! BULK DENSITY OF CLOUD ICE
REAL, PRIVATE :: RHOSN ! BULK DENSITY OF SNOW
REAL, PRIVATE :: RHOG ! BULK DENSITY OF GRAUPEL
REAL, PRIVATE :: AIMM ! PARAMETER IN BIGG IMMERSION FREEZING
REAL, PRIVATE :: BIMM ! PARAMETER IN BIGG IMMERSION FREEZING
REAL, PRIVATE :: ECR ! COLLECTION EFFICIENCY BETWEEN DROPLETS/RAIN AND SNOW/RAIN
REAL, PRIVATE :: DCS ! THRESHOLD SIZE FOR CLOUD ICE AUTOCONVERSION
REAL, PRIVATE :: MI0 ! INITIAL SIZE OF NUCLEATED CRYSTAL
REAL, PRIVATE :: MG0 ! MASS OF EMBRYO GRAUPEL
REAL, PRIVATE :: F1S ! VENTILATION PARAMETER FOR SNOW
REAL, PRIVATE :: F2S ! VENTILATION PARAMETER FOR SNOW
REAL, PRIVATE :: F1R ! VENTILATION PARAMETER FOR RAIN
REAL, PRIVATE :: F2R ! VENTILATION PARAMETER FOR RAIN
! REAL, PRIVATE :: G ! GRAVITATIONAL ACCELERATION
REAL, PRIVATE :: QSMALL ! SMALLEST ALLOWED HYDROMETEOR MIXING RATIO
REAL, PRIVATE :: CI,DI,CS,DS,CG,DG ! SIZE DISTRIBUTION PARAMETERS FOR CLOUD ICE, SNOW, GRAUPEL
REAL, PRIVATE :: EII ! COLLECTION EFFICIENCY, ICE-ICE COLLISIONS
REAL, PRIVATE :: ECI ! COLLECTION EFFICIENCY, ICE-DROPLET COLLISIONS
REAL, PRIVATE :: RIN ! RADIUS OF CONTACT NUCLEI (M)
! hm, add for V3.2
REAL, PRIVATE :: CPW ! SPECIFIC HEAT OF LIQUID WATER
! CCN SPECTRA FOR IACT = 1
REAL, PRIVATE :: C1 ! 'C' IN NCCN = CS^K (CM-3)
REAL, PRIVATE :: K1 ! 'K' IN NCCN = CS^K
! AEROSOL PARAMETERS FOR IACT = 2
REAL, PRIVATE :: MW ! MOLECULAR WEIGHT WATER (KG/MOL)
REAL, PRIVATE :: OSM ! OSMOTIC COEFFICIENT
REAL, PRIVATE :: VI ! NUMBER OF ION DISSOCIATED IN SOLUTION
REAL, PRIVATE :: EPSM ! AEROSOL SOLUBLE FRACTION
REAL, PRIVATE :: RHOA ! AEROSOL BULK DENSITY (KG/M3)
REAL, PRIVATE :: MAP ! MOLECULAR WEIGHT AEROSOL (KG/MOL)
REAL, PRIVATE :: MA ! MOLECULAR WEIGHT OF 'AIR' (KG/MOL)
REAL, PRIVATE :: RR ! UNIVERSAL GAS CONSTANT
REAL, PRIVATE :: BACT ! ACTIVATION PARAMETER
REAL, PRIVATE :: RM1 ! GEOMETRIC MEAN RADIUS, MODE 1 (M)
REAL, PRIVATE :: RM2 ! GEOMETRIC MEAN RADIUS, MODE 2 (M)
REAL, PRIVATE :: NANEW1 ! TOTAL AEROSOL CONCENTRATION, MODE 1 (M^-3)
REAL, PRIVATE :: NANEW2 ! TOTAL AEROSOL CONCENTRATION, MODE 2 (M^-3)
REAL, PRIVATE :: SIG1 ! STANDARD DEVIATION OF AEROSOL S.D., MODE 1
REAL, PRIVATE :: SIG2 ! STANDARD DEVIATION OF AEROSOL S.D., MODE 2
REAL, PRIVATE :: F11 ! CORRECTION FACTOR FOR ACTIVATION, MODE 1
REAL, PRIVATE :: F12 ! CORRECTION FACTOR FOR ACTIVATION, MODE 1
REAL, PRIVATE :: F21 ! CORRECTION FACTOR FOR ACTIVATION, MODE 2
REAL, PRIVATE :: F22 ! CORRECTION FACTOR FOR ACTIVATION, MODE 2
REAL, PRIVATE :: MMULT ! MASS OF SPLINTERED ICE PARTICLE
REAL, PRIVATE :: LAMMAXI,LAMMINI,LAMMAXR,LAMMINR,LAMMAXS,LAMMINS,LAMMAXG,LAMMING
#ifdef WRF_MARS
REAL, PRIVATE :: LAMMAXD, LAMMIND, LAMDEFD, LAMD, DUST_CONS0, DUST_CONS1, DUST_CONS2, DUST_CONS3, dust_cons3_a, DUST_MU, &
DUST_CONS_A_SEDIM, DUST_CONS_B_SEDIM, DUST_CONS_E_SEDIM, DUST_PIRHOD, DUST_CONS_RHO, &
DUST_CONS_INV_G1, DUST_CONS_INV_G4, DUST_CONS_G3,&
nfac_lammaxd1, nfac_lammind1, nfac_lammaxd4, nfac_lammind4, &
nfac_lamdefd1, nfac_lamdefd4
real(kind(0.d0)) :: dust_mu_r8
real, private :: ice_consmin_q_n, ice_consmax_q_n, lammind_q_n, lammaxd_q_n, lamdefd_q_n
! real, private :: lamdefi,nfac_lamdefd1, nfac_lamdefd4
integer, private :: DISTRIBUTION_MARS_DUST
real, private :: sigma_squared
real, private :: dust_reff_max, dust_reff_min, dust_reff_default
real, private :: ln_dust_reff_max, ln_dust_reff_min, ln_dust_reff_default
!ice constants
real, private :: ice_mu, ice_cons12, ice_cons11, ice_cons10, ice_cons2
real, private :: ice_cons11min, ice_cons11max, ice_cons10min, ice_cons10max
real, private :: ice_cons_nuc_m0,ice_cons_nuc_m2,ice_cons_nuc_m3
real, private :: ice_cons_nuc_m0p5,ice_cons_nuc_m2p5,ice_cons_nuc_m3p5
real, private :: homogeneous_ice_number_cons1
!nucleation
real, private :: ice_cons_prefactor
real, private :: water_molec_volume, water_molec_radius
real, dimension(:,:), allocatable :: hc_data
integer :: hc_ncolumns, hc_nrows
real :: hc_tmin, hc_deltaT
real :: photolysis_scrit
#endif
! CONSTANTS TO IMPROVE EFFICIENCY
REAL, PRIVATE :: CONS1,CONS2,CONS3,CONS4,CONS5,CONS6,CONS7,CONS8,CONS9,CONS10
REAL, PRIVATE :: CONS11,CONS12,CONS13,CONS14,CONS15,CONS16,CONS17,CONS18,CONS19,CONS20
REAL, PRIVATE :: CONS21,CONS22,CONS23,CONS24,CONS25,CONS26,CONS27,CONS28,CONS29,CONS30
REAL, PRIVATE :: CONS31,CONS32,CONS33,CONS34,CONS35,CONS36,CONS37,CONS38,CONS39,CONS40
REAL, PRIVATE :: CONS41
logical :: iprint, jprint
!bin scheme
integer, parameter :: nbins=6
real(kind(0.d0)), dimension(nbins) :: number, mass
real(kind(0.d0)), dimension(nbins) :: diam, vol, bin_width
real(kind(0.d0)), dimension(2,nbins) :: weights_pos
real(kind(0.d0)), dimension(nbins+1) :: diam_edges
#ifdef MARS_MORR_DEBUG
interface debugval
module procedure debugvaldouble, debugvalsingle, debugvalint,debugvallogical
end interface
#endif
CONTAINS
#ifdef MARS_MORR_DEBUG
subroutine debugvallogical(name, value)
implicit none
character(len=*), intent(in) :: name
logical, intent(in) :: value
if (iprint) write(*,*) name, " = ", value
end subroutine debugvallogical
subroutine debugvalint(name, value)
implicit none
character(len=*), intent(in) :: name
integer, intent(in) :: value
if (iprint) write(*,*) name, " = ", value
end subroutine debugvalint
subroutine debugvaldouble(name, value)
implicit none
character(len=*), intent(in) :: name
real(kind(0.d0)), intent(in) :: value
if (iprint) write(*,*) name, " = ", value
end subroutine debugvaldouble
subroutine debugvalsingle(name, value)
implicit none
character(len=*), intent(in) :: name
real, intent(in) :: value
if (iprint) write(*,*) name, " = ", value
end subroutine debugvalsingle
#endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUBROUTINE MORR_TWO_MOMENT_INIT( &
#ifdef WRF_MARS
rho_dust &
,rhod_h2oi &
,reff &
,veff &
,a_dust_sedim &
,b_dust_sedim &
,e_dust_sedim &
,dust_distribution &
,homogeneous_ice_reff &
,mars_ice_nucleation &
,mars_nucleation_surface_diffusion &
,mars_nucleation_monolayer &
,mars_nucleation_m &
,nucleation_filename &
#endif
)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! THIS SUBROUTINE INITIALIZES ALL PHYSICAL CONSTANTS AMND PARAMETERS
! NEEDED BY THE MICROPHYSICS SCHEME.
! NEEDS TO BE CALLED AT FIRST TIME STEP, PRIOR TO CALL TO MAIN MICROPHYSICS INTERFACE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IMPLICIT NONE
#ifdef WRF_MARS
real, intent(in) :: rho_dust, &
rhod_h2oi, &
reff, &
veff, &
a_dust_sedim, &
b_dust_sedim, &
e_dust_sedim
real, intent(in) :: homogeneous_ice_reff
integer, intent(in) :: dust_distribution, mars_ice_nucleation
logical, intent(in) :: mars_nucleation_monolayer, mars_nucleation_surface_diffusion
real, intent(in) :: mars_nucleation_m
character(len=*), intent(in) :: nucleation_filename
real :: volratio, diamratio
real :: bin_min_diam, bin_max_diam, bin_edge_min_diam, bin_edge_max_diam
real(kind(0.d0)), dimension(nbins+1) :: gloc
#endif
integer n,i
real(kind(0.d0)) :: pans, qans, fmin, fmax
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! THE FOLLOWING PARAMETERS ARE USER-DEFINED SWITCHES AND NEED TO BE
! SET PRIOR TO CODE COMPILATION
! INUM IS AUTOMATICALLY SET TO 0 FOR WRF-CHEM BELOW,
! ALLOWING PREDICTION OF DROPLET CONCENTRATION
! THUS, THIS PARAMETER SHOULD NOT BE CHANGED HERE
! AND SHOULD BE LEFT TO 1
INUM = 1
! SET CONSTANT DROPLET CONCENTRATION (UNITS OF CM-3)
! IF NO COUPLING WITH WRF-CHEM
NDCNST = 250.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! NOTE, THE FOLLOWING OPTIONS RELATED TO DROPLET ACTIVATION
! (IACT, IBASE, ISUB) ARE NOT AVAILABLE IN CURRENT VERSION
! FOR WRF-CHEM, DROPLET ACTIVATION IS PERFORMED
! IN 'MIX_ACTIVATE', NOT IN MICROPHYSICS SCHEME
! IACT = 1, USE POWER-LAW CCN SPECTRA, NCCN = CS^K
! IACT = 2, USE LOGNORMAL AEROSOL SIZE DIST TO DERIVE CCN SPECTRA
IACT = 2
! IBASE = 1, NEGLECT DROPLET ACTIVATION AT LATERAL CLOUD EDGES DUE TO
! UNRESOLVED ENTRAINMENT AND MIXING, ACTIVATE
! AT CLOUD BASE OR IN REGION WITH LITTLE CLOUD WATER USING
! NON-EQULIBRIUM SUPERSATURATION ASSUMING NO INITIAL CLOUD WATER,
! IN CLOUD INTERIOR ACTIVATE USING EQUILIBRIUM SUPERSATURATION
! IBASE = 2, ASSUME DROPLET ACTIVATION AT LATERAL CLOUD EDGES DUE TO
! UNRESOLVED ENTRAINMENT AND MIXING DOMINATES,
! ACTIVATE DROPLETS EVERYWHERE IN THE CLOUD USING NON-EQUILIBRIUM
! SUPERSATURATION ASSUMING NO INITIAL CLOUD WATER, BASED ON THE
! LOCAL SUB-GRID AND/OR GRID-SCALE VERTICAL VELOCITY
! AT THE GRID POINT
! NOTE: ONLY USED FOR PREDICTED DROPLET CONCENTRATION (INUM = 0)
IBASE = 2
! INCLUDE SUB-GRID VERTICAL VELOCITY (standard deviation of w) IN DROPLET ACTIVATION
! ISUB = 0, INCLUDE SUB-GRID W (RECOMMENDED FOR LOWER RESOLUTION)
! currently, sub-grid w is constant of 0.5 m/s (not coupled with PBL/turbulence scheme)
! ISUB = 1, EXCLUDE SUB-GRID W, ONLY USE GRID-SCALE W
! NOTE: ONLY USED FOR PREDICTED DROPLET CONCENTRATION (INUM = 0)
ISUB = 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! SWITCH FOR LIQUID-ONLY RUN
! ILIQ = 0, INCLUDE ICE
! ILIQ = 1, LIQUID ONLY, NO ICE
ILIQ = 0
! SWITCH FOR ICE NUCLEATION
! INUC = 0, USE FORMULA FROM RASMUSSEN ET AL. 2002 (MID-LATITUDE)
! = 1, USE MPACE OBSERVATIONS (ARCTIC ONLY)
#ifdef WRF_MARS
! = 2, USE MARS HETERO NUC ON DUST AND CONTACT PARAM TEMPERATURE DEPENDENCE
nucleation_monolayer = .false.
nucleation_surface_diffusion=.true.
nucleation_m = 0.954
nucleation_monolayer = mars_nucleation_monolayer
nucleation_surface_diffusion = mars_nucleation_surface_diffusion
nucleation_surface_diffusion = mars_nucleation_surface_diffusion
nucleation_m = mars_nucleation_m
INUC = mars_ice_nucleation
mars_heterogeneous = .false.
mars_growth=.false.
mars_dust_scavenging = .true.
if(inuc.ge.4) then
mars_growth=.true.
endif
if (inuc.eq.6 .or. inuc.eq.7) then
mars_heterogeneous = .true.
if(inuc .eq. 7) mars_dust_scavenging = .false.
!call load_heterogeneous_coefficients(nucleation_filename)
endif
#else
INUC = 0
#endif
! SWITCH FOR GRAUPEL/HAIL NO GRAUPEL/HAIL
! IGRAUP = 0, INCLUDE GRAUPEL/HAIL
! IGRAUP = 1, NO GRAUPEL/HAIL
#ifdef WRF_MARS
IGRAUP=1
#else
IGRAUP = 0
#endif
! HM ADDED 11/7/07
! SWITCH FOR HAIL/GRAUPEL
! IHAIL = 0, DENSE PRECIPITATING ICE IS GRAUPEL
! IHAIL = 1, DENSE PRECIPITATING ICE IS HAIL
! NOTE ---> RECOMMEND IHAIL = 1 FOR CONTINENTAL DEEP CONVECTION
IHAIL = 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! SET PHYSICAL CONSTANTS
! FALLSPEED PARAMETERS (V=AD^B)
AI = 700.
AC = 3.E7
AS = 11.72
AR = 841.99667
BI = 1.
BC = 2.
BS = 0.41
BR = 0.8
IF (IHAIL.EQ.0) THEN
AG = 19.3
BG = 0.37
ELSE ! (MATSUN AND HUGGINS 1980)
AG = 114.5
BG = 0.5
END IF
! CONSTANTS AND PARAMETERS
! R = 287.15
! RV = 461.5
! CP = 1005.
RHOSU = 85000./(287.15*273.15)
RHOW = 997.
#ifdef WRF_MARS
RHOI = rhod_h2oi
#else
RHOI = 500.
#endif
RHOSN = 100.
IF (IHAIL.EQ.0) THEN
RHOG = 400.
ELSE
RHOG = 900.
END IF
AIMM = 0.66
BIMM = 100.
ECR = 1.
#ifdef WRF_MARS
! Need to think about what cutoff size for ice vs. clouds. This must
! surely be something we estimate from the stokes-cunnigham to make it
! general - which means we need some cutoff fall speed above which we
! say it is snow
DCS = 125.E-6 ! cutoff or transition diameter (ice-snow) in meters
MI0 = 4./3.*PI*RHOI*(10.E-6)**3 ! initial nucleated ice particle mass
#else
DCS = 125.E-6
MI0 = 4./3.*PI*RHOI*(10.E-6)**3
#endif
MG0 = 1.6E-10
F1S = 0.86
F2S = 0.28
F1R = 0.78
! F2R = 0.32
! fix 053011
F2R = 0.308
! G = 9.806
QSMALL = 1.E-14
EII = 0.1
ECI = 0.7
! HM, ADD FOR V3.2
! hm, 7/23/13
! CPW = 4218.
CPW = 4187.
! SIZE DISTRIBUTION PARAMETERS
CI = RHOI*PI/6.
DI = 3.
CS = RHOSN*PI/6.
DS = 3.
CG = RHOG*PI/6.
DG = 3.
! RADIUS OF CONTACT NUCLEI
RIN = 0.1E-6
MMULT = 4./3.*PI*RHOI*(5.E-6)**3
! SIZE LIMITS FOR LAMBDA
#ifdef WRF_MARS
LAMMAXI = 1./5.E-7
LAMMINI = 1./(2.*DCS+100.E-6)
LAMMAXR = 1./1.E-6
! LAMMINR = 1./500.E-6
LAMMINR = 1./2800.E-6
#else
LAMMAXI = 1./1.E-6
LAMMINI = 1./(2.*DCS+100.E-6)
LAMMAXR = 1./20.E-6
! LAMMINR = 1./500.E-6
LAMMINR = 1./2800.E-6
#endif
LAMMAXS = 1./10.E-6
LAMMINS = 1./2000.E-6
LAMMAXG = 1./20.E-6
LAMMING = 1./2000.E-6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! note: these parameters only used by the non-wrf-chem version of the
! scheme with predicted droplet number
! CCN SPECTRA FOR IACT = 1
! MARITIME
! MODIFIED FROM RASMUSSEN ET AL. 2002
! NCCN = C*S^K, NCCN IS IN CM-3, S IS SUPERSATURATION RATIO IN %
K1 = 0.4
C1 = 120.
! CONTINENTAL
! K1 = 0.5
! C1 = 1000.
! AEROSOL ACTIVATION PARAMETERS FOR IACT = 2
! PARAMETERS CURRENTLY SET FOR AMMONIUM SULFATE
MW = 0.018
OSM = 1.
VI = 3.
EPSM = 0.7
RHOA = 1777.
MAP = 0.132
MA = 0.0284
! hm fix 6/23/16
! RR = 8.3187
RR = 8.3145
BACT = VI*OSM*EPSM*MW*RHOA/(MAP*RHOW)
! AEROSOL SIZE DISTRIBUTION PARAMETERS CURRENTLY SET FOR MPACE
! (see morrison et al. 2007, JGR)
! MODE 1
RM1 = 0.052E-6
SIG1 = 2.04
NANEW1 = 72.2E6
F11 = 0.5*EXP(2.5*(LOG(SIG1))**2)
F21 = 1.+0.25*LOG(SIG1)
! MODE 2
RM2 = 1.3E-6
SIG2 = 2.5
NANEW2 = 1.8E6
F12 = 0.5*EXP(2.5*(LOG(SIG2))**2)
F22 = 1.+0.25*LOG(SIG2)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! CONSTANTS FOR EFFICIENCY
CONS1=GAMMA(1.+DS)*CS
CONS2=GAMMA(1.+DG)*CG
CONS3=GAMMA(4.+BS)/6.
CONS4=GAMMA(4.+BR)/6.
CONS5=GAMMA(1.+BS)
CONS6=GAMMA(1.+BR)
CONS7=GAMMA(4.+BG)/6.
CONS8=GAMMA(1.+BG)
CONS9=GAMMA(5./2.+BR/2.)
CONS10=GAMMA(5./2.+BS/2.)
CONS11=GAMMA(5./2.+BG/2.)
CONS12=GAMMA(1.+DI)*CI
CONS13=GAMMA(BS+3.)*PI/4.*ECI
CONS14=GAMMA(BG+3.)*PI/4.*ECI
CONS15=-1108.*EII*PI**((1.-BS)/3.)*RHOSN**((-2.-BS)/3.)/(4.*720.)
CONS16=GAMMA(BI+3.)*PI/4.*ECI
CONS17=4.*2.*3.*RHOSU*PI*ECI*ECI*GAMMA(2.*BS+2.)/(8.*(RHOG-RHOSN))
CONS18=RHOSN*RHOSN
CONS19=RHOW*RHOW
CONS20=20.*PI*PI*RHOW*BIMM
CONS21=4./(DCS*RHOI)
CONS22=PI*RHOI*DCS**3/6.
CONS23=PI/4.*EII*GAMMA(BS+3.)
CONS24=PI/4.*ECR*GAMMA(BR+3.)
CONS25=PI*PI/24.*RHOW*ECR*GAMMA(BR+6.)
CONS26=PI/6.*RHOW
CONS27=GAMMA(1.+BI)
CONS28=GAMMA(4.+BI)/6.
CONS29=4./3.*PI*RHOW*(25.E-6)**3
CONS30=4./3.*PI*RHOW
CONS31=PI*PI*ECR*RHOSN
CONS32=PI/2.*ECR
CONS33=PI*PI*ECR*RHOG
CONS34=5./2.+BR/2.
CONS35=5./2.+BS/2.
CONS36=5./2.+BG/2.
CONS37=4.*PI*1.38E-23/(6.*PI*RIN)
CONS38=PI*PI/3.*RHOW
CONS39=PI*PI/36.*RHOW*BIMM
CONS40=PI/6.*BIMM
CONS41=PI*PI*ECR*RHOW
#ifdef WRF_MARS
DUST_PIRHOD = pi * rho_dust
DUST_CONS_RHO = rho_dust
!compiler issues with dust_cons3
dust_cons3_a = N_avogadro * co2_molrad * co2_molrad
DUST_CONS3 = 1./ (4. * sqrt(2.) * pi) * co2_molmass / (dust_cons3_a)
dust_reff_max = 25.e-6
dust_reff_min = 0.1e-6
dust_reff_default = reff
if(dust_distribution == 0) then !GAMMA function
DUST_MU = (1-3*veff)/veff !mu_dust
dust_mu_r8 = dust_mu
DUST_CONS0 = GAMMA(DUST_MU + 4.) * DUST_PIRHOD / (6.)
DUST_CONS1 = DUST_CONS0 / GAMMA(DUST_MU+1.)
DUST_CONS2 = GAMMA(DUST_MU + 4.) / (2*GAMMA(DUST_MU + 3.))
DUST_CONS_INV_G1 = 1./ GAMMA(DUST_MU + 1.)
DUST_CONS_INV_G4 = 1./ GAMMA(DUST_MU + 4.)
DUST_CONS_G3 = GAMMA(DUST_MU + 3.)
DUST_CONS_A_SEDIM = a_dust_sedim
DUST_CONS_B_SEDIM = b_dust_sedim
DUST_CONS_E_SEDIM = e_dust_sedim
LAMMIND = DUST_CONS2/dust_reff_max !25 micron
LAMMAXD = DUST_CONS2/dust_reff_min !0.1 micron
LAMDEFD = DUST_CONS2/dust_reff_default !2.0 micron
!nfac_LAMMIND1 = GAMMA(DUST_MU+1.) * exp(-(DUST_MU+1.)*log(LAMMIND))
!nfac_LAMMAXD1 = GAMMA(DUST_MU+1.) * exp(-(DUST_MU+1.)*log(LAMMAXD))
!nfac_LAMMIND4 = exp((DUST_MU+4.)*log(LAMMIND)) / dust_cons0
!nfac_LAMMAXD4 = exp((DUST_MU+4.)*log(LAMMAXD)) / dust_cons0
!nfac_LAMDEFD1 = GAMMA(DUST_MU+1.) * exp(-(DUST_MU+1.)*log(LAMDEFD))
!nfac_LAMDEFD4 = exp((DUST_MU+4.)*log(LAMDEFD)) / dust_cons0
LAMMIND_Q_N = exp((3.)*log(LAMMIND)) / dust_cons1
LAMMAXD_Q_N = exp((3.)*log(LAMMAXD)) / dust_cons1
LAMDEFD_Q_N = exp((3.)*log(LAMDEFD)) / dust_cons1
! Bins Gauss Legendre
gloc=0.
call prep_gaussian_weights(nbins,.false.,weights_pos) !these are the fractions. yay.
bin_width=weights_pos(1,:)
gloc(:nbins) = weights_pos(2,:)
! write(*,*) "loc", gloc
! write(*,*) "bw", bin_width
call gamma_inc_inv_calc(dust_mu_r8,gloc(:nbins),diam,nbins,"diam")
gloc(1)=0.0
do i=2, nbins+1
gloc(i) = gloc(i-1) + bin_width(i-1)
end do
fmin=1e-9
fmax=1-fmin
gloc(1) = fmin
gloc(nbins+1)=fmax
!write(*,*) "edges", gloc
call gamma_inc_inv_calc(dust_mu_r8,gloc(:),diam_edges,nbins+1,"diam_edges")
call calc_weights(dust_mu_r8,diam_edges, number, nbins) !fraction of total number between edges
call calc_weights(dust_mu_r8+3,diam_edges, mass, nbins) !fraction of total mass between edges
!done bin calculation
!debug bins
!write(*,*) bin_width
!write(*,*) diam
!write(*,*) diam_edges
! do i=1, nbins
! write(*,*) "bin ", i,": ",diam_edges(i), diam(i), diam_edges(i+1), bin_width(i), number(i),mass(i)
! end do
else if (dust_distribution == 1) then !lognormal
sigma_squared = alog(veff+1)
dust_cons1 = (DUST_PIRHOD / 6. )
!exp(-sigma**2 / 2)
dust_cons2 = exp(-sigma_squared/2)
!Cunningham factors, B and E is not used in lognormal
DUST_CONS_A_SEDIM = a_dust_sedim
ln_dust_reff_max = alog(dust_reff_max)
ln_dust_reff_min = alog(dust_reff_min)
ln_dust_reff_default = alog(dust_reff_default)
endif
DISTRIBUTION_MARS_DUST=dust_distribution
!ice constants
ice_mu = dust_mu
ice_cons2 = GAMMA(1.+DI+ice_mu) / (2.*GAMMA(ice_mu+DI)) !replaces dust_cons2 for ice on Mars
LAMMINI = ICE_CONS2/100e-6 !100 micron
LAMMAXI = ICE_CONS2/.1e-6 !.1 micron
! LAMDEFI = ICE_CONS2/dust_reff_default !2.0 micron
! DI is the shape parameter for ice that scale size to mass
! alternatively, it is describes how density changes with diameter*(1/3), or makes
! ice particles behave less spherical if DI != 3.
ice_cons10 = GAMMA(1+ice_mu)
!ice_cons10min = GAMMA(1+ice_mu) / exp((1+ice_mu)*log(lammini)) ! gamma(mu+1) / lam**(mu+1)
!ice_cons10max = GAMMA(1+ice_mu) / exp((1+ice_mu)*log(lammaxi)) ! gamma(mu+1) / lam**(mu+1)
ice_cons11 = 1./(ci * GAMMA(1+ice_mu+DI))
!ice_cons11min = ice_cons11 * exp((1+ice_mu+DI)*log(lammini))
!ice_cons11max = ice_cons11 * exp((1+ice_mu+DI)*log(lammaxi))
ice_cons12 = GAMMA(1.+DI+ice_mu) * ci / GAMMA(1+ice_mu) !replaces cons12 for Mars
ice_consmin_Q_N = exp(DI*log(lammini)) / ice_cons12
ice_consmax_Q_N = exp(DI*log(lammaxi)) / ice_cons12
homogeneous_ice_number_cons1 = (1./8) * (1./ci) * (1./homogeneous_ice_reff**3) &
* GAMMA(ice_mu+1) * (ice_mu+DI)**3 / gamma(ice_mu+DI+1) !that's horrible
!For DI ==3:
!(6/8) * (1./pi*rho) * (1./reff**3) * (mu+3)*(mu+3)/((mu+2)*(mu+1))
!The '6' is already folded in 'ci'
water_molec_volume = 3.22e-29 !m^3
water_molec_radius = ((3./(4*pi)) * water_molec_volume)**(1./3)
ice_cons_prefactor = sqrt(3./(8*pi*pi*water_molec_radius*rhoi)) * (1./kboltz)
ice_cons_nuc_m0 = 1. !ice_cons10
ice_cons_nuc_m2 = 1. ! GAMMA(3 + ice_mu)
ice_cons_nuc_m3 = 1. ! GAMMA(DI + 1 + ice_mu)
ice_cons_nuc_m0p5 = GAMMA(1.5 + ice_mu) / GAMMA(1. + ice_mu) ! GAMMA(1.5+ ice_mu)
ice_cons_nuc_m2p5 = GAMMA(3.5 + ice_mu) / GAMMA(3 + ice_mu)
ice_cons_nuc_m3p5 = GAMMA(DI + 1.5 + ice_mu) / GAMMA(DI + 1. + ice_mu)
photolysis_scrit = 10.
#endif
END SUBROUTINE MORR_TWO_MOMENT_INIT
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! THIS SUBROUTINE IS MAIN INTERFACE WITH THE TWO-MOMENT MICROPHYSICS SCHEME
! THIS INTERFACE TAKES IN 3D VARIABLES FROM DRIVER MODEL, CONVERTS TO 1D FOR
! CALL TO THE MAIN MICROPHYSICS SUBROUTINE (SUBROUTINE MORR_TWO_MOMENT_MICRO)
! WHICH OPERATES ON 1D VERTICAL COLUMNS.
! 1D VARIABLES FROM THE MAIN MICROPHYSICS SUBROUTINE ARE THEN REASSIGNED BACK TO 3D FOR OUTPUT
! BACK TO DRIVER MODEL USING THIS INTERFACE.
! MICROPHYSICS TENDENCIES ARE ADDED TO VARIABLES HERE BEFORE BEING PASSED BACK TO DRIVER MODEL.
! THIS CODE WAS WRITTEN BY HUGH MORRISON (NCAR) AND SLAVA TATARSKII (GEORGIA TECH).
! FOR QUESTIONS, CONTACT: HUGH MORRISON, E-MAIL: [email protected], PHONE:303-497-8916
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUBROUTINE MP_MORR_TWO_MOMENT(ITIMESTEP, &
TH, QV, QC, QR, QI, QS, QG, NI, NS, NR, NG, &
RHO, PII, P, DT_IN, DZ, HT, W, &
RAINNC, RAINNCV, SR, &
SNOWNC,SNOWNCV,GRAUPELNC,GRAUPELNCV, & ! hm added 7/13/13
qrcuten, qscuten, qicuten, mu & ! hm added
,F_QNDROP, qndrop & ! hm added, wrf-chem
,IDS,IDE, JDS,JDE, KDS,KDE & ! domain dims
,IMS,IME, JMS,JME, KMS,KME & ! memory dims
,ITS,ITE, JTS,JTE, KTS,KTE & ! tile dims )
!jdf ,C2PREC3D,CSED3D,ISED3D,SSED3D,GSED3D,RSED3D & ! HM ADD, WRF-CHEM
,QLSINK,PRECR,PRECI,PRECS,PRECG & ! HM ADD, WRF-CHEM
#ifdef WRF_MARS
,qdust,ndust &
,dustnc, dustncv &
,qice_core &
,corenc, corencv &
,reff_dust,effi &
,do_water &
,DUSTQ_MICRO, DUSTQ_SED &
,DUSTN_MICRO, DUSTN_SED &
,COREQ_MICRO, COREQ_SED &
,ICEQ_MICRO, ICEQ_SED &
,ICEN_MICRO, ICEN_SED &
,dsed1, dsed2 &
#endif
)
! QV - water vapor mixing ratio (kg/kg)
! QC - cloud water mixing ratio (kg/kg)
! QR - rain water mixing ratio (kg/kg)
! QI - cloud ice mixing ratio (kg/kg)
! QS - snow mixing ratio (kg/kg)
! QG - graupel mixing ratio (KG/KG)
! NI - cloud ice number concentration (1/kg)
! NS - Snow Number concentration (1/kg)
! NR - Rain Number concentration (1/kg)
! NG - Graupel number concentration (1/kg)
#ifdef WRF_MARS
! QDUST - dust mixing ratio (kg/kg)
! NDUST - dust Number concentration (1/kg)
! PRECD - SEDIMENTATION FLUXES (KG/M^2/S) FOR DUST
! QICE_CORE - dust core mixing ratio (kg/kg)
#endif
! NOTE: RHO AND HT NOT USED BY THIS SCHEME AND DO NOT NEED TO BE PASSED INTO SCHEME!!!!
! P - AIR PRESSURE (PA)
! W - VERTICAL AIR VELOCITY (M/S)
! TH - POTENTIAL TEMPERATURE (K)
! PII - exner function - used to convert potential temp to temp
! DZ - difference in height over interface (m)
! DT_IN - model time step (sec)
! ITIMESTEP - time step counter
! RAINNC - accumulated grid-scale precipitation (mm)
! RAINNCV - one time step grid scale precipitation (mm/time step)
! SNOWNC - accumulated grid-scale snow plus cloud ice (mm)
! SNOWNCV - one time step grid scale snow plus cloud ice (mm/time step)
! GRAUPELNC - accumulated grid-scale graupel (mm)
! GRAUPELNCV - one time step grid scale graupel (mm/time step)
! SR - one time step mass ratio of snow to total precip
! qrcuten, rain tendency from parameterized cumulus convection
! qscuten, snow tendency from parameterized cumulus convection
! qicuten, cloud ice tendency from parameterized cumulus convection
! variables below currently not in use, not coupled to PBL or radiation codes
! TKE - turbulence kinetic energy (m^2 s-2), NEEDED FOR DROPLET ACTIVATION (SEE CODE BELOW)
! NCTEND - droplet concentration tendency from pbl (kg-1 s-1)
! NCTEND - CLOUD ICE concentration tendency from pbl (kg-1 s-1)
! KZH - heat eddy diffusion coefficient from YSU scheme (M^2 S-1), NEEDED FOR DROPLET ACTIVATION (SEE CODE BELOW)
! EFFCS - CLOUD DROPLET EFFECTIVE RADIUS OUTPUT TO RADIATION CODE (micron)
! EFFIS - CLOUD DROPLET EFFECTIVE RADIUS OUTPUT TO RADIATION CODE (micron)
! HM, ADDED FOR WRF-CHEM COUPLING
! QLSINK - TENDENCY OF CLOUD WATER TO RAIN, SNOW, GRAUPEL (KG/KG/S)
! CSED,ISED,SSED,GSED,RSED - SEDIMENTATION FLUXES (KG/M^2/S) FOR CLOUD WATER, ICE, SNOW, GRAUPEL, RAIN
! PRECI,PRECS,PRECG,PRECR - SEDIMENTATION FLUXES (KG/M^2/S) FOR ICE, SNOW, GRAUPEL, RAIN
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! reflectivity currently not included!!!!
! REFL_10CM - CALCULATED RADAR REFLECTIVITY AT 10 CM (DBZ)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! EFFC - DROPLET EFFECTIVE RADIUS (MICRON)
! EFFR - RAIN EFFECTIVE RADIUS (MICRON)
! EFFS - SNOW EFFECTIVE RADIUS (MICRON)
! EFFI - CLOUD ICE EFFECTIVE RADIUS (MICRON)
! ADDITIONAL OUTPUT FROM MICRO - SEDIMENTATION TENDENCIES, NEEDED FOR LIQUID-ICE STATIC ENERGY
! QGSTEN - GRAUPEL SEDIMENTATION TEND (KG/KG/S)
! QRSTEN - RAIN SEDIMENTATION TEND (KG/KG/S)
! QISTEN - CLOUD ICE SEDIMENTATION TEND (KG/KG/S)
! QNISTEN - SNOW SEDIMENTATION TEND (KG/KG/S)
! QCSTEN - CLOUD WATER SEDIMENTATION TEND (KG/KG/S)
! WVAR - STANDARD DEVIATION OF SUB-GRID VERTICAL VELOCITY (M/S)
IMPLICIT NONE
INTEGER, INTENT(IN ) :: ids, ide, jds, jde, kds, kde , &
ims, ime, jms, jme, kms, kme , &
its, ite, jts, jte, kts, kte
! Temporary changed from INOUT to IN
#ifdef WRF_PLANET
REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
TH
REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT), optional:: &
qv, qc, qr, qi, qs, qg, ni, ns, nr, NG
#else
REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
qv, qc, qr, qi, qs, qg, ni, ns, nr, TH, NG
#endif
#ifdef WRF_MARS
logical, intent(in),optional :: do_water
logical :: use_water
REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
qdust, ndust, qice_core
! REAL, DIMENSION(ims:ime, kms:kme, jms:jme), optional,INTENT(INOUT):: PRECD
REAL, DIMENSION(ims:ime, jms:jme), INTENT(INOUT):: &
DUSTNC, DUSTNCV, &
CORENC, CORENCV
REAL, DIMENSION(ims:ime, kms:kme, jms:jme), intent(out):: &
reff_dust, effi !effective radius for dust
real, dimension(ims:ime, kms:kme, jms:jme), intent(inout), optional :: &
DUSTQ_MICRO, DUSTQ_SED &
,DUSTN_MICRO, DUSTN_SED &
,COREQ_MICRO, COREQ_SED &