def S_prim(SYS, Q, MP): """ The source terms of the primitive system NOTE: Uses typical ordering """ ret = zeros(NV) P = State(Q, MP) ρ = P.ρ dEdp = P.dEdp() cs2 = c_s2(ρ, MP) dcs2dρ = dc_s2dρ(ρ, MP) if VISCOUS: ψ = P.ψ() θ1_1 = P.θ1_1() ret[1] = (1 / dEdp - ρ**2 / cs2 * dcs2dρ) * L2_2D(ψ) * θ1_1 ret[5:14] = -ψ.ravel() * θ1_1 if THERMAL: H = P.H() θ2_1 = P.θ2_1() ret[1] += 1 / dEdp * L2_1D(H) * θ2_1 ret[14:17] = -H * θ2_1 if REACTIVE: K = P.K() ret[17] = - K return ret
def S_cons(Q, MP): ret = zeros(NV) P = State(Q, MP) ρ = P.ρ ret[2:5] = P.f_body() if VISCOUS: ψ = P.ψ() θ1_1 = P.θ1_1() ret[5:14] = -ψ.ravel() * θ1_1 if THERMAL: H = P.H() θ2_1 = P.θ2_1() ret[14:17] = -ρ * H * θ2_1 if REACTIVE: K = P.K() ret[17] = -ρ * K return ret