Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Refactor spatial means and rescale some global integrals #778

Open
wants to merge 2 commits into
base: dev/gfdl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4161,7 +4161,7 @@ subroutine get_ocean_stocks(CS, mass, heat, salt, on_PE_only)
if (present(mass)) &
mass = global_mass_integral(CS%h, CS%G, CS%GV, on_PE_only=on_PE_only)
if (present(heat)) &
heat = CS%US%Q_to_J_kg*CS%tv%C_p * &
heat = CS%US%Q_to_J_kg*CS%US%RZL2_to_kg * CS%tv%C_p * &
global_mass_integral(CS%h, CS%G, CS%GV, CS%tv%T, on_PE_only=on_PE_only, tmp_scale=CS%US%C_to_degC)
if (present(salt)) &
salt = 1.0e-3 * global_mass_integral(CS%h, CS%G, CS%GV, CS%tv%S, on_PE_only=on_PE_only, unscale=CS%US%S_to_ppt)
Expand Down
352 changes: 183 additions & 169 deletions src/core/MOM_forcing_type.F90

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/core/MOM_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ module MOM_grid
df_dx, & !< Derivative d/dx f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].
df_dy !< Derivative d/dy f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].

! These variables are global sums that are useful for 1-d diagnostics and should not be rescaled.
real :: areaT_global !< Global sum of h-cell area [m2]
real :: IareaT_global !< Global sum of inverse h-cell area (1/areaT_global) [m-2].
! These variables are global sums that are useful for 1-d diagnostics.
real :: areaT_global !< Global sum of h-cell area [L2 ~> m2]
real :: IareaT_global !< Global sum of inverse h-cell area (1/areaT_global) [L-2 ~> m-2].

type(unit_scale_type), pointer :: US => NULL() !< A dimensional unit scaling type

Expand Down
398 changes: 248 additions & 150 deletions src/diagnostics/MOM_spatial_means.F90

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/framework/MOM_dyn_horgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ module MOM_dyn_horgrid
df_dx, & !< Derivative d/dx f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].
df_dy !< Derivative d/dy f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].

! These variables are global sums that are useful for 1-d diagnostics and should not be rescaled.
real :: areaT_global !< Global sum of h-cell area [m2]
real :: IareaT_global !< Global sum of inverse h-cell area (1/areaT_global) [m-2]
! These variables are global sums that are useful for 1-d diagnostics.
real :: areaT_global !< Global sum of h-cell area [L2 ~> m2]
real :: IareaT_global !< Global sum of inverse h-cell area (1/areaT_global) [L-2 ~> m-2]

! These parameters are run-time parameters that are used during some
! initialization routines (but not all)
Expand Down
6 changes: 3 additions & 3 deletions src/ice_shelf/MOM_ice_shelf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1141,9 +1141,9 @@ subroutine add_shelf_flux(G, US, CS, sfc_state, fluxes, time_step)
! local variables
real :: frac_shelf !< The fractional area covered by the ice shelf [nondim].
real :: frac_open !< The fractional area of the ocean that is not covered by the ice shelf [nondim].
real :: delta_mass_shelf !< Change in ice shelf mass over one time step [R Z m2 T-1 ~> kg s-1]
real :: delta_mass_shelf !< Change in ice shelf mass over one time step [R Z L2 T-1 ~> kg s-1]
real :: balancing_flux !< The fresh water flux that balances the integrated melt flux [R Z T-1 ~> kg m-2 s-1]
real :: balancing_area !< total area where the balancing flux is applied [m2]
real :: balancing_area !< total area where the balancing flux is applied [L2 ~> m2]
type(time_type) :: dTime !< The time step as a time_type
type(time_type) :: Time0 !< The previous time (Time-dt)
real, dimension(SZDI_(G),SZDJ_(G)) :: bal_frac !< Fraction of the cell where the mass flux
Expand Down Expand Up @@ -1315,7 +1315,7 @@ subroutine add_shelf_flux(G, US, CS, sfc_state, fluxes, time_step)
endif
enddo ; enddo

balancing_area = global_area_integral(bal_frac, G, area=G%areaT)
balancing_area = global_area_integral(bal_frac, G, area=G%areaT, tmp_scale=1.0)
if (balancing_area > 0.0) then
balancing_flux = ( global_area_integral(ISS%water_flux, G, tmp_scale=US%RZ_T_to_kg_m2s, &
area=ISS%area_shelf_h) + &
Expand Down
2 changes: 1 addition & 1 deletion src/initialization/MOM_shared_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ subroutine compute_global_grid_integrals(G, US)
do j=G%jsc,G%jec ; do i=G%isc,G%iec
tmpForSumming(i,j) = G%areaT(i,j) * G%mask2dT(i,j)
enddo ; enddo
G%areaT_global = US%L_to_m**2 * reproducing_sum(tmpForSumming, unscale=US%L_to_m**2)
G%areaT_global = reproducing_sum(tmpForSumming, unscale=US%L_to_m**2)

if (G%areaT_global == 0.0) &
call MOM_error(FATAL, "compute_global_grid_integrals: zero ocean area (check topography?)")
Expand Down
Loading