Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart overwrite protection added #1306

Open
wants to merge 2 commits into
base: dev/ufs-weather-model
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions model/src/w3odatmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ MODULE W3ODATMD
!! if runtype is startup or branch run, then initfile is used
logical :: use_user_histname = .false. !<@public logical flag for user set history filenames
logical :: use_user_restname = .false. !<@public logical flag for user set restart filenames
logical :: use_overwrite_protect = .false. !<@public logical flag for protecting time0/timeN overwrite
character(len=512) :: user_histfname = '' !<@public user history filename prefix, timestring
!! YYYY-MM-DD-SSSSS will be appended
character(len=512) :: user_restfname = '' !<@public user restart filename prefix, timestring
Expand Down
22 changes: 19 additions & 3 deletions model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module wav_comp_nuopc
use wav_shr_mod , only : wav_coupling_to_cice, nwav_elev_spectrum
use wav_shr_mod , only : merge_import, dbug_flag
use w3odatmd , only : nds, iaproc, napout
use w3odatmd , only : runtype, use_user_histname, user_histfname, use_user_restname, user_restfname
use w3odatmd , only : runtype, use_user_histname, user_histfname, use_user_restname, user_restfname, use_overwrite_protect
use w3odatmd , only : user_netcdf_grdout
use w3odatmd , only : time_origin, calendar_name, elapsed_secs
use wav_shr_mod , only : casename, multigrid, inst_suffix, inst_index, unstr_mesh
Expand Down Expand Up @@ -1642,7 +1642,7 @@ subroutine waveinit_ufs( gcomp, ntrace, mpi_comm, mds, rc)
if (isPresent .and. isSet) then
use_user_restname=(trim(cvalue)=="true")
end if
write(logmsg,'(A,l)') trim(subname)//': Custom restart names in use ',use_user_restname
write(logmsg,'(A,l)') trim(subname)//': Custom restart names in use',use_user_restname
call ESMF_LogWrite(trim(logmsg), ESMF_LOGMSG_INFO)

call NUOPC_CompAttributeGet(gcomp, name='gridded_netcdfout', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
Expand All @@ -1663,7 +1663,23 @@ subroutine waveinit_ufs( gcomp, ntrace, mpi_comm, mds, rc)
fnmpre = './'

call ESMF_LogWrite(trim(subname)//' call read_shel_config', ESMF_LOGMSG_INFO)
call read_shel_config(mpi_comm, mds, time0_overwrite=time0, timen_overwrite=timen)


! Added attribute for restart time0/timeN overwrite option
call NUOPC_CompAttributeGet(gcomp, name='overwrite_protect', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)

if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
use_overwrite_protect=(trim(cvalue)=="true")
end if

if (use_overwrite_protect) then
call ESMF_LogWrite(trim(subname)//': no time0/timeN overwrite')
call read_shel_config(mpi_comm, mds)
else
call ESMF_LogWrite(trim(subname)//': time0/timeN overwrite')
call read_shel_config(mpi_comm, mds, time0_overwrite=time0, timen_overwrite=timen)
end if

call ESMF_LogWrite(trim(subname)//' call w3init', ESMF_LOGMSG_INFO)
call w3init ( 1, .false., 'ww3', mds, ntrace, odat, flgrd, flgr2, flgd, flg2, &
Expand Down
Loading