Skip to content

Use ymd instead of uninitialized date in timeInit for (unused?) optDate in alarmInit#1023

Merged
apcraig merged 1 commit into
CICE-Consortium:mainfrom
NickSzapiro-NOAA:uninitialized_date
May 8, 2025
Merged

Use ymd instead of uninitialized date in timeInit for (unused?) optDate in alarmInit#1023
apcraig merged 1 commit into
CICE-Consortium:mainfrom
NickSzapiro-NOAA:uninitialized_date

Conversation

@NickSzapiro-NOAA
Copy link
Copy Markdown
Contributor

For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers

PR checklist

  • Short (1 sentence) summary of your PR:
    Use ymd instead of uninitialized date in timeInit for (unused?) optDate in alarmInit
  • Developer(s):
    Denise Worthen, Nick Szapiro
  • Suggest PR reviewers from list in the column to the right.
  • Please copy the PR test results link or provide a summary of testing completed below.
    Options aren't exercised in UFS regression testing. Any suggestions for how to test?
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit (almost everywhere)
    • different at roundoff level
    • more substantial (in optDate alarmInit option)
  • Does this PR create or have dependencies on Icepack or any other models?
    • Yes
    • No
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.
    • Yes
    • No
  • Does this PR add any new test cases?
    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)
    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please document the changes in detail, including why the changes are made. This will become part of the PR commit log.

Address compiler warning and bug that Warning: 'date' is used uninitialized [-Wuninitialized]. This impacts alarmInit when using optDate. I don't know that anyone does that, especially as it's not working properly. Part of ufs-community/ufs-weather-model#2703

@anton-seaice
Copy link
Copy Markdown
Contributor

This looks like its only used if stop_option = date in nuopc.runconfig? I've definitely never tried that.

Copy link
Copy Markdown
Contributor

@DeniseWorthen DeniseWorthen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optDate is not used in UFS; this was found only because of the compiler warning.

@dabail10
Copy link
Copy Markdown
Contributor

dabail10 commented May 7, 2025

Do we ever use timeInit? Anyhow, good catch.

@NickSzapiro-NOAA
Copy link
Copy Markdown
Contributor Author

Private only to here...if running simulations to some ominous end date :)

@dabail10
Copy link
Copy Markdown
Contributor

dabail10 commented May 7, 2025

There was code added to ice_comp_nuopc.F90 to handle writing a restart at the end of run, but not on a particular date. I think this might be handled by the mediator.

@NickSzapiro-NOAA
Copy link
Copy Markdown
Contributor Author

Yes, in cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90

call alarmInit(mclock, stop_alarm, stop_option, &
            opt_n   = stop_n,           &
            opt_ymd = stop_ymd,         &
            RefTime = mcurrTime,           &
            alarmname = 'alarm_stop', rc=rc)

...            

! Handle end of run restart
    if (restart_eor) then
       call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc)
       if (ChkErr(rc,__LINE__,u_FILE_u)) return
       if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
          if (ChkErr(rc,__LINE__,u_FILE_u)) return
          force_restart_now = .true.
          call ESMF_AlarmRingerOff( alarm, rc=rc )
          if (ChkErr(rc,__LINE__,u_FILE_u)) return
       endif
    endif

UFS tends to use stop_option = nhours

@apcraig apcraig merged commit 6561026 into CICE-Consortium:main May 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants