Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed some coding mistakes from the last commit. * Added new variable FrictWork_diss to account for the energy dissipated by shear production (excluding the energy diffusion term which can be positive). * Added a new flag to MOM_lateral_mixing_coeffs called "USE_VISBECK", which calculates the GM coefficient using the Visbeck et al. (1997) formulation. Previously this was being done whenever VarMix was enabled, but I wanted to separate VarMix from this diffusivity call. * Re-factor of Travis-CI usage - Uses stages to parallelize testing process - Adds a doxygen job that tests for doxygen errors - Reduces dependency on other repositories - No longer uses scripst from MOM6-examples/tools/tests/Travis-MOM6/ - Still uses configurations from MOM6-examples/ocean_only/ - Adds test building/using a debug executable - Adds a .testing/ directory - Uses the latest xenial image on Travis (with openmpi) Todo: - Add code coverage (needs more experiments) - Break dependence on MOM6-examples (long term project) - Add other portable tests (e.g. parameter scaling, rotation, etc) * Set ca13csed to zero at k>1 - Like the original cased tracer, the ca13csed tracer used in generic_BLING.F90 needs to be initialized to zero at all subsurface layers (when do_13c = .true.) * Fixed problems with FrictWorkMax and FrictWorkDiss in MOM_hor_visc.F. More specifically, I moved the calculation of dudx and dvdy outside of the Leith loop so now it is being calculated with sh_xx. * +Remove unneeded MOM6 coupler_types.F90 files With the xanadu release of FMS, the coupler_types module within FMS has finally been properly scoped without adding unnecssary dependencies. The coupler_types.F90 files in the MOM6 config_src/solo_driver directories are no longer needed. In addition, the routines inside coupler_util.F90 files have not been used anywhere in MOM6 for some time, their functionality being provided via interfaces inside the coupler_types_mod. These 5 files have now been removed. All answers are bitwise identical. * +Added missing US arguments to nuopc_cap code Added unit_scale_type arguments to several subroutines in the nuopc_driver directory, added a unit_scale_type element to the nuopc_driver versoin of ocean_state_type, and use this argument to appropriately rescale forces%ustar for dimensional consistency testing. These changes are required to go with the dev-master-candidate-2018-04-22 updates to MOM6. With these changes, the code in origin/dev-master-candidate-2018-04-22 compiles up through the nuopc_driver version of MOM_ocean_model.o. * Checksum support for Depth_list.nc This patch appends a checksum for the dependencies of the depth and area lists stored in the Depth_list.nc file, which are used to compute diagnostics based on APE. The data in Depth_list.nc depends on the grid fields, and may not be reproducible when such grids are constructed internally using compiled code within the executable. This issue was observed in the 'double_gyre' experiment when a PGI-compiled executable was tested using a Depth_list.nc file generated by a GNU-compiled executable. By appending a checksum for the grid fields used to compute Depth_list.nc, we can ensure that the data is consistent with the experiment grid data. Grid data which is read from external files, such as mosaic or topography fields, are unaffected by this issue. This patch improves the reproducibilty of standard diagnostics, such as total energy, but has no impact on the reproducibility of the internal model dynamics, which does not depend on Depth_list.nc. Checksums are computed for the G%bathyT and masked G%areaT grid fields using the FMS mpp_checksum subroutine, which require collective operations, and are stored as hex strings in global attributes of the netCDF file. Strings are used to remain consistent with FMS restart checksums, and to avoid an observed re-casting of 8-byte integers to 4-bytes by the netCDF library. Attribute names are based on the grid variable names. Two flags have been introduced to control this behavior: REQUIRE_DEPTH_LIST_CHECKSUMS (default: True) This flag will abort the run if the Depth_list.nc file is present and checksums are absent from the file. Although this could impose greater restrictions on existing runs, few runs are configured to save the depth list file (READ_DEPTH_LIST) and the default behavior is to reconstruct these lists on every run. UPDATE_DEPTH_LIST_CHECKSUMS (default: False) When REQUIRE_DEPTH_LIST_CHECKSUMS is set to false, this flag will automatically update the checksums of the Depth_list.nc file. While this can affect the reproducibility of APE diagnostics, it will ensure the reproducibility of such diagnostics in subsequent runs. * Further documentation of Depth_list.nc checksums Additional documentation of the parameters used to store Depth_list.nc attribute names was added. * Depth list documentation typo fix * make uppercase DEBUG lowercase * fix uninitialized oneOrTwo * Add CS%US argument lost during merge conflict * Masked depth; style conformance The depth checksum is now replaced with masked depth, mask2dT * bathyT, and the calculation of the depth list has also been updated to use the masked depth. Various style conformance changes, such as contraction of do and if terminations (enddo, endif) and reduction of whitespace in various multiline function call, has also been applied. Finally, the attribute name docstrings were updated for clarity. * Token bugfix * use ESMF operators * gitlab: specify MOM6-examples and script commits - There is no source code change in this commit. - The switch to the xanadu version of FMS and coupler moves source code between repositories, and therefore requires new build paths which are wired into the testing scripts. This commit checks out a specific version of the gitlab testing scripts along with a xanadu commit of MOM6-examples (which is on branch xanadu-fms). - Once the dev/gfdl branch of MOM6-examples has been rolled forward to xanadu we will return the commit used for gitlab testing to the HEAD of dev/gfdl. * Revert masking of depth Using the masked depth (mask2dT * bathyT) was observed to change energy values within floating point precision, so the changes have been reverted. This may be revised at a later time, when we are prepared to update the energy stats to the new values in the regression tests. The depth checksum attribute has also been renamed to reflect this change. This will allow us to re-define the variable as masked at some later date, and can distinguish between the masked and unmasked checksums during testing. * Bugfix: Checksum the unmasked depth * Added Jansen et al. (2015) version of MEKE dissipation. Added an alternative way of calculating PE-to_MEKE energy conversion. * Fixed if statement in MOM_MEKE.F90. Added option to use alternative form of GM PE-to_MEKE energy conversion in MOM_thickness_diffuse. * Added option to calculate MKE-to-MEKE energy conversion by GME. * Cleaned up MOM_hor_visc.F90 a bit, especially parts having to do with calculating FrictWork. * Added biharmonic option for MEKE viscosity. * Added a GME sink term to the MEKE budget. Cleaned up MOM_hor_visc.F90. * Commented out thickness diffusivity calls for GME, since it is not presently being used. * Add seaice_melt and seaice_melt_heat This commit adds two new fluxes to the nuopc cap. The MOM (coupler) definition of these terms is seaice_melt (meltw) and seaice_melt_heat (melth). Currently, the alias name for these terms in the fd.yaml file is mean_fresh_water_to_ocean_rate and net_heat_flx_to_ocn. We need to change these to more meningful names and this will require changes in CICE. * MEKE: Prevent div-by-zero by bathyT in beta calc The calculation of beta in the MEKE module had an explicit division by zero when computing the lateral topography derivatives, which were raising floating point exceptions in the debug builds. This occurs in the MEKE_equilibrium and MEKE_lengthScales functions. This issue was not observed in the production tests due to MEKE_TOPOGRAPHIC_BETA always being set to zero. When FPEs are disabled, the 0 * (1./0.) operation produces a NaN which is passed to a max() function, which ignores the NaN and always returns the other value. We resolve this by explicitly checking for zero values in bathyT and setting the topographic beta to zero when this term is zero. While this could potentially change the value of the Rhines scale, these values only occur over land, which are in general masked, and should not affect the calculation. The unoptimized expressions were retained, but recommended changes which reduce the number of divisions were included in comments. No value changes were observed in our test suite, and the patch should be bitwise reproducible. Minor changes: - We do not calculate the topographic beta term if the scaling factor, MEKE_TOPOGRAPHIC_BETA is zero - the default value of beta was unset in MEKE_lengthScales was unset when CS%use_old_lscale is True, so we set this to zero. - Minor whitespace and index syntax changes * Add FMS/coupler_types.F90 to build Travis-CI build path * Add missing US entries and fix typos introduced during merge * Use xanadu-fms version of MRS in gitlab pipeline * get calendar from CESM * Revert "Added biharmonic option for MEKE viscosity." This reverts commit 6b32174. Conflicts: src/parameterizations/lateral/MOM_MEKE.F90 src/parameterizations/lateral/MOM_hor_visc.F90 * Willy was silly. * Working configuration of MEKE/GME. Has biharmonic MEKE viscosity and a GME sink term. * Added a "next-to_boundary" mask that should help with fixing abnormally large values of the velocity gradient tensor magnitude next to land. * MOM_set_diffusivity: OMEGA scaling Implementation of OMEGA parameter rescaling (s-1 -> T-1) in the MOM_set_diffusivity module. * MOM_set_diffusivity: Rescaling of Omega2, G_Rho0 * MOM_set_diffusivity: N, dissipation scaling This commit rescales the internal buoyancy frequencies (N2) and associated parameters in the MOM_set_diffusivity module. Coefficients used in computation of dissipation have also been scaled relative to W m-3, e.g. W m-3 s2 is rescaled to W m-3 T2. Scaled parameters: * DISSIPATION_N1 (partial): W m-3 T * DISSIPATION_N2 (partial): W m-3 T2 * DISSIPATION_KD_MIN: Z2 T-1 * dissip_N2 dimension update * (*)Revised propagate_int_tide code for symmetry Revised propagate_int_tide code for symmetry, and removed the old and unused debugging code setting an internal tide point source. These could change answers at the level of roundoff and MOM_parameter_doc files in cases that have INTERNAL_TIDES=True, but all answers are bitwise identical in the MOM6-examples test cases. * +(*)Revised the diagnostic subML_N2 Revised the calculation of the diagnostic subML_N2 inside of diagnoseMLDbyDensityDifference, and added as an optional argument the depth extent over which this stratification was calculated. The previous code used inconsistent pressures in calculating the densities and was simply wrong. This changes a diagnostic (subML_N2) and adds a new optional interface. All solutions are bitwise identical but there are new entries in MOM_parameter_doc files. * +Added MIN_SALINITY as a new runtime parameter. Added the new runtime parameter MIN_SALINITY, with a default value that duplicates the current hard-coded value. Also stored this value in a new element in the thermo_vars type, and corrected a few spelling errors. By default all answers are bitwise identical but there are new entries in the MOM_parameter_doc.all files. * +Corrected documentation of HALF_STRAT_DEPTH Corrected documentation of HALF_STRAT_DEPTH written to MOM_parameter_doc files by Phillips_initialize_thickness. All answers are bitwise identical, but MOM_parameter_doc files change. * +Corrected spelling errors in documentation Corrected numerous spelling errors in comments, including the descriptions that are written to the MOM_parameter_doc files. All answers are bitwise identical, but there are numerous minor changes to the MOM_parameter_doc files. * MOM_set_diffusivity: dissip scaling Dissipation parameters are now fully rescaled with respect to time: * DISSIPATION_MIN * DISSIPATION_N[012] as are internal dissipation variables. * MOM_set_diffusivity scaling: N2, Kd_work diags Dimensional scaling support for the N2 and Kd_work diagnostics in the MOM_set_diffusivity module, as wel as a hN2pO2 internal variable. * MOM_set_diffusivity: TKE_to_Kd time rescaling * MOM_set_diffusivity: scaling of ML radiation terms Time rescaling of internal variables for add_MLrad_diffusivity, including the following parameter: * ML_RAD_KD_MAX * MOM_set_diffusivity: maxTKE time scaling The calculation of maxTKE is rescaled inside set_diffusivity, along with various other internal variables. add_drag_diffusivity not yet scaled. * MOM_set_diffusivity: more TKE time scaling * MOM_set_diffusivity time scaling: more params The following parameters have been time scaled: * Kd_min * Kd_max The following physical constants have been scaled: * kpp_fill * dt_fill Internal variables: * delta_kd Some units in comments have also been fixed * +Added newlines in long parameter descriptions Added newlines in long parameter descriptions in 6 modules. All answers are bitwise identical, but there are changes in comments in the MOM_parameter_doc files. * +Revised writeMessageAndDesc to split long lines Revised writeMessageAndDesc to split comment lines that are longer than 112 characters long (usually this is a 32 character indent, with an 80 character description block), including aligned indents of continuing lines in indented lists. This will change some MOM_parameter doc files with very long lines, and it will eliminate the need for explicit newlines in get_param, log_param, and log_version calls, although they still work as before in shorter lines. All answers are bitwise identical, but a line or two in some MOM_parameter_doc files and some SIS_parameter_doc files change. * * Bugfix: Double diffusive correction to Kd The double-diffusive salinity correction to diffusivity was incorrectly using an exponent in its term: Kd_lay(i,j,k-1) = Kd_lay(i,j,k-1) + 0.5**KS_extra(i,K) The exponent has been replaced with a multiplication. * Add FMS/coupler_types.F90 to build Travis-CI build path * Use xanadu-fms version of MRS in gitlab pipeline * MOM_set_diffusivity LOTW time scaling Mostly rescaling of internal variables for LOTW diffusivity. * Set default of USE_NET_FW_ADJUSTMENT_SIGN_BUG to false in NUOPC cap * MOM_set_diffusivity time scaling: DD, bg diff, zint The double diffusive calculations were time-scaled, as well as the diagnostics. Background diffusivities and viscosities were also time-scaled, although a few could not be tested due to lack of experiments depending on the output. Two unused double-diffusive parameters were re-enabled and integrated into the source, replacing fixed dimensional constants: * MAX_SALT_DIFF_SALT_FINGERS * KV_MOLECULAR The legacy "zint" diagnostic scaling was implemented, but it is untested since few experiments still use these tests. * MOM_set_diffusivity time scaling: subroutines Some de-scaling of variables passed to other subroutines has been shifted out of MOM_set_diffusivity.F90 and into the subroutine source files. * MOM_set_diffusivity time scaling: Kd_lay * MOM_set_diffusivity time scaling: Kd_int * MOM_set_diffusivity time scaling: Kd_BBl + diag * Time scaling: entrainment_diffusive kd_(lay|int) Array operations for rescaling kd_lay and kd_int in the Entrainment_diffusive call were replaced with internal rescaling of the variables. * MOM_tidal mixing time scaling: input arguments Rescaling of input arguments which pass through to MOM_set_diffusivity. Calls to CVMix cannot be re-scaled, in particular the N2_int vector, so we pre-scale this into a temporary variable before passing to CVMix. Note that the CVMix scaling is untested, since we currently do not have any CVMix tidal tests. * MOM_set_diffusivity scaling: use kd scaling factor * Switching from moab to slurm queue scheduler * skip first tstep and double second tstep * apply ocean lag to cesm runs only * User diffusivity time rescaling * MOM_set_diffusivity comment/whitespace updates * Avoid division by zero when Ah_time_scale=0 - New viscosity option had potential division by zero - No answer changes * Add control of MEKE viscosity scaling to recover old answers - Commit db98e9e rearranged the order of limiting and resolution scaling in order to have the MEKE contribution to viscosity be scaled by the resolution functon. This changed answers in many configurations even those not using MEKE. - This adds a flag that defaults to the non-answer changing mode of not resolution scaling the MEKE contribution but does recover the desired result when set to Tree. * fix ocean lag logic for restart runs * Corrected indentation to fit code style guide - As pointed out by @Hallberg-NOAA, some indentations were off. (flint is coming) * (*) MOM_mixed_layer_restrat [uv]Dml_diag index fix This patch resolves a few issues related to the uDml_diag and vDml diagnostics in the MOM_mixed_layer_restrat module. In both cases, the index loops were not including the starting values (is-1 for uDml and js-1 for vDml). In `mixedlayer_restrat_BML`, uDml_diag(is-1,:) was never assigned a value, since only the uDml(is:ie,:) values were copied to uDml_diag. This produced volatile answers along these records. There were no known issues with vDml, since is:ie spans the vector, but we have nonetheless moved the vector copy inside of the loop. We have introduced the following changes: * [uv]Dml_diag is now evaluated in the loop, rather than relying on a vector copy, since there are no dependencies within the loop. * [uv]timescale_diag are no longer initialised within the outer loop, since their values are explicitly set. * The I and J loops are now fully nested (with whitespace changes) In `mixedlayer_restrat_general`, we now include the edge cases uDml(is-1,:) and vDml(:,js-1) in surface velocity estimates. In both functions, some half-index notation (ij->IJ) was corrected within the loops. The following diagnostics may change value: * udml_restrat * vdml_restrat * uml_restrat * vml_restrat * Rescaled 20 TKE-related variables Applied unit rescaling for dimensional consistency analysis to about 20 TKE-related variables on MOM_set_diffusivity and MOM_tidal_mixing. All answers are bitwise identical and these revised expressions pass the dimensional consistency tests for vertical height and time units. * Kd_interface diag unit fix Time scaling of Kd_interface diagnostic in the MOM diabatic driver was fixed to include its time scaling. A couple diffusive unit scalings were also replaced with diffusion macro. * MOM_vert_friction tau[xy]_bot unit fix Bottom friction forces tau[xy]_bot are computed as Rho0 * u * a_u, and in this case a_u has been scaled to units of Z s-1, rather than m s-1, so the tau[xy]_bot diagnostic must be rescaled by Z_to_m. * +Removed hard newlines in get_param calls Removed hard newlines from numerous get_param and log_param descriptions throughout the MOM6 codebase, relying instead on the new automatic newline capability in writeMessageAndDesc. In the case of formatted lists of options, the hard newlines were retained. This cleans up the code and gives more standard messages and smaller parameter_doc files, but it changes the comments in every MOM_parameter_doc and SIS_parameter_doc file. All answers are bitwise identical. * + Excise of legacy z-interpolated diagnostics This patch removes the older method for computing diagnostics onto z-levels (depth space), associated with modules ending in `_zold`. These diagnostics are being removed for two reasons: 1. The tests are now integrated into the diagnostic mediator, and are now redundant. 2. The diagnostics did not consistently handle masked values correctly, which was causing issues with checksum calculations. This patch also removes the diag_to_Z_CS control structure and its reference in some functions, causing an API change. The parameter MIN_Z_DIAG_INTERVAL has also been made obsolete, since it was used to control the output of some depth-space diagnostics. Two subroutines in MOM_diag_to_Z.F90 (to be removed) were used in MOM_tracer_flow_control.F90: * find_overlap * find_limited_slope so they have been moved to this file. We also note that there are nearly identical subroutines in midas_vertmap.F90, which could be merged at some point. This patch will break existing tests, since many use MIN_Z_DIAG_INTERVAL and several `_zold` diagnostics, and will need to be modified before this can be merged. * Z_OUTPUT_GRID_FILE parameter obsolescence * Updating the MOM_CVMix_KPP code - Remove explicit dependence on optional WAVES control structure to use Langmuir parameterization - The Langmuir term can be used w/ forms of Langmuir number that shouldn't require the WAVE module to be present. * Changes to MOM_wave_interface - Changes to facilitate running MOM6 with Langmuir turbulence but without WAVES control structure. - Changes to DHH85 spectra calculation to improve comparison w/ LF17 and GOTM simulations. * Adding ePBL tuning relationships needed to use versions from RH18/RL19 to MOM6 * Undo changing default La_depth_ratio from 0.04 to 0.2 * Moving new ePBL feature Kd_enhance entirely inside of if-block * Clean-up of previous commit * Setting ePBL enhance_K variables to parameters - The values are hard-coded into variable declaration statements and therefore are meant to be declared as parameters. * Fixing bug to WaveMethod inserted in WaveInterface by previous commit. * Renaming Elizabeth tracer and sponge to RGC * Adding changes to RGC * +(*) u,v tendendy diagnostic fix Recent testing showed a difference in the time derivative diagnostics dudt, dvdt, dhdt for symmetric and non-symmetric grids. The issue appears to be be due to assumed 1-indexing within the `register_time_deriv` functions of MOM_diagnostics, due to use of pointers without explicit start index. This was causing an error in `calculate_derivs`, which assume standard grid indexing. There was no error in non-symmetric mode, which assumes 1-indexing (when global indexing is disabled, as default), but was creating off-by-one errors in symmetric mode for the u and v time derivaties, which typically start at 0 for the x and y axes, respectively. The dhdt diagnostic was unaffected, since h-points always use 1-indexing. This also affected the dKE/dt diagnostic, since they used dudt and dvdt. We resolve this by introducing a lower bound input argument to `register_time_deriv` and use this to define the start index for the various p3d pointers. This is a minor API change which only affects the dudt, dvdt, and dhdt diagnostics, and may change the dudt and dvdt symmetric grid diagnostics. * (*) speed diagnostic fix on nonsymmetric grids The speed diagnostic currently requires an interpolation of u and v onto the h-points. On non-symmetric grids, this was causing an error on the west and south boundaries, since the compute loops in `extract_surface_state` did not update the boundaries, which are used in the speed calculation. We resolve this by extending the loops from G%IscB, which only includes the boundary on symmetric grids, to isc-1, which always include the boundaries. This assumes a nonzero halo, and that the halos of u and v have been updated. * Added GEOMETRIC as an option for MEKE. Also added biharmonic MEKE viscosity and the option to use a non-MEKE thickness diffusivity to diffuse MEKE. Split MEKE viscosity options into parts concerning Ku and Au. * Ensures that MEKE%Kh_diff is only used when USE_KH_IN_MEKE = True * Fixes doxygen syntax * Fixes additional doxygen syntax * Removes trailing space * Fixes unregistered diagnostic id * Edited RGC_tracer.F90 * dKEdt diagnostic nonsymmetric bugfix This patch fixes a minor error in the d(KE)/dt diagnostic, specifically any values on the western and southern boundaries (per PE domain). d(KE)/dt depends on the dudt and dvdt diagnostics. However, the western and southern boundaries of these two diagnostics were not updated inside `calculate_derivs`, which caused an error on the western and southern boundaries of d(KE)/dt since it requires an interpolation of dudt and dvdt onto h-points. This was not an issue in symmetric grids, since the west/south values would have been included in the update, but were not updated in non-symmetric mode. We resolve this by extending the loops to update an additional grid point to the west/south. This slightly increases the computation, and assumes an updated halo, but this change has restored consistency of d(KE)/dt in symmetric and nonsymmetric mode. * Changes logic of an if statement in calc_slope_functions to avoid change in answers * Deletes code related to GME_Varmix * Updating RGC codes * Changes in MEKE * Adds missing drag term to second part of split timestep. * Removes limiter preventing MEKE from going negative. * Reverts back to original method of initial, equilibrium solution. * Changes the way of counting the work * (*) Vertical diagnostic remap symmetric bugfix This patch fixes an error in the vertial diagnostic remapping on symmetric grids. The following functions associated with vertical remapping assume grid-based indexing, but receive arrays with 1-based indexing: * diag_remap_do_remap * vertically_reintegrate_diag_field * vertically_interpolate_diag_field Since the calculations typically include a mix of grid-based and 1-based indexing, we retain the grid index loops but introduce 1-based indices, i1 and j1, when addressing these arrays. Note that while the symmetric grid u- and v-points are now defined relative to the global grid (G%isg, G%jsg), we still assume that the h-points are locally 1-based. This is currently true in MOM6 but may require modification if we move to global grid indexing. We have included a very verbose explanation for the gridding issue, in case it ever gets addressed in the future. Symmetric grid results now match non-symmetric grid results, and non-symmetric grid results are unchanged. Model state and dynamics are unaffected by this change and should be bitwise reproducible. * Vertical remap index syntax adjustment Indices on u and v points were capitalised, as is convention. * Reverts biharmonic constants to the origial definition * Remove trailing space * Updating sponge and tracer * Correcting code comments * Fixing formatting * (*) Bugfix: reproducing_sum, bin equals prec In reproducing_sum, if a bin inside int_sum is exactly equal to prec (currently 2**46 to some integer power) then this value will not be transferred up to the next bin, due to the > check rather than a >= check. See code block below: 562 do i=ni,2,-1 ; if (abs(int_sum(i)) > prec) then 563 num_carry = int(int_sum(i) * I_prec) 564 int_sum(i) = int_sum(i) - num_carry*prec 565 int_sum(i-1) = int_sum(i-1) + num_carry 566 endif ; enddo This can cause inconsistency in reproducibility across CPUs, particularly on 1 rank, since the construction of int_sum will not produce filled bins of size prec. We fix this by replacing the > check with a >=, so that both overfilled and exactly full values in a bin are also transferred up to the next bin. We specifically fix this in regularize_ints, but also in carry_overflow for the sake of consistency. This was observed in the mean calculations of a few sparse diagnostics at isolated timesteps for certain CPU layouts, and caused variation in the least significant bit (LSB). When the patch was applied, results were consistent with the 1-rank result. It seems like a phenomenal coincidence that a bin value managed to exactly equal prec, which may indicate a further systematic error somewhere, but that can be treated as a separate issue. While this change has the potential to modify answers, since we are modifying the results of `reproducing_sum`, no changes were observed in the regression tests. * (*) Z-remap interface mask{Cu,Cv,B}i bugfix Z-interpolated diagnostics on interfaces were failing to produce consistent answers when CPU layout was changed. This was tracked down to an error in the eastern boundaries of their mask fields. These mask fields are constructed from the T-point mask, maskTi, whose halo values were not being constructed. By extending the loops from [ij]sc..[ij]ec to [ij]sc-1 .. [ij]ec+1, we restored the masks and could reproduce the values. This will affect the following diagnostics when z-remapped: * neutral_slope_[xy] * KHTH_[uv] and potentially any other diagnostics on the `axesCui` axis. * (*) Remapped d[uv]dt_dia, [uv]hml diagnostic fixes The remapped diagnostics d[uv]dt_dia, and uhml were reporting different results for different CPU layouts. This was due to a dependence on the east and north halo values of the h and remap_cs%h thicknesses, which were not being updated for these variables. The remap_cs%h thickness directly depends on h, and will properly fill in its halo values, but is only updated when a `diag_update_remap_grids` function is called. If h has missing halo values prior to this call, then remap_cs%h will also be missing. In most of the code, h has been properly updated, and remap_cs%h only needs an update when h changes, which is restricted to a few functions. This appears to not be an issue for most diagnostics, with the ones above being an exception. We resolve this by applying a halo update to h prior to any `diag_update_remap_grids` calls which are needed before the diagnostic `post_data` call. We only apply this halo update if the diagnostic has been registered. Ideally we would only apply the halo update when the remapped halo has been registered, but it is currently not possible to query this information, and ought to be done in a future release. It is likely that there are more diagnostics with this issue, so consider this a first step. * (*) Horizontal remapping re-enabled, bugfixes This patch re-enabled the `post_xy_average` calls in `post_data_3d_low`, which are used to generate and write the horizontally averaged diagnostics. We have also fixed a number of issues in the existing methods, and we have changed how masked values are handled. The first major change is that average of a field is now computed on the native grid points, rather than interpolation onto h-points. This is due to a dependence on halo values of `h` which would be potentially undefined in symmetric grids. In most cases the calculation will be mathematically equivalent, although there will be bitwise differences. Non-periodic boundaries may also yield different edge values which will modify the average. The second major change is the introduction of a reproducible sum for the calculation of the total volume and field at each vertical level, which will introduce bitwise changes but is now reproducible across layouts. The final change is the removal of explicit `missing_value` checks, which have been replaced with a new column mask. Masked values are now explicitly set to zero. This simplifies the calculation of any averages or checksums, and is also consistent with the overall removal of explicit missing_value usage in MOM. These changes have removed depenendies on unassigned values in symmetric grids, and produce results which are now reproducible across layouts and for symmetric and nonsymmetric grids. Diagnostic values are expected to change, but the model state should be bitwise reproducible. * Commenting salt_flux adjustment in net_FW * Adds MEKE_VISCOSITY_COEFF_AU and MEKE_VISCOSITY_COEFF_KU into the MEKE documentation * Obsolete parameter MEKE_VISCOSITY_COEFF * Add MEKE_GEOMETRIC_EPSILON Delete hard-coded epsilon and added a new user parameter to specify this constant. * move OMP calls below GME and above the K-loop * Fix hint syntax in MOM_obsolete_param * Commenting out salt_flux adjustment in net_FW in NUOPC cap * changes needed for mom6 validation * (+) Enable checksums for all diagnostics This patch consists of three major changes. 1. We have modified the `DIAG_AS_CHKSUM` feature as a "checksum" mode, where all diagnostics registered via these functions: * `register_diag_field` * `register_static_field` * `register_scalar_field` are caught before they are formally registered with FMS. We make two changes: a. We do not formally register the diagnostic with FMS, and instead assign them dummy FMS ids, used to enable checksums. b. We enable all diagnostics, regardless of the contents of `diag_table` Whenever data is formally written to FMS via `post_data`, we instead calculate the checksum data for the fields via the `MOM_checksum` functions and log the output to the `chksum_diag` file. 2. To more fully support these checksums, we have made several changes to the checksum module. a. We have introduced two new checksum functions, `chksum0` for scalars and `zchksum` for 1-d arrays (typically vertical columns) b. Checksum functions now support an optional IO unit, which defaults to stderr (now formally defined via `iso_fortran_env`). c. `subStats` functions now return their mean, min, and max values, rather than logging the results directly. 3. The `chksum_general` interface and its functions were removed from `MOM_checksums`, and we use the existing gridded checksums (hcksum, etc.) Due to removal of the `chksum_general` functions and addition of IO unit inputs to the other functions, this patch is an API change to MOM. But existing checksum functions should be unaffected. * Do not attach cell methods in diag chksum mode The diag mediator register functions were using the `attach_cell_method` and `diag_field_add_attribute` functions to attach attributes to the FMS diagnostics. This required referencing of internal FMS field tables, which are not created when DIAG_AS_CHKSUM is enabled. While this did not raise any errors in the Baltic tests (for unclear reasons), this was causing issues in nearly every other test, predominantly when not in debug mode. We now only conditionally call these functions when `diag_as_chksum` is disabled. * Set default AH_VEL_SCALE back to zero * Repro sum increment_ints_faster overflow check While reproducing_sum was able to detect an overflow for values exceeding its maximum allow value, `prec**N_max * (2**63 - 1)`, this check occurs after the first bin decomposition, which requires an integer conversion, `int(r * (1./prec_max), 8)`. When floating point exceptions (FPE) were disabled, this would often produce a large negative integer, and the overflow would have been caught later and handled as prescribed by the user. But when FPEs are enabled, there is a fatal error and the model aborts. (NOTE: The FPE handler in GCC tags this as "invalid", rather than "overflow") This patch adds a check inside `increment_ints_faster`, so that the `int()` operation is avoided in the case of overflow. * Remove thickness_diffuse_CS from horizontal_viscosity * Issue FATAL error if SPLIT=False and USE_GME=True * Removes Barotropic and thickness_diffuse from MOM_dynamics_unsplit* * Changes Barotropic to BT in horizontal_viscosity * Passes optional arg. (BT=CS%barotropic_CSp) in calls to horizontal_viscosity * Flux allocation check in diagnostics Currently the model will attempt to compute any enabled surface flux diagnosics, even if the model has not been configured to support this flux. This would raise memory access errors if the flux had not been allocated. We now conditionally check if a particular surface flux has been allocated before adding it to any cumulative flux diagnostic. In the future, we should probably implement some framework around all this and associate the diagnostic with the creation of the flux. * Disable diabatic KE flux for adiabatic runs This patch disables the `KE_dia` diagnostic if the flow has been configured for adiabatic flow. * Conditional thermodynamic diags; Flux diag bugfix Several thermodynamic diabatic diagnostics in the legacy_diabatic update could be registered and computed when the thermodynamics was disabled, so these are now only conditionally checked and registered when `ENABLE_THERMODYNAMICS` is true. We also fixed a bug in the flux diagnostic registration by splitting the logical association and memory access into two separate stages, since it was raising errors in builds with stricter memory access. * Removes trailing space * Conditionally enable MEKE Kh diagnostics It is possible to enable the KhMEKE_u and KhMEKE_v diagnostics when their values have not been updated, which will either write nonsense values or raise errors/exceptions if checksums are enabled. This patch introduces a general flag to check if lateral (non-biharmonic) MEKE fluxes have been turned on, and only registers the KhMEKE_[uv] variables if they are present. * fixes to get taux and tauy roundoff between mct and nuopc * Fix for static compiles - Arrays CS%Laplac3_const_u, CS%Laplac3_const_v, CS%KH_u_QG, CS%KH_v_QG are declared use the ALLOCABLE_ macro and so must be allocated with the ALLOC_ macro. Otherwise in static mode we are allocating a non-allocatable array. * Correct declaration of h in calc_QG_Leith_viscosity() - The shape of dummy argument h was wrong. This would only change answers in non-symmetric mode so we lucked out! * Split long comments in RGC_tracer.F90 RGC_tracer.F90 previously had some very long comments at the end of some lines. These have now been split onto multiple lines to respect the MOM6 standards for line-length. All answers are bitwise identical. * Split excessively long lines in 2 files Split excessively long lines and corrected the syntax for unit documentation in MOM_lateral_mixing_coeffs.F90 and MOM_thickness_diffuse.F90. All answers are bitwise identical. * (*)Multiply fmax by US%s_to_T in MOM_hor_visc.F90 Added a dimensional scaling factor for fmax in MOM_hor_visc.F90 that was dropped at some point in the merging of the dev/ncar code into dev/gfdl. All answers are bitwise identical and now pass the dimensional scaling test. * Travis tests for lines exceeding 120 characters Added the 120 character line limit into the travis testing script. * removed trailing whitespace * Deletes comments * changes to the interfaces to bring them more in line with dev/ncar latest * more updates to have caps consistent with dev/ncar * changes to get MOM_ocean_model.F90 closer to nuopc_driver * removed trailing whitespace * changes to have minimal differences between nuopc and mct * more changes to have minimal differences between nuopc and mct * Rename modules in MCT * Rename modules in NUOPC * Rename modules for MCT * Rename modules for NUOPC * Capitalize MOM inside MCT modules * Deletes contribution from kv%slow when computing a_cpl * Make sure that MEKE%GME_snk is only used when the array is allocated * Deletes all code related to Jansen15_drag * Change default way to computing FrictWork in MEKE In the calculation of MEKE%mom_src, made the old method (using FrictWork) the default and made the new calculation of FrictWork only available when using GME.
- Loading branch information