Skip to content

Commit

Permalink
Remove do while loop and dosend variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
olyson committed Jul 25, 2023
1 parent a9eb1e7 commit b8be204
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
26 changes: 14 additions & 12 deletions src/cpl/lilac/lnd_comp_esmf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc)
integer :: nstep ! time step index
logical :: rstwr ! .true. ==> write restart file before returning
logical :: nlend ! .true. ==> last time-step
logical :: dosend ! true => send data back to driver
!KO logical :: dosend ! true => send data back to driver
logical :: doalb ! .true. ==> do albedo calculation on this time step
real(r8) :: nextsw_cday ! calday from clock of next radiation computation
real(r8) :: caldayp1 ! ctsm calday plus dtime offset
Expand Down Expand Up @@ -621,22 +621,24 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc)
!--------------------------------

dtime = get_step_size()
dosend = .false.
do while(.not. dosend)
!KO dosend = .false.
!KO do while(.not. dosend)

! We assume that the land model time step matches the coupling interval. However,
! we still need this while loop to handle the initial time step (time 0). We may
! want to get rid of this time step 0 in the lilac coupling, at which point we
! should be able to remove this while loop and dosend variable.
!KO ! We assume that the land model time step matches the coupling interval. However,
!KO ! we still need this while loop to handle the initial time step (time 0). We may
!KO ! want to get rid of this time step 0 in the lilac coupling, at which point we
!KO ! should be able to remove this while loop and dosend variable.
!KO
! We assume that the land model time step matches the coupling interval.
!KO
!
! See also https://github.com/ESCOMP/CTSM/issues/925
!KO ! See also https://github.com/ESCOMP/CTSM/issues/925
nstep = get_nstep()
!KO ! TODO (KWO 07-25-2023)
!KO ! I don't think this is necessary anymore since there is no longer an nstep=0
!KO ! In fact, according to the comment above we should be able to remove this
!KO ! do while loop and the dosend variable.
!KO ! do while loop and the dosend variable. I've done that here.
!KO if (nstep > 0) then
dosend = .true.
!KO dosend = .true.
!KO end if

!--------------------------------
Expand Down Expand Up @@ -787,7 +789,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc)

call advance_timestep()

end do
!KO end do

!--------------------------------
! Check that internal clock is in sync with lilac driver clock
Expand Down
13 changes: 6 additions & 7 deletions src/cpl/nuopc/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ subroutine ModelAdvance(gcomp, rc)
integer :: localPeCount ! Number of local Processors
logical :: rstwr ! .true. ==> write restart file before returning
logical :: nlend ! .true. ==> last time-step
logical :: dosend ! true => send data back to driver
!KO logical :: dosend ! true => send data back to driver
logical :: doalb ! .true. ==> do albedo calculation on this time step
real(r8) :: nextsw_cday ! calday from clock of next radiation computation
real(r8) :: caldayp1 ! ctsm calday plus dtime offset
Expand Down Expand Up @@ -817,18 +817,17 @@ subroutine ModelAdvance(gcomp, rc)
!--------------------------------

dtime = get_step_size()
dosend = .false.
do while(.not. dosend)
!KO dosend = .false.
!KO do while(.not. dosend)

! TODO: This is currently hard-wired - is there a better way for nuopc?
! Note that the model clock is updated at the end of the time step not at the beginning
nstep = get_nstep()
!KO ! TODO (KWO 07-25-2023)
!KO ! I don't think this is necessary anymore since there is no longer an nstep=0
!KO ! In fact, according to the following comment in src/cpl/lilac/lnd_comp_esmf.F90 we should
!KO ! be able to remove this do while loop and the dosend variable.
!KO ! be able to remove this do while loop and the dosend variable. I've done that here.
!KO if (nstep > 0) then
dosend = .true.
!KO dosend = .true.
!KO end if

!--------------------------------
Expand Down Expand Up @@ -934,7 +933,7 @@ subroutine ModelAdvance(gcomp, rc)
call advance_timestep()
call t_stopf ('lc_ctsm2_adv_timestep')

end do
!KO end do

! Check that internal clock is in sync with master clock
! Note that the driver clock has not been updated yet - so at this point
Expand Down

0 comments on commit b8be204

Please sign in to comment.