Closed samsrabin closed 2 months ago
@slevis-lmwg In 827632e12, I resolved the "two flush_gdd20
s" question by removing the one that was a member of TemperatureType
. Having that alongside flush_gdd20
from clm_varctl
meant that they could disagree when restarting, and it's not obvious which should win.
Note that the user being able to request a flush at all is dangerous. If they start a run with it true, they might continue that run without setting it to false. Instead, the restart decision should be made by the model—if a gridcell has different prescribed GDD20 season from what its restart file says, then that gridcell should be flushed.
I will plan to make that change in a future update, post-code-freeze. It only affects things when streaming GDD20 seasons, which will not be a default behavior, so I think it's okay to leave things as they are now.
For some reason I'm getting an unexpected change in ERP_D_P128x1_Ld26.f10_f10_mg37.IHistClm60BgcCrop.derecho_intel.clm-midDecStart--clm-RxCropCalsAdaptGGCMI
and its PEM version.
ERP_D_P128x1_Ld26.f10_f10_mg37.IHistClm60BgcCrop.derecho_intel.clm-midDecStart--clm-RxCropCalsAdaptGGCMI
2024-07-24 18:33:49: NLCOMP
Comparison failed between '/glade/derecho/scratch/samrabin/tests_0724-183247de/ERP_D_P128x1_Ld26.f10_f10_mg37.IHistClm60BgcCrop.derecho_intel.clm-midDecStart--clm-RxCropCalsAdaptGGCMI.GC.0724-183247de_int/CaseDocs/lnd_in' with '/glade/campaign/cgd/tss/ctsm_baselines/scale-mat-reqs-pr2-ggcmiseas.22742634/ERP_D_P128x1_Ld26.f10_f10_mg37.IHistClm60BgcCrop.derecho_intel.clm-midDecStart--clm-RxCropCalsAdaptGGCMI/CaseDocs/lnd_in'
BASE: stream_fldfilename_gdd20_baseline = gdd20bl.copied_from.gdds_20230829_161011.v2.tweaked_latlons.nc'
COMP: stream_fldfilename_gdd20_baseline = 20230714_cropcals_pr2_1deg.actually2deg.1980-2009.from_GDDB20.interpd_halfdeg.tweaked_latlons.nc'
stream_fldfilename_gdd20_baseline
should not have changed. In the baseline (2274263), the relevant bit of namelist_defaults_ctsm.xml
looked like this:
<stream_fldFileName_gdd20_baseline cropcals_rx_adapt=".true.">lnd/clm2/cropdata/calendars/processed/gdd20bl.copied_from.gdds_20230829_161011.v2.tweaked_latlons.nc</stream_fldFileName_gdd20_baseline>
And in the latest test (aeb4182) it looked like this:
<stream_fldFileName_gdd20_baseline cropcals_rx_adapt=".true." stream_gdd20_seasons=".false.">lnd/clm2/cropdata/calendars/processed/20230714_cropcals_pr2_1deg.actually2deg.1980-2009.from_GDDB20.interpd_halfdeg.tweaked_latlons.nc</stream_fldFileName_gdd20_baseline>
<stream_fldFileName_gdd20_baseline cropcals_rx_adapt=".true." stream_gdd20_seasons=".true.">lnd/clm2/cropdata/calendars/processed/gdd20bl.copied_from.gdds_20230829_161011.v2.tweaked_latlons.nc</stream_fldFileName_gdd20_baseline>
These two tests have cropcals_rx_adapt
and stream_gdd20_seasons
both true, but it's like CLMBuildNamelist.pm doesn't know about the latter.
This issue still exists as of 388c7ed45.
I think the issue is here:
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldFileName_gdd20_baseline');
does not get the seasons var at all. Try:
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldFileName_gdd20_baseline', "stream_gdd20_seasons"=>$stream_gdd20_seasons->as_string() );
Alternatively, set_value(stream_gdd20_seasons) for can be used before adding default for stream_fld....
That's it! The exact diff needed, for posterity:
diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm
index 5202717d7..04d2ee37b 100755
--- a/bld/CLMBuildNamelist.pm
+++ b/bld/CLMBuildNamelist.pm
@@ -4211,7 +4211,7 @@ sub setup_logic_cropcal_streams {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldFileName_swindow_end');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_cultivar_gdds');
if ( &value_is_true($cropcals_rx_adapt) ) {
- add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldFileName_gdd20_baseline');
+ add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldFileName_gdd20_baseline', 'stream_gdd20_seasons'=>$stream_gdd20_seasons);
}
}
Thanks, @mvdebolskiy!!
@slevis-lmwg So as to not have to redo the test suites I have in progress, I will NOT bring in Matvey's fix here or in the next PR (where I merge the latest CTSM master into my dev branch). Instead, I'll bring it in as the first thing on the PR where I enable cropcals_rx_adapt
by default.
@slevis-lmwg This is ready for re-review.
@samsrabin I just wanted to confirm that you will track the items left pending from this PR, such as these: https://github.com/ESCOMP/CTSM/pull/2593#issuecomment-2249100289 https://github.com/ESCOMP/CTSM/pull/2593#issuecomment-2251010346
Good thinking. I've made the first one into issue #2660. I'm fixing the second as we speak, so I won't make a separate issue for that.
Description of changes
In the existing code, when using the default CLM crop calendars,
gddmaturity
(maturity requirement; the number of growing degree-days it takes for a crop to mature and be harvested) can vary within some bounds based on climate over the past 20 years. Specifically, CLM looks at some annual "warm period" which differs between the northern and southern hemispheres, which I call the "GDD20 season." This variation allows "farmers" to adapt the "cultivars" (varieties) they grow based on recent climate.When prescribing maturity requirement, though—with input file
stream_fldFileName_cultivar_gdds
—it's currently not allowed to vary over time. Instead, it's locked in to what's provided in the input file: the mean GDD accumulation in the GGCMI growing period over the 1980-2009 growing seasons.We want this variation to allow "farmers" to adapt the "varieties" they grow based on whether the recent climate has been warmer or cooler than that baseline 1980-2009 period.
This PR represents the second step toward adding that ability. I'm breaking this work up into separate PRs to keep them manageable:
gddmaturity
values to a realistic range.Specific notes
Other features/changes
sowing_reason_perharv_patch
RXCROPMATURITYSKIPGEN_Ld1097.f10_f10_mg37.IHistClm50BgcCrop.derecho_intel.clm-cropMonthOutput
.GDD20_BASELINE
,GDD20_SEASON_START
,GDD20_SEASON_END
Contributors other than yourself, if any: None
CTSM Issues Fixed:
Are answers expected to change (and if so in what way)? Not unless enabling this new, experimental feature.
Any User Interface Changes (namelist or namelist defaults changes)?
stream_gdd20_seasons
(default false). Enabling this automatically sets the relevant input files (see below) to the half-degree GGCMI growing seasons.stream_fldFileName_gdd20_season_start
and_end
(default''
, unlessstream_gdd20_seasons
is true, in which case the GGCMI sowing and harvest dates are used). Providing either file butstream_gdd20_seasons = .true.
will cause an error in the build namelist step.flush_gdd20
(default false), which if true causes the accumulated GDD20 variables to be reset as soon as possible.allow_invalid_gdd20_season_inputs
(default false), which if false will cause a failure upon reading a value instream_fldFileName_gdd20_season_start
or_end
outside the range [1, 365] (or 366 in leap years).Does this create a need to change or add documentation? Did you do so? Documentation will need to be updated when all the PRs in my plan are merged and this feature is considered ready for use. But at this point, things are preliminary enough that I'd have to rewrite whatever docs I added in this PR. So no: I'm adding no documentation here.
Testing performed, if any:
ctsm5.2.005
, although there was a build failure in one nag compiler test.