dbirch997 / cantera

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

Error in nAtoms cantera code... #159

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Solution object (gas = IdealGasMix('gri30.cti')).
2. Count the number of atoms: nAtoms(gas,'HCO','O')
3. Error!

What is the expected output? What do you see instead?
I would expect to see an output of (1)

instead I see:

Error using ctmethods

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

Procedure: checkElementIndex
Error:

Error in phase_get (line 7)
    i = ctmethods(30, n, job, a, b);

Error in ThermoPhase/nAtoms (line 4)
    n = phase_get(a.tp_id,14,k,m);

What version of the product are you using? On what operating system?
Using Cantera 2.0.2 and pyton 2.7.3, on a windows 7 x64 computer

Please provide any additional information below.

Original issue reported on code.google.com by jdemut...@gmail.com on 12 Apr 2013 at 5:42

GoogleCodeExporter commented 9 years ago
The nAtoms function in the Matlab interface requires the index of the species 
and element, not the names:

    nAtoms(gas, speciesIndex(gas, 'HCO'), elementIndex(gas, 'H'))

The nAtoms method in the Python interface accepts either indices or names, so 
this would probably be a reasonable improvement for the Matlab interface.

Original comment by yarmond on 12 Apr 2013 at 6:32

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 12 Apr 2013 at 6:32

GoogleCodeExporter commented 9 years ago
Attached please find a patch to look up the element or species index if a 
string is provided to the nAtoms function. It is based on r2644.

Bryan

Original comment by bryan.w....@gmail.com on 5 Jan 2014 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2657.

Original comment by yarmond on 6 Jan 2014 at 6:46