Ejemplo n.º 1
0
    def induction_length(self,
                         cj_speed=False,
                         P1=False,
                         T1=False,
                         q=False,
                         mech=False,
                         t_end=1e-5):
        # Assign default values innit
        if cj_speed is False:
            cj_speed = self.cj_speed
        if P1 is False:
            P1 = self.P1
        if T1 is False:
            T1 = self.T1
        if q is False:
            q = self.q
        if mech is False:
            mech = self.SDTmech
        # Set up gas object
        gas1 = ct.Solution(mech)
        gas1.TPX = T1, P1, q
        # Find post-shock conditions
        gas = PostShock_fr(cj_speed, P1, T1, q, mech)
        # Solve ZND ODEs to find the width of the ZND "plateau"
        znd_out = zndsolve(gas,
                           gas1,
                           cj_speed,
                           t_end=t_end,
                           advanced_output=True)
        plateau_length = znd_out['ind_len_ZND']

        return plateau_length
Ejemplo n.º 2
0
import cantera as ct

P1 = 100000
T1 = 300
q = 'H2:2 O2:1 N2:3.76'
mech = 'Mevel2017.cti'
file_name = 'h2air'

# Find CJ speed and related data, make CJ diagnostic plots
cj_speed, R2, plot_data = CJspeed(P1, T1, q, mech, fullOutput=True)
CJspeed_plot(plot_data, cj_speed)

# Set up gas object
gas1 = ct.Solution(mech)
gas1.TPX = T1, P1, q

# Find post shock state for given speed
gas = PostShock_fr(cj_speed, P1, T1, q, mech)

# Solve ZND ODEs, make ZND plots
znd_out = zndsolve(gas, gas1, cj_speed, t_end=1e-5, advanced_output=True)
znd_plot(znd_out)
znd_fileout(file_name, znd_out)

print('Reaction zone pulse width (exothermic length) = %.4g m' %
      znd_out['exo_len_ZND'])
print('Reaction zone induction length = %.4g m' % znd_out['ind_len_ZND'])
print('Reaction zone pulse time (exothermic time) = %.4g s' %
      znd_out['exo_time_ZND'])
print('Reaction zone induction time = %.4g s' % znd_out['ind_time_ZND'])
Ejemplo n.º 3
0
    Windows 8.1, Windows 10, Linux (Debian 9)
"""
from sdtoolbox.postshock import PostShock_fr
from sdtoolbox.znd import zndsolve
from sdtoolbox.utilities import znd_plot, znd_fileout
import cantera as ct

P1 = 100000 
T1 = 300
U1 = 3000
q = 'H2:2 O2:1 N2:3.76'
mech = 'Mevel2017.cti'
file_name = 'h2air'

# Set up gas object
gas1 = ct.Solution(mech)
gas1.TPX = T1,P1,q

# Find post shock state for given speed
gas = PostShock_fr(U1, P1, T1, q, mech)

# Solve ZND ODEs, make ZND plots
znd_out = zndsolve(gas,gas1,U1,advanced_output=True)
znd_plot(znd_out)
znd_fileout(file_name,znd_out)

print('Reaction zone pulse width (exothermic length) = %.4g m' % znd_out['exo_len_ZND'])
print('Reaction zone induction length = %.4g m' % znd_out['ind_len_ZND'])
print('Reaction zone pulse time (exothermic time) = %.4g s' % znd_out['exo_time_ZND'])
print('Reaction zone induction time = %.4g s' % znd_out['ind_time_ZND'])
Ejemplo n.º 4
0
    uv_T.append(gas.T)
    uv_ae.append(soundspeed_eq(gas))
    
    # CJ speed
    gas.TPX = T1,P1,x    
    Ucj.append(CJspeed(P1, T1, x, mech))

    # vN state
    gas1 = PostShock_fr(Ucj[-1], P1, T1, x, mech)
    vn_T.append(gas1.T)
    vn_P.append(gas1.P)
    vn_rho.append(gas1.density)
    vn_af.append(soundspeed_fr(gas1))

    # ZND Structure
    ZNDout = zndsolve(gas1,gas,Ucj[-1],advanced_output=True)
    ind_len_ZND.append(ZNDout['ind_len_ZND'])
    exo_len_ZND.append(ZNDout['exo_len_ZND'])

    # CJ state
    gas1 = PostShock_eq(Ucj[-1],P1, T1,x,mech)
    cj_T.append(gas1.T)
    cj_P.append(gas1.P)
    cj_rho.append(gas1.density)
    cj_af.append(soundspeed_fr(gas1))
    # Reflected CJ state
    [ref_P[i],Uref[i],gas2] = reflected_eq(gas,gas1,gas2,Ucj[-1])

    # 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]
Ejemplo n.º 5
0
graphing = True

P1 = 13.33; T1 = 300; U1 = 4000
q = 'CO2:0.96 N2:0.04'
mech = 'airNASA9noions.cti'

gas1 = ct.Solution(mech)
gas1.TPX = T1,P1,q
nsp = gas1.n_species

# FIND POST SHOCK STATE FOR GIVEN SPEED
gas = PostShock_fr(U1, P1, T1, q, mech)

# SOLVE REACTION ZONE STRUCTURE ODES
out = zndsolve(gas,gas1,U1,t_end=0.2,max_step=0.01,relTol=1e-12,absTol=1e-12)

if graphing:
    # Demonstrate using the figure outputs from znd_plot to make further formatting
    # adjustments, then saving
    maxx = max(out['distance'])
    figT,figP,figM,figTherm,figSpec = znd_plot(out,maxx=maxx,major_species='All',
                                               xscale='log',show=False)
    
    figSpec.axes[0].set_xlim((1e-5,None))
    figSpec.axes[0].set_ylim((1e-10,1))
    
    plt.show()
    
    figP.savefig('shk-P.eps',bbox_inches='tight')
    figT.savefig('shk-T.eps',bbox_inches='tight')
Ejemplo n.º 6
0
  Ts[i] = gas.T #frozen shock temperature   
  Ps[i] = gas.P #frozen shock pressure
  # SOLVE CONSTANT VOLUME EXPLOSION ODES
  CVout = cvsolve(gas,t_end=1e-4)
  exo_time_CV[i] = CVout['exo_time']
  ind_time_CV[i] = CVout['ind_time']
  
  
  ### ZND Detonation Data ###
  # FIND POST SHOCK STATE FOR GIVEN SPEED
  gas1.TPX = T1,P1[i],x
  gas = PostShock_fr(cj_speed[i], P1[i], T1, x, mech)
  Ts[i] = gas.T #frozen shock temperature   
  Ps[i] = gas.P #frozen shock pressure
  # SOLVE ZND DETONATION ODES
  ZNDout = zndsolve(gas,gas1,cj_speed[i],advanced_output=True)
  ind_time_ZND[i] = ZNDout['ind_time_ZND']
  ind_len_ZND[i] = ZNDout['ind_len_ZND']
  exo_time_ZND[i] = ZNDout['exo_time_ZND']
  exo_len_ZND[i] = ZNDout['exo_len_ZND']
  Tf_ZND[i] = ZNDout['T'][-1]
  
  ##Calculate CJstate Properties###
  gas = PostShock_eq(cj_speed[i],P1[i], T1,x, mech)
  T2[i] = gas.T
  P2[i] = gas.P
  rho2[i] = gas.density
 
  #Approximate the effective activation energy using finite differences
  Ta = Ts[i]*(1.02)
  gas.TPX = Ta,Ps[i],x
    gas = PostShock_fr(cj_speed*overdrive[i], P1, T1, x, mech)
    Ts[i] = gas.T # frozen shock temperature   
    Ps[i] = gas.P # frozen shock pressure
    
    ### Constant Volume Explosion Data ###
    # Solve constant volume explosion ODEs
    CVout = cvsolve(gas)
    exo_time_CV[i] = CVout['exo_time']
    ind_time_CV[i] = CVout['ind_time']    

    
    ### ZND Detonation Data ###
    gas.TPX = T1,P1,x
    gas = PostShock_fr(cj_speed*overdrive[i], P1, T1, x, mech)
    # Solve znd detonation ODEs
    ZNDout = zndsolve(gas,gas1,cj_speed*overdrive[i],advanced_output=True)
    exo_time_ZND[i] = ZNDout['exo_time_ZND']
    exo_len_ZND[i] = ZNDout['exo_len_ZND']
    ind_time_ZND[i] = ZNDout['ind_time_ZND']
    ind_len_ZND[i] = ZNDout['ind_len_ZND']
    Tf_ZND[i] = ZNDout['T'][-1]
    
    ### Calculate CJ state properties ###
    gas = PostShock_eq(cj_speed*overdrive[i], P1, T1, x, mech);
    T2[i] = gas.T
    P2[i] = gas.P
    rho2[i] = gas.density
   
    # Approximate the effective activation energy using finite differences
    factor = 0.02 
    Ta = Ts[i]*(1.0+factor)
Ejemplo n.º 8
0
    uv_T.append(gas.T)
    uv_ae.append(soundspeed_eq(gas))

    # CJ speed
    gas.TPX = T1, P1, x
    Ucj.append(CJspeed(P1, T1, x, mech))

    # vN state
    gas1 = PostShock_fr(Ucj[-1], P1, T1, x, mech)
    vn_T.append(gas1.T)
    vn_P.append(gas1.P)
    vn_rho.append(gas1.density)
    vn_af.append(soundspeed_fr(gas1))

    # ZND Structure
    ZNDout = zndsolve(gas1, gas, Ucj[-1], t_end=1e-4, advanced_output=True)
    ind_len_ZND.append(ZNDout['ind_len_ZND'])
    exo_len_ZND.append(ZNDout['exo_len_ZND'])

    # CJ state
    gas1 = PostShock_eq(Ucj[-1], P1, T1, x, mech)
    cj_T.append(gas1.T)
    cj_P.append(gas1.P)
    cj_rho.append(gas1.density)
    cj_af.append(soundspeed_fr(gas1))
    # Reflected CJ state
    [ref_P[i], Uref[i], gas2] = reflected_eq(gas, gas1, gas2, Ucj[-1])

    # 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]