MOM6
external_gwave_initialization.F90
1 !> Initialization for the "external gravity wave wave" configuration
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
6 use mom_error_handler, only : mom_mesg, mom_error, fatal, is_root_pe
8 use mom_get_input, only : directories
9 use mom_grid, only : ocean_grid_type
14 implicit none ; private
15 
16 #include <MOM_memory.h>
17 
18 public external_gwave_initialize_thickness
19 
20 ! A note on unit descriptions in comments: MOM6 uses units that can be rescaled for dimensional
21 ! consistency testing. These are noted in comments with units like Z, H, L, and T, along with
22 ! their mks counterparts with notation like "a velocity [Z T-1 ~> m s-1]". If the units
23 ! vary with the Boussinesq approximation, the Boussinesq variant is given first.
24 
25 contains
26 
27 !> This subroutine initializes layer thicknesses for the external_gwave experiment.
28 subroutine external_gwave_initialize_thickness(h, G, GV, US, param_file, just_read_params)
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 [H ~> m or kg m-2].
34  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
35  !! to parse for model parameter values.
36  logical, optional, intent(in) :: just_read_params !< If present and true, this call will
37  !! only read parameters without changing h.
38  ! Local variables
39  real :: eta1D(szk_(g)+1)! Interface height relative to the sea surface
40  ! positive upward [Z ~> m].
41  real :: ssh_anomaly_height ! Vertical height of ssh anomaly
42  real :: ssh_anomaly_width ! Lateral width of anomaly
43  logical :: just_read ! If true, just read parameters but set nothing.
44  character(len=40) :: mdl = "external_gwave_initialize_thickness" ! This subroutine's name.
45 ! This include declares and sets the variable "version".
46 #include "version_variable.h"
47  integer :: i, j, k, is, ie, js, je, nz
48  real :: PI, Xnondim
49 
50  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
51 
52  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
53 
54  if (.not.just_read) &
55  call mom_mesg(" external_gwave_initialization.F90, external_gwave_initialize_thickness: setting thickness", 5)
56 
57  if (.not.just_read) call log_version(param_file, mdl, version, "")
58  call get_param(param_file, mdl, "SSH_ANOMALY_HEIGHT", ssh_anomaly_height, &
59  "The vertical displacement of the SSH anomaly. ", units="m", &
60  fail_if_missing=.not.just_read, do_not_log=just_read, scale=us%m_to_Z)
61  call get_param(param_file, mdl, "SSH_ANOMALY_WIDTH", ssh_anomaly_width, &
62  "The lateral width of the SSH anomaly. ", units="coordinate", &
63  fail_if_missing=.not.just_read, do_not_log=just_read)
64 
65  if (just_read) return ! All run-time parameters have been read, so return.
66 
67  pi = 4.0*atan(1.0)
68  do j=g%jsc,g%jec ; do i=g%isc,g%iec
69  xnondim = (g%geoLonT(i,j)-g%west_lon-0.5*g%len_lon) / ssh_anomaly_width
70  xnondim = min(1., abs(xnondim))
71  eta1d(1) = ssh_anomaly_height * 0.5 * ( 1. + cos(pi*xnondim) ) ! Cosine bell
72  do k=2,nz
73  eta1d(k) = -g%max_depth & ! Stretch interior interfaces with SSH
74  + (eta1d(1)+g%max_depth) * ( real(nz+1-k)/real(nz) ) ! Stratification
75  enddo
76  eta1d(nz+1) = -g%max_depth ! Force bottom interface to bottom
77  do k=1,nz
78  h(i,j,k) = gv%Z_to_H * (eta1d(k) - eta1d(k+1))
79  enddo
80  enddo ; enddo
81 
82 end subroutine external_gwave_initialize_thickness
83 
Initialization for the "external gravity wave wave" configuration.
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:26
Reads the only Fortran name list needed to boot-strap the model.
A structure that can be parsed to read and document run-time parameters.
Provides the ocean grid type.
Definition: MOM_grid.F90:2
The MOM6 facility to parse input files for runtime parameters.
Describes various unit conversion factors.
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
Provides a transparent unit rescaling type to facilitate dimensional consistency testing.
Type to carry basic tracer information.
Routines for error handling and I/O management.
An overloaded interface to log version information about modules.
Describes the vertical ocean grid, including unit conversion factors.
Container for paths and parameter file names.
Pointers to an assortment of thermodynamic fields that may be available, including potential temperat...
Provides a transparent vertical ocean grid type and supporting routines.
Provides transparent structures with groups of MOM6 variables and supporting routines.
An overloaded interface to read and log the values of various types of parameters.