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 | Intent | Optional | 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 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | it |
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