Skip to content

Commit c46243f

Browse files
update w3init to enable reading of restarts for HAFS
1 parent bc43396 commit c46243f

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

model/src/w3initmd.F90

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -966,38 +966,29 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
966966
VA(:,:) = 0.
967967
#ifdef W3_PIO
968968
if (use_restartnc) then
969-
if (runtype == 'continue' )then
970-
call set_user_timestring(time,user_timestring)
969+
call set_user_timestring(time,user_timestring)
970+
if (restart_from_binary) then
971+
fname = trim(user_restfname)//trim(user_timestring)
972+
else
973+
fname = trim(user_restfname)//trim(user_timestring)//'.nc'
974+
endif
975+
inquire(file=trim(fname), exist=exists)
976+
if (exists) then
971977
if (restart_from_binary) then
972-
fname = trim(user_restfname)//trim(user_timestring)
973-
else
974-
fname = trim(user_restfname)//trim(user_timestring)//'.nc'
975-
endif
976-
inquire(file=trim(fname), exist=exists)
977-
if (exists) then
978-
if (restart_from_binary) then
979-
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
980-
else
981-
call read_restart(trim(fname), va=va, mapsta=mapsta, mapst2=mapst2)
982-
end if
978+
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
983979
else
984-
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
980+
call read_restart(trim(fname), va=va, mapsta=mapsta, mapst2=mapst2)
985981
end if
986982
else
987-
if (restart_from_binary) then
988-
call set_user_timestring(time,user_timestring)
989-
fname = trim(user_restfname)//trim(user_timestring)
990-
inquire(file=trim(fname), exist=exists)
991-
if (exists) then
992-
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
993-
else
994-
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
995-
end if
996-
else
983+
if (runtype == 'continue') then
984+
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
985+
elseif (restart_from_binary) then
986+
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
987+
else
997988
call read_restart('none')
998-
! mapst2 is module variable defined in read of mod_def; maptst is from 2.b above
999-
flcold = .true.
1000-
end if
989+
! mapst2 is module variable defined in read of mod_def; maptst is from 2.b above
990+
flcold = .true.
991+
endif
1001992
end if
1002993
else
1003994
#endif

0 commit comments

Comments
 (0)