fill_stencil Subroutine

private pure subroutine fill_stencil(field, h, pt_start, pt_step, stencil)

Fill a reconstruction stencil from a halo'd field.

Iterates over stencil positions i = 1 .. size(stencil, 2) and maps each to grid index pt_idx = pt_start + (i-1)*pt_step. All indices are expected to fall within the halo'd range [1-h, n_local+h]; this is the caller's responsibility (guaranteed by the choice of stencil_start_offset relative to the scheme's coupling radius).

Use pt_step = +1 for a left-biased stencil (F^+, Q_L reconstruction). Use pt_step = -1 for a right-biased (mirror) stencil (F^-, Q_R).

            (neq, 1-h:n_local+h).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: field(:,1-h:)

Halo'd source array. The dummy's column lower bound is explicitly set to 1-h so that stencil indices like iface + stencil_start_offset that fall into the halo range map to the correct cell.

integer, intent(in) :: h

Halo width (= state%decomp%halo_width).

integer, intent(in) :: pt_start

Grid index for stencil position i = 1.

integer, intent(in) :: pt_step

Grid index for stencil position i = 1. Index stride per position: +1 (left-biased) or -1 (right-biased).

real(kind=wp), intent(out) :: stencil(:,:)