MOM6
external_gwave_initialization.F90
Go to the documentation of this file.
1 !> Initialization for the "external gravity wave wave" configuration
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
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 
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 
83 
mom_verticalgrid
Provides a transparent vertical ocean grid type and supporting routines.
Definition: MOM_verticalGrid.F90:2
mom_file_parser::log_version
An overloaded interface to log version information about modules.
Definition: MOM_file_parser.F90:109
external_gwave_initialization
Initialization for the "external gravity wave wave" configuration.
Definition: external_gwave_initialization.F90:2
mom_variables::thermo_var_ptrs
Pointers to an assortment of thermodynamic fields that may be available, including potential temperat...
Definition: MOM_variables.F90:78
mom_get_input::directories
Container for paths and parameter file names.
Definition: MOM_get_input.F90:20
mom_error_handler::mom_mesg
subroutine, public mom_mesg(message, verb, all_print)
This provides a convenient interface for writing an informative comment.
Definition: MOM_error_handler.F90:53
mom_tracer_registry
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
Definition: MOM_tracer_registry.F90:5
mom_file_parser::param_file_type
A structure that can be parsed to read and document run-time parameters.
Definition: MOM_file_parser.F90:54
mom_file_parser::get_param
An overloaded interface to read and log the values of various types of parameters.
Definition: MOM_file_parser.F90:102
mom_get_input
Reads the only Fortran name list needed to boot-strap the model.
Definition: MOM_get_input.F90:6
mom_unit_scaling::unit_scale_type
Describes various unit conversion factors.
Definition: MOM_unit_scaling.F90:14
mom_verticalgrid::verticalgrid_type
Describes the vertical ocean grid, including unit conversion factors.
Definition: MOM_verticalGrid.F90:24
mom_variables
Provides transparent structures with groups of MOM6 variables and supporting routines.
Definition: MOM_variables.F90:2
mom_file_parser
The MOM6 facility to parse input files for runtime parameters.
Definition: MOM_file_parser.F90:2
mom_tracer_registry::tracer_registry_type
Type to carry basic tracer information.
Definition: MOM_tracer_registry.F90:138
mom_grid
Provides the ocean grid type.
Definition: MOM_grid.F90:2
mom_unit_scaling
Provides a transparent unit rescaling type to facilitate dimensional consistency testing.
Definition: MOM_unit_scaling.F90:2
mom_error_handler::is_root_pe
logical function, public is_root_pe()
This returns .true. if the current PE is the root PE.
Definition: MOM_error_handler.F90:44
mom_error_handler::mom_error
subroutine, public mom_error(level, message, all_print)
This provides a convenient interface for writing an mpp_error message with run-time filter based on a...
Definition: MOM_error_handler.F90:72
mom_error_handler
Routines for error handling and I/O management.
Definition: MOM_error_handler.F90:2
mom_grid::ocean_grid_type
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:26
external_gwave_initialization::external_gwave_initialize_thickness
subroutine, public external_gwave_initialize_thickness(h, G, GV, US, param_file, just_read_params)
This subroutine initializes layer thicknesses for the external_gwave experiment.
Definition: external_gwave_initialization.F90:29