Esempio n. 1
0
# write the velocity, temperature, and mole fractions to a CSV file
f.write_csv('c2h6_diffusion.csv', quiet=False)

f.show_stats(0)

# Plot Temperature without radiation
figTemperatureModifiedFlame = plt.figure()
plt.plot(f.flame.grid, f.T, label='Temperature without manipulation',linewidth=4)
plt.title('Temperature of the flame')
plt.ylim(0,2500)
plt.xlim(0.000, 0.020)



gas2 =em.efficiency_rate_swap(ct.Solution(os.getcwd()+'\\TMRP codes\\USCMech\\uscmech.cti'))
import soln2cti as ctiw
#gas2=em.efficiency_rate_swap(gas2)
gas2 = ct.Solution(os.getcwd()+'\\pym_gas.cti')
f2 = ct.CounterflowDiffusionFlame(gas2, width=width)
f2.fuel_inlet.mdot = mdot_f
f2.fuel_inlet.X = comp_f
f2.fuel_inlet.T = tin_f
f2.oxidizer_inlet.mdot = mdot_o
f2.oxidizer_inlet.X = comp_o
f2.oxidizer_inlet.T = tin_o
# Set the boundary emissivities
f2.set_boundary_emissivities(0.0, 0.0)
# Turn radiation off
f2.radiation_enabled = False
f2.set_refine_criteria(ratio=4, slope=0.2, curve=0.3, prune=0.04)
Esempio n. 2
0
sim = ct.ReactorNet([r])

tt = []
TT = []
t = 0.0
# Rmax is the maximum relative reaction rate at any timestep
Rmax = np.zeros(gas.n_reactions)
while t < 0.02:
    t = sim.step()
    tt.append(1000 * t)
    TT.append(r.T)
    rnet = abs(gas.net_rates_of_progress)
    rnet /= max(rnet)
    Rmax = np.maximum(Rmax, rnet)

gas2 = em.efficiency_rate_swap(ct.Solution(filename))

import soln2cti as ctiw
new_file = ctiw.write(gas2)
gas2 = ct.Solution(os.getcwd() + '\\pym_gas.cti')
#initial_state2=copy.deepcopy(initial_state)
gas2.TPX = initial_state
r2 = ct.IdealGasConstPressureReactor(gas2)
sim2 = ct.ReactorNet([r2])

tt2 = []
TT2 = []
t2 = 0.0
Rmax2 = np.zeros(gas2.n_reactions)
while t2 < 0.02:
    t2 = sim2.step()
Esempio n. 3
0
global conditionsTups
width = 0.03
conditionsTups = []
for i in np.arange(len(phi)):
    for filename in np.arange(len(mechanisms)):
        for j in np.arange(len(fuels)):
            for t in np.arange(len(temps)):
                for p in np.arange(len(pressures)):
                    for truth in efficiency_manipulate:
                        conditionsTups.append([
                            mechanisms[filename], phi[i], fuels[j],
                            oxidizers[j], temps[t], pressures[p], truth
                        ])
if True in efficiency_manipulate:
    gas = ct.Solution(mechanisms[0])
    gas = em.efficiency_rate_swap(gas)
    gas.name = fuels[0] + '_' + mechanisms[0].rstrip('.cti').split('\\')[-1]
    import soln2cti as ctiw
    new_file = ctiw.write(gas)


#print(conditionsTups)
def solver(conditionsTup):
    try:
        if not conditionsTup[6]:
            fuels = conditionsTup[2]
            #oxidizer={'O2':0.5, 'N2':1.88}
            oxidizer = conditionsTup[3]
            gas = ct.Solution(conditionsTup[0])

            pressures = conditionsTup[5]
          ], [11.0], [9.0], [7.5], [1.0]]
coeffs = [[9.0]]
coeffs = [[2.0, 1.5, 2.5]]
#coeffs=[[11.0]]
#coeffs=[[7.5]]
#coeffs=[[1.0]]
coeffs = [[
    2.0, 3.5, 3.0, 2.5, 5.0, 4.5, 4.0, 6.5, 6.5, 6.0, 6.0, 6.0, 5.5, 5.5, 5.5,
    5.5
]]
#coeffs=[[11.0],
#        [9.0]]
for i in nominal_models:
    gas = ct.Solution(i)
    gas.name = 'igDelayRateSwap_' + i.split('\\')[-1].rstrip('.cti')
    gas2 = em.efficiency_rate_swap(gas, [val])
    newfilename = ntpath.dirname(i) + '\\modified2_' + ntpath.basename(i)
    new_file = ctiw.write(gas2, newfilename)
    modified_models.append(new_file)

conditionsTup = []
for n in np.arange(len(nominal_models)):
    for p in np.arange(len(P)):
        for i in np.arange(len(T)):
            for subf in np.arange(len(fuels[n])):
                oxidizer = {}
                oxidizer = {
                    'O2': coeffs[n][subf],
                    'N2': 3.76 * coeffs[n][subf]
                }
                conditionsTup.append([