Skip to content

Commit

Permalink
Fix hifreq BT steps diagnostics
Browse files Browse the repository at this point in the history
This commit fixes the conflicting timestamps for diagnostics at the BT
step level (do_hifreq_output=True).
Instead of the actual dtbt, a nominal time interval is used to "squeeze"
output at all nstep+nfilter steps into a time interval of a single
baroclinic timestep.
  • Loading branch information
herrwang0 authored and marshallward committed Sep 21, 2022
1 parent 4ef14d6 commit d88c58a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
real :: visc_rem ! A work variable that may equal visc_rem_[uv] [nondim]
real :: vel_prev ! The previous velocity [L T-1 ~> m s-1].
real :: dtbt ! The barotropic time step [T ~> s].
real :: dtbt_diag ! The nominal barotropic time step used in hifreq diagnostics [T ~> s].
! dtbt_diag = dt/(nstep+nfilter)
real :: bebt ! A copy of CS%bebt [nondim].
real :: be_proj ! The fractional amount by which velocities are projected
! when project_velocity is true [nondim]. For now be_proj is set
Expand Down Expand Up @@ -1694,6 +1696,8 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
if (nstep+nfilter==0 ) call MOM_error(FATAL, &
"btstep: number of barotropic step (nstep+nfilter) is 0")

dtbt_diag = dt/(nstep+nfilter)

! Set up the normalized weights for the filtered velocity.
sum_wt_vel = 0.0 ; sum_wt_eta = 0.0 ; sum_wt_accel = 0.0 ; sum_wt_trans = 0.0
allocate(wt_vel(nstep+nfilter)) ; allocate(wt_eta(nstep+nfilter))
Expand Down Expand Up @@ -2354,7 +2358,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
!$OMP end parallel

if (do_hifreq_output) then
time_step_end = time_bt_start + real_to_time(n*US%T_to_s*dtbt)
time_step_end = time_bt_start + real_to_time(n*US%T_to_s*dtbt_diag)
call enable_averages(dtbt, time_step_end, CS%diag)
if (CS%id_ubt_hifreq > 0) call post_data(CS%id_ubt_hifreq, ubt(IsdB:IedB,jsd:jed), CS%diag)
if (CS%id_vbt_hifreq > 0) call post_data(CS%id_vbt_hifreq, vbt(isd:ied,JsdB:JedB), CS%diag)
Expand Down

0 comments on commit d88c58a

Please sign in to comment.