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

Mac fpe check #12

Closed
wants to merge 123 commits into from
Closed

Mac fpe check #12

wants to merge 123 commits into from

Conversation

marshallward
Copy link
Owner

not a real PE

gustavo-marques and others added 30 commits April 27, 2022 14:25
Replaces LU_pred to L_diag, since now this logical only controls
if diagnostics should be posted.
This commit adds the latest updates to the vertFPmix subroutine
after Bill Large did some cleaning. We have highlight places in
the code where work must be done.
omega_w2x is the counter-clockwise angle of the wind stress with
respect to the horizontal abscissa (x-coordinate) at tracer
points [rad]. This variable is needed in the vertPFmix subroutine.
This line of code was lost during the last merge.
* Rename MOM_lateral_boundary_diffusion.F90 to
  MOM_hor_bnd_diffusion.F90.
* Following the suggestion from a reviewer, MOM_lateral_boundary_diffusion
  has been renamed to MOM_hor_bnd_diffusion. Many submodules related to the
  'old; lateral diffusion have been renamed throughout the code.
  LBD has been replaced to HBD.
* Tested that answers for GMOM do not change.
Build and store the HBD grid outside the tracer loop since the
same grid is used in all tracers. This makes this module
more computationaly efficient. A GMOM case run for 10 days and with
3 tracer is ~ 7.5 % faster.
add desc argument to log_param calls in MOM_CFC_cap
CFC_BC_FILE must be specified if USE_CFC_CAP=.true.

use hemispheric averages poleward of 10 degrees latitude
linearly interpolate between 10S and 10N

correct bug that atm cfc12 was used in cfc11 flux computation
* Add subroutine hbd_grid_test, which mimics subroutine hbd_grid
  but it is only used in the unit tests;

* Add unit tests for hbd_grid_test and fix existing tests for
  fluxes_layer_method;

* Delete unused code and fix the format of doxygen throughout
  the module.
…OM_CFC_cap

refs moved out of nuopc cap code, MOM_forcing_type, MOM_variables

call CFC_cap_set_forcing in call_tracer_set_forcing

add call to call_tracer_set_forcing in nuopc cap

add arguments to call_tracer_set_forcing

increase width in MOM_CFC_cap unit test output

correct typo in oil_tracer
…of_cap

migrate nearly all refs to CFC_cap into MOM_tracer_flow_control and MOM_CFC_cap
Improvements in the MOM_lateral_boundary_diffusion module
* changes in nuopc cap, infra, and MOM.F90 to receive ensembe id from the coupler (alternative to FMS ensemble mngr)

* multi-instance logfile name correction in nuopc cap

* append ensemble suffix to _doc files

* changes in rpointer and restart file name handling to accommodate multi-instance CESM runs

* remove fms2_io_mod usage in FMS1/MOM_ensemble_manager_infra.F90

* rm whitespace in mom_cap
…in-20230504

update to MOM6 main 20230504 updating
This commit adds the option to apply a linear decay in the
neutral diffusion fluxes within a transition zone defined
by the boundary layer depths of adjacent columns. This option
is controlled by a new parameter NDIFF_TAPERING, which is only
available when NDIFF_INTERIOR_ONLY=True. By default
NDIFF_TAPERING=False and answers are bitwise identical.
…0406

Merge changes from GFDL to main (2023-04-06)
Writes useful fields when the diffusivity of viscosity is less than zero.
The should help understanding the root cause of such cases and facilitate
the necessary adjustments.
…ngmuir_kpp

Output relevant fields when diff or visc < 0
alex-huth and others added 28 commits October 26, 2023 15:11
* allow for assigned ice shelf thickness where hmask==3, but still solve for ice sheet velocity
Newest Read the Docs configuration file requires explicit specification
of the environment (using `build:`).  This patch includes this section.

Upgrading to newer Python environments has also forced us to specify an
older Jinja2 that works with our legacy Sphinx module.
… a partially-filled cell, add the reference thickness contribution from a neighboring filled cell proportionate to its flux into the partially-filled cell. This is more accurate than simply taking the average thickness of all neighboring filled cells. Also fixed incorrect bounds. (mom-ocean#475)
The directory, time and timestamp variables are needed by the particle code in order to write better restart files. I have changed the particles_save_restart interface to add these variables. I have also removed the option to pass temperature and salinity to particles_save_restart, because these variables are not useful for restart.
the module in now able to read in tidal velocities for different
tidal harmonics and distribute the energy and distribute TKE input over
the different vertical modes. This involves upsizing dimensions of
several arrays and mofiying some API. internal_tide_input_CS is
promoted to public to facilitate the passing of energy input to
MOM_internal_tides
  Removed the unused (and unusable) routine build_grid_arbitrary.  This routine
could not have been used because it had a hard-coded STOP call, and comments in
it indicated that it should have been deleted in July, 2013.  The run-time
parameter setting that would have triggered a call to this routine has been
retained for now, but with a fatal error message explaining that this routine
has not been implemented.   All answers are bitwise identical in any cases that
ran before.
  Removed the unused routine rescale_grid_bathymetry.  This routine was added in
August 2018 as a part of the development of the depth unit conversion and
dimensional consistency testing, but it is no longer being called now that this
conversion is essentially complete (and it has not been called by the code in
several years).  For the original commit that first added this code, see
github.com/mom-ocean/MOM6/commit/ddc9ed1c33a1b7357b213929118ecaa19ae63f9f.  All
answers are bitwise identical.
  Corrected dimensional rescaling bugs in the spherical harmonics SAL code.  An
issue with horizontal length scaling was corrected by using G%Rad_Earth_L in
place of G%Rad_Earth in spherical_harmonics_init.  There are new optional
tmp_scale arguments to calc_SAL and spherical_harmonics_forward to allow the
rescaling to be undone before calling the reproducing sums.

  This commit also modifies the call to the reproducing sums in
spherical_harmonics_forward so that all real or imaginary components are
calculated with a single call, which reduces the cost of the SAL calculation
reproducing sums from about 6.7 times the cost with non-reproducing sums to just
5.5 times as much in testing with the tides_025 test case.

  There is also code added to avoid NaNs arising from a square root operating
on a negative argument from a 32-bit integer roll-over when a very large
number of harmonics components (more than 1024 x 1024) are unadvisedly being
used.

  While this commit corrects the dimensional scaling when HARMONICS_SAL is true,
all answers are bitwise identical when no rescaling is used or when the
spherical harmonics SAL is not used.  There are new optional arguments to two
publicly visible interfaces.
`FMS_cap`: extract c-grid staggered currents
  Added standard-format unit descriptions for 31 real variables in comments
scattered across 14 modules in the core, tracer, and both parameterizations
directories.  Only comments are changed and all answers are bitwise identical.
  Save tv%p_surf in the restart file when USE_PSURF_IN_EOS is true so that the
diagnosed potential energy written to the ocean.stats files after a restart
matches the energy written at the end of the previous run-segment in certain
non-Boussinesq configurations, including the Baltic test case.  Because
p_surf_EOS is a non-mandatory restart field, there is no problem restarting the
run from a restart file created by an older version of the model. The solutions
themselves are bitwise identical. This change requires that tv%p_surf is treated
as an allocatable pointer to its own array rather than being used as a pointer
to the p_surf element of the fluxes or forces structures so that it can be
registered as a restart field.  At some point tv%p_surf could be converted into
an allocatable array instead of a pointer, but this would require more extensive
code refactoring.  All answers are bitwise identical.
…ename specified by new parameter ICE_SHELF_ENERGYFILE). Currently, this file outputs the kinetic energy and mass of the ice sheet according to the smae parameters used to write the ocean.stats file (TIMEUNIT, ENERGYSAVEDAYS, and ENERGYSAVEDAYS_GEOMETRIC).
A few bug fixes so that the GL_couple=.true. option works correctly. Setting GL_couple=.true. will determine the grounding based on ocean column thickness rather than the typical the hydrostatic equilibrium condition. This has the advantage of accounting for changes in sea level, tides, etc. However, it has the disadvantage of not working with the same thoroughly-tested sub-element grounding line parameterization used for the hydrostatic condition. Instead, it accounts for sub-element grounding line movement by, during the SSA solution, using a grounding mask averaged over all ocean (sub)steps that completed since the last SSA solve. Unlike the hydrostatic sub-element parameterization, the dependence of the GL_couple=.true. scheme on grid resolution has not yet been determined. Qualitatively similar grounding line retreat/advance behavior is achieved with both approaches for MISOMIP IceOcean1 on a 2km grid, but GL_couple=.true. results in a rougher grounding line position with less retreat. Note that this commit also fixed a bug in applying the hydrostatic grounding line approach without its sub-element parameterization (though the sub-element parameterization should also be used anyway).
Update .readthedocs.yml configuration
* This commit fixes a bug where restarts were not bitwise identical for coupled ice sheet/ocean runs. This required adding visc%taux and visc%taux (stress on the ocean under ice shelves) to the ocean restart file. Furthermore, ice shelf geometry-related variables needed to be updated and their halo cells filled (within subroutine update_ice_shelf) before (rather than after) calculating shelf fluxes and pressure to the ocean (subroutine add_shelf_flux). Also fixed a bug to calculate ISS%mass_shelf properly in ice-shelf cells that are only partially-filled (ice-shelf area < cell area) due to advection of the ice-shelf front.

* Modified the scheme that attempts to enforce a constant sea level in coupled ice-sheet/ocean runs, where balancing fluxes are applied to part/all of the open ocean to offset the sea level effects caused by changes in ice sheet mass on the ocean. The old scheme assumes the entire ice sheet is floating, and is retained here for the case where CS$override_shelf_movement==.true. and CS%mass_from_file (this approach is used for the MISOMIP tests without a dynamic ice sheet). The new scheme (which is needed for the MISOMIP tests with a dynamic ice sheet, e.g. IceOcean1r and IceOcean1a), accounts for the more general case where some of the ice sheet is grounded. In either case, the ocean balancing fluxes are applied over the entirety of the ice-sheet-free ocean by default. However, if the new parameter CONST_SEA_LEVEL_MISOMIP==.true., the balancing flux is only applied where x>=790 km, which is the sponge region for the MISOMIP tests.

The new scheme also requires calculation of ice sheet dHdT, which is now calculated and optionally saved as a useful diagnositc field for any ice sheet simulation.

* Eliminated array syntax and added inverse dt variables where needed
Makedep can now exclude prescribed directories in the directory tree
used to generate the file lists.

This is required for projects which may not follow normal development
processes, such as the FMS test programs.
The target (regression) configure step did not use a --with-framework
flag and would always build with FMS1, even if FRAMEWORK was set to
fms2.  This patch adds the flag to its configure step.

This patch also does some refactoring of the MOM_ENV and MOM_FCFLAGS
setup rules.  Values common to all rules are set externally, and
additional values for individual rules are appended.

Variable syntax also follows Makefile format (spaces around =) rather
than POSIX shell (no spaces).
The default FMS build in ac/deps is updated to 2023.03.

FMS source now includes a suite of test programs which require explicit
preprocessing macros, which can complicate out makedep-based build when
those macros are not present.  To avoid this, the new "skip" flag has
been added to the makedep build.

The skip flag should not cause errors or other issues in older versions
of FMS which do not have the excluded directory (though perhaps that
could or should change in the future).
  Revised the recently added brine-plume code to avoid using a vertical sum and
to use tv%SpV_avg to determine the brine plume mixing thickness instead of
GV%Z_to_H when in non-Boussinesq mode. Several internal brine plume expressions
now work in units of H instead of Z, and a total of 5 unit conversion factors
were eliminated. This will change certain non-Boussinesq calculations to avoid
any dependency on the Boussinesq reference density, but some Boussinesq answers
may also be changed and made more robust by avoiding the answer-indeterminate
sum() function.
* +Fix for issue mom-ocean#506, tracer OBC bug

 - it only happens in the advection for certain flow directions,
   inflow from OBC plus along-boundary flow.

* Tracer OBCs need more of an h halo update.

- This one should finally fix the processor count issues with OBCs.

* Correct the "if" statement.

* +Adding more halo points to an exchange

 - This will change answers if you start with a non-zero velocity.
   You need three halo points (or maybe cont_stencil) for the
   continuity solver.
 - Also trying to put in some initial DEBUG_OBC code.

* Fix some DEBUG_OBC logic

* Writing to temporary arrays for tres_xy

 - Way to trick some compiler.

* Another fix for DEBUG_OBC

* Fixing the whalo troubles for grids that are 2 wide/long.

* Exchange all the h_new points.

 - without this, because we're remapping all the tres points, it
 dies in debug mode on bad h_new values.

* Trying a different exchange

 - as it was, it was passing my tests, failing the auto-tests.

* Fixing the DEBUG_OBC logging

* Putting the logging statement back.

 - Making an error more verbose too.
- Added simple single-thread program to invoke EOS_unit_tests.F90
- Added not-as-simple program to time the cost of calculate_density()
  and calculate_spec_vol() for both scalar and array APIs
  - Placed in new directory config_src/drivers/timing_tests/
- Renamed MOM_unit_test_driver.F90 to test_MOM_file_parser.F90
- Updated .testing/Makefile
  - Added list of programs in config_src/drivers/unit_tests
    - These are added to BUILDS if DO_UNIT_TESTS is not blank.
      (DO_UNIT_TESTS was an existing macro but it might be uneeded)
    - These programs are compiled with code coverage
  - Added list of programs in config_src/drivers/timing_tests
    - These programs are compiled with optimization and no coverage
  - Fixed rule for building UNIT_EXECS (which did not re-build properly
    because the central Makefile was trying to model the dependencies
    even though those dependencies are in the build/unit/Makefile.dep)
  - Added convenient targets build.unit, run.unit, build.timing, run.timing
- Timing tests currently time a loop over 1000 calls (so that the resolution
  of the CPU timer is not too large) and 400 samples to collect statistics
  on timings. On gaea c5 this takes about 10 seconds.
  - The results are written to stdout in json.
- Added placeholder build and run of timing_tests to GH workflow.
  - Enabled for [push,pull_request]
  - We probably will not be able to use timings from GH but I still want
    to exercise the code we know the timing programs aren't broken by a
    commit.
- Also added driver for string_functions_unit_tests
  Refactored ALE_remap_velocities to separate the code setting the thicknesses
at velocity points from the code that actually does the remapping.  This
includes the creation of the new public routines ALE_remap_set_h_vel and
ALE_remap_set_h_vel_via_dz and the replacement the pair of tracer point
thickness arguments to ALE_remap_velocities and remap_dyn_split_RK2_aux_vars
with a pair of the old and new thicknesses at the velocity points and the
elimination of several arguments to these routines that are no longer being
used.  There are also new internal routines ALE_remap_set_h_vel_partial and
ALE_remap_set_h_vel_OBC to apply modifications to the velocity point thicknesses
with OBCs and one runtime option.  The runtime variable REMAP_UV_USING_OLD_ALG
has effectively been moved from MOM_ALE.F90 to MOM.F90, although it is still
being read in MOM_ALE_init for use with the accelerated regridding during
initialization.  All answers are bitwise identical, but there are two new
public interfaces and changes to the arguments to two other public interfaces
and a run-time parameter was moved between modules resulting in changes to
some MOM_parameter_doc files.
  This commit fixes a bug to ensure that OBC%debug is always being set when OBCs
are in use.  After a recent commit, the value of OBC%debug was not being set and
was being left in an indeterminate whenever DEBUG_OBC=False or DEBUG=False and
DEBUG_OBC was unspecified.  This would lead to the model writing out a number of
checksums in some cases with open boundary conditions enabled, depending on what
value was inherited by the uninitialized OBC%debug.   Although this does not
change any answers, it will avoid a problem that will write out a large volume
of undesired output and greatly slow down configurations with open boundary
conditions.
- Added a base class in MOM_EOS_base_type.F90
- All EOS modules now extend this base class
  - This reduces replicated code between the EOS modules
- All existing APIs in MOM_EOS now avoid branching for the type of
  EOS and ultimately pass through to a low-level elemental function
  implementation of the actual EOS
- Added a new elemental function exposed by MOM_EOS
  (currently not used in the main model)
- There is a speed up over the previous form of EOS due to the
  reduced branching
  - For some functions, a local implementation of the base class member is
    needed to gain performance. I deliberately did not implement this
    optimization for UNESCO or Jackett06 so that the generic implementation
    of the base class is utilized and we have code coverage.
- Added rules to .testing/Makefile to invoke build.timing, run.timing for the
  "target" code checked out for regression tests
- Appended to existing GH "perfmon" workflow
  Added or corrected the units in comments describing about 200 real variables
in MOM_hor_bnd_diffusion and MOM_neutral_diffusion, and corrected spelling
errors or other issues in about another 20 comments.  Only comments are changed
and all answers are bitwise identical.
Hoping this gives a little info about the FPE on macs.
marshallward pushed a commit that referenced this pull request May 14, 2024
Replace db array default values with real literals
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.