MOM6
user_initialization Module Reference

Detailed Description

A template of a user to code up customized initial conditions.

This subroutine initializes the fields for the simulations. The one argument passed to initialize, Time, is set to the current time of the simulation. The fields which are initialized here are:

  • u - Zonal velocity [m s-1].
  • v - Meridional velocity [m s-1].
  • h - Layer thickness [H ~> m or kg m-2]. (Must be positive.)
  • GbathyT - Basin depth [Z ~> m]. (Must be positive.)
  • GCoriolisBu - The Coriolis parameter [T-1 ~> s-1].
  • GVg_prime - The reduced gravity at each interface [L2 Z-1 T-2 ~> m s-2].
  • GVRlay - Layer potential density (coordinate variable) [kg m-3]. If ENABLE_THERMODYNAMICS is defined:
  • T - Temperature [degC].
  • S - Salinity [psu]. If BULKMIXEDLAYER is defined:
  • Rml - Mixed layer and buffer layer potential densities [kg m-3]. If SPONGE is defined:
  • A series of subroutine calls are made to set up the damping rates and reference profiles for all variables that are damped in the sponge.

Any user provided tracer code is also first linked through this subroutine.

These variables are all set in the set of subroutines (in this file) USER_initialize_bottom_depth, USER_initialize_thickness, USER_initialize_velocity, USER_initialize_temperature_salinity, USER_initialize_mixed_layer_density, USER_initialize_sponges, USER_set_coord, and USER_set_ref_profile.

The names of these subroutines should be self-explanatory. They start with "USER_" to indicate that they will likely have to be modified for each simulation to set the initial conditions and boundary conditions. Most of these take two arguments: an integer argument specifying whether the fields are to be calculated internally or read from a NetCDF file; and a string giving the path to that file. If the field is initialized internally, the path is ignored.

Functions/Subroutines

subroutine, public user_set_coord (Rlay, g_prime, GV, param_file, eqn_of_state)
 Set vertical coordinates. More...
 
subroutine, public user_initialize_topography (D, G, param_file, max_depth, US)
 Initialize topography. More...
 
subroutine, public user_initialize_thickness (h, G, GV, param_file, just_read_params)
 initialize thicknesses. More...
 
subroutine, public user_initialize_velocity (u, v, G, param_file, just_read_params)
 initialize velocities. More...
 
subroutine, public user_init_temperature_salinity (T, S, G, param_file, eqn_of_state, just_read_params)
 This function puts the initial layer temperatures and salinities into T(:,:,:) and S(:,:,:). More...
 
subroutine, public user_initialize_sponges (G, GV, use_temp, tv, param_file, CSp, h)
 Set up the sponges. More...
 
subroutine, public user_set_obc_data (OBC, tv, G, param_file, tr_Reg)
 This subroutine sets the properties of flow at open boundary conditions. More...
 
subroutine, public user_set_rotation (G, param_file)
 
subroutine write_user_log (param_file)
 Write output about the parameter values being used. More...
 

Variables

logical first_call = .true.
 A module variable that should not be used. More...
 

Function/Subroutine Documentation

◆ user_init_temperature_salinity()

subroutine, public user_initialization::user_init_temperature_salinity ( real, dimension(szi_(g),szj_(g), szk_(g)), intent(out)  T,
real, dimension(szi_(g),szj_(g), szk_(g)), intent(out)  S,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
type(eos_type), pointer  eqn_of_state,
logical, intent(in), optional  just_read_params 
)

This function puts the initial layer temperatures and salinities into T(:,:,:) and S(:,:,:).

Parameters
[in]gOcean grid structure.
[out]tPotential temperature [degC].
[out]sSalinity [ppt].
[in]param_fileA structure indicating the open file to parse for model parameter values.
eqn_of_stateInteger that selects the equation of state.
[in]just_read_paramsIf present and true, this call will only read parameters without changing T & S.

Definition at line 139 of file user_initialization.F90.

139  type(ocean_grid_type), intent(in) :: G !< Ocean grid structure.
140  real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(out) :: T !< Potential temperature [degC].
141  real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(out) :: S !< Salinity [ppt].
142  type(param_file_type), intent(in) :: param_file !< A structure indicating the
143  !! open file to parse for model
144  !! parameter values.
145  type(EOS_type), pointer :: eqn_of_state !< Integer that selects the
146  !! equation of state.
147  logical, optional, intent(in) :: just_read_params !< If present and true, this call will only
148  !! read parameters without changing T & S.
149 
150  logical :: just_read ! If true, just read parameters but set nothing.
151 
152  call mom_error(fatal, &
153  "USER_initialization.F90, USER_init_temperature_salinity: " // &
154  "Unmodified user routine called - you must edit the routine to use it")
155 
156  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
157 
158  if (just_read) return ! All run-time parameters have been read, so return.
159 
160  t(:,:,1) = 0.0
161  s(:,:,1) = 0.0
162 
163  if (first_call) call write_user_log(param_file)
164 

◆ user_initialize_sponges()

subroutine, public user_initialization::user_initialize_sponges ( type(ocean_grid_type), intent(in)  G,
type(verticalgrid_type), intent(in)  GV,
logical, intent(in)  use_temp,
type(thermo_var_ptrs), intent(in)  tv,
type(param_file_type), intent(in)  param_file,
type(sponge_cs), pointer  CSp,
real, dimension( g %isd: g %ied, g %jsd: g %jed, gv %ke), intent(in)  h 
)

Set up the sponges.

Parameters
[in]gOcean grid structure.
[in]gvThe ocean's vertical grid structure.
[in]use_tempIf true, temperature and salinity are state variables.
[in]tvA structure containing pointers to any available thermodynamic fields, potential temperature and salinity or mixed layer density. Absent fields have NULL ptrs.
[in]param_fileA structure indicating the open file to parse for model parameter values.
cspA pointer to the sponge control structure.
[in]hLayer thicknesses [H ~> m or kg m-2].

Definition at line 169 of file user_initialization.F90.

169  type(ocean_grid_type), intent(in) :: G !< Ocean grid structure.
170  type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
171  logical, intent(in) :: use_temp !< If true, temperature and salinity are state variables.
172  type(thermo_var_ptrs), intent(in) :: tv !< A structure containing pointers
173  !! to any available thermodynamic
174  !! fields, potential temperature and
175  !! salinity or mixed layer density.
176  !! Absent fields have NULL ptrs.
177  type(param_file_type), intent(in) :: param_file !< A structure indicating the
178  !! open file to parse for model
179  !! parameter values.
180  type(sponge_CS), pointer :: CSp !< A pointer to the sponge control structure.
181  real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
182  intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2].
183  call mom_error(fatal, &
184  "USER_initialization.F90, USER_initialize_sponges: " // &
185  "Unmodified user routine called - you must edit the routine to use it")
186 
187  if (first_call) call write_user_log(param_file)
188 

◆ user_initialize_thickness()

subroutine, public user_initialization::user_initialize_thickness ( real, dimension(szi_(g),szj_(g),szk_(gv)), intent(out)  h,
type(ocean_grid_type), intent(in)  G,
type(verticalgrid_type), intent(in)  GV,
type(param_file_type), intent(in)  param_file,
logical, intent(in), optional  just_read_params 
)

initialize thicknesses.

Parameters
[in]gThe ocean's grid structure.
[in]gvThe ocean's vertical grid structure.
[out]hThe thicknesses being initialized [H ~> m or kg m-2].
[in]param_fileA structure indicating the open file to parse for model parameter values.
[in]just_read_paramsIf present and true, this call will only read parameters without changing h.

Definition at line 83 of file user_initialization.F90.

83  type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
84  type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
85  real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
86  intent(out) :: h !< The thicknesses being initialized [H ~> m or kg m-2].
87  type(param_file_type), intent(in) :: param_file !< A structure indicating the open
88  !! file to parse for model parameter values.
89  logical, optional, intent(in) :: just_read_params !< If present and true, this call will
90  !! only read parameters without changing h.
91 
92  logical :: just_read ! If true, just read parameters but set nothing.
93 
94  call mom_error(fatal, &
95  "USER_initialization.F90, USER_initialize_thickness: " // &
96  "Unmodified user routine called - you must edit the routine to use it")
97 
98  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
99 
100  if (just_read) return ! All run-time parameters have been read, so return.
101 
102  h(:,:,1) = 0.0 ! h should be set [H ~> m or kg m-2].
103 
104  if (first_call) call write_user_log(param_file)
105 

◆ user_initialize_topography()

subroutine, public user_initialization::user_initialize_topography ( real, dimension(g%isd:g%ied,g%jsd:g%jed), intent(out)  D,
type(dyn_horgrid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
real, intent(in)  max_depth,
type(unit_scale_type), intent(in), optional  US 
)

Initialize topography.

Parameters
[in]gThe dynamic horizontal grid type
[out]dOcean bottom depth in m or Z if US is present
[in]param_fileParameter file structure
[in]max_depthMaximum model depth in the units of D
[in]usA dimensional unit scaling type

Definition at line 64 of file user_initialization.F90.

64  type(dyn_horgrid_type), intent(in) :: G !< The dynamic horizontal grid type
65  real, dimension(G%isd:G%ied,G%jsd:G%jed), &
66  intent(out) :: D !< Ocean bottom depth in m or Z if US is present
67  type(param_file_type), intent(in) :: param_file !< Parameter file structure
68  real, intent(in) :: max_depth !< Maximum model depth in the units of D
69  type(unit_scale_type), optional, intent(in) :: US !< A dimensional unit scaling type
70 
71  call mom_error(fatal, &
72  "USER_initialization.F90, USER_initialize_topography: " // &
73  "Unmodified user routine called - you must edit the routine to use it")
74 
75  d(:,:) = 0.0
76 
77  if (first_call) call write_user_log(param_file)
78 

◆ user_initialize_velocity()

subroutine, public user_initialization::user_initialize_velocity ( real, dimension(szib_(g), szj_(g), szk_(g)), intent(out)  u,
real, dimension(szi_(g), szjb_(g), szk_(g)), intent(out)  v,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
logical, intent(in), optional  just_read_params 
)

initialize velocities.

Parameters
[in]gOcean grid structure.
[out]ui-component of velocity [m s-1]
[out]vj-component of velocity [m/s]
[in]param_fileA structure indicating the open file to parse for model parameter values.
[in]just_read_paramsIf present and true, this call will only read parameters without changing h.

Definition at line 110 of file user_initialization.F90.

110  type(ocean_grid_type), intent(in) :: G !< Ocean grid structure.
111  real, dimension(SZIB_(G), SZJ_(G), SZK_(G)), intent(out) :: u !< i-component of velocity [m s-1]
112  real, dimension(SZI_(G), SZJB_(G), SZK_(G)), intent(out) :: v !< j-component of velocity [m/s]
113  type(param_file_type), intent(in) :: param_file !< A structure indicating the
114  !! open file to parse for model
115  !! parameter values.
116  logical, optional, intent(in) :: just_read_params !< If present and true, this call will
117  !! only read parameters without changing h.
118 
119  logical :: just_read ! If true, just read parameters but set nothing.
120 
121  call mom_error(fatal, &
122  "USER_initialization.F90, USER_initialize_velocity: " // &
123  "Unmodified user routine called - you must edit the routine to use it")
124 
125  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
126 
127  if (just_read) return ! All run-time parameters have been read, so return.
128 
129  u(:,:,1) = 0.0
130  v(:,:,1) = 0.0
131 
132  if (first_call) call write_user_log(param_file)
133 

◆ user_set_coord()

subroutine, public user_initialization::user_set_coord ( real, dimension(:), intent(out)  Rlay,
real, dimension(:), intent(out)  g_prime,
type(verticalgrid_type), intent(in)  GV,
type(param_file_type), intent(in)  param_file,
type(eos_type), pointer  eqn_of_state 
)

Set vertical coordinates.

Parameters
[in]gvThe ocean's vertical grid structure.
[out]rlayLayer potential density.
[out]g_primeThe reduced gravity at each interface [L2 Z-1 T-2 ~> m s-2].
[in]param_fileA structure indicating the open file to parse for model parameter values.
eqn_of_stateInteger that selects the equation of state.

Definition at line 41 of file user_initialization.F90.

41  type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid
42  !! structure.
43  real, dimension(:), intent(out) :: Rlay !< Layer potential density.
44  real, dimension(:), intent(out) :: g_prime !< The reduced gravity at
45  !! each interface [L2 Z-1 T-2 ~> m s-2].
46  type(param_file_type), intent(in) :: param_file !< A structure indicating the
47  !! open file to parse for model
48  !! parameter values.
49  type(EOS_type), pointer :: eqn_of_state !< Integer that selects the
50  !! equation of state.
51 
52  call mom_error(fatal, &
53  "USER_initialization.F90, USER_set_coord: " // &
54  "Unmodified user routine called - you must edit the routine to use it")
55  rlay(:) = 0.0
56  g_prime(:) = 0.0
57 
58  if (first_call) call write_user_log(param_file)
59 

◆ user_set_obc_data()

subroutine, public user_initialization::user_set_obc_data ( type(ocean_obc_type), pointer  OBC,
type(thermo_var_ptrs), intent(in)  tv,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
type(tracer_registry_type), pointer  tr_Reg 
)

This subroutine sets the properties of flow at open boundary conditions.

Parameters
obcThis open boundary condition type specifies whether, where, and what open boundary conditions are used.
[in]tvA structure containing pointers to any available thermodynamic fields, including potential temperature and salinity or mixed layer density. Absent fields have NULL ptrs.
[in]gThe ocean's grid structure.
[in]param_fileA structure indicating the open file to parse for model parameter values.
tr_regTracer registry.

Definition at line 193 of file user_initialization.F90.

193  type(ocean_OBC_type), pointer :: OBC !< This open boundary condition type specifies
194  !! whether, where, and what open boundary
195  !! conditions are used.
196  type(thermo_var_ptrs), intent(in) :: tv !< A structure containing pointers to any
197  !! available thermodynamic fields, including potential
198  !! temperature and salinity or mixed layer density. Absent
199  !! fields have NULL ptrs.
200  type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
201  type(param_file_type), intent(in) :: param_file !< A structure indicating the
202  !! open file to parse for model
203  !! parameter values.
204  type(tracer_registry_type), pointer :: tr_Reg !< Tracer registry.
205 ! call MOM_error(FATAL, &
206 ! "USER_initialization.F90, USER_set_OBC_data: " // &
207 ! "Unmodified user routine called - you must edit the routine to use it")
208 
209  if (first_call) call write_user_log(param_file)
210 

◆ user_set_rotation()

subroutine, public user_initialization::user_set_rotation ( type(ocean_grid_type), intent(inout)  G,
type(param_file_type), intent(in)  param_file 
)
Parameters
[in,out]gThe ocean's grid structure
[in]param_fileA structure to parse for run-time parameters

Definition at line 214 of file user_initialization.F90.

214  type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
215  type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
216  call mom_error(fatal, &
217  "USER_initialization.F90, USER_set_rotation: " // &
218  "Unmodified user routine called - you must edit the routine to use it")
219 
220  if (first_call) call write_user_log(param_file)
221 

◆ write_user_log()

subroutine user_initialization::write_user_log ( type(param_file_type), intent(in)  param_file)
private

Write output about the parameter values being used.

Parameters
[in]param_fileA structure indicating the open file to parse for model parameter values.

Definition at line 226 of file user_initialization.F90.

226  type(param_file_type), intent(in) :: param_file !< A structure indicating the
227  !! open file to parse for model
228  !! parameter values.
229 
230 ! This include declares and sets the variable "version".
231 #include "version_variable.h"
232  character(len=40) :: mdl = "user_initialization" ! This module's name.
233 
234  call log_version(param_file, mdl, version)
235  first_call = .false.
236 

Variable Documentation

◆ first_call

logical user_initialization::first_call = .true.
private

A module variable that should not be used.

Todo:
Move this module variable into a control structure.

Definition at line 35 of file user_initialization.F90.

35 logical :: first_call = .true.