NotImplementedError thrown by ThermoPhase::critPressure

72 views
Skip to first unread message

srikeshav Nikhilesh

unread,
Nov 9, 2023, 1:38:49 AM11/9/23
to Cantera Users' Group
Hello all,
I am trying to generate the compressibility factor chart for various gas species.
One of the requirements is to calculate critical pressure and critical temperature for each species or for the whole mixture. I noticed that I get the same error for both a mixture and a pure gas.

I am experiencing an error on Cantera via matlab.

MWE  - For a pure gas

Tu = 300;
Pu = 1e5;
comp = 'N2:1.0';
mech = 'gri30.yaml';
gas = Solution(mech);
set(gas,'Temperature',Tu,'Pressure',Pu,'MoleFractions',comp);
critPressure(gas)

Error message on MATLAB command window - 

Error using ctmethods

*******************************************************************************
NotImplementedError thrown by ThermoPhase::critPressure:
Not implemented.
*******************************************************************************


Error in thermo_get (line 3)
    i = ctmethods(20, n, job);

Error in ThermoPhase/critPressure (line 11)
v = thermo_get(tp.tp_id, 20);

Error in Untitled2 (line 14)
critPressure(gas)

Any help in diagnosing and rectifying this error is appreciated.
Warm Regards,
Nikhilesh S V

Z. Weng

unread,
Nov 9, 2023, 6:13:00 AM11/9/23
to Cantera Users' Group
Hello,

The critPressure is available for non-ideal equation of state, like Redlich-Kwong, Peng-Robinson. See for example the non-ideal shock tube demo, https://cantera.org/examples/python/reactors/NonIdealShockTube.py.html

However, one needs critical properties of each species to calculate a and b parameters as the activity_coefficients input for using these equation of state. If the activity_coefficients is left empty, cantera (at least cantera 2.6) will look up /data/critical-properties.yaml if the data is available there. An example was attached.

Best,
Zifeng
RK_emptyInput.cti
Reply all
Reply to author
Forward
0 new messages