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

Feature/convert stat #12

Closed
wants to merge 1,046 commits into from
Closed

Feature/convert stat #12

wants to merge 1,046 commits into from

Conversation

clouden90
Copy link

The recent developed SOCA state converter (soca Feature/convert stat #344) requires two existing mom6 subroutines: meshgrid and fill_miss_2d for horizontal interpolation/extrapolation. Currently these 2 subroutines are private in MOM_horizontal_regridding module and are public-access-prohibited. These updates will move them from private to public.

##Dependencies:
soca Feature/convert stat mom-ocean#344

Hallberg-NOAA and others added 30 commits July 17, 2019 14:43
  Combined halo updates inside of the MEKE code into group passes to reduce
latency.  Also made del2MEKE into a local variable and removed it from the MEKE
control structure.  All answers are bitwise identical.
  Eliminated an unnecessary halo update in horizontal_viscosity.  All answers
are bitwise identical.
  Added a new runtime parameter, VERY_SMALL_FREQUENCY, to control how close to
zero some frequencies that appear in the denominator of some expressions for the
resolutoin functions can get.  Also added some comments and rearranged some code
addressing problems in calc_QG_Leith_viscosity.  By default, all answers in the
MOM6-examples test cases are bitwise identical, but there is a new entry in the
MOM_parameter_doc.all files.
This patch remaps the opacity diagnostic to a tanh function, i.e.

    op -> 1/L * tanh(op * L)

where L is arbitrarily set to 10^-10 (1 Angstrom).  For op << 1/L, the
diagnostic is nearly equivalent to the model opacity.  For values
comparable and larger than L, the diagnostic approaches 1/L, a
sufficiently large value to reproduce the effects of a divergent
opacity.

This allows us to safely manipulate and store the opacity while also
avoiding infinite values and floating point overflow.

This change will modify the opacity diagnostic, but should not affect
the dynamic state.
  Rescaled the units of the f2_dx2_... and beta_dx2_... elements of VarMix_CS.
These particular arrays are only used in calc_resoln_function, and because these
are raised to arbitrary powers they have to be rescaled back to mks units in
some cases.  All answers are bitwise identical in the MOM6-examples test cases.
(*) Remap opacity diagnostic to tanh()
When the surface state went out of user-specified bounds we reported an error such as:
```
WARNING from PE   130: Extreme surface sfc_state detected: i=  18 j=  18 x= -60.625 y= -72.075 D= 1.9385E+01 SSH=-1.1945E+00 SST=-2.5183E+00 SSS= 3.2605E+01 U-= 0.0000E+00 U+=-8.9452E-03 V-= 0.0000E+00 V+= 0.0000E+00
```
The i,j here are the on-core local i,j and the x,y are the geographic location (so you can find the location on a map).
Neither of these are particularly useful when looking at actual model output unless you are adept on porjections.

This commit changes the message to:
```
WARNING from PE   130: Extreme surface sfc_state detected: i= 958 j=  89 lon= -60.625 lat= -72.075 x= -60.042 y= -72.075 D= 1.9385E+01 SSH=-1.1945E+00 SST=-2.5183E+00 SSS= 3.2605E+01 U-= 0.0000E+00 U+=-8.9452E-0
3 V-= 0.0000E+00 V+= 0.0000E+00
```
which allows you to look at model output using either indices or coordinates and still find the location on a map.

- Changes the reported i,j-location to global index
- Adds the diagnostic grid-lon,lat to report
When defining a parameter with get_param() we can indicate that the
parameter is for debugging purposes with the optional argument
`debuggingParam=.true.`. This had been implemented for scalar reals
but not for a vector of reals.
More useful message when detecting bad surface state
…ging-param

Allows vector-of-reals debugging parameters
The KE_adv diagnostic is a sum of values multiplied by -1, which will
assign a -0.0 value for zero-initialized states.  This can lead to
reproducibility problems for symmetric and nonsymmetric grids, since
many intermediate calculations rely on masking of the u field and do not
apply masks to subsequent steps.

This can occur when a MPP domain is bordered by land, where calculations
on the S and W boundaries of a symmetric grids are computed as if they
are unmasked, and would be assigned a -0.0 value.  For nonsymmetric
grids, these values were never computed and would retain a +0.0 value.

We resolve this by re-initalizing the KE_u and KE_v fields, since they
are re-used as buffers for several diagnostics, and exclude masked
points from the calculation.  This ensures +0.0 values in any land
boundaries across symmetric grids.

If the masking is applied to other fields using `KE_u` and `KE_v`, then
we may be able to remove the re-initialization step.

While +/-0.0 are arithmetically identical in all cases, this fix will
preserve bitwise reproducibility and is a step towards phasing out the
`abs()` operation in the checksums.
The diagnostic KPP_OBLdepth_original requires a nonzero CS%n_smooth
value, but it is currently possible to register this diagnostic even
when this parameter is unset.

This patch only registers the diagnostic when n_smooth is defined.
Diagnostic fixes to KE_adv, KPP_OBLdepth_original
- Prior to rolling forward the FMS submodule in MOM6-examples, this
  rolls evaluates that version in the Travis-CI pipeline.
- f2e2c86 includes changes necessary to build MOM6 on MacOS.
…netCDF inputs in horiz_interp_and_extrap_tracer_record
…d_scale_offset

Adding scale_factor and add_offset for horiz_interp_and_extrap_tracer_record
…ation

Refactor MCT driver to make modules consistent with those in the NUOPC driver
adcroft and others added 21 commits August 29, 2019 17:11
The z-interpolated uhml and vhml diagnostics gave inconsistent answers
across layouts when using the general mixed layer restratification
scheme, because the value of h had changed but its halos had not been
updated.

This had been previously fixed in the BML restratification but not the
general stratification method.

This patch updates the value of h by conditionally updating the halos if
this diagnostic is required.
This PR enables coverage cleanup and CodeCov upload for test runs.

It also introduces an optional configuration file, config.mk which can
be used for user-configured settings, such as templates or mpirun
commands.
Path rules for cleaning up old code coverage files (*.gcda) and for
running the CodeCov.io upload script have been fixed.
- The OBC tracer reservoirs were being updated in MOM_tracer_advect -
  twice each! Update them separately after tracer advection.
- The OBC tracer lengthscale was being cubed to get the volume. Change
  that to a lengthscale times the face area where the advection is
  happening.
- Changes answers if the tracer lengthscales were not set to zero.
- Could make it more verbose to let the user know which data are
  missing.
Travis: config.mk user config; enable coverage
*Add new update_segment_tracer_reservoirs routine
(*) Bugfix: [uv]hml z-diags in general restrat
- As agreed on the MOM6 dev call, we renamed MOM_surface_forcing.F90
  to  help distinguish it from the other caps. It is now called
  MOM_surface_forcing_gfdl.F90.
module files placed in install directory
Correct NetCDF include directories
@clouden90 clouden90 self-assigned this Jun 1, 2020
@clouden90 clouden90 closed this Jun 1, 2020
@guillaumevernieres guillaumevernieres deleted the feature/convert_stat branch June 12, 2020 15:54
travissluka pushed a commit that referenced this pull request Jul 12, 2021
Resolve conflicts between ODA use framework mom-ocean#1291 and dev/gfdl
guillaumevernieres pushed a commit that referenced this pull request Jan 11, 2022
mark-a-potts pushed a commit to mark-a-potts/MOM6 that referenced this pull request Jan 25, 2022
merge dev/emc into ocean stochastic branch
mark-a-potts pushed a commit to mark-a-potts/MOM6 that referenced this pull request Jun 28, 2022
Bitwise identical refactoring of the code in DOME_initialize_sponges,
including renaming variables for greater clarity, adding variables for several
dimensional constants, and correcting comments.  This also includes more careful
handling of the DOME OBCs in DOME_set_OBC_data() to hopefully avoid some obvious
problems (noted in a comment about a "fight with T,S") that would arise if a
DOME case were set up that used temperature and salinity. Future revisions
should add more runtime parameters to specify the details of this case, but
properly doing so would involve changing the order of arithmetic; this has not
happened in this case.  All real variables in this module are now described in
comments.  All answers and output are bitwise identical.

Co-authored-by: Marshall Ward <[email protected]>
mark-a-potts pushed a commit to mark-a-potts/MOM6 that referenced this pull request Jun 28, 2022
Note that most of these commits are from previously squashed pull
requests, and this PR is restoring them.

- 6360dbb Merge branch 'main' into main_to_dev
- bac8031 Merge pull request mom-ocean#1566 from jiandewang/EMC-FMS-mixed-mode-20220411
- e532d86 Merge pull request mom-ocean#88 from marshallward/missing_attrib_with_class_bugfix
- d380f1d An alternate fix to class(*) issues with FMS 2022-01
- 8ecf333 Merge pull request mom-ocean#87 from jiandewang/feature/update-to-main-20220317
- ba37f94 Merge remote-tracking branch 'FSU/main' into feature/update-to-main-20220317 this is corresponding to MOM6 main 20220317 commit (hash # 399a7db)
- 44313d9 Merge pull request mom-ocean#85 from jiandewang/feature/update-to-main-20220217
- 966707f Merge remote-tracking branch 'GFDL/main' into feature/update-to-main-20220217 this is corresponding to MOM6 main branch 20220217 commit (hash # 6f6d4d6), which originally based on GFDL-candidate-20220129
- 32c0e1e Merge pull request mom-ocean#81 from jiandewang/feature/update-to-main-20211220
- 9642b1d delete external/OCEAN_stochastic_phyiscs directory as Phil re-coded in external/stochastic_physics directory
- e7c9ada solve minor conflict in mom_cap.F90 mom_ocean_model_nuopc.F90 and MOM_energetic_PBL.F90, add two new files: src/parameterizations/stochastic/MOM_stochastics.F90 and config_src/external/stochastic_physics/stochastic_physics.F90
- 90d5961 Merge pull request mom-ocean#78 from jiandewang/feature/update-to-GFDL-20211019
- fd02017 Merge remote-tracking branch 'GFDL/main' into feature/update-to-GFDL-20211019
- 36f17eb Merge pull request mom-ocean#72 from pjpegion/ocn_stoch_july2021
- a9a957e return a more accurate error message in MOM_stochasics
- 56bb41e Merge branch 'ocn_stoch_july2021' of https://github.com/pjpegion/MOM6 into ocn_stoch_july2021
- ca2ae1c update to dev/emc
- 14ca4a1 Merge pull request mom-ocean#76 from jiandewang/feature/update-to-GFDL-20210914
- 29016c2 Merge remote-tracking branch 'GFDL/main' into feature/update-to-GFDL-20210914 merge GFDL main 20210914 commit (hash # c09e199)
- a8577df Merge branch 'NOAA-EMC:dev/emc' into ocn_stoch_july2021
- f8a8e4c update to gfdl 20210806 (mom-ocean#74)
- 16e6af0 update to dev/emc
- 237a510 add comments
- 1b4273d revert logic wrt increments
- 5b2040e add logic to remove incrments from restart if outside IAU window
- c5f2b72 add write_stoch_restart_ocn to MOM_stochastics
- bdf2dc7 doxygen cleanup
- 8bc4acc move stochastics to external directory
- a3fa3a1 Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch_july2021
- e4bc007 stochastic physics re-write
- 202cbd4 update to dev/emc
- 61717ee Merge remote-tracking branch 'origin/dev/emc' into ocn_stoch
- 565e0bb remove debug statements
- a4c0411 Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
- 689a73f remove PE_here from mom_ocean_model_nuopc.F90
- 8afe969 clean up of mom_ocean_model_nuopc.F90
- 25ed4fc revert MOM_domains.F90
- b8d9888 place stochastic array in fluxes container and make SPPT specific arrays allocatable
- d984a7e remove stochastics container
- eb88219 clean up of code for MOM6 coding standards
- 6e3ea1b correct coupled_driver/ocean_model_MOM.F90 and other cleanup
- 0b99c1f make stochastics optional
- 85023f8 Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
- 80f9f44 clean up MOM_domains
- 5443f8e remove blank link in MOM_diagnostics
- 1727d9a re-write of stochastic code to remove CPP directives
- 600ebf9 Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
- 6bb9d0b fix non stochastic ePBL calculation
- 1d7ffa3 clean up code
- 040e1f1 Merge pull request JCSDA-internal#13 from NOAA-EMC/dev/emc
- 2cba995 Merge branch 'dev/emc' into ocn_stoch
- 1dc0f4f Merge remote-tracking branch 'upstream/dev/emc' into dev/emc
- 4bd9b9e clean up debug statements
- 25ed5ef additions for stochy restarts
- a2a374b add stochy_restart writing to mom_cap
- 0c15f4c Update MOM_diabatic_driver.F90
- 167a62e Merge pull request JCSDA-internal#12 from pjpegion/dev/emc
- bd477a9 Update MOM_diabatic_driver.F90
- 7212400 Update MOM_diabatic_driver.F90
- 7de295c cleanup of code and enhancement of ePBL perts
- cd06356 Merge pull request JCSDA-internal#11 from NOAA-EMC/dev/emc
- 9896d61 Merge pull request JCSDA-internal#9 from pjpegion/dev/emc_merge
- 0a62737 Merge branch 'ocn_stoch' into dev/emc_merge
- 3cad1ba Merge pull request JCSDA-internal#8 from NOAA-EMC/dev/emc
- c2aa2a8 updates from dev/emc
- 182ef34 additions for stochastic physics and ePBL perts
- 671c714 Merge pull request JCSDA-internal#1 from NOAA-EMC/dev/emc
mark-a-potts pushed a commit to mark-a-potts/MOM6 that referenced this pull request Aug 10, 2023
* initial hooks for stochastic EOS modifications

* remove debug statements

* add documentation

* Change ampltiude from 0.39 to sqrt(.39)

* remove global_indexing logic from stoch_eos_init

* switch to using MOM_random and add restart capability

* update random sequence to update each each time-step

* remove tseed0 from MOM_random (leftover from debugging)

* Added necessary submodules and S^2, T^2 diagnostics to MOM_diagnostics

* Added diagnostics for outputting variables related to the stochastic parameterization.

* Diagnostics in MOM_PressureForce_FV updated for stochastic (rather than deterministic) Stanley SGS T variance parameterization.

* Added parentheses for reproducibility.

* Changed diagnostics to account for possible absence of stoch_eos_pattern in MOM_PressureForce_FV,
when deterministic parameterization is on.

* remove mom6_da_hooks and geoKdTree from pkg

* add stochastic compoment to MOM_thickness_diffuse

* fix array size declaration and post_data

* Corrected indexing of loops in MOM_calc_varT

* Changed how parameterization of SGS T variance (deterministic and stochastic) is switched on in PGF and thickness diffusion codes

* Corrected a few typos

* Cleaned up indices, redundant diagnostic, printing

* Fixed diagnostic IDs

* Fixed diagnostics typo

* Corrected indices in calculation of tv%varT

* Minor index fix

* Corrected bug in pressure in Stanley diagnostics

* Fixed whitespace error

* Stoch eos clock (JCSDA-internal#5)

*Added a clock for the Stanley parameterization

Co-authored-by: jkenigson <[email protected]>

* add halo update to random pattern

* Update MOM_stoch_eos.F90

Fix bug for looping over compute domain (is -> isc etc.)

* Avoid unnessary computations on halo (MOM_stoch_eos) and code clean-up (MOM_thickness_diffuse)

* Removed halo updates before determ param calc

* Update MOM_stoch_eos.F90

Removed unnecessary code

* Bug - indices are transposed

* Changed Stanley stochastic coefficient from exp(X) to exp(aX) (JCSDA-internal#9)

* Changed Stanley stochastic coefficient from exp(X) to exp(aX)

* Extra spaces removed

* Stoch eos init fix (JCSDA-internal#10)

* Don't bother calculating tv%varT if stanley_coeff<0

* Missing then added

* Merge Ian Grooms Tvar Discretization (JCSDA-internal#11)

* Update MOM_stoch_eos.F90

In progress updating stencil for$ | dx \times \nabla T|^2$ calculation

* New discretization of |dx\circ\nablaT|^2

Co-authored-by: Ian Grooms <[email protected]>

* Multiplied tvar%SGS by grid cell thickness ratio

* Added limiter for tv%varT

* Stoch eos ncar linear disc (JCSDA-internal#12)

* Update MOM_stoch_eos.F90

In progress updating stencil for$ | dx \times \nabla T|^2$ calculation

* New discretization of |dx\circ\nablaT|^2

* AR1 timescale land mask

Adds land mask to the computation of the AR1 decorrelation time

* Update dt in call to MOM_stoch_eos_run

The call to `MOM_stoch_eos_run` (which time steps the noise) is from within `step_MOM_dynamics`. `step_MOM_dynamics` advances on time step `dt` (per line 957), but the noise is updated using `dt_thermo`. It seems more appropriate to update the noise using `dt`, since it gets called from within `step_MOM_dynamics`.

* Fixed the units for r_sm_H

* Remove vestigial declarations

The variables `hl`, `Tl`, `mn_T`, `mn_T2`, and `r_sm_H` are no longer used, so I removed their declarations and an OMP private clause

Co-authored-by: Ian Grooms <[email protected]>

* Update MOM_thickness_diffuse.F90

Changed index for soft convention

* Update CVMix-src

* Ensure use_varT, etc., initialized

* Don't register stanley diagnostics if scheme is off

* Stanley density second derivs at h pts (JCSDA-internal#15)

* Change discretization of Stanley correction (drho_dT_dT at h points)

* Limit Stanley noise, shrink limiting value

* Revert t variance discretization

* Reverted variable declarations

* Stanley scheme in mixed_layer_restrat, vert_fill in stoch_eos, code cleanup (JCSDA-internal#19)

* Test Stanley EOS param in mixed_layer_restrat

* Fix size of TS cov, S var in Stanley calculate_density calls

* Test move stanley scheme initialization

* Added missing openMP directives

* Revert Stanley tvar discretization (JCSDA-internal#18)

* Perform vertical filling in calculation of T variance

* Variable declaration syntax error, remove scaling from get_param

* Fix call to vert_fill_TS

* Code cleanup, whitespace cleanup

Co-authored-by: Jessica Kenigson <[email protected]>

* Use Stanley (2020) variance; scheme off at coast

* Comment clean-up

* Remove factor of 0.5 in Tvar

* Don't calculate Stanley diagnostics on halo

* Change start indices in stanley_density_1d

* Stanley param in MOM_isopycnal_slopes (JCSDA-internal#22)

Stanley param in MOM_isopycnal_slopes and thickness diffuse index fix

* Set eady flag to true if use_stored_slopes is true

* Cleanup, docs, whitespace

* Docs and whitespace

* Docs and whitespace

* Docs and whitespace

* Whitespace cleanup

* Whitespace cleanup

* Clean up whitespace

* Docs cleanup

* use_stanley

* Update MOM_lateral_mixing_coeffs.F90

* Adds link to another TEOS10 module

* Set Stanley off for testing

* Line continuation

Co-authored-by: Phil Pegion <[email protected]>
Co-authored-by: Philip Pegion <[email protected]>
Co-authored-by: Jessica Kenigson <[email protected]>
Co-authored-by: Jessica Kenigson <[email protected]>
Co-authored-by: jkenigson <[email protected]>
Co-authored-by: jskenigson <[email protected]>
Co-authored-by: Jessica Kenigson <[email protected]>
Co-authored-by: Jessica Kenigson <[email protected]>
Co-authored-by: Philip Pegion <[email protected]>
Co-authored-by: Jessica Kenigson <[email protected]>
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.