Skip to content

Commit

Permalink
patches for nonBous_OBCs to prevent blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
MJHarrison-GFDL committed Oct 5, 2023
1 parent 99531a7 commit e3e8638
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/MOM_boundary_update.F90
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ subroutine update_OBC_data(OBC, G, GV, US, tv, h, CS, Time)
call shelfwave_set_OBC_data(OBC, CS%shelfwave_OBC_CSp, G, GV, US, h, Time)
if (CS%use_dyed_channel) &
call dyed_channel_update_flow(OBC, CS%dyed_channel_OBC_CSp, G, GV, US, Time)
if (OBC%needs_IO_for_data .or. OBC%add_tide_constituents) &
if (OBC%any_needs_IO_for_data .or. OBC%add_tide_constituents) &
call update_OBC_segment_data(G, GV, US, OBC, tv, h, Time)

end subroutine update_OBC_data
Expand Down
20 changes: 16 additions & 4 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ module MOM_open_boundary
logical :: update_OBC = .false. !< Is OBC data time-dependent
logical :: update_OBC_seg_data = .false. !< Is it the time for OBC segment data update for fields that
!! require less frequent update
logical :: needs_IO_for_data = .false. !< Is any i/o needed for OBCs
logical :: needs_IO_for_data = .false. !< Is any i/o needed for OBCs on the current PE
logical :: any_needs_IO_for_data = .false. !< Is any i/o needed for OBCs globally
logical :: zero_vorticity = .false. !< If True, sets relative vorticity to zero on open boundaries.
logical :: freeslip_vorticity = .false. !< If True, sets normal gradient of tangential velocity to zero
!! in the relative vorticity on open boundaries.
Expand Down Expand Up @@ -751,6 +752,7 @@ subroutine initialize_segment_data(G, GV, US, OBC, PF)
integer, dimension(1) :: single_pelist
type(external_tracers_segments_props), pointer :: obgc_segments_props_list =>NULL()
!will be able to dynamically switch between sub-sampling refined grid data or model grid
integer :: needs_IO, needs_update

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec

Expand Down Expand Up @@ -1060,6 +1062,13 @@ subroutine initialize_segment_data(G, GV, US, OBC, PF)

call Set_PElist(saved_pelist)

needs_IO=OBC%needs_IO_for_data
call sum_across_PES(needs_IO)
if (needs_IO>0) OBC%any_needs_IO_for_data=.true.
needs_update=OBC%update_OBC
call sum_across_PES(needs_update)
if (needs_update>0) OBC%update_OBC=.true.

end subroutine initialize_segment_data

!> Return an appropriate dimensional scaling factor for input data based on an OBC segment data
Expand Down Expand Up @@ -1924,7 +1933,7 @@ logical function open_boundary_query(OBC, apply_open_OBC, apply_specified_OBC, a
OBC%Flather_v_BCs_exist_globally
if (present(apply_nudged_OBC)) open_boundary_query = OBC%nudged_u_BCs_exist_globally .or. &
OBC%nudged_v_BCs_exist_globally
if (present(needs_ext_seg_data)) open_boundary_query = OBC%needs_IO_for_data
if (present(needs_ext_seg_data)) open_boundary_query = OBC%any_needs_IO_for_data

end function open_boundary_query

Expand Down Expand Up @@ -3843,8 +3852,10 @@ subroutine update_OBC_segment_data(G, GV, US, OBC, tv, h, Time)
h_neglect = GV%kg_m2_to_H * 1.0e-30 ; h_neglect_edge = GV%kg_m2_to_H * 1.0e-10
endif

if (OBC%number_of_segments >= 1) call thickness_to_dz(h, tv, dz, G, GV, US, halo_size=2)

if (OBC%number_of_segments >= 1) then
call thickness_to_dz(h, tv, dz, G, GV, US)
call pass_var(dz,G%Domain)
endif

do n = 1, OBC%number_of_segments
segment => OBC%segment(n)
Expand Down Expand Up @@ -5768,6 +5779,7 @@ subroutine rotate_OBC_config(OBC_in, G_in, OBC, G, turns)
OBC%brushcutter_mode = OBC_in%brushcutter_mode
OBC%update_OBC = OBC_in%update_OBC
OBC%needs_IO_for_data = OBC_in%needs_IO_for_data
OBC%any_needs_IO_for_data = OBC_in%any_needs_IO_for_data

OBC%ntr = OBC_in%ntr

Expand Down
8 changes: 7 additions & 1 deletion src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module MOM_state_initialization
use MOM_get_input, only : directories
use MOM_grid, only : ocean_grid_type, isPointInCell
use MOM_interface_heights, only : find_eta, dz_to_thickness, dz_to_thickness_simple
use MOM_interface_heights, only : find_col_avg_SpV
use MOM_io, only : file_exists, field_size, MOM_read_data, MOM_read_vector, slasher
use MOM_open_boundary, only : ocean_OBC_type, open_boundary_init, set_tracer_data
use MOM_open_boundary, only : OBC_NONE
Expand Down Expand Up @@ -607,8 +608,13 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
call initialize_segment_data(G, GV, US, OBC, PF)
! call open_boundary_config(G, US, PF, OBC)
! Call this once to fill boundary arrays from fixed values
if (.not. OBC%needs_IO_for_data) &
if (.not. OBC%any_needs_IO_for_data) then
if ((.not.GV%Boussinesq) .and. allocated(tv%SpV_avg)) then
call find_col_avg_SpV(h, tv%SpV_avg, tv, G, GV, US)
call pass_var(tv%SpV_avg,G%Domain)
endif
call update_OBC_segment_data(G, GV, US, OBC, tv, h, Time)
endif

call get_param(PF, mdl, "OBC_USER_CONFIG", config, &
"A string that sets how the user code is invoked to set open boundary data: \n"//&
Expand Down

0 comments on commit e3e8638

Please sign in to comment.