Skip to content
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

ctsm5.3.019: Stop running 0th time step #2084

Merged
merged 32 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bdf6b32
Changes to remove 0th timestep
olyson Jun 1, 2023
a9eb1e7
Changes for lilac
olyson Jul 25, 2023
b8be204
Remove do while loop and dosend variable.
olyson Jul 25, 2023
7f38c07
Fix unit tests for nstep starting at 1 instead of 0
billsacks Jul 25, 2023
55184f4
Merge pull request #1 from billsacks/zerothtstep
olyson Jul 26, 2023
750ed1d
Cleanup.
olyson Jul 27, 2023
198ac31
Merge branch 'zerothtstep' of https://github.com/olyson/ctsm into zer…
olyson Jul 27, 2023
caa384b
Remove comment.
olyson Aug 1, 2023
0dfd901
Remove BACKWARD COMPATIBILITY comment.
olyson Aug 3, 2023
d5b007f
Merge tag 'ctsm5.1.dev147' into zerothtstep
olyson Nov 1, 2023
c9c89a8
Correct a comment.
samsrabin Nov 1, 2023
d059220
Print error()s to console, not just log file.
samsrabin Nov 1, 2023
b311d1d
Rearrange search for h2 files in import_and_process_1yr().
samsrabin Nov 1, 2023
fa843e5
Fix h2 file patterns in import_and_process_1yr().
samsrabin Nov 1, 2023
11b6042
Merge pull request #2 from samsrabin/zerothtstep-fix-RXCROPMATURITY
olyson Nov 2, 2023
268ad5a
Merge tag 'ctsm5.3.010' into zerothtstep
slevis-lmwg Nov 12, 2024
d07fd9d
Removed comments with prefix !KO
slevis-lmwg Nov 12, 2024
0f54bc2
Merge tag 'ctsm5.3.011' into zerothtstep
slevis-lmwg Nov 12, 2024
a4b9dcf
Update docstring of is_first_step function
slevis-lmwg Nov 12, 2024
4d0ac48
New update of function's docstring
slevis-lmwg Nov 12, 2024
e578ae7
Fix typo in comment
slevis-lmwg Nov 12, 2024
bd51b8c
Correct a variable name that came in with a merge conflict
slevis-lmwg Nov 12, 2024
e87b119
Correct another error that came in with a merge conflict
slevis-lmwg Nov 13, 2024
c7e1366
Revert change I brought in with the conflicts
slevis-lmwg Nov 15, 2024
f85104b
Merge branch 'hist_time_mid_of_time_bounds' into zerothtstep
slevis-lmwg Nov 15, 2024
5148dbc
Update .gitmodules to the mosart/rtm tags corresponding to this ctsm
slevis-lmwg Nov 15, 2024
dc295f7
Correct variable name that came in with the conflicts
slevis-lmwg Nov 15, 2024
8b2f216
Merge remote-tracking branch 'escomp/master' into zerothtstep
slevis-lmwg Jan 11, 2025
f3a1dc6
call advance_timestep if startup or hybrid, not branch or continue
slevis-lmwg Jan 13, 2025
b66e1e9
Draft ChangeLog/Sum files
slevis-lmwg Jan 14, 2025
8d198cf
Update ChangeLog
slevis-lmwg Jan 14, 2025
71e56b9
Update ChangeLog
slevis-lmwg Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions python/ctsm/crop_calendars/generate_gdds_functions.py
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def log(logger, string):


def error(logger, string):
print(string)
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
logger.error(string)
raise RuntimeError(string)

Expand Down Expand Up @@ -217,7 +218,7 @@ def import_and_process_1yr(
else:
chunks = None

# Get h2 file (list)
# Get h1 file (list)
h1_pattern = os.path.join(indir, "*h1.*.nc")
h1_filelist = glob.glob(h1_pattern)
if not h1_filelist:
Expand Down Expand Up @@ -477,13 +478,14 @@ def import_and_process_1yr(
log(logger, f" Importing accumulated GDDs...")
clm_gdd_var = "GDDACCUM"
myVars = [clm_gdd_var, "GDDHARV"]
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
pattern = os.path.join(indir, f"*h2.{thisYear-1}-01-01*.nc")
h2_files = glob.glob(pattern)
if not h2_files:
pattern = os.path.join(indir, f"*h2.{thisYear-1}-01-01*.nc.base")
patterns = [f"*h2.{thisYear-1}-01*.nc", f"*h2.{thisYear-1}-01*.nc.base"]
for p in patterns:
pattern = os.path.join(indir, p)
h2_files = glob.glob(pattern)
if not h2_files:
error(logger, f"No files found matching pattern '*h2.{thisYear-1}-01-01*.nc(.base)'")
if h2_files:
break
if not h2_files:
error(logger, f"No files found matching patterns: {patterns}")
h2_ds = utils.import_ds(
h2_files,
myVars=myVars,
Expand Down
17 changes: 4 additions & 13 deletions src/biogeochem/CNPhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -383,19 +383,10 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, &
soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, &
cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst)

! BACKWARDS_COMPATIBILITY(wjs, 2022-02-03) Old restart files generated at the end
! of the year can indicate that a crop was panted on Jan 1, because that used to be
! the time given to the last time step of the year. This would cause problems if we
! ran CropPhenology in time step 0, because now time step 0 is labeled as Dec 31,
! so CropPhenology would see the crop as having been planted 364 days ago, and so
! would want to harvest this newly-planted crop. To avoid this situation, we avoid
! calling CropPhenology on time step 0.
!
! This .not. is_first_step() condition can be removed either when we can rely on
! all restart files having been generated with
! https://github.com/ESCOMP/CTSM/issues/1623 resolved, or we stop having a time
! step 0 (https://github.com/ESCOMP/CTSM/issues/925).
if (num_pcropp > 0 .and. .not. is_first_step()) then
!KO if (num_pcropp > 0 .and. .not. is_first_step()) then
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
!KO
if (num_pcropp > 0) then
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
!KO
call CropPhenology(num_pcropp, filter_pcropp, &
waterdiagnosticbulk_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst, &
cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, &
Expand Down
12 changes: 10 additions & 2 deletions src/biogeochem/CNVegetationFacade.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,11 @@ subroutine EndOfTimeStepVegDynamics(this, bounds, num_natvegp, filter_natvegp, &
! Call dv (dynamic vegetation) at last time step of year

call t_startf('d2dgvm')
if (is_end_curr_year() .and. .not. is_first_step()) then
!KO if (is_end_curr_year() .and. .not. is_first_step()) then
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
!KO
! is_first_step check no longer necessary since there is no nstep=0
if (is_end_curr_year()) then
!KO

! Get date info. kyr is used in lpj(). At end of first year, kyr = 2.
call get_curr_date(yr, mon, day, sec)
Expand Down Expand Up @@ -1327,7 +1331,11 @@ subroutine WriteHistory(this, bounds)

! Write to CNDV history buffer if appropriate
if (use_cndv) then
if (is_end_curr_year() .and. .not. is_first_step()) then
!KO if (is_end_curr_year() .and. .not. is_first_step()) then
!KO
! is_first_step check no longer necessary since there is no nstep=0
if (is_end_curr_year()) then
!KO
call t_startf('clm_drv_io_hdgvm')
call CNDVHist( bounds, this%dgvs_inst )
if (masterproc) write(iulog,*) 'Annual CNDV calculations are complete'
Expand Down
6 changes: 5 additions & 1 deletion src/biogeochem/CropType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,11 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp)
! Update nyrs when it's the end of the year (unless it's the very start of the
! run). This assumes that, if this patch is active at the end of the year, then it was
! active for the whole year.
if ((kmo == 1 .and. kda == 1 .and. mcsec == 0) .and. .not. is_first_step()) then
!KO if ((kmo == 1 .and. kda == 1 .and. mcsec == 0) .and. .not. is_first_step()) then
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
!KO
! is_first_step check no longer necessary since there is no nstep=0
if ((kmo == 1 .and. kda == 1 .and. mcsec == 0)) then
!KO
do fp = 1, num_pcropp
p = filter_pcropp(fp)

Expand Down
6 changes: 5 additions & 1 deletion src/biogeochem/dynCNDVMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ subroutine dynCNDV_interp( bounds, dgvs_inst)
patch%wtcol(p) = dgvs_inst%fpcgrid_patch(p) + &
wt1 * (dgvs_inst%fpcgridold_patch(p) - dgvs_inst%fpcgrid_patch(p))

if (mon==1 .and. day==1 .and. sec==dtime .and. nstep>0) then
!KO ! I don't think this is necessary since there no longer an nstep=0
!KO if (mon==1 .and. day==1 .and. sec==dtime .and. nstep>0) then
!KO
if (mon==1 .and. day==1 .and. sec==dtime) then
!KO
dgvs_inst%fpcgridold_patch(p) = dgvs_inst%fpcgrid_patch(p)
end if
end if
Expand Down
1 change: 1 addition & 0 deletions src/biogeophys/WaterStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ subroutine Restart(this, bounds, ncid, flag, &

! If initial run -- ensure that water is properly bounded (read only)
if (flag == 'read' ) then
!KO ! I think leaving this in here is still necessary even though is_first_step is now based on nstep=1
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
if ( is_first_step() .and. bound_h2osoi) then
do c = bounds%begc, bounds%endc
l = col%landunit(c)
Expand Down
Loading
Loading