set_farfield_ghost Function

private pure function set_farfield_ghost(q_int, q_inf, nrm, gam) result(q_ghost)

Characteristic (Riemann-invariant) far-field ghost state for an OUTWARD unit normal nrm. q_int is the boundary-adjacent interior conserved state, q_inf the free-stream. With interior/free-stream normal velocities Un_i, Un_inf and sound speeds c_i, c_inf: * supersonic in/out (|Un_i| >= c_i) short-circuit to pure free-stream / pure interior extrapolation; * otherwise combine the outgoing (interior) invariant R+ = Un_i + 2 c_i/(gam-1) with the incoming (free-stream) R- = Un_inf - 2 c_inf/(gam-1) to get Un_b = (R+ + R-)/2, c_b = (gam-1)/4 (R+ - R-). Entropy and tangential velocity are taken from the free-stream on inflow (Un_b <= 0) and from the interior on outflow; rho_b, p_b follow from entropy + c_b. gam is passed explicitly (no module-level thermodynamic state here).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q_int(:)
real(kind=wp), intent(in) :: q_inf(:)
real(kind=wp), intent(in) :: nrm(2)
real(kind=wp), intent(in) :: gam

Return Value real(kind=wp), (size(q_int))