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 explicit interfaces for MOM_domain_infra #1306

Merged
merged 5 commits into from
Feb 1, 2021

Conversation

Hallberg-NOAA
Copy link
Collaborator

Added explicit interfaces for the remaining routines in MOM_domain_infra,
including global_field, broadcast_domain, and compute_block_extent, and created
a new stand-alone routine MOM_define_layout inside of MOM_domains.F90 to replace
the mpp routine that it had previously wrapped. Also added comments explicitly
documenting some of the integer parameters that are used to signal staggering or
communication patterns. All answers are bitwise identical, but some routines
have been recreated within the MOM6 code, in the localized case of
MOM_define_layout with a slightly different interface.

  Added explicit interfaces for the remaining routines in MOM_domain_infra,
including global_field, broadcast_domain, and compute_block_extent, and created
a new stand-alone routine MOM_define_layout inside of MOM_domains.F90 to replace
the mpp routine that it had previously wrapped.   Also added comments explicitly
documenting some of the integer parameters that are used to signal staggering or
communication patterns.  All answers are bitwise identical, but some routines
have been recreated within the MOM6 code, in the localized case of
MOM_define_layout with a slightly different interface.
@codecov-io
Copy link

codecov-io commented Jan 27, 2021

Codecov Report

Merging #1306 (8526efa) into dev/gfdl (272e862) will increase coverage by 0.00%.
The diff coverage is 65.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           dev/gfdl    #1306   +/-   ##
=========================================
  Coverage     45.93%   45.93%           
=========================================
  Files           234      234           
  Lines         72079    72097   +18     
=========================================
+ Hits          33108    33120   +12     
- Misses        38971    38977    +6     
Impacted Files Coverage Δ
src/framework/MOM_domain_infra.F90 48.81% <30.00%> (-0.23%) ⬇️
src/framework/MOM_domains.F90 55.46% <100.00%> (+3.36%) ⬆️

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 272e862...8c7c8b2. Read the comment docs.

@Hallberg-NOAA
Copy link
Collaborator Author

This PR passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/11953.

use mpp_domains_mod, only : mpp_define_io_domain, mpp_define_domains, mpp_deallocate_domain
use mpp_domains_mod, only : mpp_get_domain_components, mpp_get_domain_extents
use mpp_domains_mod, only : mpp_get_compute_domain, mpp_get_data_domain, mpp_get_global_domain
use mpp_domains_mod, only : mpp_get_boundary, mpp_update_domains, global_field_sum => mpp_global_sum
Copy link
Collaborator

Choose a reason for hiding this comment

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

From our discussions, it seems that global_field_sum is being left as a pass-through because it is unused in MOM source, but still could be used by existing drivers or other config_src code.

I'd recommend breaking this out into a separate statement, with a comment explaining why this function is unwrapped, explaining that it is informally part of the MOM API but is unused and undocumented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know that this code is often examined by other people, and while these are in module use statements for the nuopc and mct couplers, they are not actually used there. Rather than putting in some comments here that will just be ignored (or perhaps as well as), I would like to either (1) put in an issue, or (2) actually remove the unused module use statements from the other couplers, now that we have a way to compile them for testing purposes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I still think it's a good idea to document exceptions to the rules, even if it is only referenced by a very small group (perhaps even just ourselves).

In order to avoid creating work for you, I have submitted a PR to your branch which makes this change.

use mpp_domains_mod, only : mpp_get_compute_domain, mpp_get_global_domain
use mpp_domains_mod, only : mpp_get_domain_extents, mpp_deallocate_domain
use mpp_domains_mod, only : mpp_update_domains, global_field_sum => mpp_global_sum
use mpp_domains_mod, only : domain2D, domain1D, group_pass_type => mpp_group_update_type
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since group_pass_type is used in the code, does this need to be documented somehow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because this is an opaque type whose contents are never referenced anywhere that is visible in the MOM6 code, I don't think that we need to document its contents (even if we could figure out how to do this).

Copy link
Collaborator

Choose a reason for hiding this comment

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

See response above, PR addresses this change.

@marshallward marshallward self-assigned this Jan 29, 2021
marshallward and others added 3 commits January 30, 2021 17:26
This patch explicitly identifies `global_field_sum` and
`group_pass_type` as FMS pass-throughs.  These remain undocumented and
cannot be wrapped, but the exceptional reasons for retaining them
justifies their existence as pass-throughs.

Since `global_field_sum` is unused in MOM6/src, it does not require an
explicit definition or wrapper.  Legacy drivers may still require this
definition, however, so we retain it here.

The contents of `group_pass_type` are never accessed, and it is only
used to facilitate internal mpp operations, so it does not need to
formally be part of the MOM6 API and can be left undocumented.

Since these two functions are exceptions to the rule that all active
operations should be wrapped and documented, it makes sense to
explicitly identify them as such.
MOM_domain_infra: Document FMS passthroughs
@marshallward
Copy link
Collaborator

marshallward commented Feb 1, 2021

@marshallward marshallward merged commit 2e4cd88 into mom-ocean:dev/gfdl Feb 1, 2021
@Hallberg-NOAA Hallberg-NOAA deleted the domain_APIs branch July 30, 2021 18:05
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