limit_positivity Subroutine

public subroutine limit_positivity(q_face, q_avg, gam)

Scale a reconstructed face state toward the cell average to ensure density ρ ≥ ε and pressure p ≥ ε (Zhang-Shu 2010).

Algorithm (applied sequentially): 1. If ρ_face < ε: θ = (ρ_avg - ε) / (ρ_avg - ρ_face), clamped to [0, 1] q_face ← q_avg + θ * (q_face - q_avg) 2. Recompute pressure from (updated) q_face. If p_face < ε: θ = (p_avg - ε) / (p_avg - p_face), clamped to [0, 1] q_face ← q_avg + θ * (q_face - q_avg)

In smooth regions both steps are no-ops (θ = 1) and the limiter does not alter the reconstructed state.

                   Modified in-place.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: q_face(:)
real(kind=wp), intent(in) :: q_avg(:)
real(kind=wp), intent(in) :: gam

Ratio of specific heats (used for pressure calculation).