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

+Complete MOM6 framework code restructuring #1293

Merged
merged 16 commits into from
Jan 22, 2021

Conversation

Hallberg-NOAA
Copy link
Collaborator

This PR includes a number of steps to complete the restructuring of the MOM6
framework code. Several modules were split into MOM-specific and FMS-specific
parts, with all rotation calls for input and output in the top level. Where
there are two related files, the FMS- specific parts are in the ..._infra.F90
files. It also includes a number of localized changes outside of the framework
directory that take advantage of the new interfaces to eliminate the direct use
of FMS-specific calls.

To complete the separation of the framework files into a MOM-specific
directory and an FMS wrapper directory, the files MOM_coms_infra.F90,
MOM_constants.F90, MOM_cpu_clock.F90, MOM_diag_manager.F90,
MOM_domain_infra.F90, MOM_error_infra.F90, MOM_interp_infra.F90,
MOM_io_infra.F90 and MOM_time_manager.F90 would be moved to the new
infrastructure directory, with no further changes to their contents.

The starting point for this PR is the result of PR#1289. The commits beyond
PR#1289 in this PR include:

  Moved MOM_domains.F90 to MOM_domain_infra.F90 and MOM_domain_init.F90 to
MOM_domains.F90, and eliminated MOM_domains_init from MOM_domain_infra.F90.  The
interfaces from MOM_domains.F90 that were previously used are still available
from the new MOM_domains module.  Also replaced the tripolar argument to
create_MOM_domain with the simple logical tripolar_N.  All answers are bitwise
identical, but a module name that was briefly in use no longer exists.
  Renamed MOM_io_wrapper to MOM_io_infra and MOM_coms_wrapper to MOM_coms_infra.
All answers are bitwise identical, but there are changes to module names that
are only used in the framework directory.
  Created a separate thin error handler, MOM_error_infra.F90, to work with the
MOM infrastructure routines and wrap infrastructure calls, and use this in
MOM_error_handler. All answers are bitwise identical, but there is a new module.
  Removed time_interp_external_mod interfaces from MOM_time_domain.F90, and
replaced calls to time_interp_external in MOM_ALE_sponge.F90 with calls coming
in via MOM_iterpolate.  All answers are bitwise identical.
  Added the new function diag_axis_init to MOM_diag_manager, with arguments and
argument orders that are more appropriate for use with MOM6 than the version in
the FMS diag_axis module, which it calls in turn.  A MOM_domain_type is one of
the new optional arguments, along with a level of grid refinement and a flag
indicating that the null_axis id should be returned.  Calls to diag_axis_init
throughout the MOM6 code have been made consistent with this new interface.  All
answers are bitwise identical.
  Moved the overloaded interface MOM_write_file to MOM_io and renamed
MOM_write_field in MOM_io_infra to write_field after removing all of the
optional turns arguments and the code to rotate arrays.  Also added a variant of
write_field to work on axis types.  The unused fill_value optional arguments
were also removed from the 1-d and scalar versions of this write_field.  All
answers are bitwise identical, but there are interface changes that are
localized to the MOM_io modules.
  Created the infrastructure wrapper module MOM_interp_infra.F90, while
retaining MOM_interpolate.F90 to do the rotation of the arrays and to provide
the public interfaces for use in the rest of the MOM6 code.  As a part of this,
time_interp_extern was renamed back to time_interp_external (now that the pgi
compiler bugs no longer interfere), which is reflected in changes in other
modules.  All answers are bitwise identical, but there is a reversion of
publicly visible interface name.
  Eliminated the dependency of MOM_domain_infra.F90 on MOM_array_transform.F90
by explicitly rotatign the maskmap if necessary. Added the new optional argument
coarsen to get_domain_extent and made three other existing arguments optional,
which makes the routine get_domain_extent_dsamp2 redundant, so it was removed.
Also store the domain name in the MOM_domain type, and use this as the default
when cloning one domain type with another.
  Renamed the recently added refine optional arguments to diag_axis_init to
coarsen to better reflect what it does.  All answers are bitwise identical.
  Removed the routine read_axis_data, which performs a function that is already
dealt with by MOM_read_data.  It has been replaced with MOM_read_data in the one
place where read_axis_data was actually being called.  All answers are bitwise
identical, but a public interface was deleted.
  Added the new optional arguments refine and extra_halo to clone_MD_to_MD, and
added calls to ensure that the cloned domain uses the same decomposition as its
parent domain.  Also added the new optional arguments xextent, yextent and
coarsen to clone_MD_to_d2D, while also modifying the code to ensure proper
inheritance of the symmetry of the parent domain, as described in the comments.
Also use calls to clone_MD_to_d2D to create the domain2D elements of the
MOM_domain_types, including the coarsened domains, reducing code duplication.
All answers are bitwise identical, but there are new optional arguments to some
publicly visible routines.
  Use a call to clone_MOM_domain (which resolves to clone_MD_to_MD) to allocate
and populate the mosaic supergrid type in MOM_grid_initialize.F90.  This greatly
reduces the number of interfaces from MOM_domains.F90 that are actually used and
need to be made public.
  As a result of reforms to MOM_grid_initialize in the previous commit, there
are several interfaces from MOM_domains that are no longer used.  The redundant
interfaces were eliminated and the remaining interfaces regrouped with comments
describing each group.  This PR also folds deallocate_domain_contents into
deallocate_domain.  All answers are bitwise identical, but some unused public
interfaces have been eliminated.
  Creates and uses an explicit interface for init_extern_field, including a new
optional MOM_domain_type argument, and the omission of some of the optional
arguments to the FMS version of init_external_field that are unused in MOM6.
All answers are bitwise identical, but there are changes to the optional
argument to the optional arguments in a public interface.
@codecov-io
Copy link

codecov-io commented Jan 20, 2021

Codecov Report

Merging #1293 (2d9f623) into dev/gfdl (55279cc) will increase coverage by 0.11%.
The diff coverage is 55.61%.

Impacted file tree graph

@@             Coverage Diff              @@
##           dev/gfdl    #1293      +/-   ##
============================================
+ Coverage     45.81%   45.93%   +0.11%     
============================================
  Files           229      231       +2     
  Lines         71761    71660     -101     
============================================
+ Hits          32880    32916      +36     
+ Misses        38881    38744     -137     
Impacted Files Coverage Δ
src/core/MOM.F90 65.70% <ø> (ø)
src/core/MOM_open_boundary.F90 30.76% <0.00%> (ø)
src/framework/MOM_coms.F90 68.05% <ø> (ø)
src/framework/MOM_coms_infra.F90 53.84% <ø> (ø)
src/framework/MOM_domain_infra.F90 49.34% <ø> (ø)
src/framework/MOM_domains.F90 52.10% <ø> (+12.79%) ⬆️
src/framework/MOM_time_manager.F90 100.00% <ø> (ø)
src/ice_shelf/MOM_ice_shelf.F90 0.00% <0.00%> (ø)
src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 0.00% <0.00%> (ø)
src/ice_shelf/user_shelf_init.F90 0.00% <ø> (ø)
... and 19 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 55279cc...2d9f623. Read the comment docs.

@adcroft
Copy link
Collaborator

adcroft commented Jan 21, 2021

src/core/MOM_grid.F90 Show resolved Hide resolved
src/framework/MOM_error_handler.F90 Show resolved Hide resolved
src/ice_shelf/user_shelf_init.F90 Show resolved Hide resolved
@adcroft adcroft merged commit 2d9f623 into mom-ocean:dev/gfdl Jan 22, 2021
@Hallberg-NOAA Hallberg-NOAA deleted the revise_framework_3rd branch July 30, 2021 16:08
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.

3 participants