@@ -625,27 +625,24 @@ real function remaining_transport_sum(G, GV, US, uhtr, vhtr, h_new)
625
625
626
626
! Local variables
627
627
real , dimension (SZI_(G),SZJ_(G)) :: trans_rem_col ! < The vertical sum of the absolute value of
628
- ! ! transports through the faces of a column, in MKS units [ kg].
628
+ ! ! transports through the faces of a column [R Z L2 ~> kg].
629
629
real :: trans_cell ! < The sum of the absolute value of the remaining transports through the faces
630
630
! ! of a tracer cell [H L2 ~> m3 or kg]
631
- real :: HL2_to_kg_scale ! < Unit conversion factor to cell mass [kg H-1 L-2 ~> kg m-3 or 1]
632
631
integer :: i, j, k, is, ie, js, je, nz
633
632
634
633
is = G% isc ; ie = G% iec ; js = G% jsc ; je = G% jec ; nz = GV% ke
635
634
636
- HL2_to_kg_scale = GV% H_to_kg_m2 * US% L_to_m** 2
637
-
638
635
trans_rem_col(:,:) = 0.0
639
636
do k= 1 ,nz ; do j= js,je ; do i= is,ie
640
637
trans_cell = (ABS (uhtr(I-1 ,j,k)) + ABS (uhtr(I,j,k))) + &
641
638
(ABS (vhtr(i,J-1 ,k)) + ABS (vhtr(i,J,k)))
642
639
if (trans_cell > max (1.0e-16 * h_new(i,j,k), GV% H_subroundoff) * G% areaT(i,j)) &
643
- trans_rem_col(i,j) = trans_rem_col(i,j) + HL2_to_kg_scale * trans_cell
640
+ trans_rem_col(i,j) = trans_rem_col(i,j) + GV % H_to_RZ * trans_cell
644
641
enddo ; enddo ; enddo
645
642
646
643
! The factor of 0.5 here is to avoid double-counting because two cells share a face.
647
- remaining_transport_sum = 0.5 * GV% kg_m2_to_H * US % m_to_L ** 2 * &
648
- reproducing_sum(trans_rem_col, is+ (1 - G% isd), ie+ (1 - G% isd), js+ (1 - G% jsd), je+ (1 - G% jsd))
644
+ remaining_transport_sum = 0.5 * GV% RZ_to_H * reproducing_sum(trans_rem_col, &
645
+ is+ (1 - G% isd), ie+ (1 - G% isd), js+ (1 - G% jsd), je+ (1 - G% jsd), unscale = US % RZL2_to_kg )
649
646
650
647
end function remaining_transport_sum
651
648
@@ -876,8 +873,8 @@ subroutine offline_advection_layer(fluxes, Time_start, time_interval, G, GV, US,
876
873
real , dimension (SZI_(G),SZJB_(G),SZK_(GV)) :: vhtr_sub ! Remaining meridional mass transports [H L2 ~> m3 or kg]
877
874
878
875
real , dimension (SZI_(G),SZJB_(G)) :: rem_col_flux ! The summed absolute value of the remaining
879
- ! fluxes through the faces of a column or within a column, in mks units [ kg]
880
- real :: sum_flux ! Globally summed absolute value of fluxes in mks units [ kg], which is
876
+ ! mass fluxes through the faces of a column or within a column [R Z L2 ~> kg]
877
+ real :: sum_flux ! Globally summed absolute value of fluxes [R Z L2 ~> kg], which is
881
878
! used to keep track of how close to convergence we are.
882
879
883
880
real , dimension (SZI_(G),SZJ_(G),SZK_(GV)) :: &
@@ -890,7 +887,6 @@ subroutine offline_advection_layer(fluxes, Time_start, time_interval, G, GV, US,
890
887
! Work arrays for temperature and salinity
891
888
integer :: iter
892
889
real :: dt_iter ! The timestep of each iteration [T ~> s]
893
- real :: HL2_to_kg_scale ! Unit conversion factors to cell mass [kg H-1 L-2 ~> kg m-3 or 1]
894
890
character (len= 160 ) :: mesg ! The text of an error message
895
891
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
896
892
integer :: IsdB, IedB, JsdB, JedB
@@ -993,22 +989,22 @@ subroutine offline_advection_layer(fluxes, Time_start, time_interval, G, GV, US,
993
989
call pass_vector(uhtr,vhtr,G% Domain)
994
990
995
991
! Calculate how close we are to converging by summing the remaining fluxes at each point
996
- HL2_to_kg_scale = US% L_to_m** 2 * GV% H_to_kg_m2
997
992
rem_col_flux(:,:) = 0.0
998
993
do k= 1 ,nz ; do j= js,je ; do i= is,ie
999
- rem_col_flux(i,j) = rem_col_flux(i,j) + HL2_to_kg_scale * &
994
+ rem_col_flux(i,j) = rem_col_flux(i,j) + GV % H_to_RZ * &
1000
995
( (abs (eatr(i,j,k)) + abs (ebtr(i,j,k))) + &
1001
996
((abs (uhtr(I-1 ,j,k)) + abs (uhtr(I,j,k))) + &
1002
997
(abs (vhtr(i,J-1 ,k)) + abs (vhtr(i,J,k))) ) )
1003
998
enddo ; enddo ; enddo
1004
- sum_flux = reproducing_sum(rem_col_flux, is+ (1 - G% isd), ie+ (1 - G% isd), js+ (1 - G% jsd), je+ (1 - G% jsd))
999
+ sum_flux = reproducing_sum(rem_col_flux, is+ (1 - G% isd), ie+ (1 - G% isd), js+ (1 - G% jsd), je+ (1 - G% jsd), &
1000
+ unscale= US% RZL2_to_kg)
1005
1001
1006
1002
if (sum_flux== 0 ) then
1007
1003
write (mesg,* ) ' offline_advection_layer: Converged after iteration' , iter
1008
1004
call MOM_mesg(mesg)
1009
1005
exit
1010
1006
else
1011
- write (mesg,* ) " offline_advection_layer: Iteration " , iter, " remaining total fluxes: " , sum_flux
1007
+ write (mesg,* ) " offline_advection_layer: Iteration " , iter, " remaining total fluxes: " , sum_flux* US % RZL2_to_kg
1012
1008
call MOM_mesg(mesg)
1013
1009
endif
1014
1010
0 commit comments