Skip to content

+Enable FMS2 interface writes#1359

Merged
marshallward merged 13 commits into
mom-ocean:dev/gfdlfrom
Hallberg-NOAA:FMS2_io_writes
Mar 31, 2021
Merged

+Enable FMS2 interface writes#1359
marshallward merged 13 commits into
mom-ocean:dev/gfdlfrom
Hallberg-NOAA:FMS2_io_writes

Conversation

@Hallberg-NOAA
Copy link
Copy Markdown
Collaborator

This PR uses the new FMS2_io interfaces for file writes from MOM6, including
writing restarts, and it removes temporary code in the infra/FMS2 directory
that had not been incorporated into the MOM6 call structure. There are some
minor changes to interfaces outside of the infra/FMS2 to accommodate these
changes. The restarts have been fully tested for writes and reads with both
single-files and domain-decomposed sets of files, and appear to be working. The
files generated with FMS2_io differ slightly from those generated with FMS1_io
in the order with which some variable attributes are stored.

The commits in this PR include:

Hallberg-NOAA and others added 13 commits March 18, 2021 17:16
  Use axistype for MOM_interp_infra directly from mpp_io_mod and add a copy of
get_axis_data to both copies of infra/FMS[12]/MOM_interp_infra.F90, and then use
these in framework/MOM_horizontal_regridding.F90, to permit the MOM6 I/O calls
to use the FMS2 interfaces without simultaneously requiring changes to the
horizontal interpolation code.  All answers are bitwise identical, but there
are changes to the interfaces offered by a public module.
  Added a new optional logical argument to write_metadata_axis to indicate when
an axis is staggered at the edges of the tracer grid, and changed calls to
get_file_info to stop requesting the number of global attributes.  Also
eliminated some unused optional arguments to the FMS1 version of write_metadata
field.  All answers are bitwise identical, but there are minor changes to
some I/O related interfaces.
 Corrected the logic of a warning message in categorize_axis by adding
parentheses.  All answers are bitwise identical, and spurious warnings are no
longer being issued.
  Added a large number of calls to handle all of the writes via the FMS2
interfaces to infra/FMS2/MOM_io_infra.F90.  There are newly defined private
types in MOM_io_infra to wrap the axistype and fieldtype that had previously
been offered from mpp_io_mod.  All answers are bitwise identical and it has been
verified that output files do not change and the restarts are still working.
  Deleted the unused MOM_axis.F90 and MOM_write_field_fms2.F90 modules, now
that MOM_io_infra.F90 has been updated to be able to use FMS2 interfaces for
both reading and writing to files.  As these modules had never been used, they
do not change any answers.
  Added variants of MOM_read_data_0d, MOM_read_data_0d_int, MOM_read_data_1d,
MOM_read_data_1d_int, and MOM_read_data_2d_region that use the FMS2 interfaces
to read data.  Also altered prepare_to_read_var so that it does not open a file
(which had been an option before); one argument to prepare_to_read_var was no
longer needed and so it was removed.  Also added a public interface to
find_varname_in_file that does the same as prepare_to_read_var but works on the
other FMS2 file type without domain decomposition.  Several unused and now
redundant routines were removed from MOM_read_data_fms2.F90. Comments describing
a number of variables were also added.  All of these changes are confined to
config_src/infra/FMS2, and all answers are bitwise identical.
  Moved the routines prepare_to_read_var and find_varname_in_file, along with
four other routines that prepare_to_read_var calls from MOM_read_data_fms2 to
MOM_io_infra, and eliminated the file MOM_read_data_fms2.F90.  All answers are
bitwise identical, but this rearrangement of identical code does eliminate one
public module, so that the file structure of infra/FMS2 is identical to that of
infra/FMS1.
  Add a missing ".nc" suffix to the output filename with FMS2_io, while also
issuing a warning, following the practice of FMS1.  Also reordered the calls to
add the longname and axis attributes to FMS2 files, to follow the order used in
MOM6 calls to FMS1.  All answers are bitwise identical, but there are some
changes to output filenames and orders of attributes in files (to revert to
traditional behavior).
FMS2 restart routines expect axes to be domain-decomposed.  However, the
domain_write_1d function does not apply this decomposition and instead
routes this operation to compressed_write_1d.

In order to accommodate this, we explicitly slice the 1d arrays of any
axes into its domain-decomposed segment before passing to write_data.
We have also introduced a control flag to MOM's FMS2 axistype to direct
MOM_write_axis when this needs to be applied.

We currently apply the domain decomposition flag to all horizontal axes
regardless of circumstances.  For now this is probably sufficient, but
may need further testing (e.g. cube sphere).
Explicit domain decomposition of horizontal axes
  Corrects reads of hexadecimal checksum attributes from distributed files when
using the FMS2 IO interfaces.  All answers are bitwise identical, and reads and
writes of distributed sets of restart files are now working with the FMS2 IO
interfaces.
@marshallward
Copy link
Copy Markdown
Collaborator

marshallward commented Mar 31, 2021

@marshallward marshallward merged commit 813fc79 into mom-ocean:dev/gfdl Mar 31, 2021
@Hallberg-NOAA Hallberg-NOAA deleted the FMS2_io_writes branch July 30, 2021 18:01
@sanAkel sanAkel mentioned this pull request Aug 30, 2021
8 tasks
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