!> @file upwind2.f90 !> @brief Second-order upwind reconstruction scheme. module upwind2 use precision, only: wp implicit none private public :: upwind2_reconstruct contains ! --------------------------------------------------------------------------- !> Second-order upwind reconstruction. !! !! Uses a 3-point stencil (half_stencil = 2, stencil_width = 3). !! For the positive (left-biased) stencil: !! stencil(:,1) = F^+_{i-1}, stencil(:,2) = F^+_i (centre) !! F_hat^+ = 1.5 * F^+_i - 0.5 * F^+_{i-1} !! !! For the negative (right-biased, reversed) stencil: !! stencil(:,1) = F^-_{i+2}, stencil(:,2) = F^-_{i+1} (centre) !! F_hat^- = 1.5 * F^-_{i+1} - 0.5 * F^-_{i+2} [same formula] !! !! @param[in] f_stencil Stencil (neq x 3) !! @param[out] f_hat Reconstructed flux at the interface ! --------------------------------------------------------------------------- pure subroutine upwind2_reconstruct(f_stencil, f_hat) real(wp), intent(in) :: f_stencil(:, :) real(wp), intent(out) :: f_hat(:) ! 2nd-order upwind: (3/2)*f_centre - (1/2)*f_{centre-1} ! Centre is index 2 for the 3-point stencil. f_hat = 1.5_wp * f_stencil(:, 2) - 0.5_wp * f_stencil(:, 1) end subroutine upwind2_reconstruct end module upwind2