Skip to content

Commit

Permalink
+Adding more halo points to an exchange
Browse files Browse the repository at this point in the history
 - This will change answers if you start with a non-zero velocity.
   You need three halo points (or maybe cont_stencil) for the
   continuity solver.
 - Also trying to put in some initial DEBUG_OBC code.
  • Loading branch information
kshedstrom committed Oct 27, 2023
1 parent 39464db commit 0dc317e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3013,10 +3013,10 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
call cpu_clock_begin(id_clock_pass_init)
call create_group_pass(tmp_pass_uv_T_S_h, CS%u, CS%v, G%Domain)
if (use_temperature) then
call create_group_pass(tmp_pass_uv_T_S_h, CS%tv%T, G%Domain, halo=1)
call create_group_pass(tmp_pass_uv_T_S_h, CS%tv%S, G%Domain, halo=1)
call create_group_pass(tmp_pass_uv_T_S_h, CS%tv%T, G%Domain, halo=3)
call create_group_pass(tmp_pass_uv_T_S_h, CS%tv%S, G%Domain, halo=3)
endif
call create_group_pass(tmp_pass_uv_T_S_h, CS%h, G%Domain, halo=1)
call create_group_pass(tmp_pass_uv_T_S_h, CS%h, G%Domain, halo=3)
call do_group_pass(tmp_pass_uv_T_S_h, G%Domain)
call cpu_clock_end(id_clock_pass_init)

Expand Down
50 changes: 38 additions & 12 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ module MOM_open_boundary
use MOM_array_transform, only : allocate_rotated_array
use MOM_coms, only : sum_across_PEs, Set_PElist, Get_PElist, PE_here, num_PEs
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end, CLOCK_ROUTINE
use MOM_debugging, only : hchksum, uvchksum
use MOM_diag_mediator, only : diag_ctrl, time_type
use MOM_domains, only : pass_var, pass_vector
use MOM_domains, only : create_group_pass, do_group_pass, group_pass_type
use MOM_domains, only : To_All, EAST_FACE, NORTH_FACE, SCALAR_PAIR, CGRID_NE, CORNER
use MOM_dyn_horgrid, only : dyn_horgrid_type
use MOM_error_handler, only : MOM_mesg, MOM_error, FATAL, WARNING, NOTE, is_root_pe
use MOM_file_parser, only : get_param, log_version, param_file_type, log_param
use MOM_grid, only : ocean_grid_type, hor_index_type
use MOM_dyn_horgrid, only : dyn_horgrid_type
use MOM_interface_heights, only : thickness_to_dz
use MOM_interpolate, only : init_external_field, time_interp_external, time_interp_external_init
use MOM_interpolate, only : external_field
use MOM_io, only : slasher, field_size, SINGLE_FILE
use MOM_io, only : vardesc, query_vardesc, var_desc
use MOM_obsolete_params, only : obsolete_logical, obsolete_int, obsolete_real, obsolete_char
use MOM_regridding, only : regridding_CS
use MOM_remapping, only : remappingSchemesDoc, remappingDefaultScheme, remapping_CS
use MOM_remapping, only : initialize_remapping, remapping_core_h, end_remapping
use MOM_restart, only : register_restart_field, register_restart_pair
use MOM_restart, only : query_initialized, MOM_restart_CS
use MOM_obsolete_params, only : obsolete_logical, obsolete_int, obsolete_real, obsolete_char
use MOM_string_functions, only : extract_word, remove_spaces, uppercase
use MOM_string_functions, only : extract_word, remove_spaces, uppercase, lowercase
use MOM_tidal_forcing, only : astro_longitudes, astro_longitudes_init, eq_phase, nodal_fu, tidal_frequency
use MOM_time_manager, only : set_date, time_type, time_type_to_real, operator(-)
use MOM_tracer_registry, only : tracer_type, tracer_registry_type, tracer_name_lookup
use MOM_interpolate, only : init_external_field, time_interp_external, time_interp_external_init
use MOM_interpolate, only : external_field
use MOM_remapping, only : remappingSchemesDoc, remappingDefaultScheme, remapping_CS
use MOM_remapping, only : initialize_remapping, remapping_core_h, end_remapping
use MOM_regridding, only : regridding_CS
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : thermo_var_ptrs
use MOM_verticalGrid, only : verticalGrid_type
use MOM_string_functions, only : lowercase

implicit none ; private

Expand Down Expand Up @@ -528,13 +528,15 @@ subroutine open_boundary_config(G, US, param_file, OBC)
OBC%add_tide_constituents = .false.
endif

call get_param(param_file, mdl, "DEBUG", OBC%debug, default=.false.)
call get_param(param_file, mdl, "DEBUG_OBC", debug_OBC, default=.false.)
if (debug_OBC .or. OBC%debug) &
call get_param(param_file, mdl, "DEBUG", debug_OBC, default=.false.)
call get_param(param_file, mdl, "DEBUG_OBC", debug_OBC, default=debug_OBC)
if (debug_OBC) then
call log_param(param_file, mdl, "DEBUG_OBC", debug_OBC, &
"If true, do additional calls to help debug the performance "//&
"of the open boundary condition code.", default=.false., &
debuggingParam=.true.)
OBC%debug = debug_OBC
endif

call get_param(param_file, mdl, "OBC_SILLY_THICK", OBC%silly_h, &
"A silly value of thicknesses used outside of open boundary "//&
Expand Down Expand Up @@ -2224,6 +2226,7 @@ subroutine radiation_open_bdry_conds(OBC, u_new, u_old, v_new, v_old, G, GV, US,
type(OBC_segment_type), pointer :: segment => NULL()
integer :: i, j, k, is, ie, js, je, m, nz, n
integer :: is_obc, ie_obc, js_obc, je_obc
logical :: sym

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

Expand Down Expand Up @@ -3298,6 +3301,29 @@ subroutine radiation_open_bdry_conds(OBC, u_new, u_old, v_new, v_old, G, GV, US,

call pass_vector(u_new, v_new, G%Domain, clock=id_clock_pass)

if (OBC%debug) then
sym = G%Domain%symmetric
if (OBC%radiation_BCs_exist_globally) then
call uvchksum("radiation_open_bdry_conds: OBC%r[xy]_normal", OBC%rx_normal, OBC%ry_normal, G%HI, &
haloshift=0, symmetric=sym, scale=1.0)
endif
if (OBC%oblique_BCs_exist_globally) then
call uvchksum("radiation_open_bdry_conds: OBC%r[xy]_oblique_[uv]", OBC%rx_oblique_u, OBC%ry_oblique_v, G%HI, &
haloshift=0, symmetric=sym, scale=1.0/US%L_T_to_m_s**2)
call uvchksum("radiation_open_bdry_conds: OBC%r[yx]_oblique_[uv]", OBC%ry_oblique_u, OBC%rx_oblique_v, G%HI, &
haloshift=0, symmetric=sym, scale=1.0/US%L_T_to_m_s**2)
call uvchksum("radiation_open_bdry_conds: OBC%cff_normal_[uv]", OBC%cff_normal_u, OBC%cff_normal_v, G%HI, &
haloshift=0, symmetric=sym, scale=1.0/US%L_T_to_m_s**2)
if (OBC%ntr == 0) return
do m=1,OBC%ntr
! write(var_name_x,'("tres_x_",I3.3)') m
! write(var_name_y,'("tres_y_",I3.3)') m
call uvchksum("radiation_open_bdry_conds: OBC%tres_[xy]", OBC%tres_x(:,:,:,m), OBC%tres_y(:,:,:,m), G%HI, &
haloshift=0, symmetric=sym, scale=1.0)
enddo
endif
endif

end subroutine radiation_open_bdry_conds

!> Applies OBC values stored in segments to 3d u,v fields
Expand Down
4 changes: 2 additions & 2 deletions src/framework/MOM_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ end subroutine register_restart_field_0d


!> query_initialized_name determines whether a named field has been successfully
!! read from a restart file or has otherwise been recored as being initialzed.
!! read from a restart file or has otherwise been recorded as being initialized.
function query_initialized_name(name, CS) result(query_initialized)
character(len=*), intent(in) :: name !< The name of the field that is being queried
type(MOM_restart_CS), intent(in) :: CS !< MOM restart control struct
Expand Down Expand Up @@ -1271,7 +1271,7 @@ subroutine only_read_restart_pair_3d(a_ptr, b_ptr, a_name, b_name, G, CS, &

end subroutine only_read_restart_pair_3d

!> Return an indicationof whether the named variable is the restart files, and provie the full path
!> Return an indication of whether the named variable is in the restart files, and provide the full path
!! to the restart file in which a variable is found.
function find_var_in_restart_files(varname, G, CS, file_path, filename, directory, is_global) result (found)
character(len=*), intent(in) :: varname !< The variable name to be used in the restart file
Expand Down

0 comments on commit 0dc317e

Please sign in to comment.