MOM6
mom_dynamics_unsplit_rk2 Module Reference

Data Types

type  mom_dyn_unsplit_rk2_cs
 

Functions/Subroutines

subroutine, public step_mom_dyn_unsplit_rk2 (u_in, v_in, h_in, tv, visc, Time_local, dt, fluxes, p_surf_begin, p_surf_end, uh, vh, uhtr, vhtr, eta_av, G, GV, CS, VarMix, MEKE)
 
subroutine, public register_restarts_dyn_unsplit_rk2 (HI, GV, param_file, CS, restart_CS)
 
subroutine, public initialize_dyn_unsplit_rk2 (u, v, h, Time, G, GV, param_file, diag, CS, restart_CS, Accel_diag, Cont_diag, MIS, OBC, update_OBC_CSp, ALE_CSp, setVisc_CSp, visc, dirs, ntrunc)
 
subroutine, public end_dyn_unsplit_rk2 (CS)
 

Variables

integer id_clock_cor
 
integer id_clock_pres
 
integer id_clock_vertvisc
 
integer id_clock_horvisc
 
integer id_clock_continuity
 
integer id_clock_mom_update
 
integer id_clock_pass
 
integer id_clock_pass_init
 

Function/Subroutine Documentation

◆ end_dyn_unsplit_rk2()

subroutine, public mom_dynamics_unsplit_rk2::end_dyn_unsplit_rk2 ( type(mom_dyn_unsplit_rk2_cs), pointer  CS)

Definition at line 738 of file MOM_dynamics_unsplit_RK2.F90.

738  type(mom_dyn_unsplit_rk2_cs), pointer :: cs
739 ! (inout) CS - The control structure set up by initialize_dyn_unsplit_RK2.
740 
741  dealloc_(cs%diffu) ; dealloc_(cs%diffv)
742  dealloc_(cs%CAu) ; dealloc_(cs%CAv)
743  dealloc_(cs%PFu) ; dealloc_(cs%PFv)
744 
745  deallocate(cs)

◆ initialize_dyn_unsplit_rk2()

subroutine, public mom_dynamics_unsplit_rk2::initialize_dyn_unsplit_rk2 ( real, dimension(szib_(g),szj_(g),szk_(g)), intent(inout)  u,
real, dimension(szi_(g),szjb_(g),szk_(g)), intent(inout)  v,
real, dimension(szi_(g),szj_(g),szk_(g)), intent(inout)  h,
type(time_type), intent(in), target  Time,
type(ocean_grid_type), intent(inout)  G,
type(verticalgrid_type), intent(in)  GV,
type(param_file_type), intent(in)  param_file,
type(diag_ctrl), intent(inout), target  diag,
type(mom_dyn_unsplit_rk2_cs), pointer  CS,
type(mom_restart_cs), pointer  restart_CS,
type(accel_diag_ptrs), intent(inout), target  Accel_diag,
type(cont_diag_ptrs), intent(inout), target  Cont_diag,
type(ocean_internal_state), intent(inout)  MIS,
type(ocean_obc_type), pointer  OBC,
type(update_obc_cs), pointer  update_OBC_CSp,
type(ale_cs), pointer  ALE_CSp,
type(set_visc_cs), pointer  setVisc_CSp,
type(vertvisc_type), intent(inout)  visc,
type(directories), intent(in)  dirs,
integer, intent(inout), target  ntrunc 
)
Parameters
[in,out]gThe ocean's grid structure.
[in]gvThe ocean's vertical grid structure.
[in,out]uThe zonal velocity, in m s-1.
[in,out]vThe meridional velocity, in m s-1.
[in,out]hLayer thicknesses, in H (usually m or kg m-2).
[in]timeThe current model time.
[in]param_fileA structure to parse for run-time parameters.
[in,out]diagA structure that is used to regulate diagnostic output.
csThe control structure set up by initialize_dyn_unsplit_RK2.
restart_csA pointer to the restart control structure.
[in,out]accel_diagA set of pointers to the various accelerations in the momentum equations, which can be used for later derived diagnostics, like energy budgets.
[in,out]cont_diagA structure with pointers to various terms in the continuity equations.
[in,out]misThe "MOM6 Internal State" structure, used to pass around pointers to various arrays for diagnostic purposes.
obcIf open boundary conditions are used, this points to the ocean_OBC_type that was set up in MOM_initialization.
update_obc_cspIf open boundary condition updates are used, this points to the appropriate control structure.
ale_cspThis points to the ALE control structure.
setvisc_cspThis points to the set_visc control structure.
[in,out]viscA structure containing vertical viscosities, bottom drag viscosities, and related fields.
[in]dirsA structure containing several relevant directory paths.
[in,out]ntruncA target for the variable that records the number of times the velocity is truncated (this should be 0).

Definition at line 568 of file MOM_dynamics_unsplit_RK2.F90.

References id_clock_continuity, id_clock_cor, id_clock_horvisc, id_clock_mom_update, id_clock_pass, id_clock_pass_init, id_clock_pres, and id_clock_vertvisc.

568  type(ocean_grid_type), intent(inout) :: g !< The ocean's grid structure.
569  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid
570  !! structure.
571  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(inout) :: u !< The zonal velocity, in m s-1.
572  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(inout) :: v !< The meridional velocity,
573  !! in m s-1.
574  real, dimension(SZI_(G),SZJ_(G),SZK_(G)) , intent(inout) :: h !< Layer thicknesses, in H
575  !! (usually m or kg m-2).
576  type(time_type), target, intent(in) :: time !< The current model time.
577  type(param_file_type), intent(in) :: param_file !< A structure to parse
578  !! for run-time parameters.
579  type(diag_ctrl), target, intent(inout) :: diag !< A structure that is used to
580  !! regulate diagnostic output.
581  type(mom_dyn_unsplit_rk2_cs), pointer :: cs !< The control structure set up
582  !! by initialize_dyn_unsplit_RK2.
583  type(mom_restart_cs), pointer :: restart_cs !< A pointer to the restart
584  !! control structure.
585  type(accel_diag_ptrs), target, intent(inout) :: accel_diag !< A set of pointers to the
586  !! various accelerations in the momentum equations, which can
587  !! be used for later derived diagnostics, like energy budgets.
588  type(cont_diag_ptrs), target, intent(inout) :: cont_diag !<A structure with pointers
589  !! to various terms in the
590  !! continuity equations.
591  type(ocean_internal_state), intent(inout) :: mis !< The "MOM6 Internal State"
592  !! structure, used to pass around pointers
593  !! to various arrays for diagnostic purposes.
594  type(ocean_obc_type), pointer :: obc !< If open boundary conditions
595  !! are used, this points to the ocean_OBC_type
596  !! that was set up in MOM_initialization.
597  type(update_obc_cs), pointer :: update_obc_csp !< If open boundary
598  !! condition updates are used, this points
599  !! to the appropriate control structure.
600  type(ale_cs), pointer :: ale_csp !< This points to the ALE
601  !! control structure.
602  type(set_visc_cs), pointer :: setvisc_csp !< This points to the
603  !! set_visc control
604  !! structure.
605  type(vertvisc_type), intent(inout) :: visc !< A structure containing
606  !! vertical viscosities, bottom drag
607  !! viscosities, and related fields.
608  type(directories), intent(in) :: dirs !< A structure containing several
609  !! relevant directory paths.
610  integer, target, intent(inout) :: ntrunc !< A target for the variable
611  !! that records the number of times the
612  !! velocity is truncated (this should be 0).
613 ! Arguments: u - The zonal velocity, in m s-1.
614 ! (inout) v - The meridional velocity, in m s-1.
615 ! (inout) h - The layer thicknesses, in m or kg m-2, depending on whether
616 ! the Boussinesq approximation is made.
617 ! (in) Time - The current model time.
618 ! (in) G - The ocean's grid structure.
619 ! (in) GV - The ocean's vertical grid structure.
620 ! (in) param_file - A structure indicating the open file to parse for
621 ! model parameter values.
622 ! (in) diag - A structure that is used to regulate diagnostic output.
623 ! (inout) CS - The control structure set up by initialize_dyn_unsplit_RK2.
624 ! (in) restart_CS - A pointer to the restart control structure.
625 ! (inout) Accel_diag - A set of pointers to the various accelerations in
626 ! the momentum equations, which can be used for later derived
627 ! diagnostics, like energy budgets.
628 ! (inout) Cont_diag - A structure with pointers to various terms in the
629 ! continuity equations.
630 ! (inout) MIS - The "MOM6 Internal State" structure, used to pass around
631 ! pointers to various arrays for diagnostic purposes.
632 ! (in) OBC - If open boundary conditions are used, this points to the
633 ! ocean_OBC_type that was set up in MOM_initialization.
634 ! (in) update_OBC_CSp - If open boundary condition updates are used,
635 ! this points to the appropriate control structure.
636 ! (in) ALE_CS - This points to the ALE control structure.
637 ! (in) setVisc_CSp - This points to the set_visc control structure.
638 ! (inout) visc - A structure containing vertical viscosities, bottom drag
639 ! viscosities, and related fields.
640 ! (in) dirs - A structure containing several relevant directory paths.
641 ! (in) ntrunc - A target for the variable that records the number of times
642 ! the velocity is truncated (this should be 0).
643 
644  ! This subroutine initializes all of the variables that are used by this
645  ! dynamic core, including diagnostics and the cpu clocks.
646  character(len=40) :: mdl = "MOM_dynamics_unsplit_RK2" ! This module's name.
647  character(len=48) :: thickness_units, flux_units
648  logical :: use_tides
649  integer :: isd, ied, jsd, jed, nz, isdb, iedb, jsdb, jedb
650  isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed ; nz = g%ke
651  isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
652 
653  if (.not.associated(cs)) call mom_error(fatal, &
654  "initialize_dyn_unsplit_RK2 called with an unassociated control structure.")
655  if (cs%module_is_initialized) then
656  call mom_error(warning, "initialize_dyn_unsplit_RK2 called with a control "// &
657  "structure that has already been initialized.")
658  return
659  endif
660  cs%module_is_initialized = .true.
661 
662  cs%diag => diag
663 
664  call get_param(param_file, mdl, "BE", cs%be, &
665  "If SPLIT is true, BE determines the relative weighting \n"//&
666  "of a 2nd-order Runga-Kutta baroclinic time stepping \n"//&
667  "scheme (0.5) and a backward Euler scheme (1) that is \n"//&
668  "used for the Coriolis and inertial terms. BE may be \n"//&
669  "from 0.5 to 1, but instability may occur near 0.5. \n"//&
670  "BE is also applicable if SPLIT is false and USE_RK2 \n"//&
671  "is true.", units="nondim", default=0.6)
672  call get_param(param_file, mdl, "BEGW", cs%begw, &
673  "If SPLIT is true, BEGW is a number from 0 to 1 that \n"//&
674  "controls the extent to which the treatment of gravity \n"//&
675  "waves is forward-backward (0) or simulated backward \n"//&
676  "Euler (1). 0 is almost always used.\n"//&
677  "If SPLIT is false and USE_RK2 is true, BEGW can be \n"//&
678  "between 0 and 0.5 to damp gravity waves.", &
679  units="nondim", default=0.0)
680  call get_param(param_file, mdl, "DEBUG", cs%debug, &
681  "If true, write out verbose debugging data.", default=.false.)
682  call get_param(param_file, mdl, "TIDES", use_tides, &
683  "If true, apply tidal momentum forcing.", default=.false.)
684 
685  allocate(cs%taux_bot(isdb:iedb,jsd:jed)) ; cs%taux_bot(:,:) = 0.0
686  allocate(cs%tauy_bot(isd:ied,jsdb:jedb)) ; cs%tauy_bot(:,:) = 0.0
687 
688  mis%diffu => cs%diffu ; mis%diffv => cs%diffv
689  mis%PFu => cs%PFu ; mis%PFv => cs%PFv
690  mis%CAu => cs%CAu ; mis%CAv => cs%CAv
691 
692  cs%ADp => accel_diag ; cs%CDp => cont_diag
693  accel_diag%diffu => cs%diffu ; accel_diag%diffv => cs%diffv
694  accel_diag%PFu => cs%PFu ; accel_diag%PFv => cs%PFv
695  accel_diag%CAu => cs%CAu ; accel_diag%CAv => cs%CAv
696 
697  call continuity_init(time, g, gv, param_file, diag, cs%continuity_CSp)
698  call coriolisadv_init(time, g, param_file, diag, cs%ADp, cs%CoriolisAdv_CSp)
699  if (use_tides) call tidal_forcing_init(time, g, param_file, cs%tides_CSp)
700  call pressureforce_init(time, g, gv, param_file, diag, cs%PressureForce_CSp, &
701  cs%tides_CSp)
702  call hor_visc_init(time, g, param_file, diag, cs%hor_visc_CSp)
703  call vertvisc_init(mis, time, g, gv, param_file, diag, cs%ADp, dirs, &
704  ntrunc, cs%vertvisc_CSp)
705  if (.not.associated(setvisc_csp)) call mom_error(fatal, &
706  "initialize_dyn_unsplit_RK2 called with setVisc_CSp unassociated.")
707  cs%set_visc_CSp => setvisc_csp
708 
709  if (associated(ale_csp)) cs%ALE_CSp => ale_csp
710  if (associated(obc)) cs%OBC => obc
711 
712  flux_units = get_flux_units(gv)
713  cs%id_uh = register_diag_field('ocean_model', 'uh', diag%axesCuL, time, &
714  'Zonal Thickness Flux', flux_units, y_cell_method='sum', v_extensive=.true.)
715  cs%id_vh = register_diag_field('ocean_model', 'vh', diag%axesCvL, time, &
716  'Meridional Thickness Flux', flux_units, x_cell_method='sum', v_extensive=.true.)
717  cs%id_CAu = register_diag_field('ocean_model', 'CAu', diag%axesCuL, time, &
718  'Zonal Coriolis and Advective Acceleration', 'meter second-2')
719  cs%id_CAv = register_diag_field('ocean_model', 'CAv', diag%axesCvL, time, &
720  'Meridional Coriolis and Advective Acceleration', 'meter second-2')
721  cs%id_PFu = register_diag_field('ocean_model', 'PFu', diag%axesCuL, time, &
722  'Zonal Pressure Force Acceleration', 'meter second-2')
723  cs%id_PFv = register_diag_field('ocean_model', 'PFv', diag%axesCvL, time, &
724  'Meridional Pressure Force Acceleration', 'meter second-2')
725 
726  id_clock_cor = cpu_clock_id('(Ocean Coriolis & mom advection)', grain=clock_module)
727  id_clock_continuity = cpu_clock_id('(Ocean continuity equation)', grain=clock_module)
728  id_clock_pres = cpu_clock_id('(Ocean pressure force)', grain=clock_module)
729  id_clock_vertvisc = cpu_clock_id('(Ocean vertical viscosity)', grain=clock_module)
730  id_clock_horvisc = cpu_clock_id('(Ocean horizontal viscosity)', grain=clock_module)
731  id_clock_mom_update = cpu_clock_id('(Ocean momentum increments)', grain=clock_module)
732  id_clock_pass = cpu_clock_id('(Ocean message passing)', grain=clock_module)
733  id_clock_pass_init = cpu_clock_id('(Ocean init message passing)', grain=clock_routine)
734 

◆ register_restarts_dyn_unsplit_rk2()

subroutine, public mom_dynamics_unsplit_rk2::register_restarts_dyn_unsplit_rk2 ( type(hor_index_type), intent(in)  HI,
type(verticalgrid_type), intent(in)  GV,
type(param_file_type), intent(in)  param_file,
type(mom_dyn_unsplit_rk2_cs), pointer  CS,
type(mom_restart_cs), pointer  restart_CS 
)
Parameters
[in]hiA horizontal index type structure.
[in]gvThe ocean's vertical grid structure.
[in]param_fileA structure to parse for run-time parameters.
csThe control structure set up by initialize_dyn_unsplit_RK2.
restart_csA pointer to the restart control structure.

Definition at line 517 of file MOM_dynamics_unsplit_RK2.F90.

517  type(hor_index_type), intent(in) :: hi !< A horizontal index type structure.
518  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid structure.
519  type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time
520  !! parameters.
521  type(mom_dyn_unsplit_rk2_cs), pointer :: cs !< The control structure set up by
522  !! initialize_dyn_unsplit_RK2.
523  type(mom_restart_cs), pointer :: restart_cs !< A pointer to the restart control
524  !! structure.
525 ! This subroutine sets up any auxiliary restart variables that are specific
526 ! to the unsplit time stepping scheme. All variables registered here should
527 ! have the ability to be recreated if they are not present in a restart file.
528 
529 ! Arguments: HI - A horizontal index type structure.
530 ! (in) GV - The ocean's vertical grid structure.
531 ! (in) param_file - A structure indicating the open file to parse for
532 ! model parameter values.
533 ! (inout) CS - The control structure set up by initialize_dyn_unsplit_RK2.
534 ! (inout) restart_CS - A pointer to the restart control structure.
535 
536  type(vardesc) :: vd
537  character(len=48) :: thickness_units, flux_units
538  integer :: isd, ied, jsd, jed, nz, isdb, iedb, jsdb, jedb
539  isd = hi%isd ; ied = hi%ied ; jsd = hi%jsd ; jed = hi%jed ; nz = gv%ke
540  isdb = hi%IsdB ; iedb = hi%IedB ; jsdb = hi%JsdB ; jedb = hi%JedB
541 
542 ! This is where a control structure that is specific to this module would be allocated.
543  if (associated(cs)) then
544  call mom_error(warning, "register_restarts_dyn_unsplit_RK2 called with an associated "// &
545  "control structure.")
546  return
547  endif
548  allocate(cs)
549 
550  alloc_(cs%diffu(isdb:iedb,jsd:jed,nz)) ; cs%diffu(:,:,:) = 0.0
551  alloc_(cs%diffv(isd:ied,jsdb:jedb,nz)) ; cs%diffv(:,:,:) = 0.0
552  alloc_(cs%CAu(isdb:iedb,jsd:jed,nz)) ; cs%CAu(:,:,:) = 0.0
553  alloc_(cs%CAv(isd:ied,jsdb:jedb,nz)) ; cs%CAv(:,:,:) = 0.0
554  alloc_(cs%PFu(isdb:iedb,jsd:jed,nz)) ; cs%PFu(:,:,:) = 0.0
555  alloc_(cs%PFv(isd:ied,jsdb:jedb,nz)) ; cs%PFv(:,:,:) = 0.0
556 
557  thickness_units = get_thickness_units(gv)
558  flux_units = get_flux_units(gv)
559 
560 ! No extra restart fields are needed with this time stepping scheme.
561 

◆ step_mom_dyn_unsplit_rk2()

subroutine, public mom_dynamics_unsplit_rk2::step_mom_dyn_unsplit_rk2 ( real, dimension(szib_(g),szj_(g),szk_(g)), intent(inout)  u_in,
real, dimension(szi_(g),szjb_(g),szk_(g)), intent(inout)  v_in,
real, dimension(szi_(g),szj_(g),szk_(g)), intent(inout)  h_in,
type(thermo_var_ptrs), intent(in)  tv,
type(vertvisc_type), intent(inout)  visc,
type(time_type), intent(in)  Time_local,
real, intent(in)  dt,
type(forcing), intent(in)  fluxes,
real, dimension(:,:), pointer  p_surf_begin,
real, dimension(:,:), pointer  p_surf_end,
real, dimension(szib_(g),szj_(g),szk_(g)), intent(inout)  uh,
real, dimension(szi_(g),szjb_(g),szk_(g)), intent(inout)  vh,
real, dimension(szib_(g),szj_(g),szk_(g)), intent(inout)  uhtr,
real, dimension(szi_(g),szjb_(g),szk_(g)), intent(inout)  vhtr,
real, dimension(szi_(g),szj_(g)), intent(out)  eta_av,
type(ocean_grid_type), intent(inout)  G,
type(verticalgrid_type), intent(in)  GV,
type(mom_dyn_unsplit_rk2_cs), pointer  CS,
type(varmix_cs), pointer  VarMix,
type(meke_type), pointer  MEKE 
)
Parameters
[in,out]gThe ocean's grid structure.
[in]gvThe ocean's vertical grid structure.
[in,out]u_inThe input and output zonal
[in,out]v_inThe input and output meridional
[in,out]h_inThe input and output layer
[in]tvA structure pointing to various thermodynamic variables.
[in,out]viscA structure containing vertical viscosities, bottom drag viscosities, and related fields.
[in]time_localThe model time at the end of the time step.
[in]dtThe baroclinic dynamics time step, in s.
[in]fluxesA structure containing pointers to any possible forcing fields. Unused fields have NULL ptrs.
p_surf_beginA pointer (perhaps NULL) to the surface pressure at the beginning of this dynamic step, in Pa.
p_surf_endA pointer (perhaps NULL) to the surface pressure at the end of this dynamic step, in Pa.
[in,out]uhThe zonal volume or mass transport,
[in,out]vhThe meridional volume or mass
[in,out]uhtrThe accumulated zonal volume or
[in,out]vhtrThe accumulated meridional volume
[out]eta_avThe time-mean free surface height or column mass, in m or kg m-2.
csThe control structure set up by initialize_dyn_unsplit_RK2.
varmixA pointer to a structure with fields that specify the spatially variable viscosities.
mekeA pointer to a structure containing fields related to the Mesoscale Eddy Kinetic Energy.

Definition at line 192 of file MOM_dynamics_unsplit_RK2.F90.

References mom_continuity::continuity(), mom_coriolisadv::coradcalc(), mom_hor_visc::horizontal_viscosity(), id_clock_continuity, id_clock_cor, id_clock_horvisc, id_clock_mom_update, id_clock_pass, id_clock_pres, id_clock_vertvisc, mom_checksum_packages::mom_accel_chksum(), mom_open_boundary::open_boundary_zero_normal_flow(), mom_pressureforce::pressureforce(), mom_set_visc::set_viscous_ml(), and mom_boundary_update::update_obc_data().

192  type(ocean_grid_type), intent(inout) :: g !< The ocean's grid structure.
193  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid
194  !! structure.
195  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
196  intent(inout) :: u_in !< The input and output zonal
197  !! velocity, in m s-1.
198  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
199  intent(inout) :: v_in !< The input and output meridional
200  !! velocity, in m s-1.
201  real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
202  intent(inout) :: h_in !< The input and output layer
203  !! thicknesses, in m or kg m-2, depending on
204  !! whether the Boussinesq approximation is made.
205  type(thermo_var_ptrs), intent(in) :: tv !< A structure pointing to various
206  !! thermodynamic variables.
207  type(vertvisc_type), intent(inout) :: visc !< A structure containing vertical
208  !! viscosities, bottom drag
209  !! viscosities, and related fields.
210  type(time_type), intent(in) :: time_local !< The model time at the end of
211  !! the time step.
212  real, intent(in) :: dt !< The baroclinic dynamics time step,
213  !! in s.
214  type(forcing), intent(in) :: fluxes !< A structure containing pointers to
215  !! any possible forcing fields. Unused
216  !! fields have NULL ptrs.
217  real, dimension(:,:), pointer :: p_surf_begin !< A pointer (perhaps NULL) to
218  !! the surface pressure at the beginning
219  !! of this dynamic step, in Pa.
220  real, dimension(:,:), pointer :: p_surf_end !< A pointer (perhaps NULL) to
221  !! the surface pressure at the end of
222  !! this dynamic step, in Pa.
223  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
224  intent(inout) :: uh !< The zonal volume or mass transport,
225  !! in m3 s-1 or kg s-1.
226  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
227  intent(inout) :: vh !< The meridional volume or mass
228  !! transport, in m3 s-1 or kg s-1.
229  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
230  intent(inout) :: uhtr !< The accumulated zonal volume or
231  !! mass transport since the last
232  !! tracer advection, in m3 or kg.
233  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
234  intent(inout) :: vhtr !< The accumulated meridional volume
235  !! or mass transport since the last
236  !! tracer advection, in m3 or kg.
237  real, dimension(SZI_(G),SZJ_(G)), intent(out) :: eta_av !< The time-mean free surface height
238  !! or column mass, in m or kg m-2.
239  type(mom_dyn_unsplit_rk2_cs), pointer :: cs !< The control structure set up by
240  !! initialize_dyn_unsplit_RK2.
241  type(varmix_cs), pointer :: varmix !< A pointer to a structure with
242  !! fields that specify the spatially
243  !! variable viscosities.
244  type(meke_type), pointer :: meke !< A pointer to a structure containing
245  !! fields related to the Mesoscale
246  !! Eddy Kinetic Energy.
247 ! Arguments: u_in - The input and output zonal velocity, in m s-1.
248 ! (inout) v_in - The input and output meridional velocity, in m s-1.
249 ! (inout) h_in - The input and output layer thicknesses, in m or kg m-2,
250 ! depending on whether the Boussinesq approximation is made.
251 ! (in) tv - a structure pointing to various thermodynamic variables.
252 ! (inout) visc - A structure containing vertical viscosities, bottom drag
253 ! viscosities, and related fields.
254 ! (in) Time_local - The model time at the end of the time step.
255 ! (in) dt - The time step in s.
256 ! (in) fluxes - A structure containing pointers to any possible
257 ! forcing fields. Unused fields have NULL ptrs.
258 ! (in) p_surf_begin - A pointer (perhaps NULL) to the surface pressure
259 ! at the beginning of this dynamic step, in Pa.
260 ! (in) p_surf_end - A pointer (perhaps NULL) to the surface pressure
261 ! at the end of this dynamic step, in Pa.
262 ! (inout) uh - The zonal volume or mass transport, in m3 s-1 or kg s-1.
263 ! (inout) vh - The meridional volume or mass transport, in m3 s-1 or kg s-1.
264 ! (inout) uhtr - The accumulated zonal volume or mass transport since the last
265 ! tracer advection, in m3 or kg.
266 ! (inout) vhtr - The accumulated meridional volume or mass transport since the last
267 ! tracer advection, in m3 or kg.
268 ! (out) eta_av - The time-mean free surface height or column mass, in m or
269 ! kg m-2.
270 ! (in) G - The ocean's grid structure.
271 ! (in) GV - The ocean's vertical grid structure.
272 ! (in) CS - The control structure set up by initialize_dyn_unsplit_RK2.
273 ! (in) VarMix - A pointer to a structure with fields that specify the
274 ! spatially variable viscosities.
275 ! (inout) MEKE - A pointer to a structure containing fields related to
276 ! the Mesoscale Eddy Kinetic Energy.
277 
278  real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_av, hp
279  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)) :: up
280  real, dimension(SZI_(G),SZJB_(G),SZK_(G)) :: vp
281  real, dimension(:,:), pointer :: p_surf
282  real :: dt_pred ! The time step for the predictor part of the baroclinic
283  ! time stepping.
284  logical :: dyn_p_surf
285  integer :: i, j, k, is, ie, js, je, isq, ieq, jsq, jeq, nz
286  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
287  isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
288  dt_pred = dt * cs%BE
289 
290  h_av(:,:,:) = 0; hp(:,:,:) = 0
291  up(:,:,:) = 0
292  vp(:,:,:) = 0
293 
294  dyn_p_surf = associated(p_surf_begin) .and. associated(p_surf_end)
295  if (dyn_p_surf) then
296  call safe_alloc_ptr(p_surf,g%isd,g%ied,g%jsd,g%jed) ; p_surf(:,:) = 0.0
297  else
298  p_surf => fluxes%p_surf
299  endif
300 
301 ! Runge-Kutta second order accurate two step scheme is used to step
302 ! all of the fields except h. h is stepped separately.
303 
304  if (cs%debug) then
305  call mom_state_chksum("Start Predictor ", u_in, v_in, h_in, uh, vh, g, gv)
306  endif
307 
308 ! diffu = horizontal viscosity terms (u,h)
309  call enable_averaging(dt,time_local, cs%diag)
310  call cpu_clock_begin(id_clock_horvisc)
311  call horizontal_viscosity(u_in, v_in, h_in, cs%diffu, cs%diffv, meke, varmix, &
312  g, gv, cs%hor_visc_CSp)
313  call cpu_clock_end(id_clock_horvisc)
314  call disable_averaging(cs%diag)
315  call cpu_clock_begin(id_clock_pass)
316  call pass_vector(cs%diffu, cs%diffv, g%Domain)
317  call cpu_clock_end(id_clock_pass)
318 
319 ! This continuity step is solely for the Coroilis terms, specifically in the
320 ! denominator of PV and in the mass transport or PV.
321 ! uh = u[n-1]*h[n-1/2]
322 ! hp = h[n-1/2] + dt/2 div . uh
323  call cpu_clock_begin(id_clock_continuity)
324  ! This is a duplicate calculation of the last continuity from the previous step
325  ! and could/should be optimized out. -AJA
326  call continuity(u_in, v_in, h_in, hp, uh, vh, dt_pred, g, gv, cs%continuity_CSp, &
327  obc=cs%OBC)
328  call cpu_clock_end(id_clock_continuity)
329  call cpu_clock_begin(id_clock_pass)
330  call pass_var(hp, g%Domain)
331  call pass_vector(uh, vh, g%Domain)
332  call cpu_clock_end(id_clock_pass)
333 
334 ! h_av = (h + hp)/2 (used in PV denominator)
335  call cpu_clock_begin(id_clock_mom_update)
336  do k=1,nz
337  do j=js-2,je+2 ; do i=is-2,ie+2
338  h_av(i,j,k) = (h_in(i,j,k) + hp(i,j,k)) * 0.5
339  enddo ; enddo ; enddo
340  call cpu_clock_end(id_clock_mom_update)
341 
342 ! CAu = -(f+zeta)/h_av vh + d/dx KE (function of u[n-1] and uh[n-1])
343  call cpu_clock_begin(id_clock_cor)
344  call coradcalc(u_in, v_in, h_av, uh, vh, cs%CAu, cs%CAv, cs%OBC, cs%ADp, &
345  g, gv, cs%CoriolisAdv_CSp)
346  call cpu_clock_end(id_clock_cor)
347 
348 ! PFu = d/dx M(h_av,T,S) (function of h[n-1/2])
349  call cpu_clock_begin(id_clock_pres)
350  if (dyn_p_surf) then ; do j=js-2,je+2 ; do i=is-2,ie+2
351  p_surf(i,j) = 0.5*p_surf_begin(i,j) + 0.5*p_surf_end(i,j)
352  enddo ; enddo ; endif
353  call pressureforce(h_in, tv, cs%PFu, cs%PFv, g, gv, &
354  cs%PressureForce_CSp, cs%ALE_CSp, p_surf)
355  call cpu_clock_end(id_clock_pres)
356  call cpu_clock_begin(id_clock_pass)
357  call pass_vector(cs%PFu, cs%PFv, g%Domain)
358  call pass_vector(cs%CAu, cs%CAv, g%Domain)
359  call cpu_clock_end(id_clock_pass)
360 
361  if (associated(cs%OBC)) then; if (cs%OBC%update_OBC) then
362  call update_obc_data(cs%OBC, g, gv, tv, h_in, cs%update_OBC_CSp, time_local)
363  endif; endif
364  if (associated(cs%OBC)) then
365  call open_boundary_zero_normal_flow(cs%OBC, g, cs%PFu, cs%PFv)
366  call open_boundary_zero_normal_flow(cs%OBC, g, cs%CAu, cs%CAv)
367  call open_boundary_zero_normal_flow(cs%OBC, g, cs%diffu, cs%diffv)
368  endif
369 
370 ! up+[n-1/2] = u[n-1] + dt_pred * (PFu + CAu)
371  call cpu_clock_begin(id_clock_mom_update)
372  do k=1,nz ; do j=js,je ; do i=isq,ieq
373  up(i,j,k) = g%mask2dCu(i,j) * (u_in(i,j,k) + dt_pred * &
374  ((cs%PFu(i,j,k) + cs%CAu(i,j,k)) + cs%diffu(i,j,k)))
375  enddo ; enddo ; enddo
376  do k=1,nz ; do j=jsq,jeq ; do i=is,ie
377  vp(i,j,k) = g%mask2dCv(i,j) * (v_in(i,j,k) + dt_pred * &
378  ((cs%PFv(i,j,k) + cs%CAv(i,j,k)) + cs%diffv(i,j,k)))
379  enddo ; enddo ; enddo
380  call cpu_clock_end(id_clock_mom_update)
381 
382  if (cs%debug) &
383  call mom_accel_chksum("Predictor 1 accel", cs%CAu, cs%CAv, cs%PFu, cs%PFv,&
384  cs%diffu, cs%diffv, g, gv)
385 
386  ! up[n-1/2] <- up*[n-1/2] + dt/2 d/dz visc d/dz up[n-1/2]
387  call cpu_clock_begin(id_clock_vertvisc)
388  call enable_averaging(dt, time_local, cs%diag)
389  call set_viscous_ml(up, vp, h_av, tv, fluxes, visc, dt_pred, g, gv, &
390  cs%set_visc_CSp)
391  call disable_averaging(cs%diag)
392  call vertvisc_coef(up, vp, h_av, fluxes, visc, dt_pred, g, gv, &
393  cs%vertvisc_CSp, cs%OBC)
394  call vertvisc(up, vp, h_av, fluxes, visc, dt_pred, cs%OBC, cs%ADp, cs%CDp, &
395  g, gv, cs%vertvisc_CSp)
396  call cpu_clock_end(id_clock_vertvisc)
397  call cpu_clock_begin(id_clock_pass)
398  call pass_vector(up, vp, g%Domain)
399  call cpu_clock_end(id_clock_pass)
400 
401 ! uh = up[n-1/2] * h[n-1/2]
402 ! h_av = h + dt div . uh
403  call cpu_clock_begin(id_clock_continuity)
404  call continuity(up, vp, h_in, hp, uh, vh, &
405  dt, g, gv, cs%continuity_CSp, obc=cs%OBC)
406  call cpu_clock_end(id_clock_continuity)
407  call cpu_clock_begin(id_clock_pass)
408  call pass_var(hp, g%Domain)
409  call pass_vector(uh, vh, g%Domain)
410  call cpu_clock_end(id_clock_pass)
411 
412 ! h_av <- (h + hp)/2 (centered at n-1/2)
413  do k=1,nz ; do j=js-2,je+2 ; do i=is-2,ie+2
414  h_av(i,j,k) = (h_in(i,j,k) + hp(i,j,k)) * 0.5
415  enddo ; enddo ; enddo
416 
417  if (cs%debug) &
418  call mom_state_chksum("Predictor 1", up, vp, h_av, uh, vh, g, gv)
419 
420 ! CAu = -(f+zeta(up))/h_av vh + d/dx KE(up) (function of up[n-1/2], h[n-1/2])
421  call cpu_clock_begin(id_clock_cor)
422  call coradcalc(up, vp, h_av, uh, vh, cs%CAu, cs%CAv, cs%OBC, cs%ADp, &
423  g, gv, cs%CoriolisAdv_CSp)
424  call cpu_clock_end(id_clock_cor)
425  if (associated(cs%OBC)) then
426  call open_boundary_zero_normal_flow(cs%OBC, g, cs%CAu, cs%CAv)
427  endif
428 
429 ! call enable_averaging(dt,Time_local, CS%diag) ?????????????????????/
430 
431 ! up* = u[n] + (1+gamma) * dt * ( PFu + CAu ) Extrapolated for damping
432 ! u*[n+1] = u[n] + dt * ( PFu + CAu )
433  do k=1,nz ; do j=js,je ; do i=isq,ieq
434  up(i,j,k) = g%mask2dCu(i,j) * (u_in(i,j,k) + dt * (1.+cs%begw) * &
435  ((cs%PFu(i,j,k) + cs%CAu(i,j,k)) + cs%diffu(i,j,k)))
436  u_in(i,j,k) = g%mask2dCu(i,j) * (u_in(i,j,k) + dt * &
437  ((cs%PFu(i,j,k) + cs%CAu(i,j,k)) + cs%diffu(i,j,k)))
438  enddo ; enddo ; enddo
439  do k=1,nz ; do j=jsq,jeq ; do i=is,ie
440  vp(i,j,k) = g%mask2dCv(i,j) * (v_in(i,j,k) + dt * (1.+cs%begw) * &
441  ((cs%PFv(i,j,k) + cs%CAv(i,j,k)) + cs%diffv(i,j,k)))
442  v_in(i,j,k) = g%mask2dCv(i,j) * (v_in(i,j,k) + dt * &
443  ((cs%PFv(i,j,k) + cs%CAv(i,j,k)) + cs%diffv(i,j,k)))
444  enddo ; enddo ; enddo
445 
446 ! up[n] <- up* + dt d/dz visc d/dz up
447 ! u[n] <- u*[n] + dt d/dz visc d/dz u[n]
448  call cpu_clock_begin(id_clock_vertvisc)
449  call vertvisc_coef(up, vp, h_av, fluxes, visc, dt, g, gv, &
450  cs%vertvisc_CSp, cs%OBC)
451  call vertvisc(up, vp, h_av, fluxes, visc, dt, cs%OBC, cs%ADp, cs%CDp, &
452  g, gv, cs%vertvisc_CSp, cs%taux_bot, cs%tauy_bot)
453  call vertvisc_coef(u_in, v_in, h_av, fluxes, visc, dt, g, gv, &
454  cs%vertvisc_CSp, cs%OBC)
455  call vertvisc(u_in, v_in, h_av, fluxes, visc, dt, cs%OBC, cs%ADp, cs%CDp,&
456  g, gv, cs%vertvisc_CSp, cs%taux_bot, cs%tauy_bot)
457  call cpu_clock_end(id_clock_vertvisc)
458  call cpu_clock_begin(id_clock_pass)
459  call pass_vector(up, vp, g%Domain)
460  call pass_vector(u_in, v_in, g%Domain)
461  call cpu_clock_end(id_clock_pass)
462 
463 ! uh = up[n] * h[n] (up[n] might be extrapolated to damp GWs)
464 ! h[n+1] = h[n] + dt div . uh
465  call cpu_clock_begin(id_clock_continuity)
466  call continuity(up, vp, h_in, h_in, uh, vh, &
467  dt, g, gv, cs%continuity_CSp, obc=cs%OBC)
468  call cpu_clock_end(id_clock_continuity)
469  call cpu_clock_begin(id_clock_pass)
470  call pass_var(h_in, g%Domain)
471  call pass_vector(uh, vh, g%Domain)
472  call cpu_clock_end(id_clock_pass)
473 
474 ! Accumulate mass flux for tracer transport
475  do k=1,nz
476  do j=js-2,je+2 ; do i=isq-2,ieq+2
477  uhtr(i,j,k) = uhtr(i,j,k) + dt*uh(i,j,k)
478  enddo ; enddo
479  do j=jsq-2,jeq+2 ; do i=is-2,ie+2
480  vhtr(i,j,k) = vhtr(i,j,k) + dt*vh(i,j,k)
481  enddo ; enddo
482  enddo
483 
484  if (cs%debug) then
485  call mom_state_chksum("Corrector", u_in, v_in, h_in, uh, vh, g, gv)
486  call mom_accel_chksum("Corrector accel", cs%CAu, cs%CAv, cs%PFu, cs%PFv, &
487  cs%diffu, cs%diffv, g, gv)
488  endif
489 
490  if (gv%Boussinesq) then
491  do j=js,je ; do i=is,ie ; eta_av(i,j) = -g%bathyT(i,j) ; enddo ; enddo
492  else
493  do j=js,je ; do i=is,ie ; eta_av(i,j) = 0.0 ; enddo ; enddo
494  endif
495  do k=1,nz ; do j=js,je ; do i=is,ie
496  eta_av(i,j) = eta_av(i,j) + h_av(i,j,k)
497  enddo ; enddo ; enddo
498 
499  if (dyn_p_surf) deallocate(p_surf)
500 
501 ! Here various terms used in to update the momentum equations are
502 ! offered for averaging.
503  if (cs%id_PFu > 0) call post_data(cs%id_PFu, cs%PFu, cs%diag)
504  if (cs%id_PFv > 0) call post_data(cs%id_PFv, cs%PFv, cs%diag)
505  if (cs%id_CAu > 0) call post_data(cs%id_CAu, cs%CAu, cs%diag)
506  if (cs%id_CAv > 0) call post_data(cs%id_CAv, cs%CAv, cs%diag)
507 
508 ! Here the thickness fluxes are offered for averaging.
509  if (cs%id_uh > 0) call post_data(cs%id_uh, uh, cs%diag)
510  if (cs%id_vh > 0) call post_data(cs%id_vh, vh, cs%diag)
511 
Here is the call graph for this function:

Variable Documentation

◆ id_clock_continuity

integer mom_dynamics_unsplit_rk2::id_clock_continuity
private

◆ id_clock_cor

integer mom_dynamics_unsplit_rk2::id_clock_cor

Definition at line 181 of file MOM_dynamics_unsplit_RK2.F90.

Referenced by initialize_dyn_unsplit_rk2(), and step_mom_dyn_unsplit_rk2().

181 integer :: id_clock_cor, id_clock_pres, id_clock_vertvisc

◆ id_clock_horvisc

integer mom_dynamics_unsplit_rk2::id_clock_horvisc
private

Definition at line 182 of file MOM_dynamics_unsplit_RK2.F90.

Referenced by initialize_dyn_unsplit_rk2(), and step_mom_dyn_unsplit_rk2().

182 integer :: id_clock_horvisc, id_clock_continuity, id_clock_mom_update

◆ id_clock_mom_update

integer mom_dynamics_unsplit_rk2::id_clock_mom_update
private

◆ id_clock_pass

integer mom_dynamics_unsplit_rk2::id_clock_pass
private

Definition at line 183 of file MOM_dynamics_unsplit_RK2.F90.

Referenced by initialize_dyn_unsplit_rk2(), and step_mom_dyn_unsplit_rk2().

183 integer :: id_clock_pass, id_clock_pass_init

◆ id_clock_pass_init

integer mom_dynamics_unsplit_rk2::id_clock_pass_init
private

Definition at line 183 of file MOM_dynamics_unsplit_RK2.F90.

Referenced by initialize_dyn_unsplit_rk2().

◆ id_clock_pres

integer mom_dynamics_unsplit_rk2::id_clock_pres
private

◆ id_clock_vertvisc

integer mom_dynamics_unsplit_rk2::id_clock_vertvisc
private