import numpy as np import cantera as ct import matplotlib.pyplot as plt import pdb out=open("initialCondition.dat","w") mech='ffcm1.cti' flameSave='ffcm1.fs' targT = 1100 #K domainL = 1.0e-02 gridNN = 1000 gas = ct.Solution(mech) specNN = gas.n_species flame = ct.FreeFlame(gas) flame.restore(flameSave) grid = np.linspace(0,domainL,gridNN) T = np.zeros(gridNN) Y_ = np.zeros([specNN,gridNN]) pdb.set_trace() ctT = np.flip(flame.T) ctY_ = np.flip(flame.Y,axis=1) ctGrid = np.flip(-flame.grid) pdb.set_trace() ctFlamePos = ctGrid[ np.argwhere(ctT < targT)[0][0] ] torcFlamePos = domainL / 2.0 ctGrid = ctGrid + (torcFlamePos - ctFlamePos) T = np.interp(grid, ctGrid, ctT) for specII in range(specNN) : Y_[specII] = np.interp(grid,ctGrid,ctY_[specII,:]) for gridII in range(gridNN) : print(str(gridII)) out.write("%15.6e\t%15.6e\t"%(grid[gridII],T[gridII])) for specII in range(specNN) : out.write("%15.6e\t"%(Y_[specII][gridII])) out.write("%15.6e\n"%(gas.P)) out.close()