MOM6
mom_dynamics_unsplit Module Reference

Data Types

type  mom_dyn_unsplit_cs
 

Functions/Subroutines

subroutine, public step_mom_dyn_unsplit (u, v, h, 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 (HI, GV, param_file, CS, restart_CS)
 
subroutine, public initialize_dyn_unsplit (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 (CS)
 

Variables

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

Function/Subroutine Documentation

◆ end_dyn_unsplit()

subroutine, public mom_dynamics_unsplit::end_dyn_unsplit ( type(mom_dyn_unsplit_cs), pointer  CS)

Definition at line 775 of file MOM_dynamics_unsplit.F90.

775  type(mom_dyn_unsplit_cs), pointer :: cs
776 ! (inout) CS - The control structure set up by initialize_dyn_unsplit.
777 
778  dealloc_(cs%diffu) ; dealloc_(cs%diffv)
779  dealloc_(cs%CAu) ; dealloc_(cs%CAv)
780  dealloc_(cs%PFu) ; dealloc_(cs%PFv)
781 
782  deallocate(cs)

◆ initialize_dyn_unsplit()

subroutine, public mom_dynamics_unsplit::initialize_dyn_unsplit ( 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_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
[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.
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 618 of file MOM_dynamics_unsplit.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.

618  type(ocean_grid_type), intent(inout) :: g !< The ocean's grid structure.
619  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid
620  !! structure.
621  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
622  intent(inout) :: u !< The zonal velocity, in m s-1.
623  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
624  intent(inout) :: v !< The meridional velocity, in m s-1.
625  real, dimension(SZI_(G),SZJ_(G),SZK_(G)) , &
626  intent(inout) :: h !< Layer thicknesses, in H
627  !! (usually m or kg m-2).
628  type(time_type), target, intent(in) :: time !< The current model time.
629  type(param_file_type), intent(in) :: param_file !< A structure to parse
630  !! for run-time parameters.
631  type(diag_ctrl), target, intent(inout) :: diag !< A structure that is used to
632  !! regulate diagnostic output.
633  type(mom_dyn_unsplit_cs), pointer :: cs !< The control structure set up
634  !! by initialize_dyn_unsplit.
635  type(mom_restart_cs), pointer :: restart_cs !< A pointer to the restart control
636  !!structure.
637  type(accel_diag_ptrs), target, intent(inout) :: accel_diag !< A set of pointers to the various
638  !! accelerations in the momentum equations, which can be used
639  !! for later derived diagnostics, like energy budgets.
640  type(cont_diag_ptrs), target, intent(inout) :: cont_diag !< A structure with pointers to
641  !! various terms in the continuity
642  !! equations.
643  type(ocean_internal_state), intent(inout) :: mis !< The "MOM6 Internal State"
644  !! structure, used to pass around pointers
645  !! to various arrays for diagnostic purposes.
646  type(ocean_obc_type), pointer :: obc !< If open boundary conditions are
647  !! used, this points to the ocean_OBC_type
648  !! that was set up in MOM_initialization.
649  type(update_obc_cs), pointer :: update_obc_csp !< If open boundary condition
650  !! updates are used, this points to
651  !! the appropriate control structure.
652  type(ale_cs), pointer :: ale_csp !< This points to the ALE control
653  !! structure.
654  type(set_visc_cs), pointer :: setvisc_csp !< This points to the set_visc
655  !! control structure.
656  type(vertvisc_type), intent(inout) :: visc !< A structure containing vertical
657  !! viscosities, bottom drag
658  !! viscosities, and related fields.
659  type(directories), intent(in) :: dirs !< A structure containing several
660  !! relevant directory paths.
661  integer, target, intent(inout) :: ntrunc !< A target for the variable that
662  !! records the number of times the velocity
663  !! is truncated (this should be 0).
664 
665 ! Arguments: u - The zonal velocity, in m s-1.
666 ! (inout) v - The meridional velocity, in m s-1.
667 ! (inout) h - The layer thicknesses, in m or kg m-2, depending on whether
668 ! the Boussinesq approximation is made.
669 ! (in) Time - The current model time.
670 ! (in) G - The ocean's grid structure.
671 ! (in) GV - The ocean's vertical grid structure.
672 ! (in) param_file - A structure indicating the open file to parse for
673 ! model parameter values.
674 ! (in) diag - A structure that is used to regulate diagnostic output.
675 ! (inout) CS - The control structure set up by initialize_dyn_unsplit.
676 ! (in) restart_CS - A pointer to the restart control structure.
677 ! (inout) Accel_diag - A set of pointers to the various accelerations in
678 ! the momentum equations, which can be used for later derived
679 ! diagnostics, like energy budgets.
680 ! (inout) Cont_diag - A structure with pointers to various terms in the
681 ! continuity equations.
682 ! (inout) MIS - The "MOM6 Internal State" structure, used to pass around
683 ! pointers to various arrays for diagnostic purposes.
684 ! (in) OBC - If open boundary conditions are used, this points to the
685 ! ocean_OBC_type that was set up in MOM_initialization.
686 ! (in) update_OBC_CSp - If open boundary condition updates are used,
687 ! this points to the appropriate control structure.
688 ! (in) ALE_CS - This points to the ALE control structure.
689 ! (in) setVisc_CSp - This points to the set_visc control structure.
690 ! (inout) visc - A structure containing vertical viscosities, bottom drag
691 ! viscosities, and related fields.
692 ! (in) dirs - A structure containing several relevant directory paths.
693 ! (in) ntrunc - A target for the variable that records the number of times
694 ! the velocity is truncated (this should be 0).
695 
696  ! This subroutine initializes all of the variables that are used by this
697  ! dynamic core, including diagnostics and the cpu clocks.
698  character(len=40) :: mdl = "MOM_dynamics_unsplit" ! This module's name.
699  character(len=48) :: thickness_units, flux_units
700  logical :: use_tides
701  integer :: isd, ied, jsd, jed, nz, isdb, iedb, jsdb, jedb
702  isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed ; nz = g%ke
703  isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
704 
705  if (.not.associated(cs)) call mom_error(fatal, &
706  "initialize_dyn_unsplit called with an unassociated control structure.")
707  if (cs%module_is_initialized) then
708  call mom_error(warning, "initialize_dyn_unsplit called with a control "// &
709  "structure that has already been initialized.")
710  return
711  endif
712  cs%module_is_initialized = .true.
713 
714  cs%diag => diag
715 
716  call get_param(param_file, mdl, "DEBUG", cs%debug, &
717  "If true, write out verbose debugging data.", default=.false.)
718  call get_param(param_file, mdl, "TIDES", use_tides, &
719  "If true, apply tidal momentum forcing.", default=.false.)
720 
721  allocate(cs%taux_bot(isdb:iedb,jsd:jed)) ; cs%taux_bot(:,:) = 0.0
722  allocate(cs%tauy_bot(isd:ied,jsdb:jedb)) ; cs%tauy_bot(:,:) = 0.0
723 
724  mis%diffu => cs%diffu ; mis%diffv => cs%diffv
725  mis%PFu => cs%PFu ; mis%PFv => cs%PFv
726  mis%CAu => cs%CAu ; mis%CAv => cs%CAv
727 
728  cs%ADp => accel_diag ; cs%CDp => cont_diag
729  accel_diag%diffu => cs%diffu ; accel_diag%diffv => cs%diffv
730  accel_diag%PFu => cs%PFu ; accel_diag%PFv => cs%PFv
731  accel_diag%CAu => cs%CAu ; accel_diag%CAv => cs%CAv
732 
733  call continuity_init(time, g, gv, param_file, diag, cs%continuity_CSp)
734  call coriolisadv_init(time, g, param_file, diag, cs%ADp, cs%CoriolisAdv_CSp)
735  if (use_tides) call tidal_forcing_init(time, g, param_file, cs%tides_CSp)
736  call pressureforce_init(time, g, gv, param_file, diag, cs%PressureForce_CSp, &
737  cs%tides_CSp)
738  call hor_visc_init(time, g, param_file, diag, cs%hor_visc_CSp)
739  call vertvisc_init(mis, time, g, gv, param_file, diag, cs%ADp, dirs, &
740  ntrunc, cs%vertvisc_CSp)
741  if (.not.associated(setvisc_csp)) call mom_error(fatal, &
742  "initialize_dyn_unsplit called with setVisc_CSp unassociated.")
743  cs%set_visc_CSp => setvisc_csp
744 
745  if (associated(ale_csp)) cs%ALE_CSp => ale_csp
746  if (associated(obc)) cs%OBC => obc
747  if (associated(update_obc_csp)) cs%update_OBC_CSp => update_obc_csp
748 
749  flux_units = get_flux_units(gv)
750  cs%id_uh = register_diag_field('ocean_model', 'uh', diag%axesCuL, time, &
751  'Zonal Thickness Flux', flux_units, y_cell_method='sum', v_extensive=.true.)
752  cs%id_vh = register_diag_field('ocean_model', 'vh', diag%axesCvL, time, &
753  'Meridional Thickness Flux', flux_units, x_cell_method='sum', v_extensive=.true.)
754  cs%id_CAu = register_diag_field('ocean_model', 'CAu', diag%axesCuL, time, &
755  'Zonal Coriolis and Advective Acceleration', 'meter second-2')
756  cs%id_CAv = register_diag_field('ocean_model', 'CAv', diag%axesCvL, time, &
757  'Meridional Coriolis and Advective Acceleration', 'meter second-2')
758  cs%id_PFu = register_diag_field('ocean_model', 'PFu', diag%axesCuL, time, &
759  'Zonal Pressure Force Acceleration', 'meter second-2')
760  cs%id_PFv = register_diag_field('ocean_model', 'PFv', diag%axesCvL, time, &
761  'Meridional Pressure Force Acceleration', 'meter second-2')
762 
763  id_clock_cor = cpu_clock_id('(Ocean Coriolis & mom advection)', grain=clock_module)
764  id_clock_continuity = cpu_clock_id('(Ocean continuity equation)', grain=clock_module)
765  id_clock_pres = cpu_clock_id('(Ocean pressure force)', grain=clock_module)
766  id_clock_vertvisc = cpu_clock_id('(Ocean vertical viscosity)', grain=clock_module)
767  id_clock_horvisc = cpu_clock_id('(Ocean horizontal viscosity)', grain=clock_module)
768  id_clock_mom_update = cpu_clock_id('(Ocean momentum increments)', grain=clock_module)
769  id_clock_pass = cpu_clock_id('(Ocean message passing)', grain=clock_module)
770  id_clock_pass_init = cpu_clock_id('(Ocean init message passing)', grain=clock_routine)
771 

◆ register_restarts_dyn_unsplit()

subroutine, public mom_dynamics_unsplit::register_restarts_dyn_unsplit ( 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_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.
restart_csA pointer to the restart control structure.

Definition at line 566 of file MOM_dynamics_unsplit.F90.

566  type(hor_index_type), intent(in) :: hi !< A horizontal index type structure.
567  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid structure.
568  type(param_file_type), intent(in) :: param_file !< A structure to parse for
569  !! run-time parameters.
570  type(mom_dyn_unsplit_cs), pointer :: cs !< The control structure set up by
571  !! initialize_dyn_unsplit.
572  type(mom_restart_cs), pointer :: restart_cs !< A pointer to the restart control structure.
573 
574 ! This subroutine sets up any auxiliary restart variables that are specific
575 ! to the unsplit time stepping scheme. All variables registered here should
576 ! have the ability to be recreated if they are not present in a restart file.
577 
578 ! Arguments: HI - A horizontal index type structure.
579 ! (in) GV - The ocean's vertical grid structure.
580 ! (in) param_file - A structure indicating the open file to parse for
581 ! model parameter values.
582 ! (inout) CS - The control structure set up by initialize_dyn_unsplit.
583 ! (inout) restart_CS - A pointer to the restart control structure.
584 
585  type(vardesc) :: vd
586  character(len=40) :: mdl = "MOM_dynamics_unsplit" ! This module's name.
587  character(len=48) :: thickness_units, flux_units
588  integer :: isd, ied, jsd, jed, nz, isdb, iedb, jsdb, jedb
589  isd = hi%isd ; ied = hi%ied ; jsd = hi%jsd ; jed = hi%jed ; nz = gv%ke
590  isdb = hi%IsdB ; iedb = hi%IedB ; jsdb = hi%JsdB ; jedb = hi%JedB
591 
592 ! This is where a control structure that is specific to this module would be allocated.
593  if (associated(cs)) then
594  call mom_error(warning, "register_restarts_dyn_unsplit called with an associated "// &
595  "control structure.")
596  return
597  endif
598  allocate(cs)
599 
600  alloc_(cs%diffu(isdb:iedb,jsd:jed,nz)) ; cs%diffu(:,:,:) = 0.0
601  alloc_(cs%diffv(isd:ied,jsdb:jedb,nz)) ; cs%diffv(:,:,:) = 0.0
602  alloc_(cs%CAu(isdb:iedb,jsd:jed,nz)) ; cs%CAu(:,:,:) = 0.0
603  alloc_(cs%CAv(isd:ied,jsdb:jedb,nz)) ; cs%CAv(:,:,:) = 0.0
604  alloc_(cs%PFu(isdb:iedb,jsd:jed,nz)) ; cs%PFu(:,:,:) = 0.0
605  alloc_(cs%PFv(isd:ied,jsdb:jedb,nz)) ; cs%PFv(:,:,:) = 0.0
606 
607  thickness_units = get_thickness_units(gv)
608  flux_units = get_flux_units(gv)
609 
610 ! No extra restart fields are needed with this time stepping scheme.
611 

◆ step_mom_dyn_unsplit()

subroutine, public mom_dynamics_unsplit::step_mom_dyn_unsplit ( 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(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_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]uThe zonal velocity, in m s-1.
[in,out]vThe meridional velocity, in m s-1.
[in,out]hLayer thicknesses, in H.
[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 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]uhtrhe accumulated zonal volume or mass
[in,out]vhtrThe accumulated meridional volume or
[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.
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 186 of file MOM_dynamics_unsplit.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().

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

Variable Documentation

◆ id_clock_continuity

integer mom_dynamics_unsplit::id_clock_continuity
private

Definition at line 176 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

176 integer :: id_clock_continuity, id_clock_horvisc, id_clock_mom_update

◆ id_clock_cor

integer mom_dynamics_unsplit::id_clock_cor

Definition at line 175 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

175 integer :: id_clock_cor, id_clock_pres, id_clock_vertvisc

◆ id_clock_horvisc

integer mom_dynamics_unsplit::id_clock_horvisc
private

Definition at line 176 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

◆ id_clock_mom_update

integer mom_dynamics_unsplit::id_clock_mom_update
private

Definition at line 176 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

◆ id_clock_pass

integer mom_dynamics_unsplit::id_clock_pass
private

Definition at line 177 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

177 integer :: id_clock_pass, id_clock_pass_init

◆ id_clock_pass_init

integer mom_dynamics_unsplit::id_clock_pass_init
private

Definition at line 177 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit().

◆ id_clock_pres

integer mom_dynamics_unsplit::id_clock_pres
private

Definition at line 175 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().

◆ id_clock_vertvisc

integer mom_dynamics_unsplit::id_clock_vertvisc
private

Definition at line 175 of file MOM_dynamics_unsplit.F90.

Referenced by initialize_dyn_unsplit(), and step_mom_dyn_unsplit().