Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/CLUBB_core/advance_clubb_core_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module advance_clubb_core_module
!#######################################################################
!#######################################################################
subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)
l_implemented, dt, fcor, sfc_elevation, & ! intent(in)
l_implemented, dt, fcor, fcory, sfc_elevation, & ! intent(in)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability, could you please rename "fcory" to "fcor_y"?

hydromet_dim, & ! intent(in)
sclr_dim, sclr_tol, edsclr_dim, sclr_idx, & ! intent(in)
thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & ! intent(in)
Expand Down Expand Up @@ -385,6 +385,7 @@ subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)

real( kind = core_rknd ), intent(in), dimension(ngrdcol) :: &
fcor, & ! Coriolis forcing [s^-1]
fcory, & ! Nontraditional Coriolis parameter [s^-1]
sfc_elevation ! Elevation of ground level [m above MSL]

integer, intent(in) :: &
Expand Down Expand Up @@ -1788,14 +1789,16 @@ subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)
ice_supersat_frac, & ! intent(in)
pdf_implicit_coefs_terms, & ! intent(in)
um_forcing, vm_forcing, ug, vg, wpthvp, & ! intent(in)
fcor, um_ref, vm_ref, up2, vp2, & ! intent(in)
fcor, fcory, um_ref, vm_ref, up2, vp2, & ! intent(in)
uprcp, vprcp, rc_coef_zm, & ! intent(in)
clubb_params, nu_vert_res_dep, & ! intent(in)
clubb_config_flags%iiPDF_type, & ! intent(in)
clubb_config_flags%penta_solve_method, & ! intent(in)
clubb_config_flags%tridiag_solve_method, & ! intent(in)
clubb_config_flags%saturation_formula, & ! intent(in)
clubb_config_flags%l_predict_upwp_vpwp, & ! intent(in)
clubb_config_flags%l_nontraditional_Coriolis, & ! intent(in)
clubb_config_flags%l_traditional_Coriolis, & ! intent(in)
clubb_config_flags%l_diffuse_rtm_and_thlm, & ! intent(in)
clubb_config_flags%l_stability_correct_Kh_N2_zm, & ! intent(in)
clubb_config_flags%l_godunov_upwind_wpxp_ta, & ! intent(in)
Expand Down Expand Up @@ -1876,14 +1879,15 @@ subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)
thv_ds_zm, cloud_frac, & ! intent(in)
wp3_on_wp2, wp3_on_wp2_zt, & ! intent(in)
pdf_implicit_coefs_terms, & ! intent(in)
dt_advance, & ! intent(in)
dt_advance, fcory, & ! intent(in)
sclrm, wpsclrp, & ! intent(in)
wpsclrp2, wpsclrprtp, wpsclrpthlp, & ! intent(in)
lhs_splat_wp2, & ! intent(in)
clubb_params, nu_vert_res_dep, & ! intent(in)
clubb_config_flags%iiPDF_type, & ! intent(in)
clubb_config_flags%tridiag_solve_method, & ! intent(in)
clubb_config_flags%l_predict_upwp_vpwp, & ! intent(in)
clubb_config_flags%l_nontraditional_Coriolis,& ! intent(in)
clubb_config_flags%l_min_xp2_from_corr_wx, & ! intent(in)
clubb_config_flags%l_C2_cloud_frac, & ! intent(in)
clubb_config_flags%l_upwind_xpyp_ta, & ! intent(in)
Expand Down Expand Up @@ -1970,7 +1974,7 @@ subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)

! advance_wp2_wp3_bad_wp2 ! Test error comment, DO NOT modify or move
call advance_wp2_wp3( nz, ngrdcol, gr, dt_advance, & ! intent(in)
sfc_elevation, sigma_sqd_w, wm_zm, & ! intent(in)
sfc_elevation, fcory, sigma_sqd_w, wm_zm, & ! intent(in)
wm_zt, a3_coef, a3_coef_zt, wp3_on_wp2, & ! intent(in)
wpup2, wpvp2, wp2up2, wp2vp2, wp4, & ! intent(in)
wpthvp, wp2thvp, um, vm, upwp, vpwp, & ! intent(in)
Expand All @@ -1997,6 +2001,7 @@ subroutine advance_clubb_core( gr, nz, ngrdcol, & ! intent(in)
clubb_config_flags%l_use_tke_in_wp3_pr_turb_term, & ! intent(in)
clubb_config_flags%l_use_tke_in_wp2_wp3_K_dfsn, & ! intent(in)
clubb_config_flags%l_use_wp3_lim_with_smth_Heaviside, & ! intent(in)
clubb_config_flags%l_nontraditional_Coriolis, & ! intent(in)
stats_metadata, & ! intent(in)
stats_zt, stats_zm, stats_sfc, & ! intent(inout)
wp2, wp3, wp3_zm, wp2_zt ) ! intent(inout)
Expand Down
44 changes: 35 additions & 9 deletions src/CLUBB_core/advance_wp2_wp3_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module advance_wp2_wp3_module

!=============================================================================
subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! intent(in)
sfc_elevation, sigma_sqd_w, wm_zm, & ! intent(in)
sfc_elevation, fcory, sigma_sqd_w, wm_zm, & ! intent(in)
wm_zt, a3, a3_zt, wp3_on_wp2, & ! intent(in)
wpup2, wpvp2, wp2up2, wp2vp2, wp4, & ! intent(in)
wpthvp, wp2thvp, um, vm, upwp, vpwp, & ! intent(in)
Expand All @@ -82,6 +82,7 @@ subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! i
l_use_tke_in_wp3_pr_turb_term, & ! intent(in)
l_use_tke_in_wp2_wp3_K_dfsn, & ! intent(in)
l_use_wp3_lim_with_smth_Heaviside, & ! intent(in)
l_nontraditional_Coriolis, & ! intent(in)
stats_metadata, & ! intent(in)
stats_zt, stats_zm, stats_sfc, & ! intent(inout)
wp2, wp3, wp3_zm, wp2_zt ) ! intent(inout)
Expand Down Expand Up @@ -201,7 +202,8 @@ subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! i
dt ! Model timestep [s]

real( kind = core_rknd ), dimension(ngrdcol), intent(in) :: &
sfc_elevation ! Elevation of ground level [m AMSL]
sfc_elevation, & ! Elevation of ground level [m AMSL]
fcory ! Nontraditional Coriolis parameter [s^-1]

real( kind = core_rknd ), intent(in), dimension(ngrdcol,nz) :: &
sigma_sqd_w, & ! sigma_sqd_w (momentum levels) [-]
Expand Down Expand Up @@ -291,7 +293,9 @@ subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! i
l_lmm_stepping, & ! Apply Linear Multistep Method (LMM) Stepping
l_use_tke_in_wp3_pr_turb_term, & ! Use TKE formulation for wp3 pr_turb term
l_use_tke_in_wp2_wp3_K_dfsn, & ! Use TKE in eddy diffusion for wp2 and wp3
l_use_wp3_lim_with_smth_Heaviside ! Flag to activate mods on wp3 limiters for conv test
l_use_wp3_lim_with_smth_Heaviside, & ! Flag to activate mods on wp3 limiters for conv test
l_nontraditional_Coriolis ! Flag to implement the nontraditional Coriolis terms in the
! prognostic equations of <w'w'>, <u'w'>, and <u'u'>.

type (stats_metadata_type), intent(in) :: &
stats_metadata
Expand Down Expand Up @@ -866,7 +870,7 @@ subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! i

! Compute the explicit portion of the w'^2 and w'^3 equations.
! Build the right-hand side vector.
call wp23_rhs( nz, ngrdcol, gr, dt, & ! intent(in)
call wp23_rhs( nz, ngrdcol, gr, dt, fcory, & ! intent(in)
wp3_term_ta_lhs_result, & ! intent(in)
lhs_diff_zm, lhs_diff_zt, lhs_diff_zm_crank, lhs_diff_zt_crank, & ! intent(in)
lhs_tp_wp3, lhs_adv_tp_wp3, lhs_pr_tp_wp3, & ! intent(in)
Expand All @@ -875,13 +879,14 @@ subroutine advance_wp2_wp3( nz, ngrdcol, gr, dt, & ! i
rhs_pr_dfsn_wp2, rhs_bp1_pr2_wp3, rhs_pr3_wp2, rhs_pr3_wp3, & ! intent(in)
rhs_ta_wp3, rhs_pr_turb_wp3, rhs_pr_dfsn_wp3, & ! intent(in)
wp2, wp3, wpup2, wpvp2, & ! intent(in)
wpthvp, wp2thvp, up2, vp2, & ! intent(in)
wpthvp, wp2thvp, up2, vp2, upwp, & ! intent(in)
C11_Skw_fnc, radf, thv_ds_zm, thv_ds_zt, & ! intent(in)
lhs_splat_wp2, lhs_splat_wp3, & ! intent(in)
clubb_params, & ! intent(in)
iiPDF_type, & ! intent(in)
l_tke_aniso, & ! intent(in)
l_use_tke_in_wp2_wp3_K_dfsn, & ! intent(in)
l_nontraditional_Coriolis, & ! intent(in)
stats_metadata, & ! intent(in)
stats_zt, stats_zm, & ! intent(in)
rhs ) ! intent(out)
Expand Down Expand Up @@ -2130,7 +2135,7 @@ subroutine wp23_lhs( nz, ngrdcol, gr, dt, &
end subroutine wp23_lhs

!=================================================================================
subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
subroutine wp23_rhs( nz, ngrdcol, gr, dt, fcory, &
wp3_term_ta_lhs_result, &
lhs_diff_zm, lhs_diff_zt, lhs_diff_zm_crank, lhs_diff_zt_crank, &
lhs_tp_wp3, lhs_adv_tp_wp3, lhs_pr_tp_wp3, &
Expand All @@ -2139,13 +2144,14 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
rhs_pr_dfsn_wp2, rhs_bp1_pr2_wp3, rhs_pr3_wp2, rhs_pr3_wp3, &
rhs_ta_wp3, rhs_pr_turb_wp3, rhs_pr_dfsn_wp3, &
wp2, wp3, wpup2, wpvp2, &
wpthvp, wp2thvp, up2, vp2, &
wpthvp, wp2thvp, up2, vp2, upwp, &
C11_Skw_fnc, radf, thv_ds_zm, thv_ds_zt, &
lhs_splat_wp2, lhs_splat_wp3, &
clubb_params, &
iiPDF_type, &
l_tke_aniso, &
l_use_tke_in_wp2_wp3_K_dfsn, &
l_nontraditional_Coriolis, &
stats_metadata, &
stats_zt, stats_zm, &
rhs )
Expand Down Expand Up @@ -2191,6 +2197,7 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &

use constants_clubb, only: &
w_tol_sqd, & ! Variable(s)
two, &
one, &
zero, &
gamma_over_implicit_ts
Expand Down Expand Up @@ -2227,6 +2234,9 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
real( kind = core_rknd ), intent(in) :: &
dt ! Timestep length [s]

real( kind = core_rknd ), dimension(ngrdcol), intent(in) :: &
fcory ! Nontraditional Coriolis parameter [s^-1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please give a few lines of description of fcory? How does it differ from fcor? Qualitatively, how does it vary from equator to pole?


real( kind = core_rknd ), intent(in), dimension(ndiags5,ngrdcol,nz) :: &
wp3_term_ta_lhs_result

Expand Down Expand Up @@ -2267,6 +2277,7 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
wp2thvp, & ! w'^2th_v' (thermodynamic levels) [K m^2/s^2]
up2, & ! u'^2 (momentum levels) [m^2/s^2]
vp2, & ! v'^2 (momentum levels) [m^2/s^2]
upwp, & ! u'w' (momentum levels) [m^2/s^2]
C11_Skw_fnc, & ! C_11 parameter with Sk_w applied [-]
radf, & ! Buoyancy production at the CL top [m^2/s^3]
thv_ds_zm, & ! Dry, base-state theta_v on momentum levs. [K]
Expand All @@ -2286,7 +2297,9 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
logical, intent(in) :: &
l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. TKE = 1/2
! (u'^2 + v'^2 + w'^2)
l_use_tke_in_wp2_wp3_K_dfsn ! Use TKE in eddy diffusion for wp2 and wp3
l_use_tke_in_wp2_wp3_K_dfsn, & ! Use TKE in eddy diffusion for wp2 and wp3
l_nontraditional_Coriolis ! Flag to implement the nontraditional Coriolis terms in the
! prognostic equations of <w'w'>, <u'w'>, and <u'u'>.

type (stats_metadata_type), intent(in) :: &
stats_metadata
Expand Down Expand Up @@ -2444,7 +2457,20 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, &
end do
!$acc end parallel loop
end if


if ( l_nontraditional_Coriolis ) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

! Add the nontraditional Coriolis term
! Hing Ong, 19 July 2025
!$acc parallel loop gang vector collapse(2) default(present)
do k = 2, nz-1
do i = 1, ngrdcol
k_wp2 = 2*k
rhs(i,k_wp2) = rhs(i,k_wp2) + two * fcory(i) * upwp(i,k)
end do
end do
!$acc end parallel loop
end if ! l_nontraditional_Coriolis

! Combine terms
!$acc parallel loop gang vector collapse(2) default(present)
do k = 2, nz-1
Expand Down
Loading