@@ -98,13 +98,9 @@ module MOM_barotropic
98
98
integer :: is_v_S_obc, ie_v_S_obc, Js_v_S_obc, Je_v_S_obc
99
99
integer :: is_v_N_obc, ie_v_N_obc, Js_v_N_obc, Je_v_N_obc
100
100
! >@}
101
- logical :: is_alloced = .false. ! < True if BT_OBC is in use and has been allocated
102
101
103
- type (group_pass_type) :: pass_uv ! < Structure for group halo pass
104
- type (group_pass_type) :: pass_uhvh ! < Structure for group halo pass
105
- type (group_pass_type) :: pass_h ! < Structure for group halo pass
106
- type (group_pass_type) :: pass_cg ! < Structure for group halo pass
107
- type (group_pass_type) :: pass_eta_outer ! < Structure for group halo pass
102
+ type (group_pass_type) :: pass_uv ! < Structure for group halo pass of vectors
103
+ type (group_pass_type) :: scalar_pass ! < Structure for group halo pass of scalars
108
104
end type BT_OBC_type
109
105
110
106
integer , parameter :: SPECIFIED_OBC = 1 ! < An integer used to encode a specified OBC point
@@ -212,6 +208,8 @@ module MOM_barotropic
212
208
! ! equation. Otherwise the transports are the sum of the transports
213
209
! ! based on a series of instantaneous velocities and the BT_CONT_TYPE
214
210
! ! for transports. This is only valid if a BT_CONT_TYPE is used.
211
+ logical :: integral_OBCs ! < This is true if integral_bt_cont is true and there are open boundary
212
+ ! ! conditions being applied somewhere in the global domain.
215
213
logical :: Nonlinear_continuity ! < If true, the barotropic continuity equation
216
214
! ! uses the full ocean thickness for transport.
217
215
integer :: Nonlin_cont_update_period ! < The number of barotropic time steps
@@ -1081,28 +1079,21 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
1081
1079
enddo ; enddo
1082
1080
enddo
1083
1081
1084
- if (apply_OBCs) then
1085
- do n= 1 ,OBC% number_of_segments
1086
- if (.not. OBC% segment(n)% on_pe) cycle
1087
- I = OBC% segment(n)% HI% IsdB ; J = OBC% segment(n)% HI% JsdB
1088
- if (OBC% segment(n)% is_N_or_S .and. (J >= Jsq-1 ) .and. (J <= Jeq+1 )) then
1089
- do i = max (Isq-1 ,OBC% segment(n)% HI% isd), min (Ieq+2 ,OBC% segment(n)% HI% ied)
1090
- if (OBC% segment(n)% direction == OBC_DIRECTION_N) then
1091
- gtot_S(i,j+1 ) = gtot_S(i,j) ! ### Should this be gtot_N(i,j) to use wt_v at the same point?
1092
- else ! (OBC%segment(n)%direction == OBC_DIRECTION_S)
1093
- gtot_N(i,j) = gtot_N(i,j+1 ) ! Perhaps this should be gtot_S(i,j+1)?
1094
- endif
1095
- enddo
1096
- elseif (OBC% segment(n)% is_E_or_W .and. (I >= Isq-1 ) .and. (I <= Ieq+1 )) then
1097
- do j = max (Jsq-1 ,OBC% segment(n)% HI% jsd), min (Jeq+2 ,OBC% segment(n)% HI% jed)
1098
- if (OBC% segment(n)% direction == OBC_DIRECTION_E) then
1099
- gtot_W(i+1 ,j) = gtot_W(i,j) ! Perhaps this should be gtot_E(i,j)?
1100
- else ! (OBC%segment(n)%direction == OBC_DIRECTION_W)
1101
- gtot_E(i,j) = gtot_E(i+1 ,j) ! Perhaps this should be gtot_W(i+1,j)?
1102
- endif
1103
- enddo
1104
- endif
1105
- enddo
1082
+ if (CS% BT_OBC% u_OBCs_on_PE) then
1083
+ do j= js,je ; do I= is-1 ,ie
1084
+ if (CS% BT_OBC% u_OBC_type(I,j) > 0 ) & ! Eastern boundary condition
1085
+ gtot_W(i+1 ,j) = gtot_W(i,j) ! Perhaps this should be gtot_E(i,j)?
1086
+ if (CS% BT_OBC% u_OBC_type(I,j) < 0 ) & ! Western boundary condition
1087
+ gtot_E(i,j) = gtot_E(i+1 ,j) ! Perhaps this should be gtot_W(i+1,j)?
1088
+ enddo ; enddo
1089
+ endif
1090
+ if (CS% BT_OBC% v_OBCs_on_PE) then
1091
+ do J= js-1 ,je ; do i= is,ie
1092
+ if (CS% BT_OBC% v_OBC_type(i,J) > 0 ) & ! Northern boundary condition
1093
+ gtot_S(i,j+1 ) = gtot_S(i,j) ! ### Should this be gtot_N(i,j) to use wt_v at the same point?
1094
+ if (CS% BT_OBC% v_OBC_type(i,J) < 0 ) & ! Southern boundary condition
1095
+ gtot_N(i,j) = gtot_N(i,j+1 ) ! Perhaps this should be gtot_S(i,j+1)?
1096
+ enddo ; enddo
1106
1097
endif
1107
1098
1108
1099
if (CS% calculate_SAL) then
@@ -1780,7 +1771,6 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
1780
1771
I_sum_wt_vel = 1.0 ; I_sum_wt_eta = 1.0 ; I_sum_wt_accel = 1.0 ; I_sum_wt_trans = 1.0
1781
1772
endif
1782
1773
1783
-
1784
1774
! March the barotropic solver through all of its time steps.
1785
1775
call btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL_v, eta_IC, &
1786
1776
eta_PF_1, d_eta_PF, eta_src, dyn_coef_eta, uhbtav, vhbtav, u_accel_bt, v_accel_bt, &
@@ -1789,7 +1779,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
1789
1779
eta_PF, gtot_E, gtot_W, gtot_N, gtot_S, SpV_col_avg, dgeo_de, &
1790
1780
eta_sum, eta_wtd, ubt_wtd, vbt_wtd, Coru_avg, PFu_avg, Corv_avg, PFv_avg, &
1791
1781
use_BT_cont, interp_eta_PF, find_etaav, dt, dtbt, nstep, nfilter, &
1792
- wt_vel, wt_eta, wt_accel, wt_trans, wt_accel2, OBC, CS% BT_OBC, CS, G, MS, GV, US)
1782
+ wt_vel, wt_eta, wt_accel, wt_trans, wt_accel2, CS% BT_OBC, CS, G, MS, GV, US)
1793
1783
1794
1784
1795
1785
if (id_clock_calc > 0 ) call cpu_clock_end(id_clock_calc)
@@ -2118,7 +2108,7 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
2118
2108
eta_PF , gtot_E , gtot_W , gtot_N , gtot_S , SpV_col_avg , dgeo_de , &
2119
2109
eta_sum , eta_wtd , ubt_wtd , vbt_wtd , Coru_avg , PFu_avg , Corv_avg , PFv_avg , &
2120
2110
use_BT_cont , interp_eta_PF , find_etaav , dt , dtbt , nstep , nfilter , &
2121
- wt_vel , wt_eta , wt_accel , wt_trans , wt_accel2 , OBC , BT_OBC , CS , G , MS , GV , US )
2111
+ wt_vel , wt_eta , wt_accel , wt_trans , wt_accel2 , BT_OBC , CS , G , MS , GV , US )
2122
2112
2123
2113
type (barotropic_CS), intent (inout ) :: CS ! < Barotropic control structure
2124
2114
type (ocean_grid_type), intent (inout ) :: G ! < The ocean's grid structure (inout to allow for halo updates)
@@ -2278,10 +2268,9 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
2278
2268
real , dimension (nstep+ nfilter+1 ), intent (in ) :: &
2279
2269
wt_accel2 ! < Potentially un-normalized relative weights of each of the
2280
2270
! ! barotropic timesteps in determining the average accelerations [nondim]
2281
- type (ocean_OBC_type), pointer :: OBC ! < An associated pointer to an OBC type
2282
2271
type (BT_OBC_type), intent (in ) :: BT_OBC ! < A structure with the private barotropic arrays
2283
2272
! ! related to the open boundary conditions,
2284
- ! ! set by set_up_BT_OBC
2273
+ ! ! with time evolving data stored via set_up_BT_OBC
2285
2274
type (verticalGrid_type), intent (in ) :: GV ! < The ocean's vertical grid structure
2286
2275
type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
2287
2276
@@ -2427,9 +2416,8 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
2427
2416
if (integral_BT_cont) then
2428
2417
call create_group_pass(CS% pass_eta_ubt, ubt_int, vbt_int, CS% BT_Domain)
2429
2418
! This is only needed with integral_BT_cont, OBCs and multiple barotropic steps between halo updates.
2430
- if (associated (OBC)) then ; if (open_boundary_query(OBC, apply_open_OBC = .true. ) ) &
2419
+ if (CS % integral_OBCs ) &
2431
2420
call create_group_pass(CS% pass_eta_ubt, uhbt_int, vhbt_int, CS% BT_Domain)
2432
- endif
2433
2421
endif
2434
2422
2435
2423
! The following loop contains all of the time steps.
@@ -2601,15 +2589,15 @@ subroutine btstep_timeloop(eta, ubt, vbt, uhbt0, Datu, BTCL_u, vhbt0, Datv, BTCL
2601
2589
! Apply open boundary condition considerations to revise the updated velocities and transports.
2602
2590
if (CS% BT_OBC% u_OBCs_on_PE) then
2603
2591
! $OMP single
2604
- call apply_u_velocity_OBCs(ubt, uhbt, ubt_trans, eta, SpV_col_avg, ubt_prev, CS % BT_OBC, &
2592
+ call apply_u_velocity_OBCs(ubt, uhbt, ubt_trans, eta, SpV_col_avg, ubt_prev, BT_OBC, &
2605
2593
G, MS, GV, US, CS, iev- ie, dtbt, CS% bebt, use_BT_cont, integral_BT_cont, n* dtbt, &
2606
2594
Datu, BTCL_u, uhbt0, ubt_int, ubt_int_prev, uhbt_int, uhbt_int_prev)
2607
2595
! $OMP end single
2608
2596
endif
2609
2597
2610
2598
if (CS% BT_OBC% v_OBCs_on_PE) then
2611
2599
! $OMP single
2612
- call apply_v_velocity_OBCs(vbt, vhbt, vbt_trans, eta, SpV_col_avg, vbt_prev, CS % BT_OBC, &
2600
+ call apply_v_velocity_OBCs(vbt, vhbt, vbt_trans, eta, SpV_col_avg, vbt_prev, BT_OBC, &
2613
2601
G, MS, GV, US, CS, iev- ie, dtbt, CS% bebt, use_BT_cont, integral_BT_cont, n* dtbt, &
2614
2602
Datv, BTCL_v, vhbt0, vbt_int, vbt_int_prev, vhbt_int, vhbt_int_prev)
2615
2603
! $OMP end single
@@ -3972,6 +3960,33 @@ subroutine initialize_BT_OBC(OBC, BT_OBC, G, CS)
3972
3960
BT_OBC% u_OBCs_on_PE = ((BT_OBC% Is_u_E_obc <= iedw) .or. (BT_OBC% Is_u_W_obc <= iedw))
3973
3961
BT_OBC% v_OBCs_on_PE = ((BT_OBC% is_v_N_obc <= iedw) .or. (BT_OBC% is_v_S_obc <= iedw))
3974
3962
3963
+ ! Allocate time-varying arrays that will be used for open boundary conditions.
3964
+
3965
+ ! This pair is used with either Flather or specified OBCs.
3966
+ allocate (BT_OBC% ubt_outer(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
3967
+ allocate (BT_OBC% vbt_outer(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
3968
+ call create_group_pass(BT_OBC% pass_uv, BT_OBC% ubt_outer, BT_OBC% vbt_outer, CS% BT_Domain)
3969
+
3970
+ ! This pair is only used with specified OBCs.
3971
+ allocate (BT_OBC% uhbt(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
3972
+ allocate (BT_OBC% vhbt(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
3973
+ call create_group_pass(BT_OBC% pass_uv, BT_OBC% uhbt, BT_OBC% vhbt, CS% BT_Domain)
3974
+
3975
+ if (OBC% Flather_u_BCs_exist_globally .or. OBC% Flather_v_BCs_exist_globally) then
3976
+ ! These 3 pairs are only used with Flather OBCs.
3977
+ allocate (BT_OBC% Cg_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
3978
+ allocate (BT_OBC% dZ_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
3979
+ allocate (BT_OBC% SSH_outer_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
3980
+
3981
+ allocate (BT_OBC% Cg_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
3982
+ allocate (BT_OBC% dZ_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
3983
+ allocate (BT_OBC% SSH_outer_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
3984
+
3985
+ call create_group_pass(BT_OBC% scalar_pass, BT_OBC% SSH_outer_u, BT_OBC% SSH_outer_v, CS% BT_Domain, To_All+ Scalar_Pair)
3986
+ call create_group_pass(BT_OBC% scalar_pass, BT_OBC% dZ_u, BT_OBC% dZ_v, CS% BT_Domain, To_All+ Scalar_Pair)
3987
+ call create_group_pass(BT_OBC% scalar_pass, BT_OBC% Cg_u, BT_OBC% Cg_v, CS% BT_Domain, To_All+ Scalar_Pair)
3988
+ endif
3989
+
3975
3990
end subroutine initialize_BT_OBC
3976
3991
3977
3992
! > This subroutine sets up the time-varying fields in the private structure used to apply the open
@@ -4026,32 +4041,6 @@ subroutine set_up_BT_OBC(OBC, eta, SpV_avg, BT_OBC, BT_Domain, G, GV, US, CS, MS
4026
4041
4027
4042
I_dt = 1.0 / dt_baroclinic
4028
4043
4029
- if ((isdw < isd) .or. (jsdw < jsd)) then
4030
- call MOM_error(FATAL, " set_up_BT_OBC: Open boundary conditions are not " // &
4031
- " yet fully implemented with wide barotropic halos." )
4032
- endif
4033
-
4034
- if (.not. BT_OBC% is_alloced) then
4035
- allocate (BT_OBC% Cg_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
4036
- allocate (BT_OBC% dZ_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
4037
- allocate (BT_OBC% uhbt(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
4038
- allocate (BT_OBC% ubt_outer(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
4039
- allocate (BT_OBC% SSH_outer_u(isdw-1 :iedw,jsdw:jedw), source= 0.0 )
4040
-
4041
- allocate (BT_OBC% Cg_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
4042
- allocate (BT_OBC% dZ_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
4043
- allocate (BT_OBC% vhbt(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
4044
- allocate (BT_OBC% vbt_outer(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
4045
- allocate (BT_OBC% SSH_outer_v(isdw:iedw,jsdw-1 :jedw), source= 0.0 )
4046
-
4047
- BT_OBC% is_alloced = .true.
4048
- call create_group_pass(BT_OBC% pass_uv, BT_OBC% ubt_outer, BT_OBC% vbt_outer, BT_Domain)
4049
- call create_group_pass(BT_OBC% pass_uhvh, BT_OBC% uhbt, BT_OBC% vhbt, BT_Domain)
4050
- call create_group_pass(BT_OBC% pass_eta_outer, BT_OBC% SSH_outer_u, BT_OBC% SSH_outer_v, BT_Domain,To_All+ Scalar_Pair)
4051
- call create_group_pass(BT_OBC% pass_h, BT_OBC% dZ_u, BT_OBC% dZ_v, BT_Domain,To_All+ Scalar_Pair)
4052
- call create_group_pass(BT_OBC% pass_cg, BT_OBC% Cg_u, BT_OBC% Cg_v, BT_Domain,To_All+ Scalar_Pair)
4053
- endif
4054
-
4055
4044
if (BT_OBC% u_OBCs_on_PE) then
4056
4045
if (OBC% specified_u_BCs_exist_globally) then
4057
4046
do n = 1 , OBC% number_of_segments
@@ -4158,10 +4147,8 @@ subroutine set_up_BT_OBC(OBC, eta, SpV_avg, BT_OBC, BT_Domain, G, GV, US, CS, MS
4158
4147
endif
4159
4148
4160
4149
call do_group_pass(BT_OBC% pass_uv, BT_Domain)
4161
- call do_group_pass(BT_OBC% pass_uhvh, BT_Domain)
4162
- call do_group_pass(BT_OBC% pass_eta_outer, BT_Domain)
4163
- call do_group_pass(BT_OBC% pass_h, BT_Domain)
4164
- call do_group_pass(BT_OBC% pass_cg, BT_Domain)
4150
+ if (OBC% Flather_u_BCs_exist_globally .or. OBC% Flather_v_BCs_exist_globally) &
4151
+ call do_group_pass(BT_OBC% scalar_pass, BT_Domain)
4165
4152
4166
4153
end subroutine set_up_BT_OBC
4167
4154
@@ -4174,21 +4161,18 @@ subroutine destroy_BT_OBC(BT_OBC)
4174
4161
if (allocated (BT_OBC% u_OBC_type)) deallocate (BT_OBC% u_OBC_type)
4175
4162
if (allocated (BT_OBC% v_OBC_type)) deallocate (BT_OBC% v_OBC_type)
4176
4163
4177
- if (BT_OBC% is_alloced) then
4178
- deallocate (BT_OBC% Cg_u)
4179
- deallocate (BT_OBC% dZ_u)
4180
- deallocate (BT_OBC% uhbt)
4181
- deallocate (BT_OBC% ubt_outer)
4182
- deallocate (BT_OBC% SSH_outer_u)
4164
+ if (allocated (BT_OBC% Cg_u)) deallocate (BT_OBC% Cg_u)
4165
+ if (allocated (BT_OBC% dZ_u)) deallocate (BT_OBC% dZ_u)
4166
+ if (allocated (BT_OBC% uhbt)) deallocate (BT_OBC% uhbt)
4167
+ if (allocated (BT_OBC% ubt_outer)) deallocate (BT_OBC% ubt_outer)
4168
+ if (allocated (BT_OBC% SSH_outer_u)) deallocate (BT_OBC% SSH_outer_u)
4183
4169
4184
- deallocate (BT_OBC% Cg_v)
4185
- deallocate (BT_OBC% dZ_v)
4186
- deallocate (BT_OBC% vhbt)
4187
- deallocate (BT_OBC% vbt_outer)
4188
- deallocate (BT_OBC% SSH_outer_v)
4170
+ if ( allocated (BT_OBC % Cg_v)) deallocate (BT_OBC% Cg_v)
4171
+ if ( allocated (BT_OBC % dZ_v)) deallocate (BT_OBC% dZ_v)
4172
+ if ( allocated (BT_OBC % vhbt)) deallocate (BT_OBC% vhbt)
4173
+ if ( allocated (BT_OBC % vbt_outer)) deallocate (BT_OBC% vbt_outer)
4174
+ if ( allocated (BT_OBC % SSH_outer_v)) deallocate (BT_OBC% SSH_outer_v)
4189
4175
4190
- BT_OBC% is_alloced = .false.
4191
- endif
4192
4176
end subroutine destroy_BT_OBC
4193
4177
4194
4178
! > btcalc calculates the barotropic velocities from the full velocity and
@@ -4465,7 +4449,7 @@ subroutine btcalc(h, G, GV, CS, h_u, h_v, may_use_default, OBC)
4465
4449
enddo
4466
4450
endif
4467
4451
else
4468
- call MOM_error(fatal, " btcalc encountered and OBC segment of indeterminate direction." )
4452
+ call MOM_error(fatal, " btcalc encountered an OBC segment of indeterminate direction." )
4469
4453
endif
4470
4454
enddo ; endif
4471
4455
@@ -5652,26 +5636,6 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
5652
5636
CS% IareaT_OBCmask(i,j) = CS% IareaT(i,j)
5653
5637
enddo ; enddo
5654
5638
5655
- if (associated (OBC)) then
5656
- call initialize_BT_OBC(OBC, CS% BT_OBC, G, CS)
5657
- endif
5658
-
5659
- ! Update IareaT_OBCmask so that nothing changes outside of the OBC (problem for interior OBCs only)
5660
- if (associated (OBC) .and. (.not. CS% exterior_OBC_bug)) then
5661
- if (CS% BT_OBC% u_OBCs_on_PE) then
5662
- do j= jsd,jed ; do i= isd,ied
5663
- if (CS% BT_OBC% u_OBC_type(I-1 ,j) > 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_E
5664
- if (CS% BT_OBC% u_OBC_type(I,j) < 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_W
5665
- enddo ; enddo
5666
- endif
5667
- if (CS% BT_OBC% v_OBCs_on_PE) then
5668
- do j= jsd,jed ; do i= isd,ied
5669
- if (CS% BT_OBC% v_OBC_type(i,J-1 ) > 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_N
5670
- if (CS% BT_OBC% v_OBC_type(i,J) < 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_S
5671
- enddo ; enddo
5672
- endif
5673
- endif
5674
-
5675
5639
! Note: G%IdxCu & G%IdyCv may be valid for a smaller extent than CS%IdxCu & CS%IdyCv, even without
5676
5640
! wide halos.
5677
5641
do j= G% jsd,G% jed ; do I= G% IsdB,G% IedB
@@ -5680,8 +5644,28 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
5680
5644
do J= G% JsdB,G% JedB ; do i= G% isd,G% ied
5681
5645
CS% IdyCv(i,J) = G% IdyCv(i,J) ; CS% dx_Cv(i,J) = G% dx_Cv(i,J)
5682
5646
enddo ; enddo
5683
- ! Set masks to avoid changing velocities at OBC points.
5647
+
5684
5648
if (associated (OBC)) then
5649
+ ! Set up information about the location and nature of the open boundary condition points.
5650
+ call initialize_BT_OBC(OBC, CS% BT_OBC, G, CS)
5651
+
5652
+ ! Update IareaT_OBCmask so that nothing changes outside of the OBC (problem for interior OBCs only)
5653
+ if (.not. CS% exterior_OBC_bug) then
5654
+ if (CS% BT_OBC% u_OBCs_on_PE) then
5655
+ do j= jsd,jed ; do i= isd,ied
5656
+ if (CS% BT_OBC% u_OBC_type(I-1 ,j) > 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_E
5657
+ if (CS% BT_OBC% u_OBC_type(I,j) < 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_W
5658
+ enddo ; enddo
5659
+ endif
5660
+ if (CS% BT_OBC% v_OBCs_on_PE) then
5661
+ do j= jsd,jed ; do i= isd,ied
5662
+ if (CS% BT_OBC% v_OBC_type(i,J-1 ) > 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_N
5663
+ if (CS% BT_OBC% v_OBC_type(i,J) < 0 ) CS% IareaT_OBCmask(i,j) = 0.0 ! OBC_DIRECTION_S
5664
+ enddo ; enddo
5665
+ endif
5666
+ endif
5667
+
5668
+ ! Set masks to avoid changing velocities at OBC points.
5685
5669
if (CS% BT_OBC% u_OBCs_on_PE) then
5686
5670
do j= G% jsd,G% jed ; do I= G% IsdB,G% IedB ; if (CS% BT_OBC% u_OBC_type(I,j) /= 0 ) then
5687
5671
CS% OBCmask_u(I,j) = 0.0 ; CS% IdxCu(I,j) = 0.0
@@ -5692,7 +5676,14 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
5692
5676
CS% OBCmask_v(i,J) = 0.0 ; CS% IdyCv(i,J) = 0.0
5693
5677
endif ; enddo ; enddo
5694
5678
endif
5679
+
5680
+ CS% integral_OBCs = CS% integral_BT_cont .and. open_boundary_query(OBC, apply_open_OBC= .true. )
5681
+ else ! There are no OBC points anywhere.
5682
+ CS% BT_OBC% u_OBCs_on_PE = .false.
5683
+ CS% BT_OBC% v_OBCs_on_PE = .false.
5684
+ CS% integral_OBCs = .false.
5695
5685
endif
5686
+
5696
5687
call create_group_pass(pass_static_data, CS% IareaT, CS% BT_domain, To_All)
5697
5688
call create_group_pass(pass_static_data, CS% bathyT, CS% BT_domain, To_All)
5698
5689
call create_group_pass(pass_static_data, CS% IareaT_OBCmask, CS% BT_domain, To_All)
0 commit comments