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 might be initialized here are:

  • u - Zonal velocity [Z T-1 ~> m s-1].
  • v - Meridional velocity [Z T-1 ~> 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 [R ~> 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_stateEquation of state structure
[in]just_read_paramsIf present and true, this call will only read parameters without changing T & S.

Definition at line 138 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 !< Equation of state structure
146  logical, optional, intent(in) :: just_read_params !< If present and true, this call will only
147  !! read parameters without changing T & S.
148 
149  logical :: just_read ! If true, just read parameters but set nothing.
150 
151  call mom_error(fatal, &
152  "USER_initialization.F90, USER_init_temperature_salinity: " // &
153  "Unmodified user routine called - you must edit the routine to use it")
154 
155  just_read = .false. ; if (present(just_read_params)) just_read = just_read_params
156 
157  if (just_read) return ! All run-time parameters have been read, so return.
158 
159  t(:,:,1) = 0.0
160  s(:,:,1) = 0.0
161 
162  if (first_call) call write_user_log(param_file)
163 

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

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

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

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

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

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

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

109  type(ocean_grid_type), intent(in) :: G !< Ocean grid structure.
110  real, dimension(SZIB_(G), SZJ_(G), SZK_(G)), intent(out) :: u !< i-component of velocity [L T-1 ~> m s-1]
111  real, dimension(SZI_(G), SZJB_(G), SZK_(G)), intent(out) :: v !< j-component of velocity [L T-1 ~> m s-1]
112  type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
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(gv%ke), intent(out)  Rlay,
real, dimension(gv%ke+1), 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_stateEquation of state structure

Definition at line 40 of file user_initialization.F90.

41  type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
42  real, dimension(GV%ke), intent(out) :: Rlay !< Layer potential density [R ~> kg m-3].
43  real, dimension(GV%ke+1), intent(out) :: g_prime !< The reduced gravity at each
44  !! interface [L2 Z-1 T-2 ~> m s-2].
45  type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
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 !< Equation of state structure
50 
51  call mom_error(fatal, &
52  "USER_initialization.F90, USER_set_coord: " // &
53  "Unmodified user routine called - you must edit the routine to use it")
54  rlay(:) = 0.0
55  g_prime(:) = 0.0
56 
57  if (first_call) call write_user_log(param_file)
58 

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

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

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

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

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

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

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.