hkmoffat / cantera

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

multiphaseEquil errors not reported in python #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In python, create a mixture object
2. Use the vcs_equilibrate method of the object in a way that a CanteraError is 
thrown

What is the expected output? What do you see instead?
I expect a CanteraError to be thrown. Instead, nothing happens.

What version of the product are you using? On what operating system?
Cantera r2494, with python 2.7.3 under linux    

Please provide any additional information below.
The problem can be demonstrated by running the attached script. This script is 
basically the samples/python/equilibrium/multiphase_plasma/multiphase_plasma.py 
example, where I replaced the 'TP' string on line 37 by an invalid one ('TK'). 
When I run the script, no error is shown. The mixture is of course also never 
equilibrated.

I think that there is a problem with the way the errors fed back from the 
mix_vcs_equilibrate method is handled in python. In 
src/python/ctmultiphase_method.cpp, one sees that an exception is thrown in 
python only if the return value of mix_vcs_equilibrate is below -900. The 
problem is that an error in the mix_vcs_equilibrate code returns a -1 value. 
Changing the value from -900 to 0 fixes the problem, but I can't tell if this 
is a 'sustainable' fix.

Regards
Charles

Original issue reported on code.google.com by chdoi...@gmail.com on 26 Jul 2013 at 2:06

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 26 Jul 2013 at 8:51

GoogleCodeExporter commented 9 years ago
Fixed in r2498.

Original comment by yarmond on 26 Jul 2013 at 9:38