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

MOM6: +(*)Write unscaled restart files. #94

Merged
merged 3 commits into from
Mar 30, 2022

Conversation

Hallberg-NOAA
Copy link
Member

This PR introduces code changes so that MOM6 writes out restart files in which
the dimensional rescaling of variables has been undone, although it is still
able to properly read older restart files that do have dimensionally rescaled
variables. This PR also includes some new optional arguments to the framework
code that will allow SIS2 to do the same; this has been tested and works, but
will have to come in a subsequent PR to SIS2 after the version of MOM6 in
coupled configurations is updated. In testing with this PR, the output
differences between cases with and without dimensional rescaling are confined to
MOM_parameter_doc.debug files. This PR includes a number of new subroutine
arguments, but the solutions are bitwise identical.

The commits in this PR include:

  • 7c3f31bd4 +(*)Write unscaled MOM6 restart files
  • 11d03b13b +Add unit conversion capability for restarts

  Added optional arguments to framework code to permit the restart files to work
with dimensionally unscaled variables.  All answers are bitwise identical, but
there are new optional arguments for multiple public interfaces.

 - Added a new conversion factor element, conv, to the field_restart type to
   specify how a field is to be unscaled before writing, and whose reciprocal is
   used to scale restart fields as they are read in.

 - Added the new optional argument conversion to each of the
   register_restart_field() and register_restart_pair() routines, which is used
   to specify how each field will be rescaled when it is written to or read from
   a restart file.  The default is the same as setting this to 1.

 - Added the new optional argument unscaled to fix_restart_scaling() and
   fix_restart_unit_scaling() to reset the unit conversion factors that will be
   save to the restart files to 1, consistent with writing out fields without
   scaling to the restart files.
  Revised the MOM6 code so that the output restart files are always exactly the
same as they would be if no dimensional rescaling is applied.  The input restart
files can still have rescaling, so files written by previous versions of the
code still work exactly as before.  This does change the output, in the sense
that the restart files are unscaled and some units documents in the restart
files are corrected, but the solutions themselves are bitwise identical.  Also,
there are new (non-optional) unit scaling type arguments to several routines.
The specific changes in this commit include:

 - Added conversion factors to all register_restart_field() or
   register_restart_pair() call for variables that are subject to dimensional
   rescaling.

 - Revised the calculation of restart rescaling factors to reflect the rescaling
   that now occurs directly in the restore_state() call.

 - Added new US arguments to register_restarts_dyn_split_RK2(),
   MEKE_alloc_register_restart(), set_visc_register_restarts()

 - Added a new GV argument to mixedlayer_restrat_register_restarts()

 - Used the new unscaled argument in calls to fix_restart_scaling() and
   fix_restart_unit_scaling()

 - Revised several calls to register_restart_field() to avoid using the variant
   that uses a var_desc type, eliminating the need for some modules to reference
   the vardesc type or the routine var_desc().

 - Added or corrected unit descriptions to the comments describing a few
   variables.

 - Noted a few probably bugs in comments with ###, but did not fix them.
@marshallward
Copy link
Member

marshallward commented Mar 28, 2022

Just a reminder that this has outstanding commits conflicts.

@codecov
Copy link

codecov bot commented Mar 28, 2022

Codecov Report

Merging #94 (fa55d54) into dev/gfdl (4c5e98e) will increase coverage by 0.00%.
The diff coverage is 28.82%.

@@            Coverage Diff            @@
##           dev/gfdl      #94   +/-   ##
=========================================
  Coverage     28.99%   28.99%           
=========================================
  Files           246      246           
  Lines         72296    72304    +8     
=========================================
+ Hits          20963    20967    +4     
- Misses        51333    51337    +4     
Impacted Files Coverage Δ
src/ice_shelf/MOM_ice_shelf.F90 0.00% <0.00%> (ø)
src/ice_shelf/MOM_ice_shelf_dynamics.F90 0.00% <0.00%> (ø)
src/ice_shelf/MOM_ice_shelf_initialize.F90 0.00% <0.00%> (ø)
src/initialization/MOM_state_initialization.F90 19.83% <0.00%> (ø)
src/ocean_data_assim/MOM_oda_incupd.F90 0.00% <0.00%> (ø)
...c/parameterizations/lateral/MOM_internal_tides.F90 0.00% <ø> (ø)
src/tracer/boundary_impulse_tracer.F90 0.00% <0.00%> (ø)
src/user/MOM_controlled_forcing.F90 0.00% <0.00%> (ø)
src/framework/MOM_restart.F90 25.71% <9.09%> (-0.24%) ⬇️
...ameterizations/lateral/MOM_mixed_layer_restrat.F90 43.52% <14.28%> (+0.06%) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c5e98e...fa55d54. Read the comment docs.

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/15099 ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants