tracer_advect Subroutine

private subroutine tracer_advect(grid, metrics, this, ms, dt)

Test-only (no production caller): unsplit 2-D tracer advection, the reference oracle for split tracer_advect_zonal/_meridional. Per-layer PPM tracer advection — iterates over the tracer registry on the multilayer C-grid state and forwards each tracer’s hTr array to the flat-impl below. Extendable by construction: appending a new entry to ms%tracers(:) (BGC, sediment, passive scalar) drops it in without touching this routine. Per-tracer behaviour gates on tracer_t%do_horizontal_advection — set to .false. for tracers that should be diagnostic / forced externally.

Consistency-with-continuity (CWC): the kernel consumes the same mass_flux_*_layer that continuity-PPM produced, so a uniform tracer remains uniform under non-zero flow (the standard discrete CWC theorem). Verified by tracer_cwc_uniform in test_ocean_tracer_adv.

Scratch is borrowed from continuity_t — those four face-reconstruction buffers are unused at this point in the step (continuity_compute_fluxes already wrote and consumed them in the upwind pick), so we re-use the same allocations for tracer face values + tracer mass fluxes without introducing a new slot.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_metrics_t), intent(in) :: metrics
type(continuity_t), intent(inout) :: this
type(multilayer_state_t), intent(inout) :: ms
real(kind=wp), intent(in) :: dt

Calls

proc~~tracer_advect~~CallsGraph proc~tracer_advect tracer_advect proc~tracer_advect_one_impl tracer_advect_one_impl proc~tracer_advect->proc~tracer_advect_one_impl local local proc~tracer_advect_one_impl->local proc~ppm_cell_limiter ppm_cell_limiter proc~tracer_advect_one_impl->proc~ppm_cell_limiter proc~ppm_limited_slope ppm_limited_slope proc~tracer_advect_one_impl->proc~ppm_limited_slope proc~ppm_mirror_h ppm_mirror_h proc~tracer_advect_one_impl->proc~ppm_mirror_h

Variables

Type Visibility Attributes Name Initial
integer, private :: it

Source Code

   subroutine tracer_advect(grid, metrics, this, ms, dt)
      !! **Test-only** (no production caller): unsplit 2-D tracer advection,
      !! the reference oracle for split `tracer_advect_zonal`/`_meridional`.
      !! Per-layer PPM tracer advection — iterates over the tracer
      !! registry on the multilayer C-grid state and forwards each
      !! tracer's hTr array to the flat-impl below.  Extendable by
      !! construction: appending a new entry to `ms%tracers(:)` (BGC,
      !! sediment, passive scalar) drops it in without touching this
      !! routine.  Per-tracer behaviour gates on
      !! `tracer_t%do_horizontal_advection` — set to .false. for
      !! tracers that should be diagnostic / forced externally.
      !!
      !! Consistency-with-continuity (CWC): the kernel consumes the
      !! same `mass_flux_*_layer` that continuity-PPM produced, so a
      !! uniform tracer remains uniform under non-zero flow (the
      !! standard discrete CWC theorem).  Verified by
      !! `tracer_cwc_uniform` in `test_ocean_tracer_adv`.
      !!
      !! Scratch is borrowed from `continuity_t` — those four
      !! face-reconstruction buffers are unused at this point in the
      !! step (continuity_compute_fluxes already wrote and consumed
      !! them in the upwind pick), so we re-use the same allocations
      !! for tracer face values + tracer mass fluxes without
      !! introducing a new slot.
      type(hgrid_t), intent(in) :: grid
      type(ocean_metrics_t), intent(in) :: metrics
      type(continuity_t), intent(inout) :: this
      type(multilayer_state_t), intent(inout) :: ms
      real(wp), intent(in) :: dt

      integer :: it

      if (.not. allocated(ms%tracers)) return

      do it = 1, size(ms%tracers)
         if (.not. ms%tracers(it)%do_horizontal_advection) cycle
         call tracer_advect_one_impl( &
            grid%nx_total, grid%ny_total, ms%nz_ml, &
            dt, metrics%iareaT, metrics%wet_T, &
            ms%h_layer, &
            ms%tracers(it)%hTr, &
            ms%mass_flux_x_layer, &
            ms%mass_flux_y_layer, &
            this%h_face_left_x%data, &
            this%h_face_right_x%data, &
            this%h_face_left_y%data, &
            this%h_face_right_y%data)
      end do
   end subroutine tracer_advect