Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f039a8

Browse files
Hallberg-NOAAmarshallward
authored andcommitted
+Fix diagnostic conversions in code from dev/ncar
Added missing unit conversion factors in two calls to register_diag_field and modified the comments describing the units of some temperature and salinity variables in code that was recently added to the recently main branch of MOM6 via dev/ncar, reflecting the rescaling of temperatures and salinities that is now in the dev/gfdl branch. Without this change, these diagnostics will fail the dimensional consistency testing for temperature and salinity. All answers are bitwise identical, but there is a case change of the units of a variable in the available_diags files.
1 parent 9a3aa1e commit 4f039a8

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/core/MOM_isopycnal_slopes.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ subroutine calc_isoneutral_slopes(G, GV, US, h, e, tv, dt_kappa_smooth, use_stan
9090
S_v, & ! Salinity on the interface at the v-point [S ~> ppt].
9191
pres_v ! Pressure on the interface at the v-point [R L2 T-2 ~> Pa].
9292
real, dimension(SZI_(G)) :: &
93-
T_h, & ! Temperature on the interface at the h-point [degC].
94-
S_h, & ! Salinity on the interface at the h-point [ppt]
93+
T_h, & ! Temperature on the interface at the h-point [C ~> degC].
94+
S_h, & ! Salinity on the interface at the h-point [S ~> ppt]
9595
pres_h, & ! Pressure on the interface at the h-point [R L2 T-2 ~> Pa].
96-
T_hr, & ! Temperature on the interface at the h (+1) point [degC].
97-
S_hr, & ! Salinity on the interface at the h (+1) point [ppt]
96+
T_hr, & ! Temperature on the interface at the h (+1) point [C ~> degC].
97+
S_hr, & ! Salinity on the interface at the h (+1) point [S ~> ppt]
9898
pres_hr ! Pressure on the interface at the h (+1) point [R L2 T-2 ~> Pa].
9999
real :: drdiA, drdiB ! Along layer zonal- and meridional- potential density
100100
real :: drdjA, drdjB ! gradients in the layers above (A) and below (B) the

src/core/MOM_stoch_eos.F90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module MOM_stoch_eos
5353
contains
5454

5555
!> Initializes MOM_stoch_eos module.
56-
subroutine MOM_stoch_eos_init(G,Time,param_file,CS,restart_CS,diag)
56+
subroutine MOM_stoch_eos_init(G, Time, param_file, CS, restart_CS, diag)
5757
type(param_file_type), intent(in) :: param_file !< structure indicating parameter file to parse
5858
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
5959
type(time_type), intent(in) :: Time !< Time for stochastic process
@@ -123,7 +123,7 @@ subroutine MOM_stoch_eos_init(G,Time,param_file,CS,restart_CS,diag)
123123
end subroutine MOM_stoch_eos_init
124124

125125
!> Generates a pattern in space and time for the ocean stochastic equation of state
126-
subroutine MOM_stoch_eos_run(G,u,v,delt,Time,CS,diag)
126+
subroutine MOM_stoch_eos_run(G, u, v, delt, Time, CS, diag)
127127
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
128128
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
129129
intent(in) :: u !< The zonal velocity [L T-1 ~> m s-1].
@@ -156,7 +156,7 @@ subroutine MOM_stoch_eos_run(G,u,v,delt,Time,CS,diag)
156156
end subroutine MOM_stoch_eos_run
157157

158158
!> Computes a parameterization of the SGS temperature variance
159-
subroutine MOM_calc_varT(G,GV,h,tv,CS,dt)
159+
subroutine MOM_calc_varT(G, GV, h, tv, CS, dt)
160160
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
161161
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
162162
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
@@ -167,13 +167,13 @@ subroutine MOM_calc_varT(G,GV,h,tv,CS,dt)
167167

168168
! local variables
169169
real, dimension(SZI_(G), SZJ_(G), SZK_(GV)) :: &
170-
T, & !> The temperature (or density) [degC], with the values in
170+
T, & !> The temperature (or density) [C ~> degC], with the values in
171171
!! in massless layers filled vertically by diffusion.
172-
S !> The filled salinity [ppt], with the values in
172+
S !> The filled salinity [S ~> ppt], with the values in
173173
!! in massless layers filled vertically by diffusion.
174-
integer :: i,j,k
174+
integer :: i, j, k
175175
real :: hl(5) !> Copy of local stencil of H [H ~> m]
176-
real :: dTdi2, dTdj2 !> Differences in T variance [degC2]
176+
real :: dTdi2, dTdj2 !> Differences in T variance [C2 ~> degC2]
177177

178178
! This block does a thickness weighted variance calculation and helps control for
179179
! extreme gradients along layers which are vanished against topography. It is
@@ -191,11 +191,11 @@ subroutine MOM_calc_varT(G,GV,h,tv,CS,dt)
191191
hl(4) = h(i,j-1,k) * G%mask2dCv(i,J-1)
192192
hl(5) = h(i,j+1,k) * G%mask2dCv(i,J)
193193

194-
! SGS variance in i-direction [degC2]
194+
! SGS variance in i-direction [C2 ~> degC2]
195195
dTdi2 = ( ( G%mask2dCu(I ,j) * G%IdxCu(I ,j) * ( T(i+1,j,k) - T(i,j,k) ) &
196196
+ G%mask2dCu(I-1,j) * G%IdxCu(I-1,j) * ( T(i,j,k) - T(i-1,j,k) ) &
197197
) * G%dxT(i,j) * 0.5 )**2
198-
! SGS variance in j-direction [degC2]
198+
! SGS variance in j-direction [C2 ~> degC2]
199199
dTdj2 = ( ( G%mask2dCv(i,J ) * G%IdyCv(i,J ) * ( T(i,j+1,k) - T(i,j,k) ) &
200200
+ G%mask2dCv(i,J-1) * G%IdyCv(i,J-1) * ( T(i,j,k) - T(i,j-1,k) ) &
201201
) * G%dyT(i,j) * 0.5 )**2

src/diagnostics/MOM_diagnostics.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,11 +1632,11 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
16321632
standard_name='sea_water_salinity_at_sea_floor', &
16331633
units='psu', conversion=US%S_to_ppt)
16341634

1635-
CS%id_tosq = register_diag_field('ocean_model', 'tosq', diag%axesTL,&
1636-
Time, 'Square of Potential Temperature', 'degc2', &
1635+
CS%id_tosq = register_diag_field('ocean_model', 'tosq', diag%axesTL, &
1636+
Time, 'Square of Potential Temperature', 'degC2', conversion=US%C_to_degC**2, &
16371637
standard_name='Potential Temperature Squared')
1638-
CS%id_sosq = register_diag_field('ocean_model', 'sosq', diag%axesTL,&
1639-
Time, 'Square of Salinity', 'psu2', &
1638+
CS%id_sosq = register_diag_field('ocean_model', 'sosq', diag%axesTL, &
1639+
Time, 'Square of Salinity', 'psu2', conversion=US%S_to_ppt**2, &
16401640
standard_name='Salinity Squared')
16411641

16421642
CS%id_temp_layer_ave = register_diag_field('ocean_model', 'temp_layer_ave', &

0 commit comments

Comments
 (0)