Skip to content

Commit

Permalink
Restart overwrite (#1)
Browse files Browse the repository at this point in the history
* adding attribute for time0/timeN oevrwrite protection

* adding time0/timeN overwrite protection

* initialize cpl_scalars when created (#1274)

---------

Co-authored-by: Denise Worthen <[email protected]>
  • Loading branch information
sbanihash and DeniseWorthen authored Sep 13, 2024
1 parent 7f548c7 commit 69cacae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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

0 comments on commit 69cacae

Please sign in to comment.