+Refactor spatial means and rescale some global integrals #778
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.
This PR consists of two commits that use the
unscale
arguments toreproducing_sums()
to refactor the 6 global area mean functions (global_area_mean()
,global_area_mean_u()
,global_area_mean_v()
,global_layer_mean()
,global_volume_mean()
andadjust_area_mean_to_zero()
) and to revise the scaling of the returned values from the two global integralroutines(
Global_area_integral()
andglobal_mass_integral()
), and then to use this revised capability to work exclusively with rescaled diagnostics of the surface fluxes.When
global_area_integral()
andglobal_mass_integral()
are called with atmp_scale
argument, now it is not just the variable that is being integrated that is returned in rescaled units, but also the area or mass, whereas previously it was only the variable that was returned in rescaled units but the area or mass multiplying them were in mks units of [m2] or [kg]. In other words, these routines now return variables in units of [L2 A ~> m2 a] and [R Z L2 A ~> kg a] (if tmp_scale is present) or [m2 a] and [kg a] (if it is not), but no longer in mixed units of [m2 A ~> m2 a] and [kg A ~> kg a]. As a result the code surrounding the 4 instances where global_area_integral or global_mass_integral were being called with tmp_scale arguments (in MOM.F90 and MOM_ice_shelf.F90) also had to be modified in the same commit.This same commit also includes a rescaling in the units of the areaT_global and IareaT_global elements of the
ocean_grid_type
anddyn_horgrid_type
to [L2 ~> m2] and [L-2 ~> m-2], respectively. These elements were only used in the area_mean functions, so it is sensible to make this change in the same commit where the area_mean functions were revised. Although thedyn_horgrid_type
is shared between MOM6 and SIS2, these elements are not used in SIS2.The second commit in this PR keeps 36 area integrated surface mass, heat or salt flux diagnostics in
forcing_diagnostics()
in rescaled units by replacing anunscale
argument with atmp_scale
argument toglobal_area_integral()
. It also adds the correspondingconversion
arguments to theregister_scalar_field()
calls for each of these diagnostics, so that the documented units and conversion factors can be used to confirm the correctness of the documented units for these variables.All answers and diagnostics are bitwise identical, but there are changes in the rescaled units of two elements each in two transparent types, and changes to the rescaling behavior of two publicly visible routines when they are called with
tmp_scale
arguments. This commits in this PR include: