compute_resid_fvm_1d Subroutine

private subroutine compute_resid_fvm_1d(state)

Compute the cell-centered finite-volume residual R_i = -1/dx_i * (F_{i+1/2} - F_{i-1/2}) on a block of cell averages.

Structurally this is the FDS path of compute_resid_fdm applied to cell averages: reconstruct Q_L and Q_R at each face from the halo'd ub array, optionally hybrid-select between the smooth and shock-capturing reconstructions, positivity-limit each face, guard against non-physical reconstructed states, and call the active FDS / Riemann solver. Two deliberate differences from the FDM kernel:

  1. The conservative divide uses the cell width mesh % dx_cell(i) rather than the nodal Jacobian mesh % jac(i). On a uniform grid the two coincide, so this reduces to the same operator there.
  2. FVM is unconditionally FDS: a finite-volume block always uses a Riemann (FDS) flux, so there is no FVS branch here (config validation guarantees an FDS flux_scheme for method='fvm').

The face loop is a faithful copy of the FDM FDS branch (lines in compute_resid_fdm guarded by state % use_fds), reusing the same private helpers (fill_stencil, eval_face_sensor) and the same module imports; compute_resid_fdm is intentionally left untouched to preserve its byte-for-byte FDM behavior, so the loop body is duplicated rather than factored into a shared helper. See task-3.1 report for the refactor note.

Arguments

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

Solver instance state.