compute_resid Subroutine

public subroutine compute_resid(state)

Compute the spatial residual R(Q) = -1/dx * (F_{i+1/2} - F_{i-1/2}).

Two code paths are supported, selected by state%use_fds:

FVS path (Lax-Friedrichs, Steger-Warming, van Leer): 1. Computes F^+(Q_j) and F^-(Q_j) at all grid points. 2. Averages adjacent states to get K and K^{-1} at the interface. 3. Assembles the stencil for both F^+ (left-biased) and F^- (right-biased), applying ghost states at boundaries. 4. Calls the active reconstruction scheme for each split flux. 5. Sums the contributions: F_hat = F_hat^+ + F_hat^-.

FDS path (AUSM+, HLL, HLLC, Roe): 1. Reconstructs Q_L and Q_R at each face from cell Q values. 2. Calls the active FDS solver: F_hat = fds_solver(Q_L, Q_R, gam).

See course notes, Sec. "Finite Difference WENO Scheme", Eq. (28)-(30).

Arguments

Type IntentOptional Attributes Name
type(solver_state_t), intent(inout) :: state

Solver instance state.