Skip to content

Commit 5542b48

Browse files
committed
Renaming l_ascending_grid to clubb_l_ascending_grid and adding it to the namelist files
1 parent c9e9d97 commit 5542b48

5 files changed

Lines changed: 43 additions & 31 deletions

File tree

bld/build-namelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,7 @@ if ($clubb_sgs =~ /$TRUE/io) {
35033503
die "$ProgName - ERROR: clubb_history = .true. with multiple threads is not supported. \n";
35043504
}
35053505

3506+
add_default($nl, 'clubb_l_ascending_grid');
35063507
add_default($nl, 'clubb_do_icesuper');
35073508
add_default($nl, 'clubb_do_energyfix');
35083509
add_default($nl, 'clubb_cloudtop_cooling');

bld/namelist_files/namelist_defaults_cam.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,6 +2120,7 @@
21202120
<clubb_timestep > 300.0D0 </clubb_timestep>
21212121
<clubb_rnevap_effic > 1.0D0 </clubb_rnevap_effic>
21222122
<clubb_do_icesuper > .false. </clubb_do_icesuper>
2123+
<clubb_l_ascending_grid > .false. </clubb_l_ascending_grid>
21232124

21242125

21252126
<!-- Lscale_from_tau set by clubb_opts config option -->

bld/namelist_files/namelist_definition.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3672,6 +3672,13 @@ Switch for CLUBB_ADV parameter that turns on advection of CLUBB pdf moments by
36723672
the dynamics core. Very experimental.
36733673
</entry>
36743674

3675+
<entry id="clubb_l_ascending_grid" type="logical" category="pblrad"
3676+
group="clubbpbl_diff_nl" valid_values="" >
3677+
Causes advance_clubb_core to run in ascending mode, where the surface is at k=1, which is opposite
3678+
of the descending cam grid. This is mainly a testing/debugging option - it requires an expensive
3679+
data flipping step and should not change answers significantly.
3680+
</entry>
3681+
36753682
<!-- Clubb timestep -->
36763683
<entry id="clubb_timestep" type="real" category="pblrad"
36773684
group="clubbpbl_diff_nl" valid_values="" >

src/physics/cam/clubb_intr.F90

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ module clubb_intr
8585
type (sclr_idx_type), public :: &
8686
sclr_idx
8787

88-
logical, public, parameter :: &
89-
l_ascending_grid = .false. ! Set clubb to ascending mode, which is opposite of the
90-
! cam grid the rest of this code uses, thus it requires
91-
! an expensive array flipping step before calling clubb.
92-
! This is mainly for testing
93-
9488
integer, public :: &
9589
nzm_clubb, & ! Number of vertical levels used by CLUBB momentum variables
9690
nzt_clubb ! Number of vertical levels used by CLUBB thermodynamic variables
@@ -166,6 +160,12 @@ module clubb_intr
166160
logical :: &
167161
clubb_l_intr_sfc_flux_smooth = .false. ! Add a locally calculated roughness to upwp and vpwp sfc fluxes
168162

163+
logical :: &
164+
clubb_l_ascending_grid = .false. ! Run clubb in ascending mode, which is opposite of the
165+
! cam grid the rest of this code uses, thus it requires
166+
! an expensive array flipping step before calling advance_clubb_core.
167+
! This is mainly for testing, it should not significantly change answers
168+
169169
logical :: lq(pcnst)
170170
logical :: do_rainturb
171171
logical :: clubb_do_adv
@@ -770,7 +770,8 @@ subroutine clubb_readnl(nlfile)
770770
namelist /clubb_his_nl/ clubb_history, clubb_rad_history
771771
namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, &
772772
clubb_do_adv, clubb_timestep, &
773-
clubb_rnevap_effic,clubb_do_icesuper
773+
clubb_rnevap_effic, clubb_do_icesuper, &
774+
clubb_l_ascending_grid
774775
namelist /clubb_params_nl/ clubb_beta, &
775776
clubb_bv_efold, &
776777
clubb_c1, &
@@ -899,6 +900,7 @@ subroutine clubb_readnl(nlfile)
899900
stats_metadata%l_output_rad_files = .false. ! Initialize to false
900901
do_cldcool = .false. ! Initialize to false
901902
do_rainturb = .false. ! Initialize to false
903+
clubb_l_ascending_grid = .false. ! Initialize to false
902904

903905
! Initialize namelist variables to clubb defaults
904906
call set_default_clubb_config_flags_api( clubb_iiPDF_type, & ! Out
@@ -1018,6 +1020,8 @@ subroutine clubb_readnl(nlfile)
10181020
if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb")
10191021
call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr)
10201022
if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv")
1023+
call mpi_bcast(clubb_l_ascending_grid, 1, mpi_logical, mstrid, mpicom, ierr)
1024+
if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_ascending_grid")
10211025
call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr)
10221026
if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep")
10231027
call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr)
@@ -1882,7 +1886,7 @@ subroutine clubb_ini_cam(pbuf_ini)
18821886
call add_default('WPRTP_CLUBB', 1, ' ')
18831887
call add_default('RTP2_CLUBB', 1, ' ')
18841888
call add_default('RTP2_ZT_CLUBB', 1, ' ')
1885-
call add_default('PDFP_RTP2_CLUBB', 1, ' ')
1889+
call add_default('PDFP_RTP2_CLUBB', 1, ' ')
18861890
call add_default('THLP2_CLUBB', 1, ' ')
18871891
call add_default('THLP2_ZT_CLUBB', 1, ' ')
18881892
call add_default('RTPTHLP_CLUBB', 1, ' ')
@@ -2537,11 +2541,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
25372541

25382542
#ifdef _OPENACC
25392543
! These options have not been GPUized
2540-
if ( l_ascending_grid ) call endrun(subr//': l_ascending_grid=.true. not available when compiling with OpenACC')
2541-
if ( do_clubb_mf ) call endrun(subr//': do_clubb_mf=.true. not available when compiling with OpenACC')
2542-
if ( do_rainturb ) call endrun(subr//': do_rainturb=.true. not available when compiling with OpenACC')
2543-
if ( do_cldcool ) call endrun(subr//': do_cldcool=.true. not available when compiling with OpenACC')
2544-
if ( clubb_do_icesuper ) call endrun(subr//': clubb_do_icesuper=.true. not available when compiling with OpenACC')
2544+
if ( clubb_l_ascending_grid ) call endrun(subr//': clubb_l_ascending_grid=.true. not available when compiling with OpenACC')
2545+
if ( do_clubb_mf ) call endrun(subr//': do_clubb_mf=.true. not available when compiling with OpenACC')
2546+
if ( do_rainturb ) call endrun(subr//': do_rainturb=.true. not available when compiling with OpenACC')
2547+
if ( do_cldcool ) call endrun(subr//': do_cldcool=.true. not available when compiling with OpenACC')
2548+
if ( clubb_do_icesuper ) call endrun(subr//': clubb_do_icesuper=.true. not available when compiling with OpenACC')
25452549
if ( single_column .and. .not. scm_cambfb_mode ) then
25462550
call endrun(subr//': (single_column && !scm_cambfb_mode)=.true. not available when compiling with OpenACC')
25472551
end if
@@ -3546,7 +3550,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
35463550
! Advance CLUBB CORE one timestep in the future
35473551
call t_startf('clubb_tend_cam:advance_clubb_core_api')
35483552

3549-
if ( l_ascending_grid ) then
3553+
if ( clubb_l_ascending_grid ) then
35503554

35513555
! CLUBB is to be run in ascending mode, which has the surface at k=1, which is
35523556
! the opposite of the cam grid that the rest of clubb_intr uses, so
@@ -3645,7 +3649,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
36453649
sclrpthvp_inout = sclrpthvp_inout(:,nzm_clubb:1:-1,:)
36463650
end if
36473651

3648-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid.
3652+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid.
36493653
! only because these are need to be stored for restarts
36503654
if ( clubb_config_flags%l_call_pdf_closure_twice ) then
36513655
pdf_params_zm_chnk(lchnk)%w_1 = pdf_params_zm_chnk(lchnk)%w_1 (:,nzm_clubb:1:-1)
@@ -3655,15 +3659,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
36553659
pdf_params_zm_chnk(lchnk)%mixt_frac = pdf_params_zm_chnk(lchnk)%mixt_frac (:,nzm_clubb:1:-1)
36563660
end if
36573661

3658-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid.
3662+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid.
36593663
! only for pdfp_rtp2_output calc
36603664
pdf_params_chnk(lchnk)%mixt_frac = pdf_params_chnk(lchnk)%mixt_frac (:,nzt_clubb:1:-1)
36613665
pdf_params_chnk(lchnk)%rt_1 = pdf_params_chnk(lchnk)%rt_1 (:,nzt_clubb:1:-1)
36623666
pdf_params_chnk(lchnk)%rt_2 = pdf_params_chnk(lchnk)%rt_2 (:,nzt_clubb:1:-1)
36633667
pdf_params_chnk(lchnk)%varnce_rt_1 = pdf_params_chnk(lchnk)%varnce_rt_1(:,nzt_clubb:1:-1)
36643668
pdf_params_chnk(lchnk)%varnce_rt_2 = pdf_params_chnk(lchnk)%varnce_rt_2(:,nzt_clubb:1:-1)
36653669

3666-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid.
3670+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid.
36673671
! only for update_xp2_mc_api call
36683672
pdf_params_chnk(lchnk)%w_1 = pdf_params_chnk(lchnk)%w_1 (:,nzt_clubb:1:-1)
36693673
pdf_params_chnk(lchnk)%w_2 = pdf_params_chnk(lchnk)%w_2 (:,nzt_clubb:1:-1)
@@ -3699,7 +3703,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
36993703

37003704
! we are in ascending mode, need to recalculate gr in ascending mode
37013705
call setup_grid_api( nzm_clubb, ncol, sfc_elevation, l_implemented, & ! intent(in)
3702-
l_ascending_grid, grid_type, & ! intent(in)
3706+
clubb_l_ascending_grid, grid_type, & ! intent(in)
37033707
deltaz, zi_g(:,1), zi_g(:,nzm_clubb), & ! intent(in)
37043708
zi_g(:,nzm_clubb:1:-1), zt_g(:,nzt_clubb:1:-1), & ! intent(in)
37053709
gr, err_info ) ! intent(inout)
@@ -3775,7 +3779,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
37753779
!$acc wp2up2_pbuf, wp2vp2_pbuf, ice_supersat_frac_pbuf )
37763780

37773781

3778-
if ( l_ascending_grid ) then
3782+
if ( clubb_l_ascending_grid ) then
37793783

37803784
! If running in ascending mode, we flip the arrays before calling advance_clubb_core
37813785
! so we need to flip them back. This section should flip every array that was flipped
@@ -3882,7 +3886,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
38823886
sclrpthvp_inout = sclrpthvp_inout(:,nzm_clubb:1:-1,:)
38833887
end if
38843888

3885-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid
3889+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid
38863890
! only because these are need to be stored for restarts
38873891
if ( clubb_config_flags%l_call_pdf_closure_twice ) then
38883892
pdf_params_zm_chnk(lchnk)%w_1 = pdf_params_zm_chnk(lchnk)%w_1 (:,nzm_clubb:1:-1)
@@ -3892,15 +3896,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &
38923896
pdf_params_zm_chnk(lchnk)%mixt_frac = pdf_params_zm_chnk(lchnk)%mixt_frac (:,nzm_clubb:1:-1)
38933897
end if
38943898

3895-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid
3899+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid
38963900
! only for pdfp_rtp2_output calc
38973901
pdf_params_chnk(lchnk)%mixt_frac = pdf_params_chnk(lchnk)%mixt_frac (:,nzt_clubb:1:-1)
38983902
pdf_params_chnk(lchnk)%rt_1 = pdf_params_chnk(lchnk)%rt_1 (:,nzt_clubb:1:-1)
38993903
pdf_params_chnk(lchnk)%rt_2 = pdf_params_chnk(lchnk)%rt_2 (:,nzt_clubb:1:-1)
39003904
pdf_params_chnk(lchnk)%varnce_rt_1 = pdf_params_chnk(lchnk)%varnce_rt_1(:,nzt_clubb:1:-1)
39013905
pdf_params_chnk(lchnk)%varnce_rt_2 = pdf_params_chnk(lchnk)%varnce_rt_2(:,nzt_clubb:1:-1)
39023906

3903-
! These are flipped, ensuring these are stored in descending mode, regardless of l_ascending_grid
3907+
! These are flipped, ensuring these are stored in descending mode, regardless of clubb_l_ascending_grid
39043908
! only for update_xp2_mc_api call
39053909
pdf_params_chnk(lchnk)%w_1 = pdf_params_chnk(lchnk)%w_1 (:,nzt_clubb:1:-1)
39063910
pdf_params_chnk(lchnk)%w_2 = pdf_params_chnk(lchnk)%w_2 (:,nzt_clubb:1:-1)
@@ -5717,8 +5721,8 @@ subroutine stats_end_timestep_clubb(thecol, stats_zt, stats_zm, stats_rad_zt, st
57175721
do i = 1, stats_zt%num_output_fields
57185722
do k = 1, stats_zt%kk
57195723

5720-
! The data stored in stats types are ascending if l_ascending_grid = .true.
5721-
if ( l_ascending_grid ) then
5724+
! The data stored in stats types are ascending if clubb_l_ascending_grid = .true.
5725+
if ( clubb_l_ascending_grid ) then
57225726
out_zt(thecol,pver+1-k,i) = stats_zt%accum_field_values(1,1,k,i)
57235727
else
57245728
out_zt(thecol,top_lev-1+k,i) = stats_zt%accum_field_values(1,1,k,i)
@@ -5732,8 +5736,8 @@ subroutine stats_end_timestep_clubb(thecol, stats_zt, stats_zm, stats_rad_zt, st
57325736
do i = 1, stats_zm%num_output_fields
57335737
do k = 1, stats_zm%kk
57345738

5735-
! The data stored in stats types are ascending if l_ascending_grid = .true.
5736-
if ( l_ascending_grid ) then
5739+
! The data stored in stats types are ascending if clubb_l_ascending_grid = .true.
5740+
if ( clubb_l_ascending_grid ) then
57375741
out_zm(thecol,pverp+1-k,i) = stats_zm%accum_field_values(1,1,k,i)
57385742
else
57395743
out_zm(thecol,top_lev-1+k,i) = stats_zm%accum_field_values(1,1,k,i)
@@ -5748,8 +5752,8 @@ subroutine stats_end_timestep_clubb(thecol, stats_zt, stats_zm, stats_rad_zt, st
57485752
do i = 1, stats_rad_zt%num_output_fields
57495753
do k = 1, stats_rad_zt%kk
57505754

5751-
! The data stored in stats types are ascending if l_ascending_grid = .true.
5752-
if ( l_ascending_grid ) then
5755+
! The data stored in stats types are ascending if clubb_l_ascending_grid = .true.
5756+
if ( clubb_l_ascending_grid ) then
57535757
out_radzt(thecol,pver+1-k,i) = stats_rad_zt%accum_field_values(1,1,k,i)
57545758
else
57555759
out_radzt(thecol,top_lev-1+k,i) = stats_rad_zt%accum_field_values(1,1,k,i)
@@ -5763,8 +5767,8 @@ subroutine stats_end_timestep_clubb(thecol, stats_zt, stats_zm, stats_rad_zt, st
57635767
do i = 1, stats_rad_zm%num_output_fields
57645768
do k = 1, stats_rad_zm%kk
57655769

5766-
! The data stored in stats types are ascending if l_ascending_grid = .true.
5767-
if ( l_ascending_grid ) then
5770+
! The data stored in stats types are ascending if clubb_l_ascending_grid = .true.
5771+
if ( clubb_l_ascending_grid ) then
57685772
out_radzm(thecol,pverp+1-k,i) = stats_rad_zm%accum_field_values(1,1,k,i)
57695773
else
57705774
out_radzm(thecol,top_lev-1+k,i) = stats_rad_zm%accum_field_values(1,1,k,i)

src/physics/cam/subcol_SILHS.F90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module subcol_SILHS
2626
hm_metadata, &
2727
hydromet_dim, &
2828
pdf_dim, &
29-
l_ascending_grid, &
3029
nzm_clubb, &
3130
nzt_clubb
3231

0 commit comments

Comments
 (0)