@@ -20,7 +20,7 @@ module clubb_intr
2020 use shr_kind_mod, only: r8 = >shr_kind_r8
2121 use ppgrid, only: pver, pverp, pcols, begchunk, endchunk
2222 use phys_control, only: phys_getopts
23- use physconst, only: cpair, gravit, rga, latvap, latice, zvir, rh2o, karman, pi, rair
23+ use physconst, only: cpair, gravit, rga, latvap, latice, zvir, rh2o, karman, pi, rair, omega
2424 use air_composition, only: rairv, cpairv
2525 use cam_history_support, only: max_fieldname_len
2626
@@ -292,6 +292,10 @@ module clubb_intr
292292 ! advance_xm_wpxp. Otherwise, <u'w'> and <v'w'> are still
293293 ! approximated by eddy diffusivity when <u> and <v> are
294294 ! advanced in subroutine advance_windm_edsclrm.
295+ clubb_l_ho_nontrad_coriolis, & ! Flag to implement the nontraditional Coriolis terms in the
296+ ! prognostic equations of <w'w'>, <u'w'>, and <u'u'>.
297+ clubb_l_ho_trad_coriolis, & ! Flag to implement the traditional Coriolis terms in the
298+ ! prognostic equations of <v'w'> and <u'w'>.
295299 clubb_l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping
296300 ! the overall correlation of w and x (w and rt, as well as w
297301 ! and theta-l) within the limits of -max_mag_correlation_flux
@@ -423,6 +427,7 @@ module clubb_intr
423427 vpwp_idx, & ! north-south momentum flux
424428 wpthvp_idx, & ! buoyancy flux
425429 wp2thvp_idx, & ! second order buoyancy term
430+ wp2up_idx, & ! w'^2 u'
426431 rtpthvp_idx, & ! moisture buoyancy correlation
427432 thlpthvp_idx, & ! temperature buoyancy correlation
428433 wp2rtp_idx, & ! w'^2 rt'
@@ -615,6 +620,7 @@ subroutine clubb_register_cam( )
615620 call pbuf_add_field(' WPTHLP_CLUBB_GW_MC' , ' physpkg' , dtype_r8 , (/ pcols,nzm_clubb/ ), wpthlp_clubb_gw_mc_idx)
616621
617622 call pbuf_add_field(' WP2THVP' , ' global' , dtype_r8 , (/ pcols,nzt_clubb/ ), wp2thvp_idx)
623+ call pbuf_add_field(' WP2UP' , ' global' , dtype_r8 , (/ pcols,nzt_clubb/ ), wp2up_idx)
618624 call pbuf_add_field(' WP2RTP' , ' global' , dtype_r8 , (/ pcols,nzt_clubb/ ), wp2rtp_idx)
619625 call pbuf_add_field(' WP2THLP' , ' global' , dtype_r8 , (/ pcols,nzt_clubb/ ), wp2thlp_idx)
620626 call pbuf_add_field(' WPUP2' , ' global' , dtype_r8 , (/ pcols,nzt_clubb/ ), wpup2_idx)
@@ -857,6 +863,8 @@ subroutine clubb_readnl(nlfile)
857863 clubb_l_mono_flux_lim_vm, &
858864 clubb_l_partial_upwind_wp3, &
859865 clubb_l_predict_upwp_vpwp, &
866+ clubb_l_ho_nontrad_coriolis, &
867+ clubb_l_ho_trad_coriolis, &
860868 clubb_l_prescribed_avg_deltaz, &
861869 clubb_l_rcm_supersat_adj, &
862870 clubb_l_rtm_nudge, &
@@ -914,6 +922,8 @@ subroutine clubb_readnl(nlfile)
914922 clubb_fill_holes_type, & ! Out
915923 clubb_l_use_precip_frac, & ! Out
916924 clubb_l_predict_upwp_vpwp, & ! Out
925+ clubb_l_ho_nontrad_coriolis, & ! Out
926+ clubb_l_ho_trad_coriolis, & ! Out
917927 clubb_l_min_wp2_from_corr_wx, & ! Out
918928 clubb_l_min_xp2_from_corr_wx, & ! Out
919929 clubb_l_C2_cloud_frac, & ! Out
@@ -1165,6 +1175,10 @@ subroutine clubb_readnl(nlfile)
11651175 if (ierr /= 0 ) call endrun(sub// " : FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared" )
11661176 call mpi_bcast(clubb_l_predict_upwp_vpwp, 1 , mpi_logical, mstrid, mpicom, ierr)
11671177 if (ierr /= 0 ) call endrun(sub// " : FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp" )
1178+ call mpi_bcast(clubb_l_ho_nontrad_coriolis, 1 , mpi_logical, mstrid, mpicom, ierr)
1179+ if (ierr /= 0 ) call endrun(sub// " : FATAL: mpi_bcast: clubb_l_ho_nontrad_coriolis" )
1180+ call mpi_bcast(clubb_l_ho_trad_coriolis, 1 , mpi_logical, mstrid, mpicom, ierr)
1181+ if (ierr /= 0 ) call endrun(sub// " : FATAL: mpi_bcast: clubb_l_ho_trad_coriolis" )
11681182 call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1 , mpi_logical, mstrid, mpicom, ierr)
11691183 if (ierr /= 0 ) call endrun(sub// " : FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx" )
11701184 call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1 , mpi_logical, mstrid, mpicom, ierr)
@@ -1358,7 +1372,9 @@ subroutine clubb_readnl(nlfile)
13581372 clubb_grid_adapt_in_time_method, & ! In
13591373 clubb_fill_holes_type, & ! In
13601374 clubb_l_use_precip_frac, & ! In
1361- clubb_l_predict_upwp_vpwp, & ! In
1375+ clubb_l_predict_upwp_vpwp, & ! In
1376+ clubb_l_ho_nontrad_coriolis, & ! In
1377+ clubb_l_ho_trad_coriolis, & ! In
13621378 clubb_l_min_wp2_from_corr_wx, & ! In
13631379 clubb_l_min_xp2_from_corr_wx, & ! In
13641380 clubb_l_C2_cloud_frac, & ! In
@@ -2167,6 +2183,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
21672183 real (r8 ), pointer , dimension (:,:) :: vpwp_pbuf ! north-south momentum flux [m^2/s^2]
21682184 real (r8 ), pointer , dimension (:,:) :: wpthvp_pbuf ! w'th_v' (momentum levels) [m/s K]
21692185 real (r8 ), pointer , dimension (:,:) :: wp2thvp_pbuf ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K]
2186+ real (r8 ), pointer , dimension (:,:) :: wp2up_pbuf ! w'^2 u' (thermodynamic levels) [m^3/s^3]
21702187 real (r8 ), pointer , dimension (:,:) :: rtpthvp_pbuf ! r_t'th_v' (momentum levels) [kg/kg K]
21712188 real (r8 ), pointer , dimension (:,:) :: thlpthvp_pbuf ! th_l'th_v' (momentum levels) [K^2]
21722189 real (r8 ), pointer , dimension (:,:) :: pdf_zm_w_1_pbuf ! work pointer for pdf_params_zm
@@ -2259,6 +2276,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
22592276 real (r8 ), dimension (state% ncol) :: &
22602277 deltaz, &
22612278 fcor, & ! Coriolis forcing [s^-1]
2279+ fcor_y, & ! Non-traditional coriolis forcing [s^-1]
22622280 sfc_elevation, & ! Elevation of ground [m AMSL][m]
22632281 wpthlp_sfc, & ! w' theta_l' at surface [(m K)/s]
22642282 wprtp_sfc, & ! w' r_t' at surface [(kg m)/( kg s)]
@@ -2591,6 +2609,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
25912609 call pbuf_get_field(pbuf, vpwp_idx, vpwp_pbuf )
25922610 call pbuf_get_field(pbuf, wpthvp_idx, wpthvp_pbuf)
25932611 call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp_pbuf)
2612+ call pbuf_get_field(pbuf, wp2up_idx, wp2up_pbuf)
25942613 call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp_pbuf)
25952614 call pbuf_get_field(pbuf, thlpthvp_idx, thlpthvp_pbuf)
25962615
@@ -2784,7 +2803,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
27842803 ! $acc data copyin( pdf_params_chnk(lchnk), pdf_params_zm_chnk(lchnk), sclr_idx, &
27852804 ! $acc state_loc, state_loc%q, state_loc%u, state_loc%v, state_loc%t, state_loc%pmid, &
27862805 ! $acc state_loc%zm, state_loc%phis, state_loc%pdel, state_loc%pdeldry, state_loc%s, &
2787- ! $acc state_loc%pint, state_loc%zi, state_loc%omega, &
2806+ ! $acc state_loc%pint, state_loc%zi, state_loc%omega, state_loc%lat, &
27882807 ! $acc cam_in, cam_in%wsx, cam_in%wsy, cam_in%cflx, cam_in%shf, &
27892808 ! $acc err_info, err_info%err_header, &
27902809 ! $acc cpairv, rairv, se_dis, eleak, cld_pbuf, clubb_params_single_col, grid_dx, grid_dy ) &
@@ -2796,13 +2815,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
27962815 ! $acc pdf_params_chnk(lchnk)%mixt_frac ) &
27972816 ! $acc copy( khzm_pbuf, upwp_pbuf, vpwp_pbuf, up2_pbuf, vp2_pbuf, up3_pbuf, vp3_pbuf, wprtp_pbuf, &
27982817 ! $acc wpthlp_pbuf, wp2_pbuf, wp3_pbuf, rtp2_pbuf, rtp3_pbuf, thlp2_pbuf, thlp3_pbuf, &
2799- ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, ice_supersat_frac_pbuf, &
2818+ ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, wp2up_pbuf, ice_supersat_frac_pbuf, &
28002819 ! $acc rtpthvp_pbuf, thlpthvp_pbuf, wp2rtp_pbuf, wp2thlp_pbuf, uprcp_pbuf, vprcp_pbuf, &
28012820 ! $acc rc_coef_zm_pbuf, wp4_pbuf, wpup2_pbuf, wpvp2_pbuf, wp2up2_pbuf, wp2vp2_pbuf ) &
28022821 ! $acc create( um_pert_inout, vm_pert_inout, upwp_pert_inout, vpwp_pert_inout, khzm_out, &
28032822 ! $acc khzt_out, thlprcp_out, w_up_in_cloud_out, w_down_in_cloud_out, cloudy_updraft_frac_out, &
28042823 ! $acc cloudy_downdraft_frac_out, cloud_cover_out, invrs_tau_zm_out, Lscale, &
2805- ! $acc invrs_exner_zt, fcor, sfc_elevation, thlm_forcing, rtm_forcing, um_forcing, &
2824+ ! $acc invrs_exner_zt, fcor, fcor_y, sfc_elevation, thlm_forcing, rtm_forcing, um_forcing, &
28062825 ! $acc vm_forcing, wprtp_forcing, wpthlp_forcing, rtp2_forcing, thlp2_forcing, &
28072826 ! $acc rtpthlp_forcing, wm_zm, wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, &
28082827 ! $acc p_sfc, upwp_sfc_pert, vpwp_sfc_pert, rtm_ref, thlm_ref, um_ref, vm_ref, &
@@ -2912,10 +2931,16 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
29122931 upwp_sfc_pert(i) = 0.0_r8
29132932 vpwp_sfc_pert(i) = 0.0_r8
29142933
2915- ! Determine Coriolis force at given latitude. This is never used
2916- ! when CLUBB is implemented in a host model, therefore just set
2917- ! to zero.
2918- fcor(i) = 0._r8
2934+ ! When run in host models, CLUBB does not apply Coriolis tendencies to the
2935+ ! mean horizontal wind components (this is controlled by the `l_implemented`
2936+ ! flag, which should be hardcoded to .true. in this file).
2937+ !
2938+ ! However, enabling `clubb_l_ho_nontrad_coriolis` or `clubb_l_ho_trad_coriolis`
2939+ ! introduces Coriolis effects in higher-order moments (e.g., wp2up).
2940+ ! Therefore, we still compute the Coriolis parameters here for potential
2941+ ! use by those higher-order terms.
2942+ fcor(i) = 2._r8 * omega * sin ( state_loc% lat(i) )
2943+ fcor_y(i) = 2._r8 * omega * cos ( state_loc% lat(i) )
29192944 end do
29202945
29212946 if ( sclr_dim > 0 ) then
@@ -3562,6 +3587,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
35623587 um_pert_inout = um_pert_inout(:,nzt_clubb:1 :- 1 )
35633588 vm_pert_inout = vm_pert_inout(:,nzt_clubb:1 :- 1 )
35643589 wp2thvp_pbuf = wp2thvp_pbuf(:,nzt_clubb:1 :- 1 )
3590+ wp2up_pbuf = wp2up_pbuf(:,nzt_clubb:1 :- 1 )
35653591 rtm = rtm(:,nzt_clubb:1 :- 1 )
35663592 thlm = thlm(:,nzt_clubb:1 :- 1 )
35673593
@@ -3687,12 +3713,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
36873713 ! REMOVECAM: This will be unnecessary once pbuf is gone and these are dimensioned ncol.
36883714 ! $acc update host( upwp_pbuf, vpwp_pbuf, up2_pbuf, vp2_pbuf, up3_pbuf, vp3_pbuf, wprtp_pbuf, &
36893715 ! $acc wpthlp_pbuf, wp2_pbuf, wp3_pbuf, rtp2_pbuf, rtp3_pbuf, thlp2_pbuf, thlp3_pbuf, &
3690- ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, rtpthvp_pbuf, thlpthvp_pbuf, wp2rtp_pbuf, &
3716+ ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, wp2up_pbuf, rtpthvp_pbuf, thlpthvp_pbuf, wp2rtp_pbuf, &
36913717 ! $acc wp2thlp_pbuf, uprcp_pbuf, vprcp_pbuf, rc_coef_zm_pbuf, wp4_pbuf, wpup2_pbuf, wpvp2_pbuf, &
36923718 ! $acc wp2up2_pbuf, wp2vp2_pbuf, ice_supersat_frac_pbuf )
36933719
36943720 call advance_clubb_core_api( gr, nzm_clubb, nzt_clubb, ncol, & ! Inputs
3695- l_implemented, dtime, fcor, sfc_elevation, &
3721+ l_implemented, dtime, fcor, fcor_y, sfc_elevation, &
36963722 hydromet_dim, &
36973723 sclr_dim, sclr_tol, edsclr_dim, sclr_idx, &
36983724 thlm_forcing, rtm_forcing, um_forcing, vm_forcing, &
@@ -3725,7 +3751,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
37253751 sclrp2, sclrp3, sclrprtp, sclrpthlp, &
37263752 wpsclrp, edsclr_inout, err_info, &
37273753 rcm, cloud_frac_inout, &
3728- wpthvp_pbuf(:ncol,:), wp2thvp_pbuf(:ncol,:), rtpthvp_pbuf(:ncol,:), thlpthvp_pbuf(:ncol,:), &
3754+ wpthvp_pbuf(:ncol,:), wp2thvp_pbuf(:ncol,:), wp2up_pbuf(:ncol,:), rtpthvp_pbuf(:ncol,:), thlpthvp_pbuf(:ncol,:), &
37293755 sclrpthvp_inout, &
37303756 wp2rtp_pbuf(:ncol,:), wp2thlp_pbuf(:ncol,:), uprcp_pbuf(:ncol,:), &
37313757 vprcp_pbuf(:ncol,:), rc_coef_zm_pbuf(:ncol,:), &
@@ -3745,7 +3771,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
37453771 ! REMOVECAM: This will be unnecessary once pbuf is gone and these are dimensioned ncol.
37463772 ! $acc update device( upwp_pbuf, vpwp_pbuf, up2_pbuf, vp2_pbuf, up3_pbuf, vp3_pbuf, wprtp_pbuf, &
37473773 ! $acc wpthlp_pbuf, wp2_pbuf, wp3_pbuf, rtp2_pbuf, rtp3_pbuf, thlp2_pbuf, thlp3_pbuf, &
3748- ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, rtpthvp_pbuf, thlpthvp_pbuf, wp2rtp_pbuf, &
3774+ ! $acc rtpthlp_pbuf, wpthvp_pbuf, wp2thvp_pbuf, wp2up_pbuf, rtpthvp_pbuf, thlpthvp_pbuf, wp2rtp_pbuf, &
37493775 ! $acc wp2thlp_pbuf, uprcp_pbuf, vprcp_pbuf, rc_coef_zm_pbuf, wp4_pbuf, wpup2_pbuf, wpvp2_pbuf, &
37503776 ! $acc wp2up2_pbuf, wp2vp2_pbuf, ice_supersat_frac_pbuf )
37513777
@@ -3803,6 +3829,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
38033829 um_pert_inout = um_pert_inout(:,nzt_clubb:1 :- 1 )
38043830 vm_pert_inout = vm_pert_inout(:,nzt_clubb:1 :- 1 )
38053831 wp2thvp_pbuf = wp2thvp_pbuf(:,nzt_clubb:1 :- 1 )
3832+ wp2up_pbuf = wp2up_pbuf(:,nzt_clubb:1 :- 1 )
38063833 rtm = rtm(:,nzt_clubb:1 :- 1 )
38073834 thlm = thlm(:,nzt_clubb:1 :- 1 )
38083835 Lscale = Lscale(:,nzt_clubb:1 :- 1 )
0 commit comments