Looking for a Mixture example in C++

21 views
Skip to first unread message

Joe Wilson

unread,
Aug 25, 2025, 11:07:44 PM (13 days ago) Aug 25
to Cantera Users' Group
I am attempting to replicate this example: https://cantera.org/stable/examples/python/thermo/mixing.html#sphx-glr-examples-python-thermo-mixing-py

In C++ to modify a constitutes initial temperature before getting its adiabatic flame temperature. And make a little wrapper function for use in other languages besides C++ / Python. 

The C++ library does not seem to contain a quantity object nor the semantics for operator overloading. Which I don't think I need, but reading the docs and searching the repo did not reveal to me an obvious way to perform this. 

Whats the appropriate way to replicate the python mixture example in C++

Ray Speth

unread,
Aug 28, 2025, 4:01:27 PM (10 days ago) Aug 28
to Cantera Users' Group

Hi,

The equations involved are pretty simple — you can see what the Python Quantity class does for the “A += B” operation in the implementation of Quantity.__iadd__. Most of the complexity just comes from the various options of mixing at constant volume or constant pressure and whether the objects are configured to use a mass or molar basis for the properties (which isn’t a consideration in C++).

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages