Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+Refactor the spatial mean calculations
Refactored the spatial mean calculations in the functions global_area_mean(), global_area_mean_u(), global_area_mean_v(), global_layer_mean(), global_volume_mean() and adjust_area_mean_to_zero() to work in rescaled units by making use of the unscale arguments to the reproducing_sum routines. Comments were also added to explain what the code does when both tmp_scale and unscale arguments are provided, which effectively acts as to allow for changes in the rescaled units. Global_area_integral() and global_mass_integral() were also similarly refactored, but with the added difference that when a tmp_scale argument is provided, the areas or masses in the integrals have units of [L2 A ~> m2 a] or [R Z L2 A ~> kg a] instead of the mixed units of [m2 A ~> m2 a] or [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 this same commit. When the optional var argument is absent from a call to global_mass_integral() so that it is the mass itself that is returned, the values (if any) of scale, unscale and tmp_scale are ignored, but the presence of tmp_scale determines whether the mass is returned in [R Z L2 ~> kg] or [kg], consistent with the behavior that would have been obtained if var had been an array of nondimensional 1s. This commit also includes a rescaling in the units of the areaT_global and IareaT_global elements of the ocean_grid_type and dyn_horgrid_type to [L2 ~> m2] and [L-2 ~> m-2], respectively. Although the dyn_horgrid_type is shared between MOM6 and SIS2, these elements are not used in SIS2. A total of 12 rescaling factors were eliminated or moved into unscale arguments as a result of these changes. All answers 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.
- Loading branch information