MOM6
lock_exchange_initialization.F90
Go to the documentation of this file.
2 !***********************************************************************
3 !* GNU General Public License *
4 !* This file is a part of MOM. *
5 !* *
6 !* MOM is free software; you can redistribute it and/or modify it and *
7 !* are expected to follow the terms of the GNU General Public License *
8 !* as published by the Free Software Foundation; either version 2 of *
9 !* the License, or (at your option) any later version. *
10 !* *
11 !* MOM is distributed in the hope that it will be useful, but WITHOUT *
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
13 !* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public *
14 !* License for more details. *
15 !* *
16 !* For the full text of the GNU General Public License, *
17 !* write to: Free Software Foundation, Inc., *
18 !* 675 Mass Ave, Cambridge, MA 02139, USA. *
19 !* or see: http://www.gnu.org/licenses/gpl.html *
20 !***********************************************************************
21 
24 use mom_get_input, only : directories
25 use mom_grid, only : ocean_grid_type
29 
30 implicit none ; private
31 
32 #include <MOM_memory.h>
33 
35 
36 contains
37 
38 !> This subroutine initializes layer thicknesses for the lock_exchange experiment.
39 ! -----------------------------------------------------------------------------
40 subroutine lock_exchange_initialize_thickness(h, G, GV, param_file, just_read_params)
41  type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
42  type(verticalgrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
43  real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
44  intent(out) :: h !< The thickness that is being initialized, in m.
45  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
46  !! to parse for model parameter values.
47  logical, optional, intent(in) :: just_read_params !< If present and true, this call will
48  !! only read parameters without changing h.
49 
50  real :: e0(szk_(gv)) ! The resting interface heights, in m, usually !
51  ! negative because it is positive upward. !
52  real :: e_pert(szk_(gv)) ! Interface height perturbations, positive !
53  ! upward, in m. !
54  real :: eta1D(szk_(gv)+1)! Interface height relative to the sea surface !
55  ! positive upward, in m. !
56  real :: front_displacement ! Vertical displacement acrodd front
57  real :: thermocline_thickness ! Thickness of stratified region
58  logical :: just_read ! If true, just read parameters but set nothing.
59 ! This include declares and sets the variable "version".
60 #include "version_variable.h"
61  character(len=40) :: mdl = "lock_exchange_initialize_thickness" ! This subroutine's name.
62  integer :: i, j, k, is, ie, js, je, nz
63 
64  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
65 
66  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
67 
68  if (.not.just_read) &
69  call mom_mesg(" lock_exchange_initialization.F90, lock_exchange_initialize_thickness: setting thickness", 5)
70 
71  if (.not.just_read) call log_version(param_file, mdl, version, "")
72  call get_param(param_file, mdl, "FRONT_DISPLACEMENT", front_displacement, &
73  "The vertical displacement of interfaces across the front. \n"//&
74  "A value larger in magnitude that MAX_DEPTH is truncated,", &
75  units="m", fail_if_missing=.not.just_read, do_not_log=just_read)
76  call get_param(param_file, mdl, "THERMOCLINE_THICKNESS", thermocline_thickness, &
77  "The thickness of the thermocline in the lock exchange \n"//&
78  "experiment. A value of zero creates a two layer system \n"//&
79  "with vanished layers in between the two inflated layers.", &
80  default=0., units="m", do_not_log=just_read)
81 
82  if (just_read) return ! All run-time parameters have been read, so return.
83 
84  do j=g%jsc,g%jec ; do i=g%isc,g%iec
85  do k=2,nz
86  eta1d(k) = -0.5 * g%max_depth & ! Middle of column
87  - thermocline_thickness * ( (real(k-1))/real(nz) -0.5 ) ! Stratification
88  if (g%geoLonT(i,j)-g%west_lon < 0.5 * g%len_lon) then
89  eta1d(k)=eta1d(k) + 0.5 * front_displacement
90  elseif (g%geoLonT(i,j)-g%west_lon > 0.5 * g%len_lon) then
91  eta1d(k)=eta1d(k) - 0.5 * front_displacement
92  endif
93  enddo
94  eta1d(nz+1) = -g%max_depth ! Force bottom interface to bottom
95  do k=nz,2,-1 ! Make sure interfaces increase upwards
96  eta1d(k) = max( eta1d(k), eta1d(k+1) + gv%Angstrom )
97  enddo
98  eta1d(1) = 0. ! Force bottom interface to bottom
99  do k=2,nz ! Make sure interfaces decrease downwards
100  eta1d(k) = min( eta1d(k), eta1d(k-1) - gv%Angstrom )
101  enddo
102  do k=nz,1,-1
103  h(i,j,k) = eta1d(k) - eta1d(k+1)
104  enddo
105  enddo ; enddo
106 
108 ! -----------------------------------------------------------------------------
109 
110 !> \namespace lock_exchange_initialization
111 !!
112 !! The module configures the model for the "lock_exchange" experiment.
113 !! lock_exchange = A 2-d density driven hydraulic exchange flow.
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:19
Provides the ocean grid type.
Definition: MOM_grid.F90:2
subroutine, public lock_exchange_initialize_thickness(h, G, GV, param_file, just_read_params)
This subroutine initializes layer thicknesses for the lock_exchange experiment.
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
Type to carry basic tracer information.
logical function, public is_root_pe()
The module configures the model for the "lock_exchange" experiment. lock_exchange = A 2-d density dri...
subroutine, public mom_mesg(message, verb, all_print)
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public mom_error(level, message, all_print)