Skip to content

Commit

Permalink
Use is_restart_fh revised to avoid thread-local storage inter-compone…
Browse files Browse the repository at this point in the history
…nt conflicts
  • Loading branch information
NickSzapiro-NOAA committed Nov 19, 2024
1 parent f4d5d47 commit 7352a37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module wav_comp_nuopc
use wmmdatmd , only : nmpscr
use w3updtmd , only : w3uini
use w3adatmd , only : flcold, fliwnd
use shr_is_restart_fh_mod , only : init_is_restart_fh, is_restart_fh, write_restartfh
use shr_is_restart_fh_mod , only : init_is_restart_fh, is_restart_fh, is_restart_fh_type
#endif
use constants , only : is_esmf_component

Expand Down Expand Up @@ -90,6 +90,7 @@ module wav_comp_nuopc
logical :: cesmcoupled = .true. !< logical to indicate CESM use case
#else
logical :: cesmcoupled = .false. !< logical to indicate non-CESM use case
type(is_restart_fh_type) :: restartfh_info ! For flexible restarts in UFS
#endif
integer, allocatable :: tend(:,:) !< the ending time of ModelAdvance when
!! run with multigrid=true
Expand Down Expand Up @@ -1127,6 +1128,7 @@ subroutine ModelAdvance(gcomp, rc)
type(ESMF_Time) :: currTime, nextTime, startTime, stopTime
integer :: yy,mm,dd,hh,ss
integer :: imod
logical :: write_restartfh
!integer :: shrlogunit ! original log unit and level
character(ESMF_MAXSTR) :: msgString
character(len=*),parameter :: subname = '(wav_comp_nuopc:ModelAdvance) '
Expand Down Expand Up @@ -1221,7 +1223,7 @@ subroutine ModelAdvance(gcomp, rc)
rstwr = .false.
endif
#ifndef W3_CESMCOUPLED
write_restartfh = is_restart_fh(clock)
call is_restart_fh(clock, restartfh_info, write_restartfh)
if (write_restartfh) rstwr = .true.
#endif

Expand Down Expand Up @@ -1371,7 +1373,7 @@ subroutine ModelSetRunClock(gcomp, rc)
#ifndef W3_CESMCOUPLED
call ESMF_TimeIntervalGet( dtimestep, s=dt_cpl, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call init_is_restart_fh(mcurrTime, dt_cpl, root_task)
call init_is_restart_fh(mcurrTime, dt_cpl, root_task, restartfh_info)
#endif

end if
Expand Down

0 comments on commit 7352a37

Please sign in to comment.