lock_exchange_initialization.F90

1! This file is part of MOM6, the Modular Ocean Model version 6.
2! See the LICENSE file for licensing information.
3! SPDX-License-Identifier: Apache-2.0
4
5!> Initialization of the "lock exchange" experiment.
6!! lock_exchange = A 2-d density driven hydraulic exchange flow.
8
9use mom_error_handler, only : mom_mesg, mom_error, fatal, is_root_pe
10use mom_file_parser, only : get_param, log_version, param_file_type
11use mom_get_input, only : directories
12use mom_grid, only : ocean_grid_type
13use mom_tracer_registry, only : tracer_registry_type
17
18implicit none ; private
19
20#include <MOM_memory.h>
21
23
24contains
25
26!> This subroutine initializes layer thicknesses for the lock_exchange experiment.
27! -----------------------------------------------------------------------------
28subroutine lock_exchange_initialize_thickness(h, G, GV, US, param_file, just_read)
29 type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure.
30 type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid structure.
31 type(unit_scale_type), intent(in) :: us !< A dimensional unit scaling type
32 real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
33 intent(out) :: h !< The thickness that is being initialized [Z ~> m]
34 type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
35 !! to parse for model parameter values.
36 logical, intent(in) :: just_read !< If true, this call will only read
37 !! parameters without changing h.
38
39 real :: eta1d(szk_(gv)+1)! Interface height relative to the sea surface
40 ! positive upward [Z ~> m].
41 real :: front_displacement ! Vertical displacement across front [Z ~> m]
42 real :: thermocline_thickness ! Thickness of stratified region [Z ~> m]
43 ! This include declares and sets the variable "version".
44# include "version_variable.h"
45 character(len=40) :: mdl = "lock_exchange_initialize_thickness" ! This subroutine's name.
46 integer :: i, j, k, is, ie, js, je, nz
47
48 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
49
50 if (.not.just_read) &
51 call mom_mesg(" lock_exchange_initialization.F90, lock_exchange_initialize_thickness: setting thickness", 5)
52
53 if (.not.just_read) call log_version(param_file, mdl, version, "")
54 call get_param(param_file, mdl, "FRONT_DISPLACEMENT", front_displacement, &
55 "The vertical displacement of interfaces across the front. "//&
56 "A value larger in magnitude that MAX_DEPTH is truncated,", &
57 units="m", fail_if_missing=.not.just_read, do_not_log=just_read, scale=us%m_to_Z)
58 call get_param(param_file, mdl, "THERMOCLINE_THICKNESS", thermocline_thickness, &
59 "The thickness of the thermocline in the lock exchange "//&
60 "experiment. A value of zero creates a two layer system "//&
61 "with vanished layers in between the two inflated layers.", &
62 default=0., units="m", do_not_log=just_read, scale=us%m_to_Z)
63
64 if (just_read) return ! All run-time parameters have been read, so return.
65
66 do j=g%jsc,g%jec ; do i=g%isc,g%iec
67 do k=2,nz
68 eta1d(k) = -0.5 * g%max_depth & ! Middle of column
69 - thermocline_thickness * ( (real(k-1))/real(nz) -0.5 ) ! Stratification
70 if (g%geoLonT(i,j)-g%west_lon < 0.5 * g%len_lon) then
71 eta1d(k) = eta1d(k) + 0.5 * front_displacement
72 elseif (g%geoLonT(i,j)-g%west_lon > 0.5 * g%len_lon) then
73 eta1d(k) = eta1d(k) - 0.5 * front_displacement
74 endif
75 enddo
76 eta1d(nz+1) = -g%max_depth ! Force bottom interface to bottom
77 do k=nz,2,-1 ! Make sure interfaces increase upwards
78 eta1d(k) = max( eta1d(k), eta1d(k+1) + gv%Angstrom_Z )
79 enddo
80 eta1d(1) = 0. ! Force bottom interface to bottom
81 do k=2,nz ! Make sure interfaces decrease downwards
82 eta1d(k) = min( eta1d(k), eta1d(k-1) - gv%Angstrom_Z )
83 enddo
84 do k=nz,1,-1
85 h(i,j,k) = eta1d(k) - eta1d(k+1)
86 enddo
87 enddo ; enddo
88
90! -----------------------------------------------------------------------------
91