diff --git a/src/core/MOM.F90 b/src/core/MOM.F90 index 3221d0371d..c2156d9cbf 100644 --- a/src/core/MOM.F90 +++ b/src/core/MOM.F90 @@ -1785,7 +1785,7 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in) call callTree_waypoint("restart registration complete (initialize_MOM)") call cpu_clock_begin(id_clock_MOM_init) - call MOM_initialize_fixed(G, param_file, write_geom_files, dirs%output_directory) + call MOM_initialize_fixed(G, CS%OBC, param_file, write_geom_files, dirs%output_directory) call callTree_waypoint("returned from MOM_initialize_fixed() (initialize_MOM)") call MOM_initialize_coord(GV, param_file, write_geom_files, & dirs%output_directory, CS%tv, G%max_depth) diff --git a/src/initialization/MOM_fixed_initialization.F90 b/src/initialization/MOM_fixed_initialization.F90 index 5ebe25a844..1d762e7376 100644 --- a/src/initialization/MOM_fixed_initialization.F90 +++ b/src/initialization/MOM_fixed_initialization.F90 @@ -18,9 +18,10 @@ module MOM_fixed_initialization use MOM_io, only : slasher, vardesc, write_field, var_desc use MOM_io, only : EAST_FACE, NORTH_FACE use MOM_grid_initialize, only : initialize_masks, set_grid_metrics +use MOM_open_boundary, only : ocean_OBC_type use MOM_string_functions, only : uppercase -use user_initialization, only : user_initialize_topography -use DOME_initialization, only : DOME_initialize_topography +use user_initialization, only : user_initialize_topography, USER_set_OBC_positions +use DOME_initialization, only : DOME_initialize_topography, DOME_set_OBC_positions use ISOMIP_initialization, only : ISOMIP_initialize_topography use benchmark_initialization, only : benchmark_initialize_topography use DOME2d_initialization, only : DOME2d_initialize_topography @@ -43,8 +44,9 @@ module MOM_fixed_initialization ! ----------------------------------------------------------------------------- !> MOM_initialize_fixed sets up time-invariant quantities related to MOM6's !! horizontal grid, bathymetry, and the Coriolis parameter. -subroutine MOM_initialize_fixed(G, PF, write_geom, output_dir) +subroutine MOM_initialize_fixed(G, OBC, PF, write_geom, output_dir) type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure. + type(ocean_OBC_type), pointer :: OBC !< Open boundary structure. type(param_file_type), intent(in) :: PF !< A structure indicating the open file !! to parse for model parameter values. logical, intent(in) :: write_geom !< If true, write grid geometry files. @@ -53,7 +55,7 @@ subroutine MOM_initialize_fixed(G, PF, write_geom, output_dir) ! Local character(len=200) :: inputdir ! The directory where NetCDF input files are. character(len=200) :: config - logical :: debug + logical :: debug, apply_OBC_u, apply_OBC_v ! This include declares and sets the variable "version". #include "version_variable.h" @@ -78,6 +80,33 @@ subroutine MOM_initialize_fixed(G, PF, write_geom, output_dir) ! masks, and Coriolis parameter. ! ==================================================================== +! Determine the position of any open boundaries + call get_param(PF, mod, "APPLY_OBC_U", apply_OBC_u, & + "If true, open boundary conditions may be set at some \n"//& + "u-points, with the configuration controlled by OBC_CONFIG", & + default=.false.) + call get_param(PF, mod, "APPLY_OBC_V", apply_OBC_v, & + "If true, open boundary conditions may be set at some \n"//& + "v-points, with the configuration controlled by OBC_CONFIG", & + default=.false.) + if (apply_OBC_u .or. apply_OBC_v) then + call get_param(PF, mod, "OBC_CONFIG", config, & + "A string that sets how the open boundary conditions are \n"//& + " configured: \n"//& + " \t DOME - use a slope and channel configuration for the \n"//& + " \t\t DOME sill-overflow test case. \n"//& + " \t USER - call a user modified routine.", default="file", & + fail_if_missing=.true.) + select case ( trim(config) ) + case ("none") + case ("DOME") ; call DOME_set_OBC_positions(G, PF, OBC) + case ("USER") ; call user_set_OBC_positions(G, PF, OBC) + case default ; call MOM_error(FATAL, "MOM_initialize_fixed: "// & + "The open boundary positions specified by OBC_CONFIG="//& + trim(config)//" have not been fully implemented.") + end select + endif + ! This call sets seamasks that prohibit flow over any point with ! ! a bottom that is shallower than min_depth from PF. ! call initialize_masks(G, PF) diff --git a/src/initialization/MOM_state_initialization.F90 b/src/initialization/MOM_state_initialization.F90 index 7bda870db3..a846988fde 100644 --- a/src/initialization/MOM_state_initialization.F90 +++ b/src/initialization/MOM_state_initialization.F90 @@ -433,18 +433,10 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, PF, dirs, & "v-points, with the configuration controlled by OBC_CONFIG", & default=.false.) if (apply_OBC_u .or. apply_OBC_v) then - call get_param(PF, mod, "OBC_CONFIG", config, & - "A string that sets how the open boundary conditions are \n"//& - " configured: \n"//& - " \t DOME - use a slope and channel configuration for the \n"//& - " \t\t DOME sill-overflow test case. \n"//& - " \t USER - call a user modified routine.", default="file", & - fail_if_missing=.true.) + call get_param(PF, mod, "OBC_CONFIG", config, fail_if_missing=.true., do_not_log=.true.) if (trim(config) == "DOME") then - call DOME_set_OBC_positions(G, PF, OBC) call DOME_set_OBC_data(OBC, tv, G, GV, PF, tracer_Reg) elseif (trim(config) == "USER") then - call user_set_OBC_positions(G, PF, OBC) call user_set_OBC_data(OBC, tv, G, PF, tracer_Reg) else call MOM_error(FATAL, "The open boundary conditions specified by "//&