Related data repo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1017B

  1. import numpy as np
  2. import cantera as ct
  3. import matplotlib.pyplot as plt
  4. import pdb
  5. out=open("initialCondition.dat","w")
  6. mech='ffcm1.cti'
  7. flameSave='ffcm1.fs'
  8. targT = 1100 #K
  9. domainL = 1.0e-02
  10. gridNN = 1000
  11. gas = ct.Solution(mech)
  12. specNN = gas.n_species
  13. flame = ct.FreeFlame(gas)
  14. flame.restore(flameSave)
  15. grid = np.linspace(0,domainL,gridNN)
  16. T = np.zeros(gridNN)
  17. Y_ = np.zeros([specNN,gridNN])
  18. pdb.set_trace()
  19. ctT = np.flip(flame.T)
  20. ctY_ = np.flip(flame.Y,axis=1)
  21. ctGrid = np.flip(-flame.grid)
  22. pdb.set_trace()
  23. ctFlamePos = ctGrid[ np.argwhere(ctT < targT)[0][0] ]
  24. torcFlamePos = domainL / 2.0
  25. ctGrid = ctGrid + (torcFlamePos - ctFlamePos)
  26. T = np.interp(grid, ctGrid, ctT)
  27. for specII in range(specNN) :
  28. Y_[specII] = np.interp(grid,ctGrid,ctY_[specII,:])
  29. for gridII in range(gridNN) :
  30. print(str(gridII))
  31. out.write("%15.6e\t%15.6e\t"%(grid[gridII],T[gridII]))
  32. for specII in range(specNN) :
  33. out.write("%15.6e\t"%(Y_[specII][gridII]))
  34. out.write("%15.6e\n"%(gas.P))
  35. out.close()