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) [R ~> 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, US, 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, US, 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 141 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Here is the call graph for this function:

◆ 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 171 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Referenced by mom_state_initialization::mom_initialize_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 84 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Here is the call graph for this function:

◆ 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 65 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Referenced by mom_fixed_initialization::mom_initialize_topography().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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(unit_scale_type), intent(in)  US,
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 [L T-1 ~> m s-1]
[out]vj-component of velocity [L T-1 ~> m s-1]
[in]usA dimensional unit scaling type
[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 111 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Here is the call graph for this function:

◆ 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(unit_scale_type), intent(in)  US,
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 [R ~> kg m-3].
[out]g_primeThe reduced gravity at each interface [L2 Z-1 T-2 ~> m s-2].
[in]usA dimensional unit scaling type
[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 [R ~> kg m-3].
44  real, dimension(:), intent(out) :: g_prime !< The reduced gravity at
45  !! each interface [L2 Z-1 T-2 ~> m s-2].
46  type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
47  type(param_file_type), intent(in) :: param_file !< A structure indicating the
48  !! open file to parse for model
49  !! parameter values.
50  type(EOS_type), pointer :: eqn_of_state !< Integer that selects the
51  !! equation of state.
52 
53  call mom_error(fatal, &
54  "USER_initialization.F90, USER_set_coord: " // &
55  "Unmodified user routine called - you must edit the routine to use it")
56  rlay(:) = 0.0
57  g_prime(:) = 0.0
58 
59  if (first_call) call write_user_log(param_file)
60 

References first_call, mom_error_handler::mom_error(), and write_user_log().

Referenced by mom_coord_initialization::mom_initialize_coord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 195 of file user_initialization.F90.

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

References first_call, and write_user_log().

Here is the call graph for this function:

◆ 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 216 of file user_initialization.F90.

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

References first_call, mom_error_handler::mom_error(), and write_user_log().

Here is the call graph for this function:

◆ 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 228 of file user_initialization.F90.

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

References first_call.

Referenced by user_init_temperature_salinity(), user_initialize_sponges(), user_initialize_thickness(), user_initialize_topography(), user_initialize_velocity(), user_set_coord(), user_set_obc_data(), and user_set_rotation().

Here is the caller graph for this function:

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.

Referenced by user_init_temperature_salinity(), user_initialize_sponges(), user_initialize_thickness(), user_initialize_topography(), user_initialize_velocity(), user_set_coord(), user_set_obc_data(), user_set_rotation(), and write_user_log().