How to export the results of Cantera to Excel

418 views
Skip to first unread message

m T

unread,
Jun 17, 2022, 4:30:21 AM6/17/22
to Cantera Users' Group
Hello,
I try to simulate at ic_engine.py.
I'd like to export calculation results of Cantera to Excel or CSV file.
Calculation results mean efficiency, co emission ,etc...
Can anyone teach me?
Thank you.

Bryan Weber

unread,
Jun 17, 2022, 2:48:58 PM6/17/22
to Cantera Users' Group
Hi,

That entirely depends on how you've saved the calculations. Cantera generally relies on NumPy to provide array support, which has a method to save data to CSV. Cantera's SolutionArray also has a write_csv method. It's hard to be more specific without more details though. Can you attach a minimal script that shows how you're calculating what you want to save?

Best,
Bryan

m T

unread,
Jun 21, 2022, 11:18:36 PM6/21/22
to Cantera Users' Group

Hello, 

Thank you for reply.

I use Cantera example named ic_engine.py as it is. (https://cantera.org/examples/python/reactors/ic_engine.py.html)

I want to save result of simulation and conditions set by myself.

I will attach a pdf. It is excel on pdf, but of course CSV is also acceptable.

 If you want to know more information, please do not hesitate to tell me.

Thank you.
2022年6月18日土曜日 3:48:58 UTC+9 bryan....@gmail.com:
Cantera to EXCEL script.pdf

Ingmar Schoegl

unread,
Jul 5, 2022, 8:46:08 AM7/5/22
to Cantera Users' Group
Hi,
If you look at the example, the solution values are stored in a `SolutionArray` called 'states', which can be written directly to a CSV file using the 'write_csv' method - see documentation here: https://cantera.org/documentation/docs-2.6/sphinx/html/cython/importing.html#cantera.SolutionArray
For anything else, there currently does not exist a capability of saving test parameters automatically - you'd have to implement that yourself (using standard Python approaches).
-is-

m T

unread,
Jul 26, 2022, 4:29:18 AM7/26/22
to Cantera Users' Group
Hello,
I have exported T(Cylinder temperature),P(Cylinder pressure) and X(Concentration of each component) to CSV file thanks to you.
Then, I want to know relation of Cylinder temperature and Clank Angle(°CA).

Could you tell me how to add Clank angle data to CSV?

Thank you.



2022年7月5日火曜日 21:46:08 UTC+9 Ingmar Schoegl:

m T

unread,
Jul 29, 2022, 4:05:12 AM7/29/22
to Cantera Users' Group
I did it, thank you

2022年7月26日火曜日 17:29:18 UTC+9 m T:

AMIT SINGH

unread,
Apr 13, 2023, 9:43:37 PM4/13/23
to Cantera Users' Group
Hi m T,

I am new to Cantera. I was running a free flame case and wanted to save to the kinetic rate of reaction at each step/location. Can you help me with this? 

Reply all
Reply to author
Forward
0 new messages