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

Add end of run functionality to CICE #77

Merged
merged 8 commits into from
Jun 25, 2024

Conversation

dpsarmie
Copy link
Collaborator

@dpsarmie dpsarmie commented Apr 24, 2024

PR checklist

  • Short (1 sentence) summary of your PR:
    This PR will add end of run restart functionality to CICE.
  • Developer(s):
    Daniel Sarmiento
  • 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.
    This PR was testing in UFS on Hera using the regression test datm_cdeps_control_gefs. This was tested using different combinations of restart setting to try and ensure expected functionality.
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
    • different at roundoff level
    • more substantial
  • 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.

This PR adds the ability for CICE to write restart files at the end of the run even if the end of a run does not coincide with the restart interval. The restart is controlled via the CMEPS configuration option write_restart_at_endofrun. If this configuration option is not set or set to False, a restart will not be created at the end of the run. Setting this configuration option to True will create a restart file for CMEPS, MOM6, and CICE. The code was written so all three components were tied together by this one configuration variable.

This PR partially resolves ufs-community/ufs-weather-model#2236 and resolves NOAA-EMC/CMEPS#118.

A similar PR is in the MOM6 repository to complete resolve these issues.

This commit changes the ice_comp_nuopc file to add the ability to
create a restart file at the end of a run. When the stop_alarm is
active, the code will now force a restart file to be written.
This will allow the user to set the write_restart_at_endofrun option
in the ufs.configure.*.IN file to control the creation of the
restart file at the end of the run. This single config option controls
restart files for CMEPS, MOM, and CICE.
The check for the write_restart_at_endofrun config option was going
to run at each model step. This change will run the check once and
set a logical variable for the subsequent check.
@dpsarmie dpsarmie marked this pull request as ready for review April 26, 2024 15:36
Turn off stop_alarm check when write at end of run restart is called.
Added a check for AlarmIsRinging call.
@NickSzapiro-NOAA
Copy link
Collaborator

@dpsarmie Can you sync with the last commit (9c0cd8d)? I think that's why the GHActions is failing

While named as "write_restart_at_endofrun", is it possible/intended for the restart to be triggered and the models continue to integrate?

@dpsarmie
Copy link
Collaborator Author

dpsarmie commented May 16, 2024

@dpsarmie Can you sync with the last commit (9c0cd8d)? I think that's why the GHActions is failing

While named as "write_restart_at_endofrun", is it possible/intended for the restart to be triggered and the models continue to integrate?

@NickSzapiro-NOAA Branch has been updated.

Not 100% sure what you mean. The stop_alarm should only ring on the last timestep and only then will the last restart file be generated. I don't think it would be possible for the models to continue running after the final restart file is written, but the other restart files at the predetermined intervals will still write and allow the model to continue running. (At least that's the intent and how it has been behaving when tested.)

@DeniseWorthen
Copy link
Collaborator

DeniseWorthen commented May 16, 2024

@NickSzapiro-NOAA Dan is correct. We normally write restarts via the restart_n,restart_option settings, so every 12 hours for example. However, if the run continues to a non-interval hour and then stops, there is currently no restart written. CMEPS has an existing 'write-restart-at-end-of-run' configuration option, but it wasn't respected by MOM6 or CICE6.

@DeniseWorthen
Copy link
Collaborator

@dpsarmie Could you add this simple change to this PR

diff --git a/cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90 b/cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90
index d0aafbb..4668f03 100644
--- a/cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90
+++ b/cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90
@@ -72,7 +72,7 @@ subroutine ufs_logfhour(msg,hour)
     real(dbl_kind),    intent(in)    :: hour
     character(len=char_len)          :: filename
     integer(int_kind)                :: nunit
-    write(filename,'(a,i3.3)')'log.ice.f',int(hour)
+    write(filename,'(a,i4.4)')'log.ice.f',int(hour)
     open(newunit=nunit,file=trim(filename))
     write(nunit,'(a)')'completed: cice'
     write(nunit,'(a,f10.3)')'forecast hour:',hour

Change precision of variable being logged
@dpsarmie
Copy link
Collaborator Author

@DeniseWorthen Ok added that change.

@FernandoAndrade-NOAA
Copy link

Testing for #2324 is complete, please continue with the merge process for this PR.

@FernandoAndrade-NOAA
Copy link

Correction - Please do not merge yet, there is still a missing commit on the WM side.

@FernandoAndrade-NOAA
Copy link

Ok, the missing log in 2324 has been committed. We should be all set to continue, sorry for the delay.

@DeniseWorthen DeniseWorthen merged commit 9452de8 into NOAA-EMC:emc/develop Jun 25, 2024
1 check passed
NickSzapiro-NOAA pushed a commit to NickSzapiro-NOAA/CICE that referenced this pull request Aug 9, 2024
* Add end of run restart file functionality
* Add CICE write_restart_at_endofrun config option call
* Update cice_wrapper_mod.F90
NickSzapiro-NOAA added a commit to NickSzapiro-NOAA/CICE that referenced this pull request Aug 21, 2024
…e cpl_scalar field when created for UFS (CICE-Consortium#969)


These are two commits cherry-picked from as in UFS and needed to close NOAA-EMC#84.

This PR adds the ability for CICE to write restart files at the end of the run (independent of other settings) and controlled via the CMEPS configuration option write_restart_at_endofrun. Setting this configuration option to True creates a restart file in the same way for CMEPS, MOM6, and CICE.

This PR also initializes the scalar field value for the index for NTile (implemented for FV3) not used or set in CICE. In certain cases, the scalar field value for this index has been found to be non-zero (NaN in debug compiles). This is the cause of the failure reported in ufs-community/ufs-weather-model#2338.

* Add end of run functionality to CICE (NOAA-EMC#77)
* initialize cpl_scalar field when created (NOAA-EMC#83)

---------

Co-authored-by: Daniel Sarmiento <[email protected]>
Co-authored-by: Denise Worthen <[email protected]>
NickSzapiro-NOAA added a commit that referenced this pull request Sep 25, 2024
…e cpl_scalar field when created for UFS (CICE-Consortium#969)


These are two commits cherry-picked from as in UFS and needed to close #84.

This PR adds the ability for CICE to write restart files at the end of the run (independent of other settings) and controlled via the CMEPS configuration option write_restart_at_endofrun. Setting this configuration option to True creates a restart file in the same way for CMEPS, MOM6, and CICE.

This PR also initializes the scalar field value for the index for NTile (implemented for FV3) not used or set in CICE. In certain cases, the scalar field value for this index has been found to be non-zero (NaN in debug compiles). This is the cause of the failure reported in ufs-community/ufs-weather-model#2338.

* Add end of run functionality to CICE (#77)
* initialize cpl_scalar field when created (#83)

---------

Co-authored-by: Daniel Sarmiento <[email protected]>
Co-authored-by: Denise Worthen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants