-
Notifications
You must be signed in to change notification settings - Fork 13
Clubb coriolis cam #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: clubb_4ncar_20240605_73d60f6_gpufixes
Are you sure you want to change the base?
Changes from all commits
15e8020
873f5c1
55e508d
5e24524
5110748
25cdd57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
|
@@ -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) | ||
|
|
@@ -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) [-] | ||
|
|
@@ -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 | ||
|
|
@@ -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) | ||
|
|
@@ -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) | ||
|
|
@@ -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, & | ||
|
|
@@ -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 ) | ||
|
|
@@ -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 | ||
|
|
@@ -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] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
|
|
@@ -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] | ||
|
|
@@ -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 | ||
|
|
@@ -2444,7 +2457,20 @@ subroutine wp23_rhs( nz, ngrdcol, gr, dt, & | |
| end do | ||
| !$acc end parallel loop | ||
| end if | ||
|
|
||
|
|
||
| if ( l_nontraditional_Coriolis ) then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flag will need to be fed into the flags namelist: |
||
| ! 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 | ||
|
|
||
There was a problem hiding this comment.
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"?