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

Code standardization #761

Merged
merged 45 commits into from
May 5, 2018
Merged

Conversation

Hallberg-NOAA
Copy link
Collaborator

These are widespread but localized changes to bring MOM6 code closer to its coding standards, and
to restructure the coupled_driver and related code to enable new modes of operation in the future. No
files in MOM6_examples should change, and answers in all test cases are bitwise identical.

Code commits include:

  Corrected two assignment that dangerously use array syntax inside of explicit
do-loops, which would lead to an order NI^2*NJ^2 operation that should have been
an NI*NJ operation unless the compiler detects and avoids it.  Answers are
unchanged in the MOM6_examples test cases, but might be corrected in other
cases.
  Moved the calls to Update_Stokes_Drift outside of the timestepping loop and
used ustar from the appropriate forcing structure.  Answers are unchanged in
the MOM6_examples test cases.
  Added a new logical element, initialized, to the mech_forcing type that can be
used to indicate whether it has been initialized and its arrays allocated.  All
answers are bitwise identical.
  Separated convert_IOB_to_forces out from convert_IOB_to_fluxes, and added
calls to both in the coupled_driver version of ocean_model_MOM. Also separated
apply_force_adjustments out from apply_flux_adjustments; both are inside of
MOM_surface_forcing.F90 and are not publicly visibility.  There is a new public
interface, and one of the arguments has been removed from convert_IOB_to_fluxes,
but all answers are bitwise identical.
  Restricted the halo widths to their minimum required extents or commented out
halo updates that do not appear to be needed at all.  All answers are bitwise
identical in the MOM6 test cases.
  Added a new optional argument, skip_pres, to copy_common_forcing_fields, to
specifiy that the surface pressure fields need not be copied.  Also added or
fixed dOxygenized comments in MOM_forcing_type.F90.  All answers are bitwise
identical.
  Moved identical calls to convert_IOB_to_forces outside of a logical test, and
set the surface pressure fields in fluxes directly from the IOB type.  All
answers are bitwise identical.
  Removed unused argument fluxes from finish_MOM_initialization.  All answers
are bitwise identical, but a public interface has changed.
  The code setting the rigidity due to ice shelves used a mismatch of the
minimum and maximum ice shelf masses in the two directions.  This has been
corrected to use the minimum in both directions.  Also, when the ice shelves are
used, the penetrating portions of the shortwave are being erroneously zeroed out
everywhere.  All solutions in the existing MOM6_examples test cases are bitwise
identical, but there will likely be answer changes if ICE_SHELF is true.
  Added an optional argument, Ocn_fluxes_used, to update_ocean_model to indicate
that the cumulative thermodynamic fluxes from the ocean, like frazil, have been
used by the ice, and hence the running sum should be reset.  Also refactored
add_berg_flux_to_shelf to collect updates to the terms in forces and fluxes.
Also added Waves arguments to more of the step_MOM calls, and a new (and as-yet
untested) variant of the step_MOM call for when the call to update_ocean_model
indicats the dynamics or thermodynamics are not to be advanced.  All answers in
the test cases are bitwise identical.
  Added the new elements area_berg and mass_berg to the mech_forcing type, since
these may be updated at different points in the algorithm than the fluxes type.
All answers are bitwise identical.
  Corrected the capitalization of the indices in several arrays, to follow the
MOM6 convention of lowercase indices at tracer points and capital indices at
vorticity points.  All answers are bitwise identical.
  Restructured add_shelf_flux to reduce the number of redundant expressions
setting rigidity_ice_[uv], and to only set rigidity_ice_[uv] and frac_shelf_[uv]
at the symmetric-grid velocity points, as these are the only values that are
actually used.  All answers are identical in the existing MOM6 test cases, but
it is possible that these changes are not being adequately tested.
  Added code storing aggregate iceberg properties in the mech_forcing type from
the Ice_ocean_boundary type.  Also reduced the index range over which
rigidity_ice_[uv] is set due to sea-ice to the range that is actually used. All
answers are bitwise identical.
  Added a pointer element, ice_rigidity, to the ice_ocean_boundary_type in
config_src/coupled_dirver, that can be used to provide information about the
rigidity (resistence to differential vertical ocean motions) of the sea-ice pack
or other ice outside of the ocean component.  Also moved the call to reset
forces%rigidity_ice_[uv] from MOM_ice_shelf to convert_IOB_to_forces, to enable
the rigidity to be accumulated across multiple flavors of ice.  As this new
field is not yet used, all answers are bitwise identical.
  Created a new module, MOM_marine_ice, to set dynamic properties for the ocean
due to icebergs and sea-ice.  The existing subroutine add_berg_flux_to_sHelf
has been moved into this new module, and there are also an init routine and a
control structure for this routine.  All answers are bitwise identical.
  All pointers should be set to null when declared.  This has now been done for
all pointers in MOM.F90 and MOM_PressureForce_Mongomery.F90.  No answers change.
  dOxyGenized comments describing barotropic_CS, and cleaned up the argument
descriptions for set_dtbt and btcalc. All answers are bitwise identical.
  All arguments in MOM_checksum_packages are now described in dOxyGen comments.
  Cleaned up the argument descriptions in the MOM_continuity and
MOM_continuity_PPM modules, so a grep can now clearly show that all arguments
have dOxyGen comments.  All answers are bitwise identical.
  Added dOxyGen comments or intent declarations for several arguments to
parse_segment_str, setup_[uv]_point_obc and register_segment_tracer.  Also
reversed the order of the optional and intent qualifiers for several arguments,
to follow the pattern elsewhere in MOM6.  All answers are bitise identical.
  Added dOxyGen comments for MOM_thermovar_chksum and alloc_BT_cont_type, and
eliminated some unused variables and inapplicable comments. All answers are
bitwise identical.
  Added dOxyGen comments for elements of the verticalGrid_type and the arguments
to verticalGridInit.  All answers are bitwise identical.
  Added intent declarations for the arguments to several functions in
MOM_checksums.  All answers are bitwise identical.
  Moved the parameters related to the icebergs into the control structure for
for the MOM_marine_ice module, and changed the arguments to
add_berg_flux_to_shelf to replace parameter arguments with a control structure
argument.  All answers are bitwise identical, although a public interface has
changed.
  Split add_berg_flux_to_shelf into two new subroutines, iceberg_forces and
iceberg_fluxes, that work on updating the mech_forcing and forcing types,
respectively.  All answers are bitwise identical.
  Specified the intent for a number of subroutine arguments in MOM_checksums.F90
where this had been omitted.  All answers are bitwise identical.
  Specified the intent for a number of subroutine arguments in
MOM_string_functions.F90 where this had been omitted.  All answers are bitwise
identical.
  Added dOxyGen comments for all routines and arguments in MOM_document.F90.
All answers are bitwise identical.
  Added dOxyGen comments for all routines and arguments in
MOM_error_handler.F90.  Also added intents for several arguments where it had
been omitted.  All answers are bitwise identical.
  Added dOxyGen comments for several routines and and their arguments in
MOM_horizontal_regridding.F90, however much more needs to be done to bring the
code in this file into alignment with MOM6 standards. All answers are bitwise
identical.
  Specified the intent for a number of subroutine arguments in
MOM_tracer_hor_diff.F90 where this had been omitted, and added dOxyGen comments
for other arguments.  All answers are bitwise identical.
  Added dOxyGen comments for several recently added arguments in
MOM_energetic_PBL.F90 where they had been omitted. All answers are bitwise
identical.
  Added dOxyGen comments for several recently added arguments in MOM_opacity.F90
where they had been omitted.  Also shortened some openMP directives.  All
answers are bitwise identical.
  Added dOxyGen comments for several routines and and their arguments in
MOM_ice_shelf.F90, however much more needs to be done to bring the code in this
file into alignment with MOM6 standards, and much of it is essentially untested.
All answers are bitwise identical.
  Replaced (intent, optional) declarations with (optional, intent), and
similarly for (pointer, intent) across numerous files.  This will help to filter
to ensure that intents or a pointer status are specified for all arguments.  All
answers are bitwise identical.
  Added comments describing some of the arguments in MOM_regridding.F90 and
split excessively long lines.  All answers are bitwise identical.
  Added comments describing some of the subroutines and arguments in
MOM_shared_initialization.F90 and split excessively long lines.  All answers
are bitwise identical.
  Split lines exceeding 120 characters in 55 source files to promote readability
and compliance with MOM6 code standards.  All answers are bitwise identical.
@Hallberg-NOAA
Copy link
Collaborator Author

This PR is being tested with https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/4086

@adcroft adcroft merged commit 026907e into mom-ocean:dev/gfdl May 5, 2018
nikizadehgfdl added a commit to nikizadehgfdl/MOM6 that referenced this pull request Jul 12, 2021
- This addresses the FMS issue $761
NOAA-GFDL/FMS#761

- There is a mpp_broadcast in the FMS2 subroutine
get_unlimited_dimension_name() and this subroutine has to be called by
all pes, so it cannot be inside a if(is_root_pe()) block
marshallward added a commit that referenced this pull request Aug 11, 2021
Bug fix for FMS2 issue #761, broadcast from root pe
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