Skip to content

Commit

Permalink
fix issue #1108
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Aug 9, 2024
1 parent 0921f39 commit 180ff4d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
16 changes: 11 additions & 5 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -3187,17 +3187,18 @@ if (($chem ne 'none') and ($chem ne 'terminator') and !($chem =~ /geoschem/)) {

# Deep convection scheme
add_default($nl, 'deep_scheme');
my $deep_scheme = $nl->get_value('deep_scheme');

# Aerosol convective processes
if (($phys =~ /cam6/ or $phys =~ /cam7/) and $nl->get_value('deep_scheme') =~ /ZM/) {
if (($phys =~ /cam6/ or $phys =~ /cam7/) and $deep_scheme =~ /ZM/) {
add_default($nl, 'convproc_do_aer', 'val'=>'.true.');
add_default($nl, 'convproc_do_evaprain_atonce', 'val'=>'.true.');
add_default($nl, 'convproc_pom_spechygro', 'val'=>'0.2D0');
add_default($nl, 'convproc_wup_max', 'val'=>'4.0D0');
}

# cam7 specific namelists
if ($phys =~ /cam7/ and $nl->get_value('deep_scheme') =~ /ZM/) {
if ($phys =~ /cam7/ and $deep_scheme =~ /ZM/) {
add_default($nl, 'zmconv_parcel_pbl', 'val'=>'.true.');
} else {
add_default($nl, 'zmconv_parcel_pbl', 'val'=>'.false.');
Expand Down Expand Up @@ -3791,12 +3792,13 @@ if (!$simple_phys) {
add_default($nl, 'gw_rdg_do_divstream' , 'val'=>'.true.');
}

my $use_gw_convect_dp = '.false.';
if ($waccm_phys or
(!$simple_phys and $cfg->get('model_top') eq 'mt')) {
# Spectral gravity waves are part of WACCM physics, and also drive the
# QBO in the high vertical resolution configuration.
add_default($nl, 'use_gw_front' , 'val'=>'.true.');
add_default($nl, 'use_gw_convect_dp', 'val'=>'.true.');
$use_gw_convect_dp = '.true.';
my $hdepth_scaling = '0.25D0' ;
my $qbo_forcing = '.false.';
if ($dyn eq 'fv') {
Expand All @@ -3818,12 +3820,16 @@ if ($waccm_phys or
} elsif ($phys =~ /cam7/) {
# cam7 settings for model_top = 'lt'
add_default($nl, 'use_gw_front' , 'val'=>'.true.');
add_default($nl, 'use_gw_convect_dp', 'val'=>'.true.');
$use_gw_convect_dp = '.true.';
add_default($nl, 'gw_qbo_hdepth_scaling', 'val'=>'1.0D0');
} else {
add_default($nl, 'use_gw_front' , 'val'=>'.false.');
add_default($nl, 'use_gw_convect_dp', 'val'=>'.false.');
}
# Check if deep convection scheme used. If not set use_gw_convect_dp=.false.
if ($deep_scheme =~ /off/) {
$use_gw_convect_dp = '.false.';
}
add_default($nl, 'use_gw_convect_dp', 'val'=>$use_gw_convect_dp);

# We need a lot of logic to use these below, so make flags for them.
my $do_gw_oro = ($nl->get_value('use_gw_oro') =~ /$TRUE/io);
Expand Down
62 changes: 62 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
===============================================================

Tag name:
Originator(s): eaton
Date:
One-line Summary: fix issues #1108,
Github PR URL:

Purpose of changes (include the issue number and title text for each relevant GitHub issue):

Issue #1108 - More robust logic in gw_drag.F90 when deep_scheme='off'
- Modify build-namelist to set use_gw_convect_dp=.false. when
deep_scheme='off'. In gw_drag::gw_tend check whether field TTEND_DP is
in the pbuf. If so then associate the ttend_dp pointer. If not then
allocate the ttend_dp pointer and set to zero.



Describe any changes made to build system:

Describe any changes made to the namelist:
. build-namelist now sets use_gw_convect_dp=.false. when deep_scheme='off'.

List any changes to the defaults for the boundary datasets:

Describe any substantial timing or memory changes:

Code reviewed by:

List all files eliminated:

List all files added and what they do:

List all existing files that have been modified, and describe the changes:

bld/build-namelist
. add check to set use_gw_convect_dp=.false. when deep_scheme='off'.

src/physics/cam/gw_drag.F90
. check that field TTEND_DP is in the pbuf before trying to associate the
pointer ttend_dp. If TTEND_DP is not in pbuf then allocate the ttend_dp
pointer and fill with zeros.



If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

izumi/nag/aux_cam:

izumi/gnu/aux_cam:

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers:

===============================================================
===============================================================

Tag name: cam6_4_018
Originator(s): peverwhee, jedwards4b
Date: 30 July 2024
Expand Down
8 changes: 7 additions & 1 deletion src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,13 @@ subroutine gw_tend(state, pbuf, dt, ptend, cam_in, flx_heat)
call alloc_err(istat,'gw_tend','phase_speeds',ncol*band_movmtn%ngwv**2+1)

! Set up heating
call pbuf_get_field(pbuf, ttend_dp_idx, ttend_dp)
if (ttend_dp_idx > 0) then
call pbuf_get_field(pbuf, ttend_dp_idx, ttend_dp)
else
allocate(ttend_dp(pcols,pver), stat=istat)
call alloc_err(istat, 'gw_tend', 'ttend_dp', pcols*pver)
ttend_dp = 0.0_r8
end if

! New couplings from CLUBB
call pbuf_get_field(pbuf, ttend_clubb_idx, ttend_clubb)
Expand Down

0 comments on commit 180ff4d

Please sign in to comment.