+(*)Fix problems with generic_tracer_min_max #615
Merged
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.
Revise
MOM_generic_tracer_min_max()
andarray_global_min_max()
to fix several problems that had previously been noted, and to make the location arguments optional, reflecting that they are optional in the calling routine. This requires a revision to the order of arguments toMOM_generic_tracer_min_max()
. The interface toarray_global_min_max()
was extensively revised and simplified to replace several previous arguments with a single newocean_grid_type
argument, to make the location arguments optional, and add an optionalunscale
argument.This commit fixes a number of problems that had previously been noted with
array_global_min_max()
, including that:(1) It actually returns the global minimum and maximum values of the tracer;
(2) It gives a position that is independent of the domain decomposition and grid rotation;
(3) For all-zero arrays it correctly reports 0 for the minimum and maximum;
(4) It properly handles unscaling of the input array;
(5) It does not use a 3-d mask array that is actually just a 2-d mask array;
(6) It is more efficient by grouping the global minimum and maximum calls.
This commit also adds or revises comments to document the units and purpose of the remaining undocumented real variables in
MOM_generic_tracer.F90
.These changes were tested and verified to be correct by calling
array_global_min_max()
for temperatures and salinities fromwrite_energy()
, but those changes were not included in this commit.This commit also adds an optional verbosity argument to
g_tracer_flux_init()
inconfig_src/external/GFDL_ocean_BGC/generic_tracer_utils.F90
, reflecting a change toocean_BGC/generic_tracers/generic_tracer_utils.F90
that was adopted in August of 2020, and is uses this newverbosity
argument in the call fromMOM_generic_flux_init()
.While all solutions are bitwise identical, there are changes (corrections) in some diagnostic output, and there are changes to the arguments of publicly visible routines.