Skip to content

merge origin dev/gfdl#2

Merged
nikizadehgfdl merged 316 commits intonikizadehgfdl:dev/gfdlfrom
mom-ocean:dev/gfdl
Jan 3, 2020
Merged

merge origin dev/gfdl#2
nikizadehgfdl merged 316 commits intonikizadehgfdl:dev/gfdlfrom
mom-ocean:dev/gfdl

Conversation

@nikizadehgfdl
Copy link
Copy Markdown
Owner

No description provided.

alperaltuntas and others added 30 commits September 19, 2019 12:30
- Changed shape of tc3 to be 10x8 to be the same size as
  tc1 and tc2. This will allow us to re-use static memory
  executables.
- Also changed tense of labels to match directories
- Similar to tc1.a but uses RK2 instead of RK3 for time integration
- Turned tides off in tc2.a
- Uses different remapping scheme, sigma coordinate and different
  topography.
  Added a new optional scale argument to calculate_density, calculate_spec_vel
calculate_density_derivs, calculate_density_second_derivs, and
calculate_specific_vol_derivs, to rescale the densities or related variables.
All answers are bitwise identical, but there are new optional arguments to
public interfaces.
  Rescale bulkmixedlayer densities and their derivatives via the calls to
calculate_density and calculate_density_derivs.  All answers are bitwise
identical.
  Rescaled density units in MOM_entrain_diffusive for dimensional consistency
testing.  All answers are bitwise identical.
  Changed the units of GV%Rlay from [kg m-3] to [R] for dimensional consistency
testing.  This required the addition of unit_scale_type arguments to several
interfaces.  All answers are bitwise identical, but new arguments have been
added to several public interfaces.
  Moved rescaling of Rlay to [R] into the various set_coord routines.  This
required the addition of unit_scale_type arguments to two interfaces.  All
answers are bitwise identical, but new arguments have been added to two
public interfaces.
  Changed the units of GV%Rho0 from [kg m-3] to [R] for dimensional consistency
testing.  This required the addition of unit_scale_type arguments to several
interfaces.  All answers are bitwise identical, but new arguments have been
added to several public interfaces and the units of an element in a public
type have changed.
  Rescaled density units in MOM_regularize_layers for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in MOM_set_viscosity for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in MOM_set_diffusivity for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in MOM_kappa_shear for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in MOM_internal_tide_input for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in diagnoseMLDbyDensityDifference in MOM_diabatic_aux
for dimensional consistency testing.  All answers are bitwise identical.
  Rescaled density units in MOM_tidal_mixing for dimensional consistency
testing.  All answers are bitwise identical.
  Rescaled density units in MOM_geothermal for dimensional consistency
testing.  This required adding a unit_scale_type argument to geothermal_init.
All answers are bitwise identical, but a public interface has a new argument.
adcroft and others added 25 commits December 3, 2019 09:46
  Added conversion factors to 4 mass-flux diagnostics and comments to 4 others
on why no conversion factors are needed.  All answers are bitwise identical.
  Added scale arguments to 5 chksum calls and grouped another two chksum calls
while also adding the right scaling argument. All answers are bitwise identical.
  Undoes the dimensional scaling of the cell areas before taking their global
sum, so that the reproducing sum does not overflow when there is dimensional
rescaling.  All answers are bitwise identical when there is no rescaling, but
this eliminates a source of inadvertent overflows or underflows in the global
sums, and there is a new optional argument to compute_global_grid_integrals.
  Corrects the dimensionally inconsistent expressions for the CFL number in
the tracer advection code, in which a negligible thickness had been added to
the cell volume to avoid division by zero.  This change does not alter the
solutions in the MOM6-examples test cases, but now it permits dimensional
rescaling of lengths over a much larger range, and it could change answers if
the minimum layer thicknesses are small enough.
  Unscale interface heights before taking a global average via a reproducing sum
in non-Boussinesq mode global diagnostics to permit dimensional consistency
testing over a larger range.  All answers are bitwise identical.
  Added an optional tmp_scale argument to global_i_mean and global_j_mean to
specify an internal rescaling of variables being averaged before the reproducing
sum.  All answers are bitwise identical, but there are new optional arguments
to two public interfaces.
  Use tmp_scale when taking the i-mean interface heights for i-mean sponges, to
give a greatly expanded range of dimensional consistency testing.  All answers
are bitwise identical.
MOM6: +(*)Dimensional consistency completion
  Refactored how time-averaging of fluxes in forcing types that span multiple
timesteps and flux diagnostics are handled, and rescaled the units of
fluxes%dt_buoy_accum from [s] to [T].  This involved changing the arguments to
fluxes_accumulate, forcing_accumulate, mech_forcing_diags and
forcing_diagnostics, but because of the differing types of the arguments, an
incompatible mix of code will not compile.  Also changed the units of dt as
passed to accumulate_net_input, and made a minor change to extractFluxes1d to
avoid the possibilty of a division by zero.  All answers are bitwise identical,
but there are public interface changes, including changes that impact the mct
and nuopc driver codes.
  Added the new runtime parameters KAPPA_SHEAR_ITER_BUG and KD_TRUNC_KAPPA_SHEAR
to permit correction of a dimensionally inconsistent expression in the Newton's
method solver code of kappa_shear, and to allow the value of shear mixing that
is neglected compared with the background mixing to be set at run-time instead
of being hard-coded.  By default, all answers are bitwise identical, but there
are two new runtime parameters and the MOM_parameter_doc files change.
  Added the new runtime parameter VERT_FRICTION_2018_ANSWERS that avoids the use
of the hard-coded maximum viscous mixing length per timestep in the vertical
viscosity code, and added h_neglect in the denominators of several terms in the
viscosity code.  All answers in the MOM6-examples test cases are bitwise
identical, but the answers will change if ANGSTROM is set to 0, and there is a
new entry in the MOM_parameter_doc files.
- has the potential to change answers, depending on the options used.
- This is perhaps redundant in that the model was already loading
  dudy or dvdx if they were provided.
- Turns out the model was reading them, but not loading them
  into the segment%tangential_grad array.
Added rotated dumbbell, fixed a couple small OBC things.
@nikizadehgfdl nikizadehgfdl merged commit a9b4e97 into nikizadehgfdl:dev/gfdl Jan 3, 2020
nikizadehgfdl pushed a commit that referenced this pull request Apr 30, 2021
nikizadehgfdl pushed a commit that referenced this pull request Jan 7, 2022
nikizadehgfdl pushed a commit that referenced this pull request Apr 6, 2022
nikizadehgfdl pushed a commit that referenced this pull request Mar 11, 2026
* Add MOM_ANN module

* Mesoscale momentum parameterization with ANN

- Computes subgrid stress using ANN in MOM_Zanna_Bolton
- Uses MOM_ANN module for ANN inference

Equivalent MOM_override for defaults
```
USE_ZB2020 = True
ZB2020_USE_ANN = True
USE_CIRCULATION_IN_HORVISC = True
ZB2020_ANN_FILE_TALL = /path/to/ocean3d/subfilter/FGR3/EXP1/model/Tall.nc
```

* Mesoscale momentum parameterization with ANN (#2)

Blank commit after squash/rebase was handled on command line

* Moved MOM_ANN.F90 to src/framework/

* Minor refactor of MOM_ANN

- Removed unused modules
- Removed unused MOM_memory.h
- Added input and output means which default to 0 and
  do not need to be present in the weights file
- Gave defaults to means, norms, tests so that they do
  no need to be present in file
- Added missing array notation "(:)"
- Minor formatting

* Adds unit tests and timing test to MOM_ANN

- Added ANN_allocate, set_layer, set_input_normalization, and
  set_output_normalization methods to allow reconfiguration during
  unit tests
- Added ANN_unit_tests with some simple constructed-by-code
  networks with known solutions
- Added config_src/drivers/unit_tests/test_MOM_ANN.F90 to drive
  unit tests
- Added  config_src/drivers/timing_tests/time_MOM_ANN.F90 as
  rudimentary for timing inference

* Adding multiple forms of inference

- Adds inference operating on array (instead of single vector of
  features)
- Implements several different versions of inference with various
  loop orders
  - Involves storing the transpose of A in the type
  - Tested by checking inference on same inputs is identical between
    variants
    - Added randomizers to assist in unit testing
- Adds timing of variants to config_src/drivers/timing/time_MOM_ANN.F90
- Adds an interface (MOM_apply) to select preferred version of
  inference subroutine
- Added command line args to time_MOM_ANN.F90 to allow more rapid
  evaluation of performance

Variants explored, timed with gfortran (13.2) -O3 on Xeon:
- vector_v1:
  - original inference from Pavel
- vector_v2:
  - allocate work arrays just once, using widest layer
  - loop over layers in 2's to avoid pointer calculations and copies
  - speed up, x0.8 relative to v1
- vector_v3:
  - transpose loops
  - slow down, x1.54 relative to v1
- vector_v4:
  - transpose weights with same loop order as v1
  - slow down, x1.03 relative to v1
- array_v1:
  - same structure as v2, working on x(space,feature) input/outputs
  - speed up, x0.41 relative to v1
- array_v2:
  - as for array_v1 but with transposed loop order
  - apply activation function on vector of first index while in cache
  - speed up, x0.35 relative to v1
- array_v3:
  - same structure as v2, working on x(feature,space) input/outputs
  - speed up, x0.58 relative to v1

* Renamed ANN variants and added some module documentation

- Added module dox
- Renamed _v1, _v2 etc to labels
- Added ANN_apply_array_sio to ANN_apply interface
- Replaced "flops" with "MBps" in timing output

* Removed alternative variants of ANN in favor of optimized

- Deleted variants of ANN that did not perform as well as the two
  versions that remain.

* Apply array_sio function in ANN inference for momentum fluxes (#5)

* Apply array_sio ANN inference for computation of momentum fluxes

* remove trailing space

* Initial commit

* address Robert Hallberg code review

* Restore deafult value of ZB_SCALING coefficient

---------

Co-authored-by: Alistair Adcroft <Alistair.Adcroft@noaa.gov>
Co-authored-by: Alistair Adcroft <adcroft@users.noreply.github.com>
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.

8 participants