Skip to content

Commit dc3ad4a

Browse files
Merge remote-tracking branch 'EMC/dev/ufs-weather-model' into syncdev2ufs_20250730
2 parents ec083f1 + f436fd6 commit dc3ad4a

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

model/src/w3initmd.F90

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -981,38 +981,29 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
981981
VA(:,:) = 0.
982982
#ifdef W3_PIO
983983
if (use_restartnc) then
984-
if (runtype == 'continue' )then
985-
call set_user_timestring(time,user_timestring)
984+
call set_user_timestring(time,user_timestring)
985+
if (restart_from_binary) then
986+
fname = trim(user_restfname)//trim(user_timestring)
987+
else
988+
fname = trim(user_restfname)//trim(user_timestring)//'.nc'
989+
endif
990+
inquire(file=trim(fname), exist=exists)
991+
if (exists) then
986992
if (restart_from_binary) then
987-
fname = trim(user_restfname)//trim(user_timestring)
988-
else
989-
fname = trim(user_restfname)//trim(user_timestring)//'.nc'
990-
endif
991-
inquire(file=trim(fname), exist=exists)
992-
if (exists) then
993-
if (restart_from_binary) then
994-
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
995-
else
996-
call read_restart(trim(fname), va=va, mapsta=mapsta, mapst2=mapst2)
997-
end if
993+
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
998994
else
999-
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
995+
call read_restart(trim(fname), va=va, mapsta=mapsta, mapst2=mapst2)
1000996
end if
1001997
else
1002-
if (restart_from_binary) then
1003-
call set_user_timestring(time,user_timestring)
1004-
fname = trim(user_restfname)//trim(user_timestring)
1005-
inquire(file=trim(fname), exist=exists)
1006-
if (exists) then
1007-
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
1008-
else
1009-
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
1010-
end if
1011-
else
998+
if (runtype == 'continue') then
999+
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
1000+
elseif (restart_from_binary) then
1001+
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
1002+
else
10121003
call read_restart('none')
1013-
! mapst2 is module variable defined in read of mod_def; maptst is from 2.b above
1014-
flcold = .true.
1015-
end if
1004+
! mapst2 is module variable defined in read of mod_def; maptst is from 2.b above
1005+
flcold = .true.
1006+
endif
10161007
end if
10171008
else
10181009
#endif

model/src/wav_import_export.F90

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ subroutine import_fields( gcomp, time0, timen, rc )
283283
use w3wdatmd , only: w3setw
284284
#ifdef W3_CESMCOUPLED
285285
use w3idatmd , only: HSL
286+
#else
287+
use wav_shr_mod , only : casename
288+
#ifdef W3_MPI
289+
use wmmdatmd , only: mpi_comm_grd
290+
#endif
286291
#endif
287292

288293
! input/output variables
@@ -299,6 +304,8 @@ subroutine import_fields( gcomp, time0, timen, rc )
299304
real(r4) :: def_value
300305
character(len=10) :: uwnd
301306
character(len=10) :: vwnd
307+
integer :: isea
308+
real(r4), parameter :: fillv = 9.99e20
302309
real(r4), allocatable :: wxdata(:) ! only needed if merge_import
303310
real(r4), allocatable :: wydata(:) ! only needed if merge_import
304311
character(len=*), parameter :: subname='(wav_import_export:import_fields)'
@@ -357,6 +364,14 @@ subroutine import_fields( gcomp, time0, timen, rc )
357364
if (state_fldchk(importState, 'So_u')) then
358365
call SetGlobalInput(importState, 'So_u', vm, global_data, rc)
359366
if (ChkErr(rc,__LINE__,u_FILE_u)) return
367+
368+
if(trim(casename) == 'ufs.hafs') then
369+
do isea = 1,nsea
370+
if(abs(global_data(isea)-fillv).lt.0.01) then
371+
global_data(isea)=0.0
372+
end if
373+
end do
374+
end if
360375
call FillGlobalInput(global_data, CX0)
361376
end if
362377

@@ -365,6 +380,13 @@ subroutine import_fields( gcomp, time0, timen, rc )
365380
if (state_fldchk(importState, 'So_v')) then
366381
call SetGlobalInput(importState, 'So_v', vm, global_data, rc)
367382
if (ChkErr(rc,__LINE__,u_FILE_u)) return
383+
if(trim(casename) == 'ufs.hafs') then
384+
do isea = 1,nsea
385+
if(abs(global_data(isea)-fillv).lt.0.01) then
386+
global_data(isea)=0.0
387+
end if
388+
end do
389+
end if
368390
call FillGlobalInput(global_data, CY0)
369391
end if
370392
end if

0 commit comments

Comments
 (0)