s-amouyal12 / cantera

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

importPhase #243

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run example surfreactor.m in Matlab

What is the expected output? What do you see instead?
Expected: output of run
Actual: 

Undefined function 'importPhase' for input arguments of type 'char'.

Error in surfreactor (line 10)
gas = importPhase('ptcombust.cti','gas');

What version of the product are you using? On what operating system?
Latest (October 2014), OS X

Please provide any additional information below.

I have browsed through the various issues, and it seems this example is legacy, 
and perhaps importPhase should be changed to import_phases? However, this alone 
does not seem to fix it (I get the following message: 

Undefined function 'import_phases' for input arguments of type 'char'.

Error in surfreactor (line 10)
gas = import_phases('ptcombust.cti','gas');
)

Presumably I would need an older version of cantera? My computer is already a 
forest of old versions of python, so hopefully this will not be another wild 
goose chase. 

Original issue reported on code.google.com by Simone.H...@gmail.com on 14 Oct 2014 at 10:05

GoogleCodeExporter commented 9 years ago
Dear Simone,

I can't reproduce this error on my Windows 7 install. Have you set the MATLAB 
path to include the install directory for Cantera? Which version of 
MATLAB/Cantera are you using?

The entire MATLAB interface uses a rather old method of accessing the 
underlying C++ layers, so importPhase(cti_file, phase_name) should be the 
correct call in MATLAB. If you're using Python, it is a different story. Which 
interface would you like to use?

Best,
Bryan

Original comment by bryan.w....@gmail.com on 14 Oct 2014 at 12:24

GoogleCodeExporter commented 9 years ago
1) I have followed the instructions 
(http://cantera.github.io/docs/sphinx/html/install.html#mac-os-x) to install 
Cantera for Matlab and Python interface to install it  (which worked after a 
few hours of struggling through homebrew's confusion over various python 
versions). 

2) I used python to run a demo case, which ran successfully, but it failed in 
the case I would like to run, with solid and gas phase involving invoking 
importPhase. 
So I looked for help on the web, and found that this could b related to the 
issue of the change between ImportPhase and import_phases in different 
versions. Neither of them work. 

3) I then switched to the Matlab interface, to find that, although I do have 
the path pointing to the library (/usr/local/cantera.2.1.x) the simple first 
tutorial tut1.m is not running successfully, so something is missing. 

gas1 = GRI30

gives the following message: 

-------------------------
Error using ctmethods

************************************************
               Cantera Error!
************************************************

Procedure: ct2ctml
Error:   Error converting input file 
"/usr/local/Cellar/cantera/2.1.x/share/cantera/data/gri30.cti" to
CTML.
Python command was: '/usr/local/bin/python'
-------------------------

4) I have checked that python2.7 is called when /usr/local/bin/python runs via 
matlab. Numpy happily installed in the python version. 

Original comment by Simone.H...@gmail.com on 14 Oct 2014 at 4:22

GoogleCodeExporter commented 9 years ago
Dear Simone,

Can you try running the diamond_cvd.py example in Python? 
http://cantera.github.io/docs/sphinx/html/cython/examples/surface_chemistry_diam
ond_cvd.html

That example involves using import_phases in the Python interface, and might be 
closer to what you want.

For the MATLAB errors, I have no experience with OS X so this will be shots in 
the dark. You might have more luck posting on the Users Group 
(https://groups.google.com/forum/#!forum/cantera-users) - more people read 
that, and several of them have OS X experience.

Where is the Python interface installed? Can you verify that 
/usr/local/bin/python can import cantera? (Is that what you did in 2)?) Sorry I 
can't be more help!

Bryan

Original comment by bryan.w....@gmail.com on 17 Oct 2014 at 11:47

GoogleCodeExporter commented 9 years ago
Dear Simone,

Ray has posted that the error you see may be due to incompatible versions of 
one of the Fortran libraries: 
https://groups.google.com/d/msg/cantera-users/5RnyeoTd_Rk/2k4AcZ85L6IJ

Its possible this is the cause of your problem.

Bryan

Original comment by bryan.w....@gmail.com on 22 Oct 2014 at 8:56

GoogleCodeExporter commented 9 years ago
Can you even run Python from within Matlab? What happens if you run (in Matlab):

    !/usr/local/bin/python

Does this give you a Python prompt? Can you run 'import cantera' from that 
prompt?

I'm not sure this is the same issue, but it may be related. I'd also suggest 
that the users' group is a better place to handle this unless it can actually 
be confirmed as a Cantera bug.

Original comment by yarmond on 27 Oct 2014 at 8:58

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 14 Nov 2014 at 4:00