Add Generic Tracer Sponges#17
Closed
theresa-cordero wants to merge 84 commits into
Closed
Conversation
Add a routine that will initialize the pointers for ALE sponges to be used with any of the generic tracers. The data for the nuding is set by the user with a number of new parameters.
Collaborator
Author
|
@nikizadehgfdl I would appreciate if you could take a look at this if you have time. |
Collaborator
Author
|
yes, I am looking forward to adding @gabyneg 's results here! |
|
Hi @theresa-morrison, when you have a moment, would you mind updating the feature branch to reflect some of the recent code changes (specifically the generic tracer interface update)? This will allow a few users to continue testing the BGC boundary nudging option. Thanks. |
Moved the publicly visible routine array_global_min_max to MOM_spatial_means from MOM_generic_tracer, along with the private supporting function ijk_loc, without any changes to the code itself. This was done because this routine now gives useful debugging information that can be useful outside of the generic tracer module. All answers are bitwise identical, but the module use statements for array_global_min_max will need to be updated.
Added the new runtime parameters WRITE_TRACER_MIN_MAX and WRITE_TRACER_MIN_MAX_LOC to the MOM_sum_output module to control whether the maximum and minimum values of temperature, salinity and some tracers are periodically written to stdout, perhaps with their locations, as determined by array_global_min_max. These can be expensive global reductions, so by default these are set to false. All solutions are bitwise identical, but there can be some changes to the output to stdout and there will be new entries in the MOM_parameter_doc.debugging files.
- Without this, one can see the tile boundaries in the uhml and vhml fields.
Optionally correct a bug due to a missing halo exchange. This likely isn't needed when compiled for nonsymmetric memory, but the added halo exchange does no harm in such cases. The pass_vector call could probably be replaced with fill_symmetric_edges, except there is no subroutine fill_vector_symmetric_edges_3d. USE_CONT_THICKNESS is not yet widely used, so rather than preserving the old (incorrect) solutions by default, this bug is corrected by default. However, the previous answers can be recovered by setting the new runtime parameter USE_CONT_THICKNESS_BUG to true. This parameter is only used (and logged) when USE_CONT_THICKNESS set to true. By default, this commit does change answers in symmetric memory cases with USE_CONT_THICKNESS = True, and there is a new runtime parameter in such cases.
* Directional linear wave drag This commit allows the linear wave drag to be applied to the u and v components of the barotropic velocity separately.
* Calculate a photoacclimation MLD in MOM6 Using the diagnose MLD routines calculate a MLD that can be used in COBALTv3. * Update interfaces for diagnoseMLD Some previously optional arguments were made nonoptinal in the final version merged into dev/gfdl. So these areguents have been added to the call in MOM_generic_tracers. * Add unset variable in diagnoseMLDbyenergy * Remove timescale variable This parameter seems unneeded at this time. * Change paramter name and though up PR Change "MLD_PHA_FIXED" to "MLD_PHA_CALC" which is default false. Touch up a few formatting issues. Add initialization and comment for mld_pha. * Add fatal errors Add fatal errors if PHA_MLD_CALC is true, but a method is not specified. * Add additional argument to generic tracer stub Add the photo_acc_mld argument to the generic tracer stub in MOM6. --------- Co-authored-by: Theresa Morrison <Theresa.Morrison@gaea57.ncrc.gov> Co-authored-by: Theresa Morrison <Theresa.Morrison@gaea56.ncrc.gov>
* Apply changes for BGC budgets # Conflicts: # src/tracer/MOM_generic_tracer.F90 # src/tracer/MOM_tracer_registry.F90 * Updated budget code from Fan * Enable built in diagnostics * Cleanup * Cleanup * Add boundary_forcing_tend to stub g_tracer_type * Clean trailing whitespace * Remove redundant zeroing of boundary_forcing_tend * Add an attribution * Clarify which diagnostics are for concentration * Fix units for _diffusion_xy
This patch makes some changes to makedep output: * Compile commands now end with the source code, rather than the include files. This makes it easier to see which file is being compiled. * Blank lines were added inbetween object file rules. * Redundant spaces from absent include flags is now removed. Also some minor PEP8-like cleanups: * Some (but not all) 79+ character lines were reduced or split. * Some (but not all) single-letter variables were renamed. * A bad error handler for missing macros was fixed. Nothing particularly major here, but build output should be more readable.
Added parentheses to expressions taking the squares of the wind stress components in 70 lines in 7 files so that these expressions will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to 9 expressions like `curv_3 = h_W(i) + h_E(i) - 2.0*h(i)` in PPM_limit_pos, zonal_flux_layer, zonal_flux_thickness, merid_flux_layer and merid_flux_thickness, changing them to `curv_3 = (h_W(i) + h_E(i)) - 2.0*h(i)`. This change enforces the order of arithmetic that is required to give rotational symmetry, but it also is the order that the Intel, GNU, and Nvidia compliers were all already using in these expressions. Moreover, had the order of arithmetic ever been anything else, this would have led to failures in our rotational consistency and redundant point consistency testing, and almost certainly would have been detected before. However, by adding these parentheses, there is a remote chance that the addition of these parentheses could change answers for some compiler or compiler settings we have never tested before. This change should not impact any FMA-enabled calculations. All answers are bitwise identical in the MOM6-examples regression suite as run on Gaea.
Added parentheses to 16 expressions setting the grad_gradient arrays with oblique_grad open boundary conditions and setting cff_new with all kinds of oblique boundary conditions so that they will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers with certain types of open boundary conditions could change with FMAs.
Added parentheses to 150 lines in the 5 generic density integral routines (int_density_dz_generic_pcm, int_density_dz_generic_plm, int_density_dz_generic_ppm, int_spec_vol_dp_generic_pcm and int_spec_vol_dp_generic_plm) in the MOM_density_integrals module so that they will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to 140 lines in 8 int_density_dz and int_spec_vol_dp routines for the linear, Wright, Wright_full and Wright_red equations of state so that they will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Removed recently added parentheses around expressions like '+ (hL*hR)' in 110 lines in MOM_density_integrals and 4 equation of state module to reflect that these parentheses are not necessary for rotational symmetry in FMAs. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to 4 lines in PressureForce_Mont_nonBouss and PressureForce_Mont_Bouss so that they will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs in cases that use the Montgomery potential form of the pressure gradient accelerations.
Added parentheses to 4 lines in calc_isoneutral_slopes so that they will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to 2 lines in MOM_calc_varT so that they will be rotationally invariant when fused-multiply-adds are enabled. In this case, FMAs can still be applied to the impacted lines, exploiting that the masks are always 0 or 1. Also added parentheses to 2 other lines used to generate the stochastic pattern for rotational symmetry with FMAs. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to the calculation of the diffusive temperature changes in tracer_hordiff so that it will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs.
Added parentheses to the calculation of the iceberg contribution to the fractional area of ice shelves in iceberg_forces so that it will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical in cases without FMAs, but answers could change with FMAs enabled in cases with tabular icebergs.
Added parentheses to the calculation of the Stokes-drift Coriolis velocity increments in CoriolisStokes so that it will be rotationally invariant when fused-multiply-adds are enabled. All answers are bitwise identical because CoriolisStokes is still under development and is never called, with a fatal error occurring if anyone tries to use it. Also added parentheses to two expressions calculating the magnitude of the Stokes velocity in get_Langmuir_Number. Answers could change for some cases that use Langmuir turbulence parameterizations with FMAs enabled.
Added the new element Coriolis2Bu to the ocean_grid_type and the dyn_horgrid_type to hold the square of the Coriolis parameter, and use this array in 10 routines (including btstep, set_dtbt, calculate_diagnostic_fields, VarMix_init, propagate_int_tide, Calculate_kappa_shear, Calc_kappa_shear_vertex and add_MLrad_diffusivity) that had been calculating and averaging the square of the Coriolis parameter. This could change some answers with FMAs enabled because the compilers were previously free to split up some of the squares when averaging the squared Coriolis parameter, but without FMAs all answers are bitwise identical. This commit does add a new element to two transparent types.
This is a minor patch which allows the code to be compiled under F2023 standardization. * Arguments are declared in the order that they are used. In this case, it means that array lengths are declared before the arrays using them. * The syntax of various IO statements has been cleaned up.
Some functions in the FMS cap used arguments which depended on other arguments, which were declared out of order. * ocean_model_data2D_get * ocean_model_get_UV_surf This patch moves the array index size definitions before the array definitions. This is required for language standard compliance.
This patch enables Fortran 2018 standard compliance testing. We could do 2023, but our current CI of choice doesn't yet have a compiler which can do this. The actual content of this PR is a decoupling of FCFLAGS_DEBUG and FCFLAGS_FMS. There is now a default FCFLAGS macro which is used by the other two macros. One can now optionally configure FCFLAGS_DEBUG without worrying about the impact on FCFLAGS_FMS. The motivation here is that we don't want to test for F2018/2023 compliance in FMS.
Temporarily cut off the control of VISC_REM_CONT_HVEL_FIX from VISC_REM_BUG and change the default of VISC_REM_CONT_HVEL_FIX to False.
…l ice-sheet velocities (NOAA-GFDL#714) * Updated with dev/gfdl. Then, added parameters for min ice thickness, min basal traction, max surf slope, and min ice viscosity to use for ice dynamics * noted how the MIN_BASAL_TRACTION parameter input is in units [Pa m-1 yr], but converts automatically to [Pa m-1 s] in the code * Added separate scalar ice-shelf diagnostics for Antarctica and Greenland * Added sx_shelf and sy_shelf as ice shelf diagnostics to save the surface slope fields used in the shallow shelf approximation (SSA). This is particularly helpful for determining whether unrealistic velocities are caused by unrealistically steep surface slopes, which can sometimes arise for example, on coarse grid cells that cover both a steep mountainous region and a realively flat ice shelf. Then, the MAX_SURFACE_SLOPE parameter can be tuned to set an upper bound on the SSA surface slope to avoid these steep-slope-induced problematic velocities. * Fix doxygen errors for ice-sheet process_and_post_scalar_data routine * FMA fix associated with enforcement of max allowed ice-shelf surface slope
* EBT Backscatter Backscatter code using the equivalent barotropic (EBT) mode documented in Yankovsky et al. (2024). * Modifications to MOM_hor_visc: - Separate FrictWork and FrictWork_bh loops - Simplified the computation for MEKE%mom_src and MEKE%mom_src_bh when MEKE%backscatter_Ro_c /= 0. (cherry picked from commit 8ffc6a8) --------- Co-authored-by: Wenda Zhang <zhangwenda33@hotmail.com> Co-authored-by: Marshall Ward <marshall.ward@noaa.gov>
bigthetao refers the the uppercase greek letter theta used for conservative temperature. Salinity so uses the roman alphabet and a bigso is ambiguous as many papers use S for salinity hence absso seems like the most unambiguous.
This commit fixes a bug that target code cannot be built for regression tests when BUILD is specified with command line arguments. The fix explicitly specifies BUILD argument for target codebase, avoiding the variable being passed from the parent make.
…es, and ice speed; and the magnitude of ice surface slope and driving stress. Fixed some misleading units for variables related to ice viscosity
…ics. Also fixed incorrect loop bounds for a seldom-used ice-shelf convergence criterion
* Fixes to preserve rotational symmetry when using Fused-multiply-adds Tested in ice-ocean mode and ice-shelf-only mode using ISOMIP and MISOMIP+, respectively * Added more parentheses to preserve rotational symmetry when using FMAs. Note that the changes here are to the MOM_ice_shelf_dynamics.F90 function 'quad_area', which is only called by the subroutine 'bilinear_shape_functions'; this subroutine is currently unused so that rotationally-consistent use of FMAs in both 'quad_area' and 'bilinear_shape_functions' has not been tested
Fix a bug that layer/interface weights may not be reset to 1.0 if no calculations are needed. The bug has negligible impact for barotropic applications but may affect baroclinic runs which are yet to performed.
Other than staying up to date, this purportedly fixes a "Node.js deprecation" message we first noticed in the coverage workflow but has appeared elsewhere intermittently.
- Changed gitlab runner to the mom6-account on gaea - Added gitlab variable MOM6_RUN_JOB_DURATION to control the allowed run duration during bad days for the system. Defaults to 15:00 (15 mins) - Added FC=ftn MPIFC=ftn CC=cc environment vars when invoking make in .testing
Eliminated the previously optional h_neglect and h_neglect_edge arguments to remapping_core_h and remapping_core_w, and added optional h_neglect and h_neglect_edge arguments to initialize_remapping for storage in the remapping control structures. The answer_date, h_neglect and h_neglect_edge arguments to ALE_remap_scalar were also eliminated, as they are no longer used. The new routine open_boundary_setup_vert was added to manage these changes. A new verticalGrid_type argument was added to wave_speed_init. The h_neglect argument to 29 routines was made non-optional, because there is no way to provide a consistent hard-coded default for a dimensional parameter. The (mostly low-level) routines where this change to a non-optional h_neglect was made include build_reconstructions_1d, P1M_interpolation, P3M_interpolation, P3M_boundary_extrapolation, PLM_reconstruction, PLM_boundary_extrapolation, PPM_reconstruction, PPM_limiter_standard, PPM_boundary_extrapolation, PQM_reconstruction, PQM_limiter, PQM_boundary_extrapolation_v1, build_hycom1_column, build_rho_column, bound_edge_values, edge_values_explicit_h4, edge_values_explicit_h4cw, edge_values_implicit_h4, edge_slopes_implicit_h3, edge_slopes_implicit_h5, edge_values_implicit_h6, regridding_set_ppolys, build_and_interpolate_grid, remapByProjection, remapByDeltaZ, and integrateReconOnInterval. In two modules (MOM_open_boundary and MOM_wave_speed), two separate copies of remapping_CS variables were needed to accommodate different negligible thicknesses or units in different remapping calls. In those cases that also have an optional h_neglect_edge argument the default is now set to h_neglect. Improperly hard-coded dimensional default values for h_neglect or h_neglect_edge were eliminated in 16 places as a result of this change, but they were added back in 2 unit testing routines (one of these is archaic and unused) that do not use exercise dimensional rescaling tests. Because the previously optional arguments were already present in all calls from the dev/gfdl or main branches of the MOM6 code, and because the places where arguments have been removed they are balanced by equivalent arguments added to initialize_remapping, all answers are bitwise identical in the regression tests, but this change in interfaces could impact other code that is not in the main branch of MOM6.
* subroutine initialize_MOM * MOM_input in test cases
This patch replaces the `CS%[uv]_file < 0` checks with `CS%[uv]_file == -1`. FMS1 returns negative file handles for missing or otherwise error-prone files, but the FMS2 IO framework relies on `newunit=` to autogenerate handle IDs, which are always negative and cannot be used with checks for negative values. The check is replaced with equality with -1. `newunit` is guaranteed to never return -1 for a valid file, so this is a valid check for a missing file. It also lets us continue to use -1 as the initial (unopened) value. Behavior is compatible with `mpp_open()` output, so this can also be used with the FMS1 API. A better solution would be to introduce some validation function which is defined by each API, but there is not yet any need for such sophistication.
This commit contains two changes to gcov report generation and codecov upload. 1. Separation of the file parser unit tests from the others was causing them to be exluded from report.cov.unit. This patch reworks the rules to replace MOM_file_parser_tests.F90.gcov with driver code, build/unit/test_%.F90.gcov. This does assume at all drivers will look the same (test_*.F90) but that part can be reworked if it ever becomes a problem in the future. Thanks to @adcroft for multiple suggestions in this PR. 2. Github appears to internally store all its repositories in another directory with the name as the repo (in this case MOM6/). Normally this is hidden to everyone, but it was causing some confusion with the codecov upload tool, and was unable to match the source code to the .gcov report. The .codecov.yml config file was modified to adjust for this path change, and should now correctly allow coverage to be reported alongside the file. (The GitHub Actions app likely makes this adjustment, but we need to do it manually since we upload directly to Codecov.io.)
This particular bugfix was proved to be unnecessary and therefore incorrectly added. Runtime parameter VISC_REM_BUG now controls two bugfixes, related to RK2 time stepping and barotropic vertical weight, which are valid.
VISC_REM_TIMESTEP_FIX -> VISC_REM_TIMESTEP_BUG VISC_REM_BT_WEIGHT_FIX -> VISC_REM_BT_WEIGHT_BUG The "signs" of the flags are flipped accordingly.
…lt_fingers - Double diffusion code was updated to include runtime parameter for maximum density ratio, but it was never implemented in the actual calculation of the double diffusion diffusivities. It is now used in the calculation and Rrho0 is removed from the code. - The default value of Max_Rrho_salt_fingers is changed from 2.55 to 1.9 to avoid changing behavior from the old code. However, it should be updated to 2.55 and noted that it will change answers for any run with double diffusion enabled through MOM6. It does not affect the behavior of double diffusion enabled through CVMix.
Most modules that use remapping have their own parameter e.g. Z_INIT_REMAPPING_SCHEME. However, OBC, ODA and SPONGE currently sliently use the primary ALE REMAPPING_SCHEME parameter. Added logged parameters OBC_REMAPPING_SCHEME, ODA_REMAPPING_SCHEME and SPONGE_REMAPPING_SCHEME to allow customization. All take REMAPPING_SCHEME as their default to maintain compatibility. For ODA, also added ODA_REMAPPING_USE_OM4_SUBCELLS that takes REMAPPING_USE_OM4_SUBCELLS as its default to maintain compatibility, and ODA_BOUNDARY_EXTRAP that takes BOUNDARY_EXTRAPOLATION as its default to maintain compatibility. Note that BOUNDARY_EXTRAPOLATION is a bug, it should have been REMAP_BOUNDARY_EXTRAP, but the former remains the default for compatibility. For SPONGE, also added SPONGE_BOUNDARY_EXTRAP that takes BOUNDARY_EXTRAPOLATION as its default to maintain compatibility. Note that BOUNDARY_EXTRAPOLATION is a bug, it should have been REMAP_BOUNDARY_EXTRAP, but the former remains the default for compatibility. Answers are unchanged, but there are new logged parameters.
|
PR #20 is merged. Close this one now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a routine to generic tracers that will initialize the pointers for ALE sponges to be used with any of the generic tracers.
These sponges are primarily targeted at correcting biases near open boundaries that result from surious mixing from larger issues with the open boundary forcings. However, then could also be used to nudge the interior of the domain to prevent drift over a long simulation as is done with temperature and salinity in the hindecasts used to initalize forecasts from a realistic state.
Information for Nudging
For each variable that is nudged, you will need to add information including: a file with the data, the variable name of the data in that file, and the vertical coordinate of the data. A damping file which sets the timescale of the nudging used by all the generic tracer variables is also needed - it can be the same as the dampling file for T and S. Data for nudging multiple generic tracer variables can be in the same file, or seperate files can be used for each variable.
Here is an example of the setting to nudge no3 and o2:
In the MOM_parameter_doc.all file, if
DO_SPONGE_GENERIC_TRACER = Truethen there will be parameters forDO_SPONGE_GT_$VARfor each generic tracer used in the simulation. The additionalSPONGE_GT_$VAR_FILE,SPONGE_GT_$VAR_VAR, andSPONGE_GT_$VAR_ETA_VARwill only be included ifDO_SPONGE_GT_$VAR=True.Impacts
This PR was tested with a configuration and data files provided by Zihua Liu. Thank you! This configuration is ideal for this testing because it is a subset of a larger simulation, so there is a "correct" value for the generic tracers that does not include any boundary artifacts. For this experiment, no3 was nuged in the 10 grid cells nearest the boundaries to the "correct" value.
The figure below shows monthly average of the surface no3 after 10 monhts of the simultaion in (A) the original run with no nudging, (B) the run with nudging, and (C) the difference (B) minus (A). The high values of no3 near the eastern boundary are the result of vertical mixing and are what the sponges aim to correct. Note that the correction extends well beyond the 10-gird cell nudging region.
The target concentration of no3 from the parent run are shown in (D) and the difference between the with-nudging and no-nudging runs are shown in (D) and (F) respectively. Note that the color bar for (C) is an order of mangitude smaller than the color range for (E) and (F).