Skip to content

Commit

Permalink
Merge pull request #1 from adcroft/user/aja/move_obctype_to_open_boun…
Browse files Browse the repository at this point in the history
…dary_module

Move ocean_OBC_type into MOM_open_boundary.F90
  • Loading branch information
kshedstrom authored Jun 14, 2016
2 parents 73c725d + 2db5e11 commit ead182e
Show file tree
Hide file tree
Showing 38 changed files with 169 additions and 180 deletions.
3 changes: 2 additions & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module MOM

! This file is part of MOM6. See LICENSE.md for the license.

use MOM_variables, only : vertvisc_type, ocean_OBC_type
use MOM_variables, only : vertvisc_type
use MOM_open_boundary, only : ocean_OBC_type

! A Structure with pointers to forcing fields to drive MOM;
! all fluxes are positive downward.
Expand Down
6 changes: 3 additions & 3 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ module MOM_barotropic
use MOM_grid, only : ocean_grid_type
use MOM_hor_index, only : hor_index_type
use MOM_io, only : vardesc, var_desc
use MOM_open_boundary, only : ocean_OBC_type, OBC_SIMPLE, OBC_NONE
use MOM_open_boundary, only : OBC_FLATHER_E, OBC_FLATHER_W
use MOM_open_boundary, only : OBC_FLATHER_N, OBC_FLATHER_S
use MOM_restart, only : register_restart_field, query_initialized, MOM_restart_CS
use MOM_tidal_forcing, only : tidal_forcing_sensitivity, tidal_forcing_CS
use MOM_time_manager, only : time_type, set_time, operator(+), operator(-)
use MOM_variables, only : BT_cont_type, alloc_bt_cont_type
use MOM_variables, only : ocean_OBC_type, OBC_SIMPLE, OBC_NONE
use MOM_variables, only : OBC_FLATHER_E, OBC_FLATHER_W
use MOM_variables, only : OBC_FLATHER_N, OBC_FLATHER_S
use MOM_verticalGrid, only : verticalGrid_type

implicit none ; private
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM_continuity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ module MOM_continuity
use MOM_file_parser, only : get_param, log_version, param_file_type
use MOM_string_functions, only : uppercase
use MOM_grid, only : ocean_grid_type
use MOM_variables, only : ocean_OBC_type, BT_cont_type
use MOM_open_boundary, only : ocean_OBC_type
use MOM_variables, only : BT_cont_type
use MOM_verticalGrid, only : verticalGrid_type

implicit none ; private
Expand Down
5 changes: 3 additions & 2 deletions src/core/MOM_continuity_PPM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ module MOM_continuity_PPM
use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe
use MOM_file_parser, only : get_param, log_version, param_file_type
use MOM_grid, only : ocean_grid_type
use MOM_variables, only : ocean_OBC_type, BT_cont_type, OBC_SIMPLE
use MOM_variables, only : OBC_FLATHER_E, OBC_FLATHER_W, OBC_FLATHER_N, OBC_FLATHER_S
use MOM_open_boundary, only : ocean_OBC_type, OBC_SIMPLE
use MOM_open_boundary, only : OBC_FLATHER_E, OBC_FLATHER_W, OBC_FLATHER_N, OBC_FLATHER_S
use MOM_variables, only : BT_cont_type
use MOM_verticalGrid, only : verticalGrid_type

implicit none ; private
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM_dynamics_legacy_split.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ module MOM_dynamics_legacy_split
!********+*********+*********+*********+*********+*********+*********+**


use MOM_variables, only : vertvisc_type, ocean_OBC_type, thermo_var_ptrs
use MOM_open_boundary, only : ocean_OBC_type
use MOM_variables, only : vertvisc_type, thermo_var_ptrs
use MOM_variables, only : BT_cont_type, alloc_bt_cont_type, dealloc_bt_cont_type
use MOM_variables, only : accel_diag_ptrs, ocean_internal_state, cont_diag_ptrs
use MOM_forcing_type, only : forcing
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module MOM_dynamics_split_RK2

! This file is part of MOM6. See LICENSE.md for the license.

use MOM_variables, only : vertvisc_type, ocean_OBC_type, thermo_var_ptrs
use MOM_variables, only : vertvisc_type, thermo_var_ptrs
use MOM_variables, only : BT_cont_type, alloc_bt_cont_type, dealloc_bt_cont_type
use MOM_variables, only : accel_diag_ptrs, ocean_internal_state, cont_diag_ptrs
use MOM_forcing_type, only : forcing
Expand Down Expand Up @@ -45,6 +45,7 @@ module MOM_dynamics_split_RK2
use MOM_interface_heights, only : find_eta
use MOM_lateral_mixing_coeffs, only : VarMix_CS
use MOM_MEKE_types, only : MEKE_type
use MOM_open_boundary, only : ocean_OBC_type
use MOM_open_boundary, only : Radiation_Open_Bdry_Conds, open_boundary_init
use MOM_open_boundary, only : open_boundary_CS
use MOM_PressureForce, only : PressureForce, PressureForce_init, PressureForce_CS
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM_dynamics_unsplit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module MOM_dynamics_unsplit
!********+*********+*********+*********+*********+*********+*********+**


use MOM_variables, only : vertvisc_type, ocean_OBC_type, thermo_var_ptrs
use MOM_variables, only : vertvisc_type, thermo_var_ptrs
use MOM_variables, only : accel_diag_ptrs, ocean_internal_state, cont_diag_ptrs
use MOM_forcing_type, only : forcing
use MOM_checksum_packages, only : MOM_thermo_chksum, MOM_state_chksum, MOM_accel_chksum
Expand Down Expand Up @@ -102,6 +102,7 @@ module MOM_dynamics_unsplit
use MOM_interface_heights, only : find_eta
use MOM_lateral_mixing_coeffs, only : VarMix_CS
use MOM_MEKE_types, only : MEKE_type
use MOM_open_boundary, only : ocean_OBC_type
use MOM_open_boundary, only : Radiation_Open_Bdry_Conds, open_boundary_init
use MOM_open_boundary, only : open_boundary_CS
use MOM_PressureForce, only : PressureForce, PressureForce_init, PressureForce_CS
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM_dynamics_unsplit_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module MOM_dynamics_unsplit_RK2
!* *
!********+*********+*********+*********+*********+*********+*********+**

use MOM_variables, only : vertvisc_type, ocean_OBC_type, thermo_var_ptrs
use MOM_variables, only : vertvisc_type, thermo_var_ptrs
use MOM_variables, only : ocean_internal_state, accel_diag_ptrs, cont_diag_ptrs
use MOM_forcing_type, only : forcing
use MOM_checksum_packages, only : MOM_thermo_chksum, MOM_state_chksum, MOM_accel_chksum
Expand Down Expand Up @@ -100,6 +100,7 @@ module MOM_dynamics_unsplit_RK2
use MOM_hor_visc, only : horizontal_viscosity, hor_visc_init, hor_visc_CS
use MOM_lateral_mixing_coeffs, only : VarMix_CS
use MOM_MEKE_types, only : MEKE_type
use MOM_open_boundary, only : ocean_OBC_type
use MOM_open_boundary, only : Radiation_Open_Bdry_Conds, open_boundary_init
use MOM_open_boundary, only : open_boundary_CS
use MOM_PressureForce, only : PressureForce, PressureForce_init, PressureForce_CS
Expand Down
6 changes: 3 additions & 3 deletions src/core/MOM_legacy_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ module MOM_legacy_barotropic
use MOM_grid, only : ocean_grid_type
use MOM_hor_index, only : hor_index_type
use MOM_io, only : vardesc, var_desc
use MOM_open_boundary, only : ocean_OBC_type, OBC_SIMPLE, OBC_NONE
use MOM_open_boundary, only : OBC_FLATHER_E, OBC_FLATHER_W
use MOM_open_boundary, only : OBC_FLATHER_N, OBC_FLATHER_S
use MOM_restart, only : register_restart_field, query_initialized, MOM_restart_CS
use MOM_tidal_forcing, only : tidal_forcing_sensitivity, tidal_forcing_CS
use MOM_time_manager, only : time_type, set_time, operator(+), operator(-)
use MOM_variables, only : BT_cont_type, alloc_bt_cont_type
use MOM_variables, only : ocean_OBC_type, OBC_SIMPLE, OBC_NONE
use MOM_variables, only : OBC_FLATHER_E, OBC_FLATHER_W
use MOM_variables, only : OBC_FLATHER_N, OBC_FLATHER_S
use MOM_verticalGrid, only : verticalGrid_type

implicit none ; private
Expand Down
173 changes: 99 additions & 74 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
@@ -1,90 +1,106 @@
!> Controls where open boundary conditions are applied
module MOM_open_boundary
!***********************************************************************
!* GNU General Public License *
!* This file is a part of MOM. *
!* *
!* MOM is free software; you can redistribute it and/or modify it and *
!* are expected to follow the terms of the GNU General Public License *
!* as published by the Free Software Foundation; either version 2 of *
!* the License, or (at your option) any later version. *
!* *
!* MOM is distributed in the hope that it will be useful, but WITHOUT *
!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
!* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public *
!* License for more details. *
!* *
!* For the full text of the GNU General Public License, *
!* write to: Free Software Foundation, Inc., *
!* 675 Mass Ave, Cambridge, MA 02139, USA. *
!* or see: http://www.gnu.org/licenses/gpl.html *
!***********************************************************************

!********+*********+*********+*********+*********+*********+*********+**
!* *
!* By Mehmet Ilicak and Robert Hallberg, 2010 *
!* *
!* This module implements some aspects of internal open boundary *
!* conditions in MOM. *
!* *
!* A small fragment of the grid is shown below: *
!* *
!* j+1 x ^ x ^ x At x: q, CoriolisBu *
!* j+1 > o > o > At ^: v, tauy *
!* j x ^ x ^ x At >: u, taux *
!* j > o > o > At o: h, bathyT, buoy, tr, T, S, Rml, ustar *
!* j-1 x ^ x ^ x *
!* i-1 i i+1 At x & ^: *
!* i i+1 At > & o: *
!* *
!* The boundaries always run through q grid points (x). *
!* *
!********+*********+*********+*********+*********+*********+*********+**

use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end, CLOCK_ROUTINE
use MOM_diag_mediator, only : diag_ctrl, time_type
use MOM_domains, only : pass_var, pass_vector
use MOM_error_handler, only : MOM_mesg, MOM_error, FATAL, WARNING
use MOM_file_parser, only : get_param, log_version, param_file_type
use MOM_grid, only : ocean_grid_type
use MOM_variables, only : ocean_OBC_type, OBC_NONE, OBC_SIMPLE
use MOM_variables, only : OBC_FLATHER_E, OBC_FLATHER_W, OBC_FLATHER_N, OBC_FLATHER_S

implicit none ; private

#include <MOM_memory.h>

public Radiation_Open_Bdry_Conds, open_boundary_init, open_boundary_end

!> The control structure for open-boundaries
type, public :: open_boundary_CS ; private
real :: gamma_uv ! The relative weighting for the baroclinic radiation
! velocities (or speed of characteristics) at the
! new time level (1) or the running mean (0) for velocities.
! Valid values range from 0 to 1, with a default of 0.3.
real :: gamma_h ! The relative weighting for the baroclinic radiation
! velocities (or speed of characteristics) at the
! new time level (1) or the running mean (0) for thicknesses.
! Valid values range from 0 to 1, with a default of 0.2.
real :: rx_max ! The maximum magnitude of the baroclinic radiation
! velocity (or speed of characteristics), in m s-1. The
! default value is 10 m s-1.
real :: gamma_uv !< The relative weighting for the baroclinic radiation
!! velocities (or speed of characteristics) at the
!! new time level (1) or the running mean (0) for velocities.
!! Valid values range from 0 to 1, with a default of 0.3.
real :: gamma_h !< The relative weighting for the baroclinic radiation
!! velocities (or speed of characteristics) at the
!! new time level (1) or the running mean (0) for thicknesses.
!! Valid values range from 0 to 1, with a default of 0.2.
real :: rx_max !< The maximum magnitude of the baroclinic radiation
!! velocity (or speed of characteristics), in m s-1. The
!! default value is 10 m s-1.
end type open_boundary_CS

integer, parameter, public :: OBC_NONE = 0, OBC_SIMPLE = 1, OBC_WALL = 2
integer, parameter, public :: OBC_FLATHER_E = 4, OBC_FLATHER_W = 5
integer, parameter, public :: OBC_FLATHER_N = 6, OBC_FLATHER_S = 7

!> Open-boundary data
type, public :: ocean_OBC_type
logical :: apply_OBC_u_flather_east = .false. !< True if any zonal velocity points in the
!! local domain use east-facing Flather OBCs.
logical :: apply_OBC_u_flather_west = .false. !< True if any zonal velocity points in the
!! local domain use west-facing Flather OBCs.
logical :: apply_OBC_v_flather_north = .false. !< True if any zonal velocity points in the
!! local domain use north-facing Flather OBCs.
logical :: apply_OBC_v_flather_south = .false. !< True if any zonal velocity points in the
!! local domain use south-facing Flather OBCs.
logical :: apply_OBC_u = .false. !< True if any zonal velocity points in to local domain use OBCs.
logical :: apply_OBC_v = .false. !< True if any meridional velocity points in to local domain use OBCs.
logical, pointer, dimension(:,:) :: &
OBC_mask_u => NULL(), & !< True at zonal velocity points that have prescribed OBCs.
OBC_mask_v => NULL() !< True at meridional velocity points that have prescribed OBCs.
! These arrays indicate the kind of open boundary conditions that are to be applied at the u and v
! points, and can be OBC_NONE, OBC_SIMPLE, OBC_WALL, or one of OBC_FLATHER_[EWNS]. Generally these
! should be consistent with OBC_mask_[uv], with OBC_mask_[uv] .false. for OBC_kind_[uv] = NONE
! and true for all other values.
integer, pointer, dimension(:,:) :: &
OBC_kind_u => NULL(), & !< Type of OBC at u-points.
OBC_kind_v => NULL() !< Type of OBC at v-points.
! The following apply at points with OBC_kind_[uv] = OBC_FLATHER_x.
real, pointer, dimension(:,:,:) :: &
rx_old_u => NULL(), & !< The rx_old_u value for radiation coeff for u-velocity in x-direction
ry_old_v => NULL(), & !< The ry_old_v value for radiation coeff for v-velocity in y-direction
rx_old_h => NULL(), & !< The rx_old_h value for radiation coeff for layer thickness h in x-direction
ry_old_h => NULL() !< The ry_old_h value for radiation coeff for layer thickness h in y-direction

! The following can be used to specify the outer-domain values of the
! surface height and barotropic velocity. If these are not allocated, the
! default with Flather boundary conditions is the same as if they were
! filled with zeros. With simple OBCs, these should not be allocated.
real, pointer, dimension(:,:) :: &
ubt_outer => NULL(), & !< The u-velocity in the outer domain, in m s-1.
vbt_outer => NULL(), & !< The v-velocity in the outer domain, in m s-1.
eta_outer_u => NULL(), & !< The SSH anomaly in the outer domain, in m or kg m-2.
eta_outer_v => NULL() !< The SSH anomaly in the outer domain, in m or kg m-2.

! The following apply at points with OBC_kind_[uv] = OBC_SIMPLE.
real, pointer, dimension(:,:,:) :: &
u => NULL(), & !< The prescribed values of the zonal velocity (u) at OBC points.
v => NULL(), & !< The prescribed values of the meridional velocity (v) at OBC points.
uh => NULL(), & !< The prescribed values of the zonal volume transport (uh) at OBC points.
vh => NULL() !< The prescribed values of the meridional volume transport (vh) at OBC points.
end type ocean_OBC_type

integer :: id_clock_pass

character(len=40) :: mod = "MOM_open_boundary" ! This module's name.
! This include declares and sets the variable "version".
#include "version_variable.h"

contains

!> Diagnose radiation conditions at open boundaries
subroutine Radiation_Open_Bdry_Conds(OBC, u_new, u_old, v_new, v_old, &
h_new, h_old, G, CS)
type(ocean_grid_type), intent(inout) :: G
type(ocean_OBC_type), pointer :: OBC
type(ocean_grid_type), intent(inout) :: G !< Ocean grid structure
type(ocean_OBC_type), pointer :: OBC !< Open boundary data
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(inout) :: u_new
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u_old
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(inout) :: v_new
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v_old
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: h_new
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(in) :: h_old
type(open_boundary_CS), pointer :: CS

type(open_boundary_CS), pointer :: CS !< Open boundary control structure
! Local variables
real :: dhdt, dhdx, gamma_u, gamma_h, gamma_v
real :: rx_max, ry_max ! coefficients for radiation
real :: rx_new, rx_avg ! coefficients for radiation
Expand Down Expand Up @@ -189,26 +205,18 @@ subroutine Radiation_Open_Bdry_Conds(OBC, u_new, u_old, v_new, v_old, &

end subroutine Radiation_Open_Bdry_Conds

!> Initialize open boundary control structure
subroutine open_boundary_init(Time, G, param_file, diag, CS)
type(time_type), target, intent(in) :: Time
type(ocean_grid_type), intent(in) :: G
type(param_file_type), intent(in) :: param_file
type(diag_ctrl), target, intent(inout) :: diag
type(open_boundary_CS), pointer :: CS
! Arguments: Time - The current model time.
! (in) G - The ocean's grid structure.
! (in) param_file - A structure indicating the open file to parse for
! model parameter values.
! (in) diag - A structure that is used to regulate diagnostic output.
! (in/out) CS - A pointer that is set to point to the control structure
! for this module
! This include declares and sets the variable "version".
#include "version_variable.h"
character(len=40) :: mod = "MOM_open_boundary" ! This module's name.
type(time_type), target, intent(in) :: Time !< Current model time
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(param_file_type), intent(in) :: param_file !< Parameter file handle
type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure
type(open_boundary_CS), pointer :: CS !< Open boundary control structure
! Local variables
logical :: flather_east, flather_west, flather_north, flather_south

if (associated(CS)) then
call MOM_error(WARNING, "continuity_init called with associated control structure.")
call MOM_error(WARNING, "MOM_open_boundary: open_boundary_init called with associated control structure.")
return
endif

Expand Down Expand Up @@ -257,9 +265,26 @@ subroutine open_boundary_init(Time, G, param_file, diag, CS)

end subroutine open_boundary_init

!> Deallocate open boundary data
subroutine open_boundary_end(CS)
type(open_boundary_CS), pointer :: CS
type(open_boundary_CS), pointer :: CS !< Open boundary control structure
deallocate(CS)
end subroutine open_boundary_end

!> \namespace mom_open_boundary
!! This module implements some aspects of internal open boundary
!! conditions in MOM.
!!
!! A small fragment of the grid is shown below:
!!
!! j+1 x ^ x ^ x At x: q, CoriolisBu
!! j+1 > o > o > At ^: v, tauy
!! j x ^ x ^ x At >: u, taux
!! j > o > o > At o: h, bathyT, buoy, tr, T, S, Rml, ustar
!! j-1 x ^ x ^ x
!! i-1 i i+1 At x & ^:
!! i i+1 At > & o:
!!
!! The boundaries always run through q grid points (x).

end module MOM_open_boundary
Loading

0 comments on commit ead182e

Please sign in to comment.