Skip to content

Commit

Permalink
Clean up uo vo calculation
Browse files Browse the repository at this point in the history
Comment out the calculation of uo_cont within the bt step loop.
Move uo vo calculation to just after the bt accels are calculated.
  • Loading branch information
Theresa Morrison authored and Theresa Morrison committed Jan 31, 2024
1 parent 4cdf24f commit bb05814
Showing 1 changed file with 26 additions and 61 deletions.
87 changes: 26 additions & 61 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,14 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
scale=US%L_to_m**2*GV%H_to_m)
endif

! Update the surface velocity estimate
do j=js,je ; do I=is-1,ie
uo(i,j) = uo_st(i,j) + (dt*(n*dtbt/dt))*(u_accel_bt(i,j))
enddo ; enddo
do j=js-1,je ; do I=is,ie
vo(i,j) = vo_st(i,j) + (dt*(n*dtbt/dt))*(v_accel_bt(i,j))
enddo ; enddo

if (find_PF) then
!$OMP do
do j=js,je ; do I=is-1,ie
Expand Down Expand Up @@ -1965,46 +1973,15 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif
!$OMP end parallel

! update estimate of surface velocity
!do j=js,je ; do I=is,ie
!uo(i,j) = U_in(i,j,1)
!vo(i,j) = V_in(i,j,1)
!uo(i,j) = uo_st(i,j)
!vo(i,j) = vo_st(i,j)
do j=js,je ; do I=is-1,ie
!uo(i,j) = uo_st(i,j) + dt*(u_accel_bt(i,j))
!uo(i,j) = (uo_st(i,j) - ubt_st(i,j)) + ubt(i,j)
uo(i,j) = uo_st(i,j) + (dt*(n*dtbt/dt))*(u_accel_bt(i,j))
enddo ; enddo
do j=js-1,je ; do I=is,ie
!vo(i,j) = vo_st(i,j) + dt*(v_accel_bt(i,j))
!vo(i,j) = (vo_st(i,j) - vbt_st(i,j)) + vbt(i,j)
vo(i,j) = vo_st(i,j) + (dt*(n*dtbt/dt))*(v_accel_bt(i,j))
enddo ; enddo
!uo(i,j) = uo_st(i,j) + (dt*(n*dtbt/dt))*(u_accel_bt(i,j))
!vo(i,j) = vo_st(i,j) + (dt*(n*dtbt/dt))*(v_accel_bt(i,j))
!uo(i,j) = (uo_st(i,j) - ubt_st(i,j)) + ubt_sum(i,j)
!vo(i,j) = (vo_st(i,j) - vbt_st(i,j)) + vbt_sum(i,j)
!uo(i,j) = (uo_st(i,j) - ubt_st(i,j)) + ubt(i,j)
!vo(i,j) = (vo_st(i,j) - vbt_st(i,j)) + vbt(i,j)
!enddo ; enddo
! u = u + dt*( u_bc_accel + u_accel_bt )

! calculate each layer's accelerations for
call btstep_layer_accel(dt, u_accel_bt, v_accel_bt, pbce, gtot_E, gtot_W, gtot_N, gtot_S, &
e_anom, G, GV, CS, accel_layer_uo, accel_layer_vo)
!call btstep_layer_accel(dt, u_accel_bt, v_accel_bt, pbce, gtot_E, gtot_W, gtot_N, gtot_S, &
! e_anom, G, GV, CS, accel_layer_uo, accel_layer_vo)

!do j=js,je ; do I=is,ie
do j=js,je ; do I=is-1,ie
!uo_cont(i,j) = uo_st(i,j) + dt*(accel_layer_uo(i,j,1) + u_accel_bt(i,j))
uo_cont(i,j) = uo_st(i,j) + (dt*(n*dtbt/dt))*(accel_layer_uo(i,j,1) + u_accel_bt(i,j))
enddo ; enddo
do j=js-1,je ; do I=is,ie
!vo_cont(i,j) = vo_st(i,j) + dt*(accel_layer_vo(i,j,1) + v_accel_bt(i,j))
vo_cont(i,j) = vo_st(i,j) + (dt*(n*dtbt/dt))*(accel_layer_vo(i,j,1) + v_accel_bt(i,j))
enddo ; enddo
!uo(i,j) = uo_st(i,j) + (dt*(n*dt_bt/dt))*(accel_layer_u(i,j,1) + u_accel_bt(i,j))
!vo(i,j) = vo_st(i,j) + (dt*(n*dt_bt/dt))*(accel_layer_v(i,j,1) + v_accel_bt(i,j))
!do j=js,je ; do I=is-1,ie
! uo_cont(i,j) = uo_st(i,j) + (dt*(n*dtbt/dt))*(accel_layer_uo(i,j,1) + u_accel_bt(i,j))
!enddo ; enddo
!do j=js-1,je ; do I=is,ie
! vo_cont(i,j) = vo_st(i,j) + (dt*(n*dtbt/dt))*(accel_layer_vo(i,j,1) + v_accel_bt(i,j))
!enddo ; enddo

if (do_hifreq_output) then
Expand All @@ -2018,8 +1995,8 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
if (CS%id_eta_pred_hifreq > 0) call post_data(CS%id_eta_pred_hifreq, eta_PF_BT(isd:ied,jsd:jed), CS%diag)
if (CS%id_uo_hifreq > 0) call post_data(CS%id_uo_hifreq, uo(IsdB:IedB,jsd:jed), CS%diag)
if (CS%id_vo_hifreq > 0) call post_data(CS%id_vo_hifreq, vo(isd:ied,JsdB:JedB), CS%diag)
if (CS%id_uo_cont_hifreq > 0) call post_data(CS%id_uo_cont_hifreq, uo_cont(IsdB:IedB,jsd:jed), CS%diag)
if (CS%id_vo_cont_hifreq > 0) call post_data(CS%id_vo_cont_hifreq, vo_cont(isd:ied,JsdB:JedB), CS%diag)
!if (CS%id_uo_cont_hifreq > 0) call post_data(CS%id_uo_cont_hifreq, uo_cont(IsdB:IedB,jsd:jed), CS%diag)
!if (CS%id_vo_cont_hifreq > 0) call post_data(CS%id_vo_cont_hifreq, vo_cont(isd:ied,JsdB:JedB), CS%diag)
endif

if (CS%debug_bt) then
Expand Down Expand Up @@ -2165,28 +2142,16 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
call btstep_layer_accel(dt, u_accel_bt, v_accel_bt, pbce, gtot_E, gtot_W, gtot_N, gtot_S, &
e_anom, G, GV, CS, accel_layer_u, accel_layer_v)


! update estimate of surface velocity
!do j=jsv-1,jev+1 ; do I=isv-1,iev
! uo(i,j) = uo_st(i,j) + dt*(u_accel_bt(i,j))
! vo(i,j) = vo_st(i,j) + dt*(v_accel_bt(i,j))
! !uo(i,j) = (uo_st(i,j) - ubt_st(i,j)) + ubt_sum(i,j)
! !vo(i,j) = (vo_st(i,j) - vbt_st(i,j)) + vbt_sum(i,j)
! !uo(i,j) = (uo_st(i,j) - ubt_st(i,j)) + ubt(i,j)
! !vo(i,j) = (vo_st(i,j) - vbt_st(i,j)) + vbt(i,j)
!enddo ; enddo
!! u = u + dt*( u_bc_accel + u_accel_bt )
!do j=jsv-1,jev+1 ; do I=isv-1,iev
! uo_cont(i,j) = uo_st(i,j) + dt*(accel_layer_u(i,j,1) + u_accel_bt(i,j))
! vo_cont(i,j) = vo_st(i,j) + dt*(accel_layer_v(i,j,1) + v_accel_bt(i,j))
! !uo(i,j) = uo_st(i,j) + (dt*(n*dt_bt/dt))*(accel_layer_u(i,j,1) + u_accel_bt(i,j))
! !vo(i,j) = vo_st(i,j) + (dt*(n*dt_bt/dt))*(accel_layer_v(i,j,1) + v_accel_bt(i,j))
!enddo ; enddo

!!if (CS%id_uo_hifreq > 0) call post_data(CS%id_uo_hifreq, uo(IsdB:IedB,jsd:jed), CS%diag)
!!if (CS%id_vo_hifreq > 0) call post_data(CS%id_vo_hifreq, vo(isd:ied,JsdB:JedB), CS%diag)
!if (CS%id_uo_cont_hifreq > 0) call post_data(CS%id_uo_cont_hifreq, uo_cont(IsdB:IedB,jsd:jed), CS%diag)
!if (CS%id_vo_cont_hifreq > 0) call post_data(CS%id_vo_cont_hifreq, vo_cont(isd:ied,JsdB:JedB), CS%diag)
do j=js,je ; do I=is-1,ie
uo_cont(i,j) = uo_st(i,j) + dt*(accel_layer_u(i,j,1) + u_accel_bt(i,j))
enddo ; enddo
do j=js-1,je ; do I=is,ie
vo_cont(i,j) = vo_st(i,j) + dt*(accel_layer_v(i,j,1) + v_accel_bt(i,j))
enddo ; enddo

if (CS%id_uo_cont_hifreq > 0) call post_data(CS%id_uo_cont_hifreq, uo_cont(IsdB:IedB,jsd:jed), CS%diag)
if (CS%id_vo_cont_hifreq > 0) call post_data(CS%id_vo_cont_hifreq, vo_cont(isd:ied,JsdB:JedB), CS%diag)

! TJM
! The EVP function from the SIS2 model
Expand Down

0 comments on commit bb05814

Please sign in to comment.