1
-
2
1
module zm_conv
3
2
!- ---------------------------------------------------------------------------
4
3
! Purpose: primary methods for the Zhang-McFarlane convection scheme
5
4
!- ---------------------------------------------------------------------------
6
5
! Contributors: Rich Neale, Byron Boville, Xiaoliang song
7
6
!- ---------------------------------------------------------------------------
7
+ #ifdef SCREAM_CONFIG_IS_CMAKE
8
+ use zm_eamxx_bridge_params, only: r8 , pcols, pver, pverp
9
+ use zm_eamxx_bridge_methods,only: cldfrc_fice
10
+ #else
8
11
use shr_kind_mod, only: r8 = > shr_kind_r8
9
- use spmd_utils, only: masterproc
10
12
use ppgrid, only: pcols, pver, pverp
11
13
use cloud_fraction, only: cldfrc_fice
12
- use cam_abortutils , only: endrun
13
- use cam_logfile, only: iulog
14
+ use zm_microphysics , only: zm_mphy
15
+ # endif
14
16
use zm_conv_cape, only: compute_dilute_cape
15
17
use zm_conv_types, only: zm_const_t, zm_param_t
16
18
use zm_conv_util, only: qsat_hpa ! remove after moving cldprp to new module
17
- use zm_aero, only: zm_aero_t
18
- use zm_microphysics, only: zm_mphy
19
+ use zm_aero_type, only: zm_aero_t
19
20
use zm_microphysics_state, only: zm_microp_st, zm_microp_st_alloc, zm_microp_st_dealloc, zm_microp_st_ini, zm_microp_st_gb
20
21
!- ---------------------------------------------------------------------------
21
22
implicit none
@@ -32,9 +33,8 @@ module zm_conv
32
33
type (zm_param_t), public :: zm_param ! derived type to hold ZM tunable parameters
33
34
!- ---------------------------------------------------------------------------
34
35
! private variables
35
- real (r8 ), parameter :: capelmt = 70._r8 ! threshold value of cape for deep convection
36
+ real (r8 ), parameter :: capelmt = 70._r8 ! threshold value for cape for deep convection
36
37
real (r8 ), parameter :: trigdcapelmt = 0._r8 ! threshold value of dcape for deep convection
37
-
38
38
! ===================================================================================================
39
39
contains
40
40
! ===================================================================================================
@@ -43,7 +43,7 @@ subroutine zm_convi(limcnv_in, no_deep_pbl_in)
43
43
!- ---------------------------------------------------------------------------
44
44
! Purpose: initialize quantities for ZM convection scheme
45
45
!- ---------------------------------------------------------------------------
46
- use zm_conv_types, only: zm_const_set_to_global
46
+ use zm_conv_types, only: zm_const_set_to_global, zm_param_print
47
47
!- ---------------------------------------------------------------------------
48
48
! Arguments
49
49
integer , intent (in ) :: limcnv_in ! top interface level limit for convection
@@ -60,14 +60,17 @@ subroutine zm_convi(limcnv_in, no_deep_pbl_in)
60
60
! set zm_const using global values
61
61
call zm_const_set_to_global(zm_const)
62
62
63
+ ! print parameter values to the log file
64
+ call zm_param_print(zm_param)
65
+
63
66
!- ---------------------------------------------------------------------------
64
67
return
65
68
66
69
end subroutine zm_convi
67
70
68
71
! ===================================================================================================
69
72
70
- subroutine zm_convr (lchnk ,ncol , &
73
+ subroutine zm_convr (lchnk ,ncol ,is_first_step , &
71
74
t ,qh ,prec ,jctop ,jcbot , &
72
75
pblh ,zm ,geos ,zi ,qtnd , &
73
76
heat ,pap ,paph ,dpp ,omega , &
@@ -98,7 +101,6 @@ subroutine zm_convr(lchnk ,ncol , &
98
101
! and will make use of the standard CAM nomenclature
99
102
!
100
103
!- ----------------------------------------------------------------------
101
- use time_manager, only: is_first_step
102
104
!
103
105
! ************************ index of variables **********************
104
106
!
@@ -198,6 +200,7 @@ subroutine zm_convr(lchnk ,ncol , &
198
200
!
199
201
integer , intent (in ) :: lchnk ! chunk identifier
200
202
integer , intent (in ) :: ncol ! number of atmospheric columns
203
+ logical , intent (in ) :: is_first_step ! flag to control DCAPE calculations
201
204
202
205
real (r8 ), intent (in ) :: t(pcols,pver) ! grid slice of temperature at mid-layer.
203
206
real (r8 ), intent (in ) :: qh(pcols,pver) ! grid slice of specific humidity.
@@ -565,7 +568,7 @@ subroutine zm_convr(lchnk ,ncol , &
565
568
if (zm_param% trig_dcape) dcapemx(:ncol) = maxi(:ncol)
566
569
567
570
! Calculate dcape trigger condition
568
- if ( .not. is_first_step() .and. zm_param% trig_dcape ) then
571
+ if ( .not. is_first_step .and. zm_param% trig_dcape ) then
569
572
iclosure = .false.
570
573
call compute_dilute_cape( pcols, ncol, pver, pverp, &
571
574
zm_param% num_cin, msg, &
@@ -585,13 +588,13 @@ subroutine zm_convr(lchnk ,ncol , &
585
588
!
586
589
capelmt_wk = capelmt ! capelmt_wk default to capelmt for default trigger
587
590
588
- if ( zm_param% trig_dcape .and. (.not. is_first_step() ) ) capelmt_wk = 0.0_r8
591
+ if ( zm_param% trig_dcape .and. (.not. is_first_step) ) capelmt_wk = 0.0_r8
589
592
590
593
lengath = 0
591
594
do i= 1 ,ncol
592
595
if (zm_param% trig_dcape) then
593
596
! DCAPE-ULL
594
- if (is_first_step() ) then
597
+ if (is_first_step) then
595
598
! Will this cause restart to be non-BFB
596
599
if (cape(i) > capelmt) then
597
600
lengath = lengath + 1
@@ -1163,10 +1166,11 @@ subroutine zm_conv_evap(ncol,lchnk, &
1163
1166
! in the Zhang-MacFarlane parameterization.
1164
1167
! Evaporate some of the precip directly into the environment using a Sundqvist type algorithm
1165
1168
!- ----------------------------------------------------------------------
1166
-
1169
+ #ifdef SCREAM_CONFIG_IS_CMAKE
1170
+ use zm_eamxx_bridge_wv_saturation, only: qsat
1171
+ #else
1167
1172
use wv_saturation, only: qsat
1168
- use phys_grid, only: get_rlat_all_p
1169
-
1173
+ #endif
1170
1174
!- -----------------------------Arguments--------------------------------
1171
1175
integer ,intent (in ) :: ncol, lchnk ! number of columns and chunk index
1172
1176
real (r8 ),intent (in ), dimension (pcols,pver) :: t ! temperature (K)
@@ -2161,6 +2165,7 @@ subroutine cldprp(lchnk , zm_const, &
2161
2165
end do
2162
2166
end do
2163
2167
2168
+ #ifndef SCREAM_CONFIG_IS_CMAKE
2164
2169
call zm_mphy(su, qu, mu, du, eu, loc_microp_st% cmel, loc_microp_st% cmei, zf, p, &
2165
2170
t, q, eps0, jb, jt, jlcl, msg, il2g, zm_const% grav, zm_const% cpair, zm_const% rdair, aero, gamhat, &
2166
2171
loc_microp_st% qliq, loc_microp_st% qice, loc_microp_st% qnl, loc_microp_st% qni, &
@@ -2183,7 +2188,7 @@ subroutine cldprp(lchnk , zm_const, &
2183
2188
loc_microp_st% acciln ,loc_microp_st% fallrm ,loc_microp_st% fallsm ,loc_microp_st% fallgm , &
2184
2189
loc_microp_st% fallrn ,loc_microp_st% fallsn ,loc_microp_st% fallgn ,loc_microp_st% fhmrm , &
2185
2190
dsfm, dsfn, zm_param% auto_fac, zm_param% accr_fac, zm_param% micro_dcs)
2186
-
2191
+ # endif
2187
2192
2188
2193
do k = pver,msg + 2 ,- 1
2189
2194
do i = 1 ,il2g
0 commit comments