Skip to content

Commit

Permalink
fix write_nstep0 logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Courtney Peverley committed Jul 9, 2024
1 parent d87e41f commit 1a58f15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ subroutine cam_timestep_final(rstwr, nlend, do_ncdata_check)
logical, intent(in) :: rstwr ! write restart file
logical, intent(in) :: nlend ! this is final timestep
!Flag for whether a snapshot (ncdata) check should be run or not
! - flag is true if this is not the last step
! - flag is true if this is not the first or last step
logical, intent(in) :: do_ncdata_check

if (do_ncdata_check) then
if (do_ncdata_check .or. get_nstep() == 0) then
call physics_history_out()
call history_write_files()
! peverwhee - todo: handle restarts
Expand Down
8 changes: 6 additions & 2 deletions src/history/cam_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,12 @@ subroutine history_write_files()
end if
end select
write_nstep0 = hist_configs(file_idx)%do_write_nstep0()
if (write_nstep0 .and. nstep == 0) then
write_history = .true.
if (nstep == 0) then
if (write_nstep0) then
write_history = .true.
else
write_history = .false.
end if
end if
if (.not. write_history) then
! Don't write this volume!
Expand Down

0 comments on commit 1a58f15

Please sign in to comment.