@@ -31,7 +31,7 @@ module clubb_intr
3131
3232#ifdef CLUBB_SGS
3333 use clubb_api_module, only: pdf_parameter, implicit_coefs_terms
34- use clubb_api_module, only: clubb_config_flags_type, grid, stats, &
34+ use clubb_api_module, only: clubb_config_flags_type, grid, stats, &
3535 nu_vertical_res_dep, stats_metadata_type, &
3636 hm_metadata_type, sclr_idx_type
3737
@@ -52,16 +52,16 @@ module clubb_intr
5252 stats_sfc(pcols) ! stats_sfc
5353 type (hm_metadata_type) :: &
5454 hm_metadata
55-
55+
5656 type (stats_metadata_type) :: &
5757 stats_metadata
5858
5959 type (sclr_idx_type) :: &
6060 sclr_idx
6161
6262 integer :: &
63- nzm_clubb, &
64- nzt_clubb
63+ nzm_clubb, & ! Number of vertical levels used by CLUBB momentum variables
64+ nzt_clubb ! Number of vertical levels used by CLUBB thermodynamic variables
6565#endif
6666
6767 private
@@ -99,7 +99,7 @@ module clubb_intr
9999
100100 ! These are zero by default, but will be set by SILHS before they are used by subcolumns
101101 integer :: &
102- hydromet_dim = 0 , &
102+ hydromet_dim = 0 , &
103103 pdf_dim = 0
104104
105105
@@ -121,7 +121,7 @@ module clubb_intr
121121 hm_metadata
122122#endif
123123#endif
124-
124+
125125 ! ------------ !
126126 ! Private data !
127127 ! ------------ !
@@ -344,7 +344,7 @@ module clubb_intr
344344 clubb_l_mono_flux_lim_um, & ! Flag to turn on monotonic flux limiter for um
345345 clubb_l_mono_flux_lim_vm, & ! Flag to turn on monotonic flux limiter for vm
346346 clubb_l_mono_flux_lim_spikefix, & ! Flag to implement monotonic flux limiter code that
347- ! eliminates spurious drying tendencies at model top
347+ ! eliminates spurious drying tendencies at model top
348348 clubb_l_host_applies_sfc_fluxes ! Whether the host model applies the surface fluxes
349349
350350 logical :: &
@@ -353,7 +353,7 @@ module clubb_intr
353353! Constant parameters
354354 logical , parameter , private :: &
355355 l_implemented = .true. ! Implemented in a host model (always true)
356-
356+
357357 logical , parameter , private :: &
358358 apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh))
359359
@@ -1740,7 +1740,7 @@ subroutine clubb_ini_cam(pbuf2d)
17401740 clubb_params_single_col(iwpxp_Ri_exp) = clubb_wpxp_Ri_exp
17411741 clubb_params_single_col(iz_displace) = clubb_z_displace
17421742
1743- ! Override clubb default
1743+ ! Override clubb default
17441744 if ( trim (subcol_scheme) == ' SILHS' ) then
17451745 clubb_config_flags% saturation_formula = saturation_flatau
17461746 else
@@ -1749,7 +1749,7 @@ subroutine clubb_ini_cam(pbuf2d)
17491749
17501750 ! Define model constant parameters
17511751 call setup_parameters_model_api( theta0, ts_nudge, clubb_params_single_col(iSkw_max_mag) )
1752-
1752+
17531753 ! Set up CLUBB core. Note that some of these inputs are overwritten
17541754 ! when clubb_tend_cam is called. The reason is that heights can change
17551755 ! at each time step, which is why dummy arrays are read in here for heights
@@ -1892,7 +1892,7 @@ subroutine clubb_ini_cam(pbuf2d)
18921892 dum3 = 300._r8
18931893
18941894 if (stats_metadata% l_stats) then
1895-
1895+
18961896 call stats_init_clubb( .true. , dum1, dum2, &
18971897 nzm_clubb, nzm_clubb, nzm_clubb, dum3, &
18981898 stats_zt(:), stats_zm(:), stats_sfc(:), &
@@ -2591,7 +2591,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
25912591 dpdlfice, &
25922592 dpdlft, &
25932593 detnliquid
2594-
2594+
25952595 real (r8 ), dimension (pcols,pverp) :: &
25962596 wprcp_clubb, &
25972597 wpthvp_clubb
@@ -2614,7 +2614,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
26142614 sclr, &
26152615 edsclr, &
26162616 n
2617-
2617+
26182618#endif
26192619
26202620 call t_startf(' clubb_tend_cam' )
@@ -2763,7 +2763,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
27632763 if (clubb_do_liqsupersat) then
27642764 call pbuf_get_field(pbuf, npccn_idx, npccn)
27652765 endif
2766-
2766+
27672767 ! Define the grid box size. CLUBB needs this information to determine what
27682768 ! the maximum length scale should be. This depends on the column for
27692769 ! variable mesh grids and lat-lon grids
@@ -2865,7 +2865,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
28652865 ! $acc state1, state1%q, state1%u, state1%v, state1%t, state1%pmid, state1%s, state1%pint, &
28662866 ! $acc state1%zm, state1%zi, state1%pdeldry, state1%pdel, state1%omega, state1%phis, &
28672867 ! $acc cam_in, cam_in%shf, cam_in%wsx, cam_in%wsy, cam_in%cflx, &
2868- ! $acc rrho, prer_evap, rtp2_mc_zt, thlp2_mc_zt, wprtp_mc_zt, wpthlp_mc_zt, rtpthlp_mc_zt ) &
2868+ ! $acc rrho, prer_evap, rtp2_mc_zt, thlp2_mc_zt, wprtp_mc_zt, wpthlp_mc_zt, rtpthlp_mc_zt ) &
28692869 ! $acc copy( um, vm, upwp, vpwp, wpthvp, wp2thvp, rtpthvp, thlpthvp, up2, vp2, up3, vp3, &
28702870 ! $acc wp2, wp3, rtp2, thlp2, rtp3, thlp3, thlm, rtm, rvm, wprtp, wpthlp, rtpthlp, &
28712871 ! $acc cloud_frac, wp2rtp, wp2thlp, uprcp, vprcp, rc_coef, wp4, wpup2, wpvp2, &
@@ -2889,7 +2889,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
28892889 ! $acc wprtp_forcing, wpthlp_forcing, rtp2_forcing, thlp2_forcing, &
28902890 ! $acc rtpthlp_forcing, wm_zm, wm_zt, rho_zm, rho_zt, rho_ds_zm, rho_ds_zt, &
28912891 ! $acc invrs_rho_ds_zm, invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, rfrzm, &
2892- ! $acc radf, wpthlp_sfc, clubb_params, sfc_elevation, wprtp_sfc, upwp_sfc, vpwp_sfc, &
2892+ ! $acc radf, wpthlp_sfc, clubb_params, sfc_elevation, wprtp_sfc, upwp_sfc, vpwp_sfc, &
28932893 ! $acc rtm_ref, thlm_ref, um_ref, vm_ref, ug, vg, p_in_Pa, exner, um_pert_inout, &
28942894 ! $acc inv_exner_clubb_surf, thlprcp_out, zi_g, zt_g, qrl_clubb, &
28952895 ! $acc pdf_zm_w_1, pdf_zm_w_2, pdf_zm_varnce_w_1, pdf_zm_varnce_w_2, pdf_zm_mixt_frac, &
@@ -3001,7 +3001,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
30013001 vm_pert_inout(i,k) = 0.0_r8
30023002 upwp_pert_inout(i,k) = 0.0_r8
30033003 vpwp_pert_inout(i,k) = 0.0_r8
3004-
3004+
30053005 ! Initialize these to prevent crashing behavior
30063006 wprcp_out(i,k) = 0._r8
30073007 rcm_in_layer_out(i,k) = 0._r8
@@ -3040,7 +3040,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
30403040 end do
30413041 end do
30423042 end do
3043-
3043+
30443044 ! $acc parallel loop gang vector collapse(2) default(present)
30453045 do sclr = 1 , sclr_dim
30463046 do i= 1 , ncol
@@ -3126,7 +3126,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
31263126 s_awv_output(i,k) = 0._r8
31273127 mf_thlflx_output(i,k) = 0._r8
31283128 mf_qtflx_output(i,k) = 0._r8
3129- end do
3129+ end do
31303130 end do
31313131 end if
31323132
@@ -3254,7 +3254,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
32543254 ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables
32553255 ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state
32563256 inv_exner_clubb(i,k) = 1._r8 / ( ( state1% pmid(i,k) / p0_clubb )** ( rairv(i,k,lchnk) / cpairv(i,k,lchnk) ) )
3257-
3257+
32583258 ! Compute virtual potential temperature, which is needed for CLUBB
32593259 thv(i,k) = state1% t(i,k) * inv_exner_clubb(i,k) &
32603260 * ( 1._r8 + zvir * state1% q(i,k,ixq) - state1% q(i,k,ixcldliq) )
@@ -3272,7 +3272,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
32723272
32733273 enddo
32743274 enddo
3275-
3275+
32763276 ! $acc parallel loop gang vector default(present)
32773277 do i = 1 , ncol
32783278 rtm(i,pverp) = rtm(i,pver)
@@ -3409,7 +3409,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
34093409 call t_stopf(' clubb_tend_cam:ACCR' )
34103410 call t_startf(' clubb_tend_cam:NAR' )
34113411 ! $acc update host( zi_g, zt_g, clubb_params, sfc_elevation )
3412-
3412+
34133413 call setup_grid_api( nzm_clubb, ncol, sfc_elevation, l_implemented, & ! intent(in)
34143414 grid_type, zi_g(:,2 ), zi_g(:,1 ), zi_g(:,nzm_clubb), & ! intent(in)
34153415 zi_g, zt_g, & ! intent(in)
@@ -3512,14 +3512,14 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
35123512 end do
35133513
35143514 endif
3515-
3515+
35163516 call t_startf(' clubb_tend_cam:flip-index' )
35173517
35183518 ! Need to flip arrays around for CLUBB core
35193519 ! $acc parallel loop gang vector collapse(2) default(present)
35203520 do k = 1 , nzm_clubb
35213521 do i = 1 , ncol
3522-
3522+
35233523 um_in(i,k) = um(i,pverp- k+1 )
35243524 vm_in(i,k) = vm(i,pverp- k+1 )
35253525 upwp_in(i,k) = upwp(i,pverp- k+1 )
@@ -3866,7 +3866,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
38663866 call t_stopf(' clubb_tend_cam:do_cldcool' )
38673867
38683868 end if
3869-
3869+
38703870 ! Check to see if stats should be output, here stats are read into
38713871 ! output arrays to make them conformable to CAM output
38723872 if (stats_metadata% l_stats) then
@@ -4035,7 +4035,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
40354035 end do
40364036
40374037 call t_stopf(' clubb_tend_cam:flip-index' )
4038-
4038+
40394039 ! $acc parallel loop gang vector collapse(2) default(present)
40404040 do k= 1 , pverp
40414041 do i= 1 , ncol
@@ -4190,7 +4190,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
41904190 end do
41914191
41924192 endif
4193-
4193+
41944194 ! $acc parallel loop gang vector collapse(2) default(present)
41954195 do k= 1 , pverp
41964196 do i= 1 , ncol
@@ -4327,7 +4327,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
43274327 end if
43284328 end if
43294329 end do
4330-
4330+
43314331 rvmtend_clubb(:ncol,:pver) = ptend_loc% q(:ncol,:pver,ixq)* state1% pdeldry(:ncol,:pver)/ state1% pdel(:ncol,:pver)
43324332 rcmtend_clubb(:ncol,:pver) = ptend_loc% q(:ncol,:pver,ixcldliq)* state1% pdeldry(:ncol,:pver)/ state1% pdel(:ncol,:pver)
43334333 rimtend_clubb(:ncol,:pver) = ptend_loc% q(:ncol,:pver,ixcldice)* state1% pdeldry(:ncol,:pver)/ state1% pdel(:ncol,:pver)
@@ -5147,7 +5147,7 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, &
51475147
51485148 ! Set stats_variables variables with inputs from calling subroutine
51495149 stats_metadata% l_stats = l_stats_in
5150-
5150+
51515151 stats_metadata% stats_tsamp = stats_tsamp_in
51525152 stats_metadata% stats_tout = stats_tout_in
51535153
0 commit comments