Skip to content

Commit

Permalink
Add maxlai_triggers_grainfill option.
Browse files Browse the repository at this point in the history
Default .true. preserves old behavior.
  • Loading branch information
samsrabin committed Feb 15, 2025
1 parent 6c30de8 commit b83c4ac
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4288,6 +4288,7 @@ sub setup_logic_cropcal_streams {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'flush_gdd20');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'generate_crop_gdds');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_mxmat');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maxlai_triggers_grainfill');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_cropcal');

# These can't both be true
Expand Down
1 change: 1 addition & 0 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<generate_crop_gdds >.false.</generate_crop_gdds>
<use_mxmat >.true.</use_mxmat>
<maxlai_triggers_grainfill >.true.</maxlai_triggers_grainfill>

<!-- use additional stress deciduous onset trigger -->
<constrain_stress_deciduous_onset >.true.</constrain_stress_deciduous_onset>
Expand Down
5 changes: 5 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,11 @@ Set to .true. in order to override crop harvesting logic and to instead harvest
Set to .false. in order to ignore crop PFT parameter for maximum growing season length (mxmat). Must be set to .false. when generate_crop_gdds is .true.
</entry>

<entry id="maxlai_triggers_grainfill" type="logical" category="physics"
group="cnphenology" valid_values="" value=".true.">
Set to .false. in order to disable behavior where crops enter grain-filling phase upon reaching max LAI
</entry>

<entry id="min_critical_dayl_method" type="char*25" category="physics"
group="cnphenology" valid_values="Constant,DependsOnLat,DependsOnVeg,DependsOnLatAndVeg">
Method for determining what the minimum critical day length for seasonal decidious leaf offset depends on
Expand Down
9 changes: 9 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,15 @@
<option name="comment" >Repeat ERP_Ly3_P64x2...cropMonthOutput test with matrixcnOn</option>
</options>
</test>
<test name="ERP_Ly3_P64x2" grid="f10_f10_mg37" compset="IHistClm60BgcCrop" testmods="clm/cropMonthOutput--clm/NoMaxLaiGrainFillTrigger">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">01:40:00</option>
<option name="comment" >Repeat ERP_Ly3_P64x2...cropMonthOutput test without max LAI trigering grain fill</option>
</options>
</test>
<test name="ERI_D_Ld9" grid="f10_f10_mg37" compset="I1850Clm45Bgc" testmods="clm/default">
<machines>
<machine name="derecho" compiler="gnu" category="aux_clm"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
maxlai_triggers_grainfill = .false.

6 changes: 4 additions & 2 deletions src/biogeochem/CNPhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ module CNPhenologyMod
real(r8) :: min_gddmaturity = 1._r8 ! Weird things can happen if gddmaturity is tiny
logical, public :: generate_crop_gdds = .false. ! If true, harvest the day before next sowing
logical, public :: use_mxmat = .true. ! If true, ignore crop maximum growing season length
logical, public :: maxlai_triggers_grainfill = .true. ! If true, crops will enter cphase_grainfill upon reaching maximum LAI

! For use with adapt_cropcal_rx_cultivar_gdds .true.
real(r8), parameter :: min_gdd20_baseline = 0._r8 ! If gdd20_baseline_patch is ≤ this, do not consider baseline.
Expand Down Expand Up @@ -200,7 +201,7 @@ subroutine CNPhenologyReadNML( NLFilename )
!-----------------------------------------------------------------------
namelist /cnphenology/ initial_seed_at_planting, onset_thresh_depends_on_veg, &
min_critical_dayl_method, generate_crop_gdds, &
use_mxmat
use_mxmat, maxlai_triggers_grainfill

! Initialize options to default values, in case they are not specified in
! the namelist
Expand All @@ -226,6 +227,7 @@ subroutine CNPhenologyReadNML( NLFilename )
call shr_mpi_bcast (min_critical_dayl_method, mpicom)
call shr_mpi_bcast (generate_crop_gdds, mpicom)
call shr_mpi_bcast (use_mxmat, mpicom)
call shr_mpi_bcast (maxlai_triggers_grainfill, mpicom)

if ( min_critical_dayl_method == "DependsOnLat" )then
critical_daylight_method = critical_daylight_depends_on_lat
Expand Down Expand Up @@ -2434,7 +2436,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
! enter phase 2 onset for one time step:
! transfer seed carbon to leaf emergence

if (peaklai(p) >= 1 .and. hui(p) < huigrain(p)) then
if (maxlai_triggers_grainfill .and. peaklai(p) >= 1 .and. hui(p) < huigrain(p)) then
hui(p) = huigrain(p)
crop_inst%maxlai_triggered_grainfill_patch(p) = .true.
endif
Expand Down

0 comments on commit b83c4ac

Please sign in to comment.