Skip to content

Commit 9023da5

Browse files
committed
Eliminate eta_PF_BT pointer in btstep_timeloop
Use two separate calls to btloop_find_PF an eta argument that depends on BT_project_velocity, thereby eliminating the need for the eta_PF_BT pointer to the eta array that will be used for the barotropic pressure force. All answers are bitwise identical and no public interfaces are changed.
1 parent 3fbbd69 commit 9023da5

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/core/MOM_barotropic.F90

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,9 +2317,6 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
23172317
eta_pred ! A predictor value of eta [H ~> m or kg m-2] like eta
23182318
real, dimension(SZIW_(CS),SZJW_(CS)) :: &
23192319
p_surf_dyn !< A dynamic surface pressure under rigid ice [L2 T-2 ~> m2 s-2]
2320-
real, dimension(:,:), pointer :: &
2321-
eta_PF_BT ! A pointer to the eta array (either eta or eta_pred) that
2322-
! determines the barotropic pressure force [H ~> m or kg m-2]
23232320
real :: wt_end ! The weighting of the final value of eta_PF [nondim]
23242321
real :: Instep ! The inverse of the number of barotropic time steps to take [nondim]
23252322
real :: trans_wt1, trans_wt2 ! The weights used to compute ubt_trans and vbt_trans [nondim]
@@ -2431,8 +2428,6 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
24312428

24322429
p_surf_dyn(:,:) = 0.0
24332430

2434-
if (CS%BT_project_velocity) then ; eta_PF_BT => eta ; else ; eta_PF_BT => eta_pred ; endif
2435-
24362431
! Set up the group pass used for halo updates within the barotropic time stepping loops.
24372432
call create_group_pass(CS%pass_eta_ubt, eta, CS%BT_Domain)
24382433
call create_group_pass(CS%pass_eta_ubt, ubt, vbt, CS%BT_Domain)
@@ -2503,9 +2498,16 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
25032498
endif
25042499

25052500
v_first = (MOD(n+G%first_direction,2)==1)
2506-
call btloop_find_PF(PFu, PFv, isv, iev, jsv, jev, eta_PF_BT, eta_PF, &
2507-
gtot_N, gtot_S, gtot_E, gtot_W, p_surf_dyn, dgeo_de, &
2508-
find_etaav, wt_accel2(n), eta_sum, v_first, G, US, CS)
2501+
2502+
if (CS%BT_project_velocity) then
2503+
call btloop_find_PF(PFu, PFv, isv, iev, jsv, jev, eta, eta_PF, &
2504+
gtot_N, gtot_S, gtot_E, gtot_W, p_surf_dyn, dgeo_de, &
2505+
find_etaav, wt_accel2(n), eta_sum, v_first, G, US, CS)
2506+
else
2507+
call btloop_find_PF(PFu, PFv, isv, iev, jsv, jev, eta_pred, eta_PF, &
2508+
gtot_N, gtot_S, gtot_E, gtot_W, p_surf_dyn, dgeo_de, &
2509+
find_etaav, wt_accel2(n), eta_sum, v_first, G, US, CS)
2510+
endif
25092511

25102512
if (v_first) then
25112513
! On odd-steps, update v first.
@@ -2734,7 +2736,12 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
27342736
if (CS%id_eta_hifreq > 0) call post_data(CS%id_eta_hifreq, eta(isd:ied,jsd:jed), CS%diag)
27352737
if (CS%id_uhbt_hifreq > 0) call post_data(CS%id_uhbt_hifreq, uhbt(IsdB:IedB,jsd:jed), CS%diag)
27362738
if (CS%id_vhbt_hifreq > 0) call post_data(CS%id_vhbt_hifreq, vhbt(isd:ied,JsdB:JedB), CS%diag)
2737-
if (CS%id_eta_pred_hifreq > 0) call post_data(CS%id_eta_pred_hifreq, eta_PF_BT(isd:ied,jsd:jed), CS%diag)
2739+
if (CS%BT_project_velocity) then
2740+
! This diagnostic is redundant in this case and should probably be omitted.
2741+
if (CS%id_eta_pred_hifreq > 0) call post_data(CS%id_eta_pred_hifreq, eta(isd:ied,jsd:jed), CS%diag)
2742+
else
2743+
if (CS%id_eta_pred_hifreq > 0) call post_data(CS%id_eta_pred_hifreq, eta_pred(isd:ied,jsd:jed), CS%diag)
2744+
endif
27382745
endif
27392746
enddo ! end of do n=1,ntimestep
27402747

@@ -5740,6 +5747,7 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
57405747
'High Frequency Barotropic zonal velocity', 'm s-1', conversion=US%L_T_to_m_s)
57415748
CS%id_vbt_hifreq = register_diag_field('ocean_model', 'vbt_hifreq', diag%axesCv1, Time, &
57425749
'High Frequency Barotropic meridional velocity', 'm s-1', conversion=US%L_T_to_m_s)
5750+
! if (.not.CS%BT_project_velocity) & ! The following diagnostic is redundant with BT_project_velocity.
57435751
CS%id_eta_pred_hifreq = register_diag_field('ocean_model', 'eta_pred_hifreq', diag%axesT1, Time, &
57445752
'High Frequency Predictor Barotropic SSH', thickness_units, conversion=GV%H_to_MKS)
57455753
CS%id_uhbt_hifreq = register_diag_field('ocean_model', 'uhbt_hifreq', diag%axesCu1, Time, &

0 commit comments

Comments
 (0)