I'm having two problems that I'm sure relate to how I'm defining and calling variables in python.
I have successfully made a program (adapted from the adiabatic flame w/ soot formation tutorial) to calculate the equilibrium composition at different temperatures for a single starting composition and write that in addition to some other calculations to a .csv file. What I can't do is output the mole fraction of graphite in the mixture (or other properties of the mixture for that matter). I have annotated the attached file with where I want that to happen in the for loop. I looked
here but still can't seem to figure it out without getting errors. Apologies for what is likely a problem with a simple solution.
What I want to do next is modify the for loop to repeat for incrementally changing initial compositions. Whenever I try defining a gas composition with variables in it, I get 'nan' (not a number) for all species concentrations, presumably because my variables are being read as strings.
For example, inserting variables like this:
import cantera as ct
gas = ct.Solution('gri30.xml')
c1= 0.1
c2= 0.9
gas.X= 'H2O:c1, CH4:c2'
gas()
gives 'nan' for all outputs. How can I define species compositions with variable in a way that this does not happen?
Thanks,
Colin