コード例 #1
0
    # State 3 - Plateau at end of Taylor wave
    # print('Generating points on isentrope and computing Taylor wave velocity')
    w2 = gas.density*Ucj[-1]/cj_rho[-1]
    S2 = gas1.entropy_mass
    u2 = Ucj[-1] - w2
    u = [u2]
    P = [gas1.P]
    R = [gas1.density]
    V = [1/R[0]]
    #T = [gas1.T]
    a = [soundspeed_eq(gas1)]
    vv = 1/cj_rho[-1]
    
    while u[-1] > 0:
        vv = vv*1.01
        gas1.SVX = S2,vv,gas1.X
        gas1.equilibrate('SV')
        P.append(gas1.P)
        R.append(gas1.density)
        V.append(1/R[-1])
        a.append(soundspeed_eq(gas1))
        u.append(u[-1] + 0.5*(P[-1]-P[-2])*(1/(R[-1]*a[-1]) + 1/(R[-2]*a[-2])))

    # estimate plateau conditions (state 3) by interpolating to find the u = 0 state.
    P3.append(P[-1] + u[-1]*(P[-2]-P[-1])/(u[-2]-u[-1]))
    
    # Tune dt for quicker solving of ODEs. For these parameters, Case 1 has a much longer timescale
    # than the other cases.
    if i == 0:
        t_end = 1e-3
        dt = 1e-5
コード例 #2
0
# Find points on the isentrope connected to the CJ state, evaluate velocity
# in Taylor wave using trapezoidal rule to evaluate the Riemann function

vv = V2
V = [V2]
P = [P2]
R = [R2]
a = [a2_fr]
u = [u2]
T = [T2]
print('Generating points on isentrope and expansion wave velocity')

while u[-1] > 0:
    vv = vv * 1.01
    gas.SVX = S2, vv, gas.X
    P.append(gas.P)
    R.append(gas.density)
    V.append(1. / R[-1])
    T.append(gas.T)
    a.append(soundspeed_fr(gas))
    u.append(u[-1] + 0.5 * (P[-1] - P[-2]) * (1 / (R[-1] * a[-1]) + 1 /
                                              (R[-2] * a[-2])))

# estimate plateau conditions (state 3) by interpolating to find the u = 0 state.
P3 = P[-1] + u[-1] * (P[-2] - P[-1]) / (u[-2] - u[-1])
a3 = a[-1] + u[-1] * (a[-2] - a[-1]) / (u[-2] - u[-1])
V3 = V[-1] + u[-1] * (V[-2] - V[-1]) / (u[-2] - u[-1])
T3 = T[-1] + u[-1] * (T[-2] - T[-1]) / (u[-2] - u[-1])
print('State 3')
print('   pressure ' + str(P3) + ' (Pa)')