Cantera example error batch_reactor_ignition_delay_NTC.ipynb

31 views
Skip to first unread message

tullio viola

unread,
Jul 14, 2021, 11:52:07 AM7/14/21
to Cantera Users' Group
Hi all,

simple question: in batch_reactor_ignition_delay_NTC.ipynb on cantera's website, if you uncomment  # timeHistory.to_csv("time_history.csv")  you should have data saved into a .csv file, but it doesn't work.


https://cantera.org/examples/jupyter/reactors/batch_reactor_ignition_delay_NTC.ipynb.html

How to do that??

Thank you 

p.s It gives the error <cantera.composite.SolutionArray object at 0x7f4badca0fd0> when I try to save data with a personal implemented dataframe
Tullio

Steven DeCaluwe

unread,
Jul 14, 2021, 12:39:52 PM7/14/21
to canter...@googlegroups.com
Hi Tulio,

time_history  used to be a pandas data frame object (some of the comments still reflect this; the example could probably benefit from a little cleanup), which does have a ’to_csv’ method.

Now that it is a Cantera SolutionArray, such a method no longer exists.  The SolutionArray is an array of Cantera objects, which does not *automatically* translate to a data output.  There may be some output routines connected to this class, but if not you should be able to loop through the array objects, save the state and time associated with each in a numpy array, for example, and then write that numpy array to a csv file.

Best,
Steven 



——————————————————
Steven C. DeCaluwe, Ph.D | Associate Professor of Mechanical Engineering
COLORADOSCHOOLOFMINES
Brown Building W410B
Golden, CO 80401

Twitter: @CORESresearch
He / Him / His





--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/c306136a-cd1c-4063-b1b2-73f4185584abn%40googlegroups.com.

tullio viola

unread,
Jul 15, 2021, 4:59:53 AM7/15/21
to canter...@googlegroups.com
Dear Steven,

thank you as ever for your availability. I'll fix this procedure and then I'll post the complete script.

Best regards

Reply all
Reply to author
Forward
0 new messages