matthewd139 / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Inconsistent behavior between inserted "gas" and property "thermo" #250

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Please download and run the attached py-file.

What is the expected output? What do you see instead?
The first and last line is expected to be "(1000.0, 1000.0)",
instead I see "(300.0, 101324.99999999999)".
In the attached script, gas and reac.thermo are reportedly the same object,
but behave in a different and, in my opinion, confusing way.

What version of the product are you using? On what operating system?
cantera 2.1.2, Python 3.4.2, Mac OS X 10.9.4

Please provide any additional information below.
I'm a novice of both cantera and Python, so maybe misunderstood about the 
object identity.
I was trying to do probably something like "syncContents" of the legacy 
interface(though I haven't used the legacy one), and came across this issue.

Original issue reported on code.google.com by yuts...@gmail.com on 8 Feb 2015 at 8:00

Attachments:

GoogleCodeExporter commented 8 years ago
The thermo attribute of the Reactor object is for accessing the state of the 
Reactor's contents, not setting them. Accessing the thermo attribute updates 
the gas object to match the state of the Reactor. While the state of the gas 
object is used to initialize the Reactor object, changes to the gas's state do 
not (and should not) automatically flow back to the Reactor. If you want to 
change the state of the reactor (before starting integration), you can change 
the state of the gas and then call Reactor.insert(gas).

Original comment by yarmond on 9 Feb 2015 at 4:37

GoogleCodeExporter commented 8 years ago
It seems that the gas in the reactor is not the same entity (object) in its 
meaning as the gas defined from the Solution.
I thought if the Reactor copied the gas (or only its state) at its 
initialization or gas insertion, and had its own gas (state) as a different 
object, it would become easier to use. 
But, anyway, I understand the intended usage and can do my research. Thank you, 
Mr. yarmond!

Original comment by yuts...@gmail.com on 11 Feb 2015 at 11:25