Skip to content

Commit

Permalink
Moved calls that set OBC masks into MOM_fixed_initialization
Browse files Browse the repository at this point in the history
- Prior to this commit, OBC masks were set at the same time as
  OBC inflow data was set, and all called from MOM_state_initialization,
  which is too late to correct bathymetry etc.
- This is part of a larger OBC re-factor.
- No answer changes.
  • Loading branch information
adcroft committed Jun 14, 2016
1 parent 2d3856f commit d5efae2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 33 additions & 4 deletions src/initialization/MOM_fixed_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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"

Expand All @@ -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)
Expand Down
10 changes: 1 addition & 9 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 "//&
Expand Down

0 comments on commit d5efae2

Please sign in to comment.