Skip to content

Commit ee198de

Browse files
Merge pull request mom-ocean#10 from NoraLoose/cpt_visc_rem_diags
Visc_rem_[uv] multiplied momentum budget diagnostics
2 parents b771b91 + a874d6d commit ee198de

5 files changed

Lines changed: 141 additions & 2 deletions

File tree

src/core/MOM_barotropic.F90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,6 +2685,16 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
26852685
ADp%diag_hv(i,J,k) = BT_cont%h_v(i,J,k)
26862686
enddo ; enddo ; enddo
26872687
endif
2688+
if (present(ADp) .and. (associated(ADp%visc_rem_u))) then
2689+
do k=1,nz ; do j=js,je ; do I=is-1,ie
2690+
ADp%visc_rem_u(I,j,k) = visc_rem_u(I,j,k)
2691+
enddo ; enddo ; enddo
2692+
endif
2693+
if (present(ADp) .and. (associated(ADp%visc_rem_u))) then
2694+
do k=1,nz ; do J=js-1,je ; do i=is,ie
2695+
ADp%visc_rem_v(i,J,k) = visc_rem_v(i,J,k)
2696+
enddo ; enddo ; enddo
2697+
endif
26882698

26892699
if (G%nonblocking_updates) then
26902700
if (find_etaav) call complete_group_pass(CS%pass_etaav, G%Domain)

src/core/MOM_dynamics_split_RK2.F90

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,12 @@ module MOM_dynamics_split_RK2
163163
integer :: id_h_PFu = -1, id_h_PFv = -1
164164
integer :: id_hf_PFu_2d = -1, id_hf_PFv_2d = -1
165165
integer :: id_intz_PFu_2d = -1, id_intz_PFv_2d = -1
166+
integer :: id_PFu_visc_rem = -1, id_PFv_visc_rem = -1
166167
! integer :: id_hf_CAu = -1, id_hf_CAv = -1
167168
integer :: id_h_CAu = -1, id_h_CAv = -1
168169
integer :: id_hf_CAu_2d = -1, id_hf_CAv_2d = -1
169170
integer :: id_intz_CAu_2d = -1, id_intz_CAv_2d = -1
171+
integer :: id_CAu_visc_rem = -1, id_CAv_visc_rem = -1
170172

171173
! Split scheme only.
172174
integer :: id_uav = -1, id_vav = -1
@@ -175,6 +177,7 @@ module MOM_dynamics_split_RK2
175177
integer :: id_h_u_BT_accel = -1, id_h_v_BT_accel = -1
176178
integer :: id_hf_u_BT_accel_2d = -1, id_hf_v_BT_accel_2d = -1
177179
integer :: id_intz_u_BT_accel_2d = -1, id_intz_v_BT_accel_2d = -1
180+
integer :: id_u_BT_accel_visc_rem = -1, id_v_BT_accel_visc_rem = -1
178181
!>@}
179182

180183
type(diag_ctrl), pointer :: diag !< A structure that is used to regulate the
@@ -354,6 +357,12 @@ subroutine step_MOM_dyn_split_RK2(u, v, h, tv, visc, Time_local, dt, forces, p_s
354357
real, dimension(SZI_(G),SZJB_(G)) :: &
355358
intz_PFv_2d, intz_CAv_2d, intz_v_BT_accel_2d ! [H L T-2 ~> m2 s-2].
356359

360+
! Diagnostics for momentum budget terms multiplied by visc_rem_[uv],
361+
real, allocatable, dimension(:,:,:) :: &
362+
PFu_visc_rem, PFv_visc_rem, & ! Pressure force accel. x visc_rem_[uv] [L T-2 ~> m s-2].
363+
CAu_visc_rem, CAv_visc_rem, & ! Coriolis force accel. x visc_rem_[uv] [L T-2 ~> m s-2].
364+
u_BT_accel_visc_rem, v_BT_accel_visc_rem ! barotropic correction accel. x visc_rem_[uv] [L T-2 ~> m s-2].
365+
357366
real :: dt_pred ! The time step for the predictor part of the baroclinic time stepping [T ~> s].
358367

359368
logical :: dyn_p_surf
@@ -1102,6 +1111,61 @@ subroutine step_MOM_dyn_split_RK2(u, v, h, tv, visc, Time_local, dt, forces, p_s
11021111
deallocate(h_v_BT_accel)
11031112
endif
11041113

1114+
if (CS%id_PFu_visc_rem > 0) then
1115+
allocate(PFu_visc_rem(G%IsdB:G%IedB,G%jsd:G%jed,GV%ke))
1116+
PFu_visc_rem(:,:,:) = 0.0
1117+
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
1118+
PFu_visc_rem(I,j,k) = CS%PFu(I,j,k) * CS%ADp%visc_rem_u(I,j,k)
1119+
enddo ; enddo ; enddo
1120+
call post_data(CS%id_PFu_visc_rem, PFu_visc_rem, CS%diag)
1121+
deallocate(PFu_visc_rem)
1122+
endif
1123+
if (CS%id_PFv_visc_rem > 0) then
1124+
allocate(PFv_visc_rem(G%isd:G%ied,G%JsdB:G%JedB,GV%ke))
1125+
PFv_visc_rem(:,:,:) = 0.0
1126+
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
1127+
PFv_visc_rem(i,J,k) = CS%PFv(i,J,k) * CS%ADp%visc_rem_v(i,J,k)
1128+
enddo ; enddo ; enddo
1129+
call post_data(CS%id_PFv_visc_rem, PFv_visc_rem, CS%diag)
1130+
deallocate(PFv_visc_rem)
1131+
endif
1132+
if (CS%id_CAu_visc_rem > 0) then
1133+
allocate(CAu_visc_rem(G%IsdB:G%IedB,G%jsd:G%jed,GV%ke))
1134+
CAu_visc_rem(:,:,:) = 0.0
1135+
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
1136+
CAu_visc_rem(I,j,k) = CS%CAu(I,j,k) * CS%ADp%visc_rem_u(I,j,k)
1137+
enddo ; enddo ; enddo
1138+
call post_data(CS%id_CAu_visc_rem, CAu_visc_rem, CS%diag)
1139+
deallocate(CAu_visc_rem)
1140+
endif
1141+
if (CS%id_CAv_visc_rem > 0) then
1142+
allocate(CAv_visc_rem(G%isd:G%ied,G%JsdB:G%JedB,GV%ke))
1143+
CAv_visc_rem(:,:,:) = 0.0
1144+
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
1145+
CAv_visc_rem(i,J,k) = CS%CAv(i,J,k) * CS%ADp%visc_rem_v(i,J,k)
1146+
enddo ; enddo ; enddo
1147+
call post_data(CS%id_CAv_visc_rem, CAv_visc_rem, CS%diag)
1148+
deallocate(CAv_visc_rem)
1149+
endif
1150+
if (CS%id_u_BT_accel_visc_rem > 0) then
1151+
allocate(u_BT_accel_visc_rem(G%IsdB:G%IedB,G%jsd:G%jed,GV%ke))
1152+
u_BT_accel_visc_rem(:,:,:) = 0.0
1153+
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
1154+
u_BT_accel_visc_rem(I,j,k) = CS%u_accel_bt(I,j,k) * CS%ADp%visc_rem_u(I,j,k)
1155+
enddo ; enddo ; enddo
1156+
call post_data(CS%id_u_BT_accel_visc_rem, u_BT_accel_visc_rem, CS%diag)
1157+
deallocate(u_BT_accel_visc_rem)
1158+
endif
1159+
if (CS%id_v_BT_accel_visc_rem > 0) then
1160+
allocate(v_BT_accel_visc_rem(G%isd:G%ied,G%JsdB:G%JedB,GV%ke))
1161+
v_BT_accel_visc_rem(:,:,:) = 0.0
1162+
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
1163+
v_BT_accel_visc_rem(i,J,k) = CS%v_accel_bt(i,J,k) * CS%ADp%visc_rem_v(i,J,k)
1164+
enddo ; enddo ; enddo
1165+
call post_data(CS%id_v_BT_accel_visc_rem, v_BT_accel_visc_rem, CS%diag)
1166+
deallocate(v_BT_accel_visc_rem)
1167+
endif
1168+
11051169
if (CS%debug) then
11061170
call MOM_state_chksum("Corrector ", u, v, h, uh, vh, G, GV, US, symmetric=sym)
11071171
call uvchksum("Corrector avg [uv]", u_av, v_av, G%HI, haloshift=1, symmetric=sym, scale=US%L_T_to_m_s)
@@ -1606,6 +1670,33 @@ subroutine initialize_dyn_split_RK2(u, v, h, uh, vh, eta, Time, G, GV, US, param
16061670
'm2 s-2', conversion=GV%H_to_m*US%L_T2_to_m_s2)
16071671
if (CS%id_intz_v_BT_accel_2d > 0) call safe_alloc_ptr(CS%ADp%diag_hv,isd,ied,JsdB,JedB,nz)
16081672

1673+
CS%id_PFu_visc_rem = register_diag_field('ocean_model', 'PFu_visc_rem', diag%axesCuL, Time, &
1674+
'Zonal Pressure Force Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1675+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1676+
if (CS%id_PFu_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_u,IsdB,IedB,jsd,jed,nz)
1677+
CS%id_PFv_visc_rem = register_diag_field('ocean_model', 'PFv_visc_rem', diag%axesCvL, Time, &
1678+
'Meridional Pressure Force Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1679+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1680+
if(CS%id_PFv_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_v,isd,ied,JsdB,JedB,nz)
1681+
1682+
CS%id_CAu_visc_rem = register_diag_field('ocean_model', 'CAu_visc_rem', diag%axesCuL, Time, &
1683+
'Zonal Coriolis and Advective Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1684+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1685+
if (CS%id_CAu_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_u,IsdB,IedB,jsd,jed,nz)
1686+
CS%id_CAv_visc_rem = register_diag_field('ocean_model', 'CAv_visc_rem', diag%axesCvL, Time, &
1687+
'Meridional Coriolis and Advective Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1688+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1689+
if(CS%id_CAv_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_v,isd,ied,JsdB,JedB,nz)
1690+
1691+
CS%id_u_BT_accel_visc_rem = register_diag_field('ocean_model', 'u_BT_accel_visc_rem', diag%axesCuL, Time, &
1692+
'Barotropic Anomaly Zonal Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1693+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1694+
if (CS%id_u_BT_accel_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_u,IsdB,IedB,jsd,jed,nz)
1695+
CS%id_v_BT_accel_visc_rem = register_diag_field('ocean_model', 'v_BT_accel_visc_rem', diag%axesCvL, Time, &
1696+
'Barotropic Anomaly Meridional Acceleration multiplied by the viscous remnant', 'm2 s-2', &
1697+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
1698+
if(CS%id_v_BT_accel_visc_rem > 0) call safe_alloc_ptr(CS%ADp%visc_rem_v,isd,ied,JsdB,JedB,nz)
1699+
16091700
id_clock_Cor = cpu_clock_id('(Ocean Coriolis & mom advection)', grain=CLOCK_MODULE)
16101701
id_clock_continuity = cpu_clock_id('(Ocean continuity equation)', grain=CLOCK_MODULE)
16111702
id_clock_pres = cpu_clock_id('(Ocean pressure force)', grain=CLOCK_MODULE)

src/core/MOM_variables.F90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ module MOM_variables
191191
real, pointer :: diag_hu(:,:,:) => NULL() !< layer thickness at u points
192192
real, pointer :: diag_hv(:,:,:) => NULL() !< layer thickness at v points
193193

194+
real, pointer :: visc_rem_u(:,:,:) => NULL() !< viscous remnant at u points
195+
real, pointer :: visc_rem_v(:,:,:) => NULL() !< viscous remnant at v points
196+
194197
end type accel_diag_ptrs
195198

196199
!> Pointers to arrays with transports, which can later be used for derived diagnostics, like energy balances.

src/diagnostics/MOM_diagnostics.F90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,6 @@ subroutine set_dependent_diagnostics(MIS, ADp, CDp, G, GV, CS)
23222322
call safe_alloc_ptr(ADp%gradKEu,IsdB,IedB,jsd,jed,nz)
23232323
call safe_alloc_ptr(ADp%gradKEv,isd,ied,JsdB,JedB,nz)
23242324
endif
2325-
23262325
if (associated(CS%KE_visc)) then
23272326
call safe_alloc_ptr(ADp%du_dt_visc,IsdB,IedB,jsd,jed,nz)
23282327
call safe_alloc_ptr(ADp%dv_dt_visc,isd,ied,JsdB,JedB,nz)
@@ -2368,7 +2367,7 @@ subroutine MOM_diagnostics_end(CS, ADp)
23682367
if (associated(CS%vhGM_Rlay)) deallocate(CS%vhGM_Rlay)
23692368

23702369
if (associated(ADp%gradKEu)) deallocate(ADp%gradKEu)
2371-
if (associated(ADp%gradKEu)) deallocate(ADp%gradKEu)
2370+
if (associated(ADp%gradKEv)) deallocate(ADp%gradKEv)
23722371
if (associated(ADp%du_dt_visc)) deallocate(ADp%du_dt_visc)
23732372
if (associated(ADp%dv_dt_visc)) deallocate(ADp%dv_dt_visc)
23742373
if (associated(ADp%du_dt_dia)) deallocate(ADp%du_dt_dia)

src/parameterizations/lateral/MOM_hor_visc.F90

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ module MOM_hor_visc
190190
integer :: id_h_diffu = -1, id_h_diffv = -1
191191
integer :: id_hf_diffu_2d = -1, id_hf_diffv_2d = -1
192192
integer :: id_intz_diffu_2d = -1, id_intz_diffv_2d = -1
193+
integer :: id_diffu_visc_rem = -1, id_diffv_visc_rem = -1
193194
integer :: id_Ah_h = -1, id_Ah_q = -1
194195
integer :: id_Kh_h = -1, id_Kh_q = -1
195196
integer :: id_GME_coeff_h = -1, id_GME_coeff_q = -1
@@ -280,6 +281,8 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
280281

281282
real, allocatable, dimension(:,:,:) :: h_diffu ! h x diffu [H L T-2 ~> m2 s-2]
282283
real, allocatable, dimension(:,:,:) :: h_diffv ! h x diffv [H L T-2 ~> m2 s-2]
284+
real, allocatable, dimension(:,:,:) :: diffu_visc_rem ! diffu x visc_rem_u [L T-2 ~> m2 s-2]
285+
real, allocatable, dimension(:,:,:) :: diffv_visc_rem ! diffv x visc_rem_v [L T-2 ~> m2 s-2]
283286

284287
real, dimension(SZIB_(G),SZJB_(G)) :: &
285288
dvdx, dudy, & ! components in the shearing strain [T-1 ~> s-1]
@@ -1704,6 +1707,25 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
17041707
deallocate(h_diffv)
17051708
endif
17061709

1710+
if (present(ADp) .and. (CS%id_diffu_visc_rem > 0)) then
1711+
allocate(diffu_visc_rem(G%IsdB:G%IedB,G%jsd:G%jed,GV%ke))
1712+
diffu_visc_rem(:,:,:) = 0.0
1713+
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
1714+
diffu_visc_rem(I,j,k) = diffu(I,j,k) * ADp%visc_rem_u(I,j,k)
1715+
enddo ; enddo ; enddo
1716+
call post_data(CS%id_diffu_visc_rem, diffu_visc_rem, CS%diag)
1717+
deallocate(diffu_visc_rem)
1718+
endif
1719+
if (present(ADp) .and. (CS%id_diffv_visc_rem > 0)) then
1720+
allocate(diffv_visc_rem(G%isd:G%ied,G%JsdB:G%JedB,GV%ke))
1721+
diffv_visc_rem(:,:,:) = 0.0
1722+
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
1723+
diffv_visc_rem(i,J,k) = diffv(i,J,k) * ADp%visc_rem_v(i,J,k)
1724+
enddo ; enddo ; enddo
1725+
call post_data(CS%id_diffv_visc_rem, diffv_visc_rem, CS%diag)
1726+
deallocate(diffv_visc_rem)
1727+
endif
1728+
17071729
end subroutine horizontal_viscosity
17081730

17091731
!> Allocates space for and calculates static variables used by horizontal_viscosity().
@@ -2448,6 +2470,20 @@ subroutine hor_visc_init(Time, G, GV, US, param_file, diag, CS, MEKE, ADp)
24482470
call safe_alloc_ptr(ADp%diag_hv,G%isd,G%ied,G%JsdB,G%JedB,GV%ke)
24492471
endif
24502472

2473+
CS%id_diffu_visc_rem = register_diag_field('ocean_model', 'diffu_visc_rem', diag%axesCuL, Time, &
2474+
'Zonal Acceleration from Horizontal Viscosity multiplied by viscous remnant', 'm2 s-2', &
2475+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
2476+
if ((CS%id_diffu_visc_rem > 0) .and. (present(ADp))) then
2477+
call safe_alloc_ptr(ADp%visc_rem_u,G%IsdB,G%IedB,G%jsd,G%jed,GV%ke)
2478+
endif
2479+
2480+
CS%id_diffv_visc_rem = register_diag_field('ocean_model', 'diffv_visc_rem', diag%axesCvL, Time, &
2481+
'Meridional Acceleration from Horizontal Viscosity multiplied by viscous remnant', 'm2 s-2', &
2482+
conversion=GV%H_to_m*US%L_T2_to_m_s2)
2483+
if ((CS%id_diffv_visc_rem > 0) .and. (present(ADp))) then
2484+
call safe_alloc_ptr(ADp%visc_rem_v,G%isd,G%ied,G%JsdB,G%JedB,GV%ke)
2485+
endif
2486+
24512487
if (CS%biharmonic) then
24522488
CS%id_Ah_h = register_diag_field('ocean_model', 'Ahh', diag%axesTL, Time, &
24532489
'Biharmonic Horizontal Viscosity at h Points', 'm4 s-1', conversion=US%L_to_m**4*US%s_to_T, &

0 commit comments

Comments
 (0)