MOM6
mom_ocean_model_mct.F90
Go to the documentation of this file.
1 !> Top-level module for the MOM6 ocean model in coupled mode.
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
6 ! This is the top level module for the MOM6 ocean model. It contains routines
7 ! for initialization, termination and update of ocean model state. This
8 ! particular version wraps all of the calls for MOM6 in the calls that had
9 ! been used for MOM4.
10 !
11 ! This code is a stop-gap wrapper of the MOM6 code to enable it to be called
12 ! in the same way as MOM4.
13 
15 use mom, only : extract_surface_state, allocate_surface_state, finish_mom_initialization
18 use mom_constants, only : celsius_kelvin_offset, hlf
21 use mom_domains, only : pass_var, pass_vector, agrid, bgrid_ne, cgrid_ne
22 use mom_domains, only : to_all, omit_corners
23 use mom_error_handler, only : mom_error, fatal, warning, is_root_pe
33 use mom_grid, only : ocean_grid_type
34 use mom_io, only : close_file, file_exists, read_data, write_version_number
42 use mom_time_manager, only : time_type, get_time, set_time, operator(>)
43 use mom_time_manager, only : operator(+), operator(-), operator(*), operator(/)
44 use mom_time_manager, only : operator(/=), operator(<=), operator(>=)
45 use mom_time_manager, only : operator(<), real_to_time_type, time_type_to_real
49 use mom_variables, only : surface
53 use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
54 use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
55 use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
56 use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
57 use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
58 use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
59 use fms_mod, only : stdout
60 use mpp_mod, only : mpp_chksum
61 use mom_eos, only : gsw_sp_from_sr, gsw_pt_from_ct
64 
65 ! MCT specfic routines
66 use mom_domains, only : mom_infra_end
67 
68 #include <MOM_memory.h>
69 
70 #ifdef _USE_GENERIC_TRACER
71 use mom_generic_tracer, only : mom_generic_tracer_fluxes_accumulate
72 #endif
73 
74 implicit none ; public
75 
81 public ice_ocn_bnd_type_chksum
83 public get_ocean_grid
84 
85 !> This type is used for communication with other components via the FMS coupler.
86 !! The element names and types can be changed only with great deliberation, hence
87 !! the persistnce of things like the cutsy element name "avg_kount".
88 type, public :: ocean_public_type
89  type(domain2d) :: domain !< The domain for the surface fields.
90  logical :: is_ocean_pe !< .true. on processors that run the ocean model.
91  character(len=32) :: instance_name = '' !< A name that can be used to identify
92  !! this instance of an ocean model, for example
93  !! in ensembles when writing messages.
94  integer, pointer, dimension(:) :: pelist => null() !< The list of ocean PEs.
95  logical, pointer, dimension(:,:) :: maskmap =>null() !< A pointer to an array
96  !! indicating which logical processors are actually used for
97  !! the ocean code. The other logical processors would be all
98  !! land points and are not assigned to actual processors.
99  !! This need not be assigned if all logical processors are used.
100 
101  integer :: stagger = -999 !< The staggering relative to the tracer points
102  !! points of the two velocity components. Valid entries
103  !! include AGRID, BGRID_NE, CGRID_NE, BGRID_SW, and CGRID_SW,
104  !! corresponding to the community-standard Arakawa notation.
105  !! (These are named integers taken from mpp_parameter_mod.)
106  !! Following MOM5, stagger is BGRID_NE by default when the
107  !! ocean is initialized, but here it is set to -999 so that
108  !! a global max across ocean and non-ocean processors can be
109  !! used to determine its value.
110  real, pointer, dimension(:,:) :: &
111  t_surf => null(), & !< SST on t-cell (degrees Kelvin)
112  s_surf => null(), & !< SSS on t-cell (psu)
113  u_surf => null(), & !< i-velocity at the locations indicated by stagger, m/s.
114  v_surf => null(), & !< j-velocity at the locations indicated by stagger, m/s.
115  sea_lev => null(), & !< Sea level in m after correction for surface pressure,
116  !! i.e. dzt(1) + eta_t + patm/rho0/grav (m)
117  frazil =>null(), & !< Accumulated heating (in Joules/m^2) from frazil
118  !! formation in the ocean.
119  melt_potential => null(), & !< Instantaneous heat used to melt sea ice (in J/m^2)
120  area => null(), & !< cell area of the ocean surface, in m2.
121  obld => null() !< Ocean boundary layer depth, in m.
122  type(coupler_2d_bc_type) :: fields !< A structure that may contain named
123  !! arrays of tracer-related surface fields.
124  integer :: avg_kount !< A count of contributions to running
125  !! sums, used externally by the FMS coupler
126  !! for accumulating averages of this type.
127  integer, dimension(2) :: axes = 0 !< Axis numbers that are available
128  !! for I/O using this surface data.
129 end type ocean_public_type
130 
131 !> The ocean_state_type contains all information about the state of the ocean,
132 !! with a format that is private so it can be readily changed without disrupting
133 !! other coupled components.
134 type, public :: ocean_state_type ;
135  ! This type is private, and can therefore vary between different ocean models.
136  logical :: is_ocean_pe = .false. !< True if this is an ocean PE.
137  type(time_type) :: time !< The ocean model's time and master clock.
138  integer :: restart_control !< An integer that is bit-tested to determine whether
139  !! incremental restart files are saved and whether they
140  !! have a time stamped name. +1 (bit 0) for generic
141  !! files and +2 (bit 1) for time-stamped files. A
142  !! restart file is saved at the end of a run segment
143  !! unless Restart_control is negative.
144 
145  integer :: nstep = 0 !< The number of calls to update_ocean.
146  logical :: use_ice_shelf !< If true, the ice shelf model is enabled.
147  logical :: use_waves !< If true use wave coupling.
148 
149  logical :: icebergs_alter_ocean !< If true, the icebergs can change ocean the
150  !! ocean dynamics and forcing fluxes.
151  logical :: restore_salinity !< If true, the coupled MOM driver adds a term to
152  !! restore salinity to a specified value.
153  logical :: restore_temp !< If true, the coupled MOM driver adds a term to
154  !! restore sst to a specified value.
155  real :: press_to_z !< A conversion factor between pressure and ocean
156  !! depth in m, usually 1/(rho_0*g), in m Pa-1.
157  real :: c_p !< The heat capacity of seawater, in J K-1 kg-1.
158  logical :: offline_tracer_mode = .false. !< If false, use the model in prognostic mode
159  !! with the barotropic and baroclinic dynamics, thermodynamics,
160  !! etc. stepped forward integrated in time.
161  !! If true, all of the above are bypassed with all
162  !! fields necessary to integrate only the tracer advection
163  !! and diffusion equation read in from files stored from
164  !! a previous integration of the prognostic model.
165 
166  logical :: single_step_call !< If true, advance the state of MOM with a single
167  !! step including both dynamics and thermodynamics.
168  !! If false, the two phases are advanced with
169  !! separate calls. The default is true.
170  ! The following 3 variables are only used here if single_step_call is false.
171  real :: dt !< (baroclinic) dynamics time step (seconds)
172  real :: dt_therm !< thermodynamics time step (seconds)
173  logical :: thermo_spans_coupling !< If true, thermodynamic and tracer time
174  !! steps can span multiple coupled time steps.
175  logical :: diabatic_first !< If true, apply diabatic and thermodynamic
176  !! processes before time stepping the dynamics.
177 
178  type(directories) :: dirs !< A structure containing several relevant directory paths.
179  type(mech_forcing) :: forces !< A structure with the driving mechanical surface forces
180  type(forcing) :: fluxes !< A structure containing pointers to
181  !! the thermodynamic ocean forcing fields.
182  type(forcing) :: flux_tmp !< A secondary structure containing pointers to the
183  !! ocean forcing fields for when multiple coupled
184  !! timesteps are taken per thermodynamic step.
185  type(surface) :: sfc_state !< A structure containing pointers to
186  !! the ocean surface state fields.
187  type(ocean_grid_type), pointer :: &
188  grid => null() !< A pointer to a grid structure containing metrics
189  !! and related information.
190  type(verticalgrid_type), pointer :: &
191  gv => null() !< A pointer to a structure containing information
192  !! about the vertical grid.
193  type(unit_scale_type), pointer :: us => null() !< A pointer to a structure containing
194  !! dimensional unit scaling factors.
195  type(mom_control_struct), pointer :: &
196  mom_csp => null() !< A pointer to the MOM control structure
197  type(ice_shelf_cs), pointer :: &
198  ice_shelf_csp => null() !< A pointer to the control structure for the
199  !! ice shelf model that couples with MOM6. This
200  !! is null if there is no ice shelf.
201  type(marine_ice_cs), pointer :: &
202  marine_ice_csp => null() !< A pointer to the control structure for the
203  !! marine ice effects module.
204  type(wave_parameters_cs), pointer :: &
205  waves !< A structure containing pointers to the surface wave fields
206  type(surface_forcing_cs), pointer :: &
207  forcing_csp => null() !< A pointer to the MOM forcing control structure
208  type(mom_restart_cs), pointer :: &
209  restart_csp => null() !< A pointer set to the restart control structure
210  !! that will be used for MOM restart files.
211  type(diag_ctrl), pointer :: &
212  diag => null() !< A pointer to the diagnostic regulatory structure
213 end type ocean_state_type
214 
215 contains
216 
217 !> ocean_model_init initializes the ocean model, including registering fields
218 !! for restarts and reading restart files if appropriate.
219 !!
220 !! This subroutine initializes both the ocean state and the ocean surface type.
221 !! Because of the way that indicies and domains are handled, Ocean_sfc must have
222 !! been used in a previous call to initialize_ocean_type.
223 subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, input_restart_file)
224  type(ocean_public_type), target, &
225  intent(inout) :: ocean_sfc !< A structure containing various publicly
226  !! visible ocean surface properties after initialization,
227  !! the data in this type is intent out.
228  type(ocean_state_type), pointer :: os !< A structure whose internal
229  !! contents are private to ocean_model_mod that may be used to
230  !! contain all information about the ocean's interior state.
231  type(time_type), intent(in) :: time_init !< The start time for the coupled model's calendar
232  type(time_type), intent(in) :: time_in !< The time at which to initialize the ocean model.
233  type(coupler_1d_bc_type), &
234  optional, intent(in) :: gas_fields_ocn !< If present, this type describes the
235  !! ocean and surface-ice fields that will participate
236  !! in the calculation of additional gas or other
237  !! tracer fluxes, and can be used to spawn related
238  !! internal variables in the ice model.
239  character(len=*), optional, intent(in) :: input_restart_file !< If present, name of restart file to read
240  ! Local variables
241  real :: rho0 ! The Boussinesq ocean density, in kg m-3.
242  real :: g_earth ! The gravitational acceleration in m s-2.
243  real :: hfrz !< If HFrz > 0 (m), melt potential will be computed.
244  !! The actual depth over which melt potential is computed will
245  !! min(HFrz, OBLD), where OBLD is the boundary layer depth.
246  !! If HFrz <= 0 (default), melt potential will not be computed.
247  logical :: use_melt_pot!< If true, allocate melt_potential array
248 
249 ! This include declares and sets the variable "version".
250 #include "version_variable.h"
251  character(len=40) :: mdl = "ocean_model_init" ! This module's name.
252  character(len=48) :: stagger
253  integer :: secs, days
254  type(param_file_type) :: param_file !< A structure to parse for run-time parameters
255  logical :: use_temperature
256 
257  call calltree_enter("ocean_model_init(), MOM_ocean_model_mct.F90")
258  if (associated(os)) then
259  call mom_error(warning, "ocean_model_init called with an associated "// &
260  "ocean_state_type structure. Model is already initialized.")
261  return
262  endif
263  allocate(os)
264 
265  os%is_ocean_pe = ocean_sfc%is_ocean_pe
266  if (.not.os%is_ocean_pe) return
267 
268  os%Time = time_in
269  call initialize_mom(os%Time, time_init, param_file, os%dirs, os%MOM_CSp, &
270  os%restart_CSp, time_in, offline_tracer_mode=os%offline_tracer_mode, &
271  input_restart_file=input_restart_file, &
272  diag_ptr=os%diag, count_calls=.true.)
273  call get_mom_state_elements(os%MOM_CSp, g=os%grid, gv=os%GV, us=os%US, c_p=os%C_p, &
274  use_temp=use_temperature)
275  os%fluxes%C_p = os%C_p
276 
277  ! Read all relevant parameters and write them to the model log.
278  call log_version(param_file, mdl, version, "")
279 
280  call get_param(param_file, mdl, "SINGLE_STEPPING_CALL", os%single_step_call, &
281  "If true, advance the state of MOM with a single step "//&
282  "including both dynamics and thermodynamics. If false, "//&
283  "the two phases are advanced with separate calls.", default=.true.)
284  call get_param(param_file, mdl, "DT", os%dt, &
285  "The (baroclinic) dynamics time step. The time-step that "//&
286  "is actually used will be an integer fraction of the "//&
287  "forcing time-step.", units="s", fail_if_missing=.true.)
288  call get_param(param_file, mdl, "DT_THERM", os%dt_therm, &
289  "The thermodynamic and tracer advection time step. "//&
290  "Ideally DT_THERM should be an integer multiple of DT "//&
291  "and less than the forcing or coupling time-step, unless "//&
292  "THERMO_SPANS_COUPLING is true, in which case DT_THERM "//&
293  "can be an integer multiple of the coupling timestep. By "//&
294  "default DT_THERM is set to DT.", units="s", default=os%dt)
295  call get_param(param_file, "MOM", "THERMO_SPANS_COUPLING", os%thermo_spans_coupling, &
296  "If true, the MOM will take thermodynamic and tracer "//&
297  "timesteps that can be longer than the coupling timestep. "//&
298  "The actual thermodynamic timestep that is used in this "//&
299  "case is the largest integer multiple of the coupling "//&
300  "timestep that is less than or equal to DT_THERM.", default=.false.)
301  call get_param(param_file, mdl, "DIABATIC_FIRST", os%diabatic_first, &
302  "If true, apply diabatic and thermodynamic processes, "//&
303  "including buoyancy forcing and mass gain or loss, "//&
304  "before stepping the dynamics forward.", default=.false.)
305 
306  call get_param(param_file, mdl, "RESTART_CONTROL", os%Restart_control, &
307  "An integer whose bits encode which restart files are "//&
308  "written. Add 2 (bit 1) for a time-stamped file, and odd "//&
309  "(bit 0) for a non-time-stamped file. A restart file "//&
310  "will be saved at the end of the run segment for any "//&
311  "non-negative value.", default=1)
312  call get_param(param_file, mdl, "OCEAN_SURFACE_STAGGER", stagger, &
313  "A case-insensitive character string to indicate the "//&
314  "staggering of the surface velocity field that is "//&
315  "returned to the coupler. Valid values include "//&
316  "'A', 'B', or 'C'.", default="C")
317  if (uppercase(stagger(1:1)) == 'A') then ; ocean_sfc%stagger = agrid
318  elseif (uppercase(stagger(1:1)) == 'B') then ; ocean_sfc%stagger = bgrid_ne
319  elseif (uppercase(stagger(1:1)) == 'C') then ; ocean_sfc%stagger = cgrid_ne
320  else ; call mom_error(fatal,"ocean_model_init: OCEAN_SURFACE_STAGGER = "// &
321  trim(stagger)//" is invalid.") ; endif
322 
323  call get_param(param_file, mdl, "RESTORE_SALINITY",os%restore_salinity, &
324  "If true, the coupled driver will add a globally-balanced "//&
325  "fresh-water flux that drives sea-surface salinity "//&
326  "toward specified values.", default=.false.)
327  call get_param(param_file, mdl, "RESTORE_TEMPERATURE",os%restore_temp, &
328  "If true, the coupled driver will add a "//&
329  "heat flux that drives sea-surface temperature "//&
330  "toward specified values.", default=.false.)
331  call get_param(param_file, mdl, "RHO_0", rho0, &
332  "The mean ocean density used with BOUSSINESQ true to "//&
333  "calculate accelerations and the mass for conservation "//&
334  "properties, or with BOUSSINSEQ false to convert some "//&
335  "parameters from vertical units of m to kg m-2.", &
336  units="kg m-3", default=1035.0)
337  call get_param(param_file, mdl, "G_EARTH", g_earth, &
338  "The gravitational acceleration of the Earth.", &
339  units="m s-2", default = 9.80)
340 
341  call get_param(param_file, mdl, "ICE_SHELF", os%use_ice_shelf, &
342  "If true, enables the ice shelf model.", default=.false.)
343 
344  call get_param(param_file, mdl, "ICEBERGS_APPLY_RIGID_BOUNDARY", os%icebergs_alter_ocean, &
345  "If true, allows icebergs to change boundary condition felt by ocean", default=.false.)
346 
347  os%press_to_z = 1.0/(rho0*g_earth)
348 
349  call get_param(param_file, mdl, "HFREEZE", hfrz, &
350  "If HFREEZE > 0, melt potential will be computed. The actual depth "//&
351  "over which melt potential is computed will be min(HFREEZE, OBLD), "//&
352  "where OBLD is the boundary layer depth. If HFREEZE <= 0 (default), "//&
353  "melt potential will not be computed.", units="m", default=-1.0, do_not_log=.true.)
354 
355  if (hfrz .gt. 0.0) then
356  use_melt_pot=.true.
357  else
358  use_melt_pot=.false.
359  endif
360 
361  ! Consider using a run-time flag to determine whether to do the diagnostic
362  ! vertical integrals, since the related 3-d sums are not negligible in cost.
363  call allocate_surface_state(os%sfc_state, os%grid, use_temperature, &
364  do_integrals=.true., gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot)
365 
366  call surface_forcing_init(time_in, os%grid, os%US, param_file, os%diag, &
367  os%forcing_CSp, os%restore_salinity, os%restore_temp)
368 
369  if (os%use_ice_shelf) then
370  call initialize_ice_shelf(param_file, os%grid, os%Time, os%ice_shelf_CSp, &
371  os%diag, os%forces, os%fluxes)
372  endif
373 
374  if (os%icebergs_alter_ocean) then
375  call marine_ice_init(os%Time, os%grid, param_file, os%diag, os%marine_ice_CSp)
376  if (.not. os%use_ice_shelf) &
377  call allocate_forcing_type(os%grid, os%fluxes, shelf=.true.)
378  endif
379 
380  call get_param(param_file, mdl, "USE_WAVES", os%Use_Waves, &
381  "If true, enables surface wave modules.", default=.false.)
382  if (os%use_waves) then
383  call mom_wave_interface_init(os%Time, os%grid, os%GV, os%US, param_file, os%Waves, os%diag)
384  else
385  call mom_wave_interface_init_lite(param_file)
386  endif
387 
388  if (associated(os%grid%Domain%maskmap)) then
389  call initialize_ocean_public_type(os%grid%Domain%mpp_domain, ocean_sfc, &
390  os%diag, maskmap=os%grid%Domain%maskmap, &
391  gas_fields_ocn=gas_fields_ocn)
392  else
393  call initialize_ocean_public_type(os%grid%Domain%mpp_domain, ocean_sfc, &
394  os%diag, gas_fields_ocn=gas_fields_ocn)
395  endif
396 
397  ! This call can only occur here if the coupler_bc_type variables have been
398  ! initialized already using the information from gas_fields_ocn.
399  if (present(gas_fields_ocn)) then
400  call coupler_type_set_diags(ocean_sfc%fields, "ocean_sfc", &
401  ocean_sfc%axes(1:2), time_in)
402 
403  call extract_surface_state(os%MOM_CSp, os%sfc_state)
404 
405  call convert_state_to_ocean_type(os%sfc_state, ocean_sfc, os%grid, os%US)
406  endif
407 
408  call close_param_file(param_file)
410 
411  if (is_root_pe()) &
412  write(*,'(/12x,a/)') '======== COMPLETED MOM INITIALIZATION ========'
413 
414  call calltree_leave("ocean_model_init(")
415 end subroutine ocean_model_init
416 
417 !> update_ocean_model uses the forcing in Ice_ocean_boundary to advance the
418 !! ocean model's state from the input value of Ocean_state (which must be for
419 !! time time_start_update) for a time interval of Ocean_coupling_time_step,
420 !! returning the publicly visible ocean surface properties in Ocean_sfc and
421 !! storing the new ocean properties in Ocean_state.
422 subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
423  time_start_update, Ocean_coupling_time_step, &
424  update_dyn, update_thermo, Ocn_fluxes_used)
426  intent(in) :: ice_ocean_boundary !< A structure containing the
427  !! various forcing fields coming from the ice.
428  type(ocean_state_type), &
429  pointer :: os !< A pointer to a private structure containing
430  !! the internal ocean state.
431  type(ocean_public_type), &
432  intent(inout) :: ocean_sfc !< A structure containing all the
433  !! publicly visible ocean surface fields after
434  !! a coupling time step. The data in this type is
435  !! intent out.
436  type(time_type), intent(in) :: time_start_update !< The time at the beginning of the update step.
437  type(time_type), intent(in) :: ocean_coupling_time_step !< The amount of time over
438  !! which to advance the ocean.
439  logical, optional, intent(in) :: update_dyn !< If present and false, do not do updates
440  !! due to the ocean dynamics.
441  logical, optional, intent(in) :: update_thermo !< If present and false, do not do updates
442  !! due to the ocean thermodynamics or remapping.
443  logical, optional, intent(in) :: ocn_fluxes_used !< If present, this indicates whether the
444  !! cumulative thermodynamic fluxes from the ocean,
445  !! like frazil, have been used and should be reset.
446  ! Local variables
447  type(time_type) :: master_time ! This allows step_MOM to temporarily change
448  ! the time that is seen by internal modules.
449  type(time_type) :: time1 ! The value of the ocean model's time at the
450  ! start of a call to step_MOM.
451  integer :: index_bnds(4) ! The computational domain index bounds in the
452  ! ice-ocean boundary type.
453  real :: weight ! Flux accumulation weight
454  real :: dt_coupling ! The coupling time step in seconds.
455  integer :: nts ! The number of baroclinic dynamics time steps
456  ! within dt_coupling.
457  real :: dt_therm ! A limited and quantized version of OS%dt_therm (sec)
458  real :: dt_dyn ! The dynamics time step in sec.
459  real :: dtdia ! The diabatic time step in sec.
460  real :: t_elapsed_seg ! The elapsed time in this update segment, in s.
461  integer :: n, n_max, n_last_thermo
462  type(time_type) :: time2 ! A temporary time.
463  logical :: thermo_does_span_coupling ! If true, thermodynamic forcing spans
464  ! multiple dynamic timesteps.
465  logical :: do_dyn ! If true, step the ocean dynamics and transport.
466  logical :: do_thermo ! If true, step the ocean thermodynamics.
467  logical :: step_thermo ! If true, take a thermodynamic step.
468  integer :: secs, days
469  integer :: is, ie, js, je
470 
471  call calltree_enter("update_ocean_model(), MOM_ocean_model_mct.F90")
472  call get_time(ocean_coupling_time_step, secs, days)
473  dt_coupling = 86400.0*real(days) + real(secs)
474 
475  if (time_start_update /= os%Time) then
476  call mom_error(warning, "update_ocean_model: internal clock does not "//&
477  "agree with time_start_update argument.")
478  endif
479 
480  if (.not.associated(os)) then
481  call mom_error(fatal, "update_ocean_model called with an unassociated "// &
482  "ocean_state_type structure. ocean_model_init must be "// &
483  "called first to allocate this structure.")
484  return
485  endif
486 
487  do_dyn = .true. ; if (present(update_dyn)) do_dyn = update_dyn
488  do_thermo = .true. ; if (present(update_thermo)) do_thermo = update_thermo
489 
490  ! This is benign but not necessary if ocean_model_init_sfc was called or if
491  ! OS%sfc_state%tr_fields was spawned in ocean_model_init. Consider removing it.
492  is = os%grid%isc ; ie = os%grid%iec ; js = os%grid%jsc ; je = os%grid%jec
493  call coupler_type_spawn(ocean_sfc%fields, os%sfc_state%tr_fields, &
494  (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.)
495 
496  ! Translate Ice_ocean_boundary into fluxes.
497  call mpp_get_compute_domain(ocean_sfc%Domain, index_bnds(1), index_bnds(2), &
498  index_bnds(3), index_bnds(4))
499  weight = 1.0
500 
501  call convert_iob_to_forces(ice_ocean_boundary, os%forces, index_bnds, os%Time, &
502  os%grid, os%US, os%forcing_CSp)
503 
504  if (os%fluxes%fluxes_used) then
505 
506  ! GMM, is enable_averaging needed now?
507  call enable_averaging(dt_coupling, os%Time + ocean_coupling_time_step, os%diag)
508 
509  if (do_thermo) &
510  call convert_iob_to_fluxes(ice_ocean_boundary, os%fluxes, index_bnds, os%Time, dt_coupling, &
511  os%grid, os%US, os%forcing_CSp, os%sfc_state, &
512  os%restore_salinity, os%restore_temp)
513 
514  ! Add ice shelf fluxes
515  if (os%use_ice_shelf) then
516  if (do_thermo) &
517  call shelf_calc_flux(os%sfc_state, os%fluxes, os%Time, dt_coupling, os%Ice_shelf_CSp)
518  if (do_dyn) &
519  call add_shelf_forces(os%grid, os%US, os%Ice_shelf_CSp, os%forces)
520  endif
521  if (os%icebergs_alter_ocean) then
522  if (do_dyn) &
523  call iceberg_forces(os%grid, os%forces, os%use_ice_shelf, &
524  os%sfc_state, dt_coupling, os%marine_ice_CSp)
525  if (do_thermo) &
526  call iceberg_fluxes(os%grid, os%US, os%fluxes, os%use_ice_shelf, &
527  os%sfc_state, dt_coupling, os%marine_ice_CSp)
528  endif
529 
530  ! Fields that exist in both the forcing and mech_forcing types must be copied.
531  call copy_common_forcing_fields(os%forces, os%fluxes, os%grid)
532 
533 #ifdef _USE_GENERIC_TRACER
534  call enable_averaging(dt_coupling, os%Time + ocean_coupling_time_step, os%diag) !Is this needed?
535  call mom_generic_tracer_fluxes_accumulate(os%fluxes, weight) !here weight=1, just saving the current fluxes
536 #endif
537 
538  else
539 
540  os%flux_tmp%C_p = os%fluxes%C_p
541 
542  if (do_thermo) &
543  call convert_iob_to_fluxes(ice_ocean_boundary, os%flux_tmp, index_bnds, os%Time, dt_coupling, &
544  os%grid, os%US, os%forcing_CSp, os%sfc_state, os%restore_salinity,os%restore_temp)
545 
546  if (os%use_ice_shelf) then
547  if (do_thermo) &
548  call shelf_calc_flux(os%sfc_state, os%flux_tmp, os%Time, dt_coupling, os%Ice_shelf_CSp)
549  if (do_dyn) &
550  call add_shelf_forces(os%grid, os%US, os%Ice_shelf_CSp, os%forces)
551  endif
552  if (os%icebergs_alter_ocean) then
553  if (do_dyn) &
554  call iceberg_forces(os%grid, os%forces, os%use_ice_shelf, &
555  os%sfc_state, dt_coupling, os%marine_ice_CSp)
556  if (do_thermo) &
557  call iceberg_fluxes(os%grid, os%US, os%flux_tmp, os%use_ice_shelf, &
558  os%sfc_state, dt_coupling, os%marine_ice_CSp)
559  endif
560 
561  call forcing_accumulate(os%flux_tmp, os%forces, os%fluxes, os%grid, weight)
562 
563  ! Some of the fields that exist in both the forcing and mech_forcing types
564  ! (e.g., ustar) are time-averages must be copied back to the forces type.
565  call copy_back_forcing_fields(os%fluxes, os%forces, os%grid)
566 
567 #ifdef _USE_GENERIC_TRACER
568  call mom_generic_tracer_fluxes_accumulate(os%flux_tmp, weight) !weight of the current flux in the running average
569 #endif
570  endif
571 
572  call set_derived_forcing_fields(os%forces, os%fluxes, os%grid, os%US, os%GV%Rho0)
573  call set_net_mass_forcing(os%fluxes, os%forces, os%grid, os%US)
574 
575  if (os%use_waves) then
576  call update_surface_waves(os%grid, os%GV, os%US, os%time, ocean_coupling_time_step, os%waves)
577  endif
578 
579  if (os%nstep==0) then
580  call finish_mom_initialization(os%Time, os%dirs, os%MOM_CSp, os%restart_CSp)
581  endif
582 
583  call disable_averaging(os%diag)
584  master_time = os%Time ; time1 = os%Time
585 
586  if(os%offline_tracer_mode) then
587  call step_offline(os%forces, os%fluxes, os%sfc_state, time1, dt_coupling, os%MOM_CSp)
588 
589  elseif ((.not.do_thermo) .or. (.not.do_dyn)) then
590  ! The call sequence is being orchestrated from outside of update_ocean_model.
591  call step_mom(os%forces, os%fluxes, os%sfc_state, time1, dt_coupling, os%MOM_CSp, &
592  waves=os%Waves, do_dynamics=do_thermo, do_thermodynamics=do_dyn, &
593  reset_therm=ocn_fluxes_used)
594 
595  elseif (os%single_step_call) then
596  call step_mom(os%forces, os%fluxes, os%sfc_state, time1, dt_coupling, os%MOM_CSp, waves=os%Waves)
597 
598  else
599  n_max = 1 ; if (dt_coupling > os%dt) n_max = ceiling(dt_coupling/os%dt - 0.001)
600  dt_dyn = dt_coupling / real(n_max)
601  thermo_does_span_coupling = (os%thermo_spans_coupling .and. &
602  (os%dt_therm > 1.5*dt_coupling))
603 
604  if (thermo_does_span_coupling) then
605  dt_therm = dt_coupling * floor(os%dt_therm / dt_coupling + 0.001)
606  nts = floor(dt_therm/dt_dyn + 0.001)
607  else
608  nts = max(1,min(n_max,floor(os%dt_therm/dt_dyn + 0.001)))
609  n_last_thermo = 0
610  endif
611 
612  time2 = time1 ; t_elapsed_seg = 0.0
613  do n=1,n_max
614  if (os%diabatic_first) then
615  if (thermo_does_span_coupling) call mom_error(fatal, &
616  "MOM is not yet set up to have restarts that work with "//&
617  "THERMO_SPANS_COUPLING and DIABATIC_FIRST.")
618  if (modulo(n-1,nts)==0) then
619  dtdia = dt_dyn*min(nts,n_max-(n-1))
620  call step_mom(os%forces, os%fluxes, os%sfc_state, time2, dtdia, os%MOM_CSp, &
621  waves=os%Waves, do_dynamics=.false., do_thermodynamics=.true., &
622  start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
623  endif
624 
625  call step_mom(os%forces, os%fluxes, os%sfc_state, time2, dt_dyn, os%MOM_CSp, &
626  waves=os%Waves, do_dynamics=.true., do_thermodynamics=.false., &
627  start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling)
628  else
629  call step_mom(os%forces, os%fluxes, os%sfc_state, time2, dt_dyn, os%MOM_CSp, &
630  waves=os%Waves, do_dynamics=.true., do_thermodynamics=.false., &
631  start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
632 
633  step_thermo = .false.
634  if (thermo_does_span_coupling) then
635  dtdia = dt_therm
636  step_thermo = mom_state_is_synchronized(os%MOM_CSp, adv_dyn=.true.)
637  elseif ((modulo(n,nts)==0) .or. (n==n_max)) then
638  dtdia = dt_dyn*(n - n_last_thermo)
639  n_last_thermo = n
640  step_thermo = .true.
641  endif
642 
643  if (step_thermo) then
644  ! Back up Time2 to the start of the thermodynamic segment.
645  time2 = time2 - set_time(int(floor((dtdia - dt_dyn) + 0.5)))
646  call step_mom(os%forces, os%fluxes, os%sfc_state, time2, dtdia, os%MOM_CSp, &
647  waves=os%Waves, do_dynamics=.false., do_thermodynamics=.true., &
648  start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling)
649  endif
650  endif
651 
652  t_elapsed_seg = t_elapsed_seg + dt_dyn
653  time2 = time1 + set_time(int(floor(t_elapsed_seg + 0.5)))
654  enddo
655  endif
656 
657  os%Time = master_time + ocean_coupling_time_step
658  os%nstep = os%nstep + 1
659 
660  call mech_forcing_diags(os%forces, dt_coupling, os%grid, os%Time, os%diag, os%forcing_CSp%handles)
661 
662  if (os%fluxes%fluxes_used) then
663  call forcing_diagnostics(os%fluxes, os%sfc_state, os%grid, os%US, os%Time, os%diag, os%forcing_CSp%handles)
664  endif
665 
666 ! Translate state into Ocean.
667 ! call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, &
668 ! Ice_ocean_boundary%p, OS%press_to_z)
669  call convert_state_to_ocean_type(os%sfc_state, ocean_sfc, os%grid, os%US)
670  call coupler_type_send_data(ocean_sfc%fields, os%Time)
671 
672  call calltree_leave("update_ocean_model()")
673 end subroutine update_ocean_model
674 
675 !> This subroutine writes out the ocean model restart file.
676 subroutine ocean_model_restart(OS, timestamp, restartname)
677  type(ocean_state_type), pointer :: os !< A pointer to the structure containing the
678  !! internal ocean state being saved to a restart file
679  character(len=*), optional, intent(in) :: timestamp !< An optional timestamp string that should be
680  !! prepended to the file name. (Currently this is unused.)
681  character(len=*), optional, intent(in) :: restartname !< Name of restart file to use
682  !! This option distinguishes the cesm interface from the
683  !! non-cesm interface
684 
685  if (.not.mom_state_is_synchronized(os%MOM_CSp)) &
686  call mom_error(warning, "End of MOM_main reached with inconsistent "//&
687  "dynamics and advective times. Additional restart fields "//&
688  "that have not been coded yet would be required for reproducibility.")
689  if (.not.os%fluxes%fluxes_used) call mom_error(fatal, "ocean_model_restart "//&
690  "was called with unused buoyancy fluxes. For conservation, the ocean "//&
691  "restart files can only be created after the buoyancy forcing is applied.")
692 
693  if (present(restartname)) then
694  call save_restart(os%dirs%restart_output_dir, os%Time, os%grid, &
695  os%restart_CSp, gv=os%GV, filename=restartname)
696  call forcing_save_restart(os%forcing_CSp, os%grid, os%Time, &
697  os%dirs%restart_output_dir) ! Is this needed?
698  if (os%use_ice_shelf) then
699  call ice_shelf_save_restart(os%Ice_shelf_CSp, os%Time, &
700  os%dirs%restart_output_dir)
701  endif
702  else
703  if (btest(os%Restart_control,1)) then
704  call save_restart(os%dirs%restart_output_dir, os%Time, os%grid, &
705  os%restart_CSp, .true., gv=os%GV)
706  call forcing_save_restart(os%forcing_CSp, os%grid, os%Time, &
707  os%dirs%restart_output_dir, .true.)
708  if (os%use_ice_shelf) then
709  call ice_shelf_save_restart(os%Ice_shelf_CSp, os%Time, os%dirs%restart_output_dir, .true.)
710  endif
711  endif
712  if (btest(os%Restart_control,0)) then
713  call save_restart(os%dirs%restart_output_dir, os%Time, os%grid, &
714  os%restart_CSp, gv=os%GV)
715  call forcing_save_restart(os%forcing_CSp, os%grid, os%Time, &
716  os%dirs%restart_output_dir)
717  if (os%use_ice_shelf) then
718  call ice_shelf_save_restart(os%Ice_shelf_CSp, os%Time, os%dirs%restart_output_dir)
719  endif
720  endif
721  end if
722 
723 end subroutine ocean_model_restart
724 ! </SUBROUTINE> NAME="ocean_model_restart"
725 
726 !> ocean_model_end terminates the model run, saving the ocean state in a restart
727 !! and deallocating any data associated with the ocean.
728 subroutine ocean_model_end(Ocean_sfc, Ocean_state, Time)
729  type(ocean_public_type), intent(inout) :: ocean_sfc !< An ocean_public_type structure that is
730  !! to be deallocated upon termination.
731  type(ocean_state_type), pointer :: ocean_state !< A pointer to the structure containing
732  !! the internal ocean state to be deallocated
733  !! upon termination.
734  type(time_type), intent(in) :: time !< The model time, used for writing restarts.
735 
736  call ocean_model_save_restart(ocean_state, time)
737  call diag_mediator_end(time, ocean_state%diag, end_diag_manager=.true.)
738  ! print time stats
739  call mom_infra_end
740  call mom_end(ocean_state%MOM_CSp)
741  if (ocean_state%use_ice_shelf) call ice_shelf_end(ocean_state%Ice_shelf_CSp)
742 end subroutine ocean_model_end
743 
744 !> ocean_model_save_restart causes restart files associated with the ocean to be
745 !! written out.
746 subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix)
747  type(ocean_state_type), pointer :: os !< A pointer to the structure containing the
748  !! internal ocean state (in).
749  type(time_type), intent(in) :: time !< The model time at this call, needed for mpp_write calls.
750  character(len=*), optional, intent(in) :: directory !< An optional directory into which to
751  !! write these restart files.
752  character(len=*), optional, intent(in) :: filename_suffix !< An optional suffix (e.g., a time-stamp)
753  !! to append to the restart file names.
754 ! Note: This is a new routine - it will need to exist for the new incremental
755 ! checkpointing. It will also be called by ocean_model_end, giving the same
756 ! restart behavior as now in FMS.
757  character(len=200) :: restart_dir
758 
759  if (.not.mom_state_is_synchronized(os%MOM_CSp)) &
760  call mom_error(warning, "ocean_model_save_restart called with inconsistent "//&
761  "dynamics and advective times. Additional restart fields "//&
762  "that have not been coded yet would be required for reproducibility.")
763  if (.not.os%fluxes%fluxes_used) call mom_error(fatal, "ocean_model_save_restart "//&
764  "was called with unused buoyancy fluxes. For conservation, the ocean "//&
765  "restart files can only be created after the buoyancy forcing is applied.")
766 
767  if (present(directory)) then ; restart_dir = directory
768  else ; restart_dir = os%dirs%restart_output_dir ; endif
769 
770  call save_restart(restart_dir, time, os%grid, os%restart_CSp, gv=os%GV)
771 
772  call forcing_save_restart(os%forcing_CSp, os%grid, time, restart_dir)
773 
774  if (os%use_ice_shelf) then
775  call ice_shelf_save_restart(os%Ice_shelf_CSp, os%Time, os%dirs%restart_output_dir)
776  endif
777 
778 end subroutine ocean_model_save_restart
779 
780 !> Initialize the public ocean type
781 subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap, &
782  gas_fields_ocn)
783  type(domain2d), intent(in) :: input_domain !< The ocean model domain description
784  type(ocean_public_type), intent(inout) :: Ocean_sfc !< A structure containing various publicly
785  !! visible ocean surface properties after initialization, whose
786  !! elements are allocated here.
787  type(diag_ctrl), intent(in) :: diag !< A structure that regulates diagnsotic output
788  logical, dimension(:,:), &
789  optional, intent(in) :: maskmap !< A mask indicating which virtual processors
790  !! are actually in use. If missing, all are used.
791  type(coupler_1d_bc_type), &
792  optional, intent(in) :: gas_fields_ocn !< If present, this type describes the
793  !! ocean and surface-ice fields that will participate
794  !! in the calculation of additional gas or other
795  !! tracer fluxes.
796  integer :: xsz, ysz, layout(2)
797  ! ice-ocean-boundary fields are always allocated using absolute indicies
798  ! and have no halos.
799  integer :: isc, iec, jsc, jec
800 
801  call mpp_get_layout(input_domain,layout)
802  call mpp_get_global_domain(input_domain, xsize=xsz, ysize=ysz)
803  if(PRESENT(maskmap)) then
804  call mpp_define_domains((/1,xsz,1,ysz/),layout,ocean_sfc%Domain, maskmap=maskmap)
805  else
806  call mpp_define_domains((/1,xsz,1,ysz/),layout,ocean_sfc%Domain)
807  endif
808  call mpp_get_compute_domain(ocean_sfc%Domain, isc, iec, jsc, jec)
809 
810  allocate (ocean_sfc%t_surf (isc:iec,jsc:jec), &
811  ocean_sfc%s_surf (isc:iec,jsc:jec), &
812  ocean_sfc%u_surf (isc:iec,jsc:jec), &
813  ocean_sfc%v_surf (isc:iec,jsc:jec), &
814  ocean_sfc%sea_lev(isc:iec,jsc:jec), &
815  ocean_sfc%area (isc:iec,jsc:jec), &
816  ocean_sfc%OBLD (isc:iec,jsc:jec), &
817  ocean_sfc%melt_potential(isc:iec,jsc:jec), &
818  ocean_sfc%frazil (isc:iec,jsc:jec))
819 
820  ocean_sfc%t_surf = 0.0 ! time averaged sst (Kelvin) passed to atmosphere/ice model
821  ocean_sfc%s_surf = 0.0 ! time averaged sss (psu) passed to atmosphere/ice models
822  ocean_sfc%u_surf = 0.0 ! time averaged u-current (m/sec) passed to atmosphere/ice models
823  ocean_sfc%v_surf = 0.0 ! time averaged v-current (m/sec) passed to atmosphere/ice models
824  ocean_sfc%sea_lev = 0.0 ! time averaged thickness of top model grid cell (m) plus patm/rho0/grav
825  ocean_sfc%frazil = 0.0 ! time accumulated frazil (J/m^2) passed to ice model
826  ocean_sfc%melt_potential = 0.0 ! time accumulated melt potential (J/m^2) passed to ice model
827  ocean_sfc%OBLD = 0.0 ! ocean boundary layer depth, in m
828  ocean_sfc%area = 0.0
829  ocean_sfc%axes = diag%axesT1%handles !diag axes to be used by coupler tracer flux diagnostics
830 
831  if (present(gas_fields_ocn)) then
832  call coupler_type_spawn(gas_fields_ocn, ocean_sfc%fields, (/isc,isc,iec,iec/), &
833  (/jsc,jsc,jec,jec/), suffix = '_ocn', as_needed=.true.)
834  endif
835 
836 end subroutine initialize_ocean_public_type
837 
838 !> This subroutine translates the coupler's ocean_data_type into MOM's
839 !! surface state variable. This may eventually be folded into the MOM
840 !! code that calculates the surface state in the first place.
841 !! Note the offset in the arrays because the ocean_data_type has no
842 !! halo points in its arrays and always uses absolute indicies.
843 subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_to_z)
844  type(surface), intent(inout) :: sfc_state !< A structure containing fields that
845  !! describe the surface state of the ocean.
846  type(ocean_public_type), &
847  target, intent(inout) :: Ocean_sfc !< A structure containing various publicly
848  !! visible ocean surface fields, whose elements
849  !! have their data set here.
850  type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
851  type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
852  real, optional, intent(in) :: patm(:,:) !< The pressure at the ocean surface, in Pa.
853  real, optional, intent(in) :: press_to_z !< A conversion factor between pressure and
854  !! ocean depth in m, usually 1/(rho_0*g), in m Pa-1.
855 
856  ! Local variables
857  real :: IgR0
858  character(len=48) :: val_str
859  integer :: isc_bnd, iec_bnd, jsc_bnd, jec_bnd
860  integer :: i, j, i0, j0, is, ie, js, je
861 
862  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
863  call pass_vector(sfc_state%u,sfc_state%v,g%Domain)
864 
865  call mpp_get_compute_domain(ocean_sfc%Domain, isc_bnd, iec_bnd, &
866  jsc_bnd, jec_bnd)
867  if (present(patm)) then
868  ! Check that the inidicies in patm are (isc_bnd:iec_bnd,jsc_bnd:jec_bnd).
869  if (.not.present(press_to_z)) call mom_error(fatal, &
870  'convert_state_to_ocean_type: press_to_z must be present if patm is.')
871  endif
872 
873  i0 = is - isc_bnd ; j0 = js - jsc_bnd
874  if (sfc_state%T_is_conT) then
875  ! Convert the surface T from conservative T to potential T.
876  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
877  ocean_sfc%t_surf(i,j) = gsw_pt_from_ct(sfc_state%SSS(i+i0,j+j0), &
878  sfc_state%SST(i+i0,j+j0)) + celsius_kelvin_offset
879  enddo ; enddo
880  else
881  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
882  ocean_sfc%t_surf(i,j) = sfc_state%SST(i+i0,j+j0) + celsius_kelvin_offset
883  enddo ; enddo
884  endif
885  if (sfc_state%S_is_absS) then
886  ! Convert the surface S from absolute salinity to practical salinity.
887  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
888  ocean_sfc%s_surf(i,j) = gsw_sp_from_sr(sfc_state%SSS(i+i0,j+j0))
889  enddo ; enddo
890  else
891  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
892  ocean_sfc%s_surf(i,j) = sfc_state%SSS(i+i0,j+j0)
893  enddo ; enddo
894  endif
895 
896  if (present(patm)) then
897  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
898  ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
899  ocean_sfc%area(i,j) = us%L_to_m**2*g%areaT(i+i0,j+j0)
900  enddo ; enddo
901  else
902  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
903  ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
904  ocean_sfc%area(i,j) = us%L_to_m**2*g%areaT(i+i0,j+j0)
905  enddo ; enddo
906  endif
907 
908  if (associated(sfc_state%frazil)) then
909  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
910  ocean_sfc%frazil(i,j) = sfc_state%frazil(i+i0,j+j0)
911  enddo ; enddo
912  endif
913 
914  if (allocated(sfc_state%melt_potential)) then
915  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
916  ocean_sfc%melt_potential(i,j) = sfc_state%melt_potential(i+i0,j+j0)
917  enddo ; enddo
918  endif
919 
920  if (allocated(sfc_state%Hml)) then
921  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
922  ocean_sfc%OBLD(i,j) = sfc_state%Hml(i+i0,j+j0)
923  enddo ; enddo
924  endif
925 
926  if (ocean_sfc%stagger == agrid) then
927  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
928  ocean_sfc%u_surf(i,j) = g%mask2dT(i+i0,j+j0) * &
929  0.5*(sfc_state%u(i+i0,j+j0)+sfc_state%u(i-1+i0,j+j0))
930  ocean_sfc%v_surf(i,j) = g%mask2dT(i+i0,j+j0) * &
931  0.5*(sfc_state%v(i+i0,j+j0)+sfc_state%v(i+i0,j-1+j0))
932  enddo ; enddo
933  elseif (ocean_sfc%stagger == bgrid_ne) then
934  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
935  ocean_sfc%u_surf(i,j) = g%mask2dBu(i+i0,j+j0) * &
936  0.5*(sfc_state%u(i+i0,j+j0)+sfc_state%u(i+i0,j+j0+1))
937  ocean_sfc%v_surf(i,j) = g%mask2dBu(i+i0,j+j0) * &
938  0.5*(sfc_state%v(i+i0,j+j0)+sfc_state%v(i+i0+1,j+j0))
939  enddo ; enddo
940  elseif (ocean_sfc%stagger == cgrid_ne) then
941  do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
942  ocean_sfc%u_surf(i,j) = g%mask2dCu(i+i0,j+j0)*sfc_state%u(i+i0,j+j0)
943  ocean_sfc%v_surf(i,j) = g%mask2dCv(i+i0,j+j0)*sfc_state%v(i+i0,j+j0)
944  enddo ; enddo
945  else
946  write(val_str, '(I8)') ocean_sfc%stagger
947  call mom_error(fatal, "convert_state_to_ocean_type: "//&
948  "Ocean_sfc%stagger has the unrecognized value of "//trim(val_str))
949  endif
950 
951  if (coupler_type_initialized(sfc_state%tr_fields)) then
952  if (.not.coupler_type_initialized(ocean_sfc%fields)) then
953  call mom_error(fatal, "convert_state_to_ocean_type: "//&
954  "Ocean_sfc%fields has not been initialized.")
955  endif
956  call coupler_type_copy_data(sfc_state%tr_fields, ocean_sfc%fields)
957  endif
958 
959 end subroutine convert_state_to_ocean_type
960 
961 !> This subroutine extracts the surface properties from the ocean's internal
962 !! state and stores them in the ocean type returned to the calling ice model.
963 !! It has to be separate from the ocean_initialization call because the coupler
964 !! module allocates the space for some of these variables.
965 subroutine ocean_model_init_sfc(OS, Ocean_sfc)
966  type(ocean_state_type), pointer :: os !< The structure with the complete ocean state
967  type(ocean_public_type), intent(inout) :: ocean_sfc !< A structure containing various publicly
968  !! visible ocean surface properties after initialization, whose
969  !! elements have their data set here.
970  integer :: is, ie, js, je
971 
972  is = os%grid%isc ; ie = os%grid%iec ; js = os%grid%jsc ; je = os%grid%jec
973  call coupler_type_spawn(ocean_sfc%fields, os%sfc_state%tr_fields, &
974  (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.)
975 
976  call extract_surface_state(os%MOM_CSp, os%sfc_state)
977 
978  call convert_state_to_ocean_type(os%sfc_state, ocean_sfc, os%grid, os%US)
979 
980 end subroutine ocean_model_init_sfc
981 
982 !> ocean_model_flux_init is used to initialize properties of the air-sea fluxes
983 !! as determined by various run-time parameters. It can be called from
984 !! non-ocean PEs, or PEs that have not yet been initialzed, and it can safely
985 !! be called multiple times.
986 subroutine ocean_model_flux_init(OS, verbosity)
987  type(ocean_state_type), optional, pointer :: os !< An optional pointer to the ocean state,
988  !! used to figure out if this is an ocean PE that
989  !! has already been initialized.
990  integer, optional, intent(in) :: verbosity !< A 0-9 integer indicating a level of verbosity.
991 
992  logical :: os_is_set
993  integer :: verbose
994 
995  os_is_set = .false. ; if (present(os)) os_is_set = associated(os)
996 
997  ! Use this to control the verbosity of output; consider rethinking this logic later.
998  verbose = 5 ; if (os_is_set) verbose = 3
999  if (present(verbosity)) verbose = verbosity
1000 
1001  call call_tracer_flux_init(verbosity=verbose)
1002 
1003 end subroutine ocean_model_flux_init
1004 
1005 !> Ocean_stock_pe - returns the integrated stocks of heat, water, etc. for conservation checks.
1006 !! Because of the way FMS is coded, only the root PE has the integrated amount,
1007 !! while all other PEs get 0.
1008 subroutine ocean_stock_pe(OS, index, value, time_index)
1009  use stock_constants_mod, only : istock_water, istock_heat,istock_salt
1010  type(ocean_state_type), pointer :: os !< A structure containing the internal ocean state.
1011  !! The data in OS is intent in.
1012  integer, intent(in) :: index !< The stock index for the quantity of interest.
1013  real, intent(out) :: value !< Sum returned for the conservation quantity of interest.
1014  integer, optional, intent(in) :: time_index !< An unused optional argument, present only for
1015  !! interfacial compatibility with other models.
1016 ! Arguments: OS - A structure containing the internal ocean state.
1017 ! (in) index - Index of conservation quantity of interest.
1018 ! (in) value - Sum returned for the conservation quantity of interest.
1019 ! (in,opt) time_index - Index for time level to use if this is necessary.
1020 
1021  real :: salt
1022 
1023  value = 0.0
1024  if (.not.associated(os)) return
1025  if (.not.os%is_ocean_pe) return
1026 
1027  select case (index)
1028  case (istock_water) ! Return the mass of fresh water in the ocean in kg.
1029  if (os%GV%Boussinesq) then
1030  call get_ocean_stocks(os%MOM_CSp, mass=value, on_pe_only=.true.)
1031  else ! In non-Boussinesq mode, the mass of salt needs to be subtracted.
1032  call get_ocean_stocks(os%MOM_CSp, mass=value, salt=salt, on_pe_only=.true.)
1033  value = value - salt
1034  endif
1035  case (istock_heat) ! Return the heat content of the ocean in J.
1036  call get_ocean_stocks(os%MOM_CSp, heat=value, on_pe_only=.true.)
1037  case (istock_salt) ! Return the mass of the salt in the ocean in kg.
1038  call get_ocean_stocks(os%MOM_CSp, salt=value, on_pe_only=.true.)
1039  case default ; value = 0.0
1040  end select
1041  ! If the FMS coupler is changed so that Ocean_stock_PE is only called on
1042  ! ocean PEs, uncomment the following and eliminate the on_PE_only flags above.
1043  ! if (.not.is_root_pe()) value = 0.0
1044 
1045 end subroutine ocean_stock_pe
1046 
1047 !> Write out FMS-format checsums on fields from the ocean surface state
1048 subroutine ocean_public_type_chksum(id, timestep, ocn)
1050  character(len=*), intent(in) :: id !< An identifying string for this call
1051  integer, intent(in) :: timestep !< The number of elapsed timesteps
1052  type(ocean_public_type), intent(in) :: ocn !< A structure containing various publicly
1053  !! visible ocean surface fields.
1054  integer :: n, m, outunit
1055 
1056  outunit = stdout()
1057 
1058  write(outunit,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
1059  write(outunit,100) 'ocean%t_surf ',mpp_chksum(ocn%t_surf )
1060  write(outunit,100) 'ocean%s_surf ',mpp_chksum(ocn%s_surf )
1061  write(outunit,100) 'ocean%u_surf ',mpp_chksum(ocn%u_surf )
1062  write(outunit,100) 'ocean%v_surf ',mpp_chksum(ocn%v_surf )
1063  write(outunit,100) 'ocean%sea_lev ',mpp_chksum(ocn%sea_lev)
1064  write(outunit,100) 'ocean%frazil ',mpp_chksum(ocn%frazil )
1065  write(outunit,100) 'ocean%melt_potential ',mpp_chksum(ocn%melt_potential)
1066 
1067  call coupler_type_write_chksums(ocn%fields, outunit, 'ocean%')
1068 100 FORMAT(" CHECKSUM::",a20," = ",z20)
1069 
1070 end subroutine ocean_public_type_chksum
1071 
1072 subroutine get_ocean_grid(OS, Gridp)
1073  ! Obtain the ocean grid.
1074  type(ocean_state_type) :: os
1075  type(ocean_grid_type) , pointer :: gridp
1076 
1077  gridp => os%grid
1078  return
1079 end subroutine get_ocean_grid
1080 
1081 end module mom_ocean_model_mct
mom_tracer_flow_control::tracer_flow_control_init
subroutine, public tracer_flow_control_init(restart, day, G, GV, US, h, param_file, diag, OBC, CS, sponge_CSp, ALE_sponge_CSp, tv)
This subroutine calls all registered tracer initialization subroutines.
Definition: MOM_tracer_flow_control.F90:278
mom_time_manager
Wraps the FMS time manager functions.
Definition: MOM_time_manager.F90:2
mom_forcing_type::allocate_forcing_type
subroutine, public allocate_forcing_type(G, fluxes, water, heat, ustar, press, shelf, iceberg, salt)
Conditionally allocate fields within the forcing type.
Definition: MOM_forcing_type.F90:2811
mom_ice_shelf::ice_shelf_end
subroutine, public ice_shelf_end(CS)
Deallocates all memory associated with this module.
Definition: MOM_ice_shelf.F90:1744
mom_forcing_type::mech_forcing
Structure that contains pointers to the mechanical forcing at the surface used to drive the liquid oc...
Definition: MOM_forcing_type.F90:187
mom_marine_ice::iceberg_forces
subroutine, public iceberg_forces(G, forces, use_ice_shelf, sfc_state, time_step, CS)
add_berg_flux_to_shelf adds rigidity and ice-area coverage due to icebergs to the forces type fields,...
Definition: MOM_marine_ice.F90:47
mom_variables::surface
Pointers to various fields which may be used describe the surface state of MOM, and which will be ret...
Definition: MOM_variables.F90:38
mom_ocean_model_mct::ocean_model_end
subroutine, public ocean_model_end(Ocean_sfc, Ocean_state, Time)
ocean_model_end terminates the model run, saving the ocean state in a restart and deallocating any da...
Definition: mom_ocean_model_mct.F90:729
mom_ocean_model_mct::convert_state_to_ocean_type
subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_to_z)
This subroutine translates the coupler's ocean_data_type into MOM's surface state variable....
Definition: mom_ocean_model_mct.F90:844
mom::step_mom
subroutine, public step_mom(forces, fluxes, sfc_state, Time_start, time_int_in, CS, Waves, do_dynamics, do_thermodynamics, start_cycle, end_cycle, cycle_length, reset_therm)
This subroutine orchestrates the time stepping of MOM. The adiabatic dynamics are stepped by calls to...
Definition: MOM.F90:399
mom_forcing_type::forcing_diagnostics
subroutine, public forcing_diagnostics(fluxes, sfc_state, G, US, time_end, diag, handles)
Offer buoyancy forcing fields for diagnostics for those fields registered as part of register_forcing...
Definition: MOM_forcing_type.F90:2238
mom_ice_shelf
Implements the thermodynamic aspects of ocean / ice-shelf interactions, along with a crude placeholde...
Definition: MOM_ice_shelf.F90:4
mom_verticalgrid
Provides a transparent vertical ocean grid type and supporting routines.
Definition: MOM_verticalGrid.F90:2
mom_marine_ice
Routines incorporating the effects of marine ice (sea-ice and icebergs) into the ocean model dynamics...
Definition: MOM_marine_ice.F90:3
mom_surface_forcing_mct::ice_ocn_bnd_type_chksum
subroutine, public ice_ocn_bnd_type_chksum(id, timestep, iobt)
Write out a set of messages with checksums of the fields in an ice_ocen_boundary type.
Definition: mom_surface_forcing_mct.F90:1356
mom_ocean_model_mct::ocean_public_type_chksum
subroutine, public ocean_public_type_chksum(id, timestep, ocn)
Write out FMS-format checsums on fields from the ocean surface state.
Definition: mom_ocean_model_mct.F90:1049
mom_file_parser::log_version
An overloaded interface to log version information about modules.
Definition: MOM_file_parser.F90:109
mom::mom_end
subroutine, public mom_end(CS)
End of ocean model, including memory deallocation.
Definition: MOM.F90:3132
mom_constants
Provides a few physical constants.
Definition: MOM_constants.F90:2
mom_forcing_type::copy_back_forcing_fields
subroutine, public copy_back_forcing_fields(fluxes, forces, G)
This subroutine copies the computational domains of common forcing fields from a mech_forcing type to...
Definition: MOM_forcing_type.F90:2182
mom_diag_mediator
The subroutines here provide convenient wrappers to the fms diag_manager interfaces with additional d...
Definition: MOM_diag_mediator.F90:3
mom_surface_forcing_mct::convert_iob_to_forces
subroutine, public convert_iob_to_forces(IOB, forces, index_bounds, Time, G, US, CS)
This subroutine translates the Ice_ocean_boundary_type into a MOM mechanical forcing type,...
Definition: mom_surface_forcing_mct.F90:591
mom_get_input::directories
Container for paths and parameter file names.
Definition: MOM_get_input.F90:20
mom_string_functions
Handy functions for manipulating strings.
Definition: MOM_string_functions.F90:2
mom_surface_forcing_mct::surface_forcing_cs
Contains pointers to the forcing fields which may be used to drive MOM. All fluxes are positive downw...
Definition: mom_surface_forcing_mct.F90:58
mom_wave_interface::update_surface_waves
subroutine, public update_surface_waves(G, GV, US, Day, dt, CS)
Subroutine that handles updating of surface wave/Stokes drift related properties.
Definition: MOM_wave_interface.F90:437
mom_tracer_flow_control::call_tracer_flux_init
subroutine, public call_tracer_flux_init(verbosity)
This subroutine carries out a series of calls to initialize the air-sea tracer fluxes,...
Definition: MOM_tracer_flow_control.F90:117
mom_eos
Provides subroutines for quantities specific to the equation of state.
Definition: MOM_EOS.F90:2
mom::mom_control_struct
Control structure for the MOM module, including the variables that describe the state of the ocean.
Definition: MOM.F90:153
mom_domains::pass_var
Do a halo update on an array.
Definition: MOM_domains.F90:49
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_diag_mediator::diag_mediator_close_registration
subroutine, public diag_mediator_close_registration(diag_CS)
Definition: MOM_diag_mediator.F90:3284
mom_forcing_type::set_derived_forcing_fields
subroutine, public set_derived_forcing_fields(forces, fluxes, G, US, Rho0)
This subroutine calculates certain derived forcing fields based on information from a mech_forcing ty...
Definition: MOM_forcing_type.F90:2089
mom_forcing_type::set_net_mass_forcing
subroutine, public set_net_mass_forcing(fluxes, forces, G, US)
This subroutine determines the net mass source to the ocean from a (thermodynamic) forcing type and s...
Definition: MOM_forcing_type.F90:2129
mom_io
This module contains I/O framework code.
Definition: MOM_io.F90:2
mom_ocean_model_mct::ocean_model_init
subroutine, public ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, input_restart_file)
ocean_model_init initializes the ocean model, including registering fields for restarts and reading r...
Definition: mom_ocean_model_mct.F90:224
mom_string_functions::uppercase
character(len=len(input_string)) function, public uppercase(input_string)
Return a string in which all uppercase letters have been replaced by their lowercase counterparts.
Definition: MOM_string_functions.F90:42
mom_restart::mom_restart_cs
A restart registry and the control structure for restarts.
Definition: MOM_restart.F90:72
mom_forcing_type::mech_forcing_diags
subroutine, public mech_forcing_diags(forces, dt, G, time_end, diag, handles)
Offer mechanical forcing fields for diagnostics for those fields registered as part of register_forci...
Definition: MOM_forcing_type.F90:2201
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_surface_forcing_mct::surface_forcing_init
subroutine, public surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt, restore_temp)
Initialize the surface forcing, including setting parameters and allocating permanent memory.
Definition: mom_surface_forcing_mct.F90:1007
mom_domains::pass_vector
Do a halo update on a pair of arrays representing the two components of a vector.
Definition: MOM_domains.F90:54
mom_ice_shelf::ice_shelf_save_restart
subroutine, public ice_shelf_save_restart(CS, Time, directory, time_stamped, filename_suffix)
Save the ice shelf restart file.
Definition: MOM_ice_shelf.F90:1721
mom_ocean_model_mct::ocean_model_flux_init
subroutine, public ocean_model_flux_init(OS, verbosity)
ocean_model_flux_init is used to initialize properties of the air-sea fluxes as determined by various...
Definition: mom_ocean_model_mct.F90:987
mom_generic_tracer
Definition: MOM_generic_tracer.F90:1
mom_wave_interface::mom_wave_interface_init
subroutine, public mom_wave_interface_init(time, G, GV, US, param_file, CS, diag)
Initializes parameters related to MOM_wave_interface.
Definition: MOM_wave_interface.F90:193
mom_forcing_type
This module implements boundary forcing for MOM6.
Definition: MOM_forcing_type.F90:2
mom_diag_mediator::diag_mediator_end
subroutine, public diag_mediator_end(time, diag_CS, end_diag_manager)
Definition: MOM_diag_mediator.F90:3299
mom_domains::to_all
integer, parameter, public to_all
A flag for passing in all directions.
Definition: MOM_domains.F90:132
mom_wave_interface
Interface for surface waves.
Definition: MOM_wave_interface.F90:2
mom_surface_forcing_mct::forcing_save_restart
subroutine, public forcing_save_restart(CS, G, Time, directory, time_stamped, filename_suffix)
Save any restart files associated with the surface forcing.
Definition: mom_surface_forcing_mct.F90:988
mom_wave_interface::wave_parameters_cs
Container for all surface wave related parameters.
Definition: MOM_wave_interface.F90:47
mom_ice_shelf::ice_shelf_cs
Control structure that contains ice shelf parameters and diagnostics handles.
Definition: MOM_ice_shelf.F90:71
mom_verticalgrid::verticalgrid_type
Describes the vertical ocean grid, including unit conversion factors.
Definition: MOM_verticalGrid.F90:24
mom_surface_forcing_mct::convert_iob_to_fluxes
subroutine, public convert_iob_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G, US, CS, sfc_state, restore_salt, restore_temp)
This subroutine translates the Ice_ocean_boundary_type into a MOM thermodynamic forcing type,...
Definition: mom_surface_forcing_mct.F90:197
mom_restart
The MOM6 facility for reading and writing restart files, and querying what has been read.
Definition: MOM_restart.F90:2
mom::step_offline
subroutine, public step_offline(forces, fluxes, sfc_state, Time_start, time_interval, CS)
step_offline is the main driver for running tracers offline in MOM6. This has been primarily develope...
Definition: MOM.F90:1310
mom_domains
Describes the decomposed MOM domain and has routines for communications across PEs.
Definition: MOM_domains.F90:2
mom_variables
Provides transparent structures with groups of MOM6 variables and supporting routines.
Definition: MOM_variables.F90:2
mom::finish_mom_initialization
subroutine, public finish_mom_initialization(Time, dirs, CS, restart_CSp)
Finishes initializing MOM and writes out the initial conditions.
Definition: MOM.F90:2484
mom_ocean_model_mct::ocean_model_save_restart
subroutine, public ocean_model_save_restart(OS, Time, directory, filename_suffix)
ocean_model_save_restart causes restart files associated with the ocean to be written out.
Definition: mom_ocean_model_mct.F90:747
mom::initialize_mom
subroutine, public initialize_mom(Time, Time_init, param_file, dirs, CS, restart_CSp, Time_in, offline_tracer_mode, input_restart_file, diag_ptr, count_calls, tracer_flow_CSp)
Initialize MOM, including memory allocation, setting up parameters and diagnostics,...
Definition: MOM.F90:1506
mom_ocean_model_mct::ocean_stock_pe
subroutine, public ocean_stock_pe(OS, index, value, time_index)
Ocean_stock_pe - returns the integrated stocks of heat, water, etc. for conservation checks....
Definition: mom_ocean_model_mct.F90:1009
mom_ocean_model_mct::ocean_state_type
The ocean_state_type contains all information about the state of the ocean, with a format that is pri...
Definition: mom_ocean_model_mct.F90:134
mom_file_parser
The MOM6 facility to parse input files for runtime parameters.
Definition: MOM_file_parser.F90:2
mom_error_handler::calltree_leave
subroutine, public calltree_leave(mesg)
Writes a message about leaving a subroutine if call tree reporting is active.
Definition: MOM_error_handler.F90:151
mom_wave_interface::mom_wave_interface_init_lite
subroutine, public mom_wave_interface_init_lite(param_file)
A 'lite' init subroutine to initialize a few inputs needed if using wave information with the wind-sp...
Definition: MOM_wave_interface.F90:410
mom_tracer_flow_control
Orchestrates the registration and calling of tracer packages.
Definition: MOM_tracer_flow_control.F90:2
mom_get_input::get_mom_input
subroutine, public get_mom_input(param_file, dirs, check_params, default_input_filename, ensemble_num)
Get the names of the I/O directories and initialization file. Also calls the subroutine that opens ru...
Definition: MOM_get_input.F90:34
mom_ocean_model_mct::ocean_model_restart
subroutine, public ocean_model_restart(OS, timestamp, restartname)
This subroutine writes out the ocean model restart file.
Definition: mom_ocean_model_mct.F90:677
mom_ocean_model_mct::get_ocean_grid
subroutine, public get_ocean_grid(OS, Gridp)
Definition: mom_ocean_model_mct.F90:1073
mom_grid
Provides the ocean grid type.
Definition: MOM_grid.F90:2
mom_diag_mediator::disable_averaging
subroutine, public disable_averaging(diag_cs)
Call this subroutine to avoid averaging any offered fields.
Definition: MOM_diag_mediator.F90:1840
mom_surface_forcing_mct::ice_ocean_boundary_type
Structure corresponding to forcing, but with the elements, units, and conventions that exactly confor...
Definition: mom_surface_forcing_mct.F90:147
mom_unit_scaling
Provides a transparent unit rescaling type to facilitate dimensional consistency testing.
Definition: MOM_unit_scaling.F90:2
mom_ocean_model_mct::ocean_model_init_sfc
subroutine, public ocean_model_init_sfc(OS, Ocean_sfc)
This subroutine extracts the surface properties from the ocean's internal state and stores them in th...
Definition: mom_ocean_model_mct.F90:966
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
The central module of the MOM6 ocean model.
Definition: MOM.F90:2
mom_file_parser::close_param_file
subroutine, public close_param_file(CS, quiet_close, component)
Close any open input files and deallocate memory associated with this param_file_type....
Definition: MOM_file_parser.F90:242
mom_marine_ice::iceberg_fluxes
subroutine, public iceberg_fluxes(G, US, fluxes, use_ice_shelf, sfc_state, time_step, CS)
iceberg_fluxes adds ice-area-coverage and modifies various thermodynamic fluxes due to the presence o...
Definition: MOM_marine_ice.F90:108
mom_forcing_type::forcing
Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by ...
Definition: MOM_forcing_type.F90:50
mom_ocean_model_mct::ocean_public_type
This type is used for communication with other components via the FMS coupler. The element names and ...
Definition: mom_ocean_model_mct.F90:88
mom_io::file_exists
Indicate whether a file exists, perhaps with domain decomposition.
Definition: MOM_io.F90:68
mom::get_mom_state_elements
subroutine, public get_mom_state_elements(CS, G, GV, US, C_p, use_temp)
This subroutine offers access to values or pointers to other types from within the MOM_control_struct...
Definition: MOM.F90:3096
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_restart::save_restart
subroutine, public save_restart(directory, time, G, CS, time_stamped, filename, GV)
save_restart saves all registered variables to restart files.
Definition: MOM_restart.F90:781
mom_ocean_model_mct::update_ocean_model
subroutine, public update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, time_start_update, Ocean_coupling_time_step, update_dyn, update_thermo, Ocn_fluxes_used)
update_ocean_model uses the forcing in Ice_ocean_boundary to advance the ocean model's state from the...
Definition: mom_ocean_model_mct.F90:425
mom_forcing_type::copy_common_forcing_fields
subroutine, public copy_common_forcing_fields(forces, fluxes, G, skip_pres)
This subroutine copies the computational domains of common forcing fields from a mech_forcing type to...
Definition: MOM_forcing_type.F90:2046
mom_ocean_model_mct::initialize_ocean_public_type
subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap, gas_fields_ocn)
Initialize the public ocean type.
Definition: mom_ocean_model_mct.F90:783
mom_ice_shelf::initialize_ice_shelf
subroutine, public initialize_ice_shelf(param_file, ocn_grid, Time, CS, diag, forces, fluxes, Time_in, solo_ice_sheet_in)
Initializes shelf model data, parameters and diagnostics.
Definition: MOM_ice_shelf.F90:1082
mom_ice_shelf::add_shelf_forces
subroutine, public add_shelf_forces(G, US, CS, forces, do_shelf_area)
This subroutine adds the mechanical forcing fields and perhaps shelf areas, based on the ice state in...
Definition: MOM_ice_shelf.F90:760
mom_surface_forcing_mct
Definition: mom_surface_forcing_mct.F90:1
mom_diag_mediator::enable_averaging
subroutine, public enable_averaging(time_int_in, time_end_in, diag_cs)
This subroutine enables the accumulation of time averages over the specified time interval.
Definition: MOM_diag_mediator.F90:1805
mom_forcing_type::forcing_accumulate
subroutine, public forcing_accumulate(flux_tmp, forces, fluxes, G, wt2)
Accumulate the forcing over time steps, taking input from a mechanical forcing type and a temporary f...
Definition: MOM_forcing_type.F90:1882
mom_ocean_model_mct
Top-level module for the MOM6 ocean model in coupled mode.
Definition: mom_ocean_model_mct.F90:2
mom_marine_ice::marine_ice_init
subroutine, public marine_ice_init(Time, G, param_file, diag, CS)
Initialize control structure for MOM_marine_ice.
Definition: MOM_marine_ice.F90:181
mom_marine_ice::marine_ice_cs
Control structure for MOM_marine_ice.
Definition: MOM_marine_ice.F90:28
mom_error_handler
Routines for error handling and I/O management.
Definition: MOM_error_handler.F90:2
mom_ice_shelf::shelf_calc_flux
subroutine, public shelf_calc_flux(state, fluxes, Time, time_step, CS, forces)
Calculates fluxes between the ocean and ice-shelf using the three-equations formulation (optional to ...
Definition: MOM_ice_shelf.F90:193
mom::get_ocean_stocks
subroutine, public get_ocean_stocks(CS, mass, heat, salt, on_PE_only)
Find the global integrals of various quantities.
Definition: MOM.F90:3115
mom_error_handler::calltree_enter
subroutine, public calltree_enter(mesg, n)
Writes a message about entering a subroutine if call tree reporting is active.
Definition: MOM_error_handler.F90:130
mom::extract_surface_state
subroutine, public extract_surface_state(CS, sfc_state)
Set the surface (return) properties of the ocean model by setting the appropriate fields in sfc_state...
Definition: MOM.F90:2712
mom::mom_state_is_synchronized
logical function, public mom_state_is_synchronized(CS, adv_dyn)
Return true if all phases of step_MOM are at the same point in time.
Definition: MOM.F90:3075
mom_grid::ocean_grid_type
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:26
mom_diag_mediator::diag_ctrl
The following data type a list of diagnostic fields an their variants, as well as variables that cont...
Definition: MOM_diag_mediator.F90:239
mom_constants::celsius_kelvin_offset
real, parameter, public celsius_kelvin_offset
The constant offset for converting temperatures in Kelvin to Celsius.
Definition: MOM_constants.F90:11
mom_tracer_flow_control::call_tracer_register
subroutine, public call_tracer_register(HI, GV, US, param_file, CS, tr_Reg, restart_CS)
This subroutine determines which tracer packages are to be used and does the calls to register their ...
Definition: MOM_tracer_flow_control.F90:152