Enabled use of the 'calculatePsat' function for MixtureFugacityTP thermo class

in the Matlab toolbox.
This commit is contained in:
Steven DeCaluwe 2013-07-03 15:44:52 +00:00
parent ebaefabf08
commit 06d239a40a
4 changed files with 26 additions and 2 deletions

View file

@ -0,0 +1,4 @@
function v = calculatePsat(a, T)
% calcPsat - Calculate saturation pressure for temperature T (in K) for a
% fluid with the MFTP thermo model.
v = thermo_get(a.tp_id,26,T);

View file

@ -21,6 +21,7 @@
#include "Cabinet.h"
#include "cantera/kinetics/InterfaceKinetics.h"
#include "cantera/thermo/PureFluidPhase.h"
#include "cantera/thermo/MixtureFugacityTP.h"
using namespace std;
using namespace Cantera;
@ -605,7 +606,7 @@ extern "C" {
return handleAllExceptions(-1, ERR);
}
}
doublereal th_refPressure(int n)
{
try {
@ -767,6 +768,19 @@ extern "C" {
return handleAllExceptions(-1, ERR);
}
}
//-------------MFTP Models------------------//
double th_calculatePsat(int n, double TKelvin, double molarVolGas, double molarVolLiquid)
{
try {
return ThermoCabinet::get<MixtureFugacityTP>(n).calculatePsat(TKelvin, molarVolGas, molarVolLiquid);
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
//-------------- Kinetics ------------------//

View file

@ -58,6 +58,7 @@ extern "C" {
CANTERA_CAPI double th_cv_mole(int n);
CANTERA_CAPI double th_pressure(int n);
CANTERA_CAPI int th_setPressure(int n, double p);
CANTERA_CAPI double th_calculatePsat(int n, double TKelvin, double molarVolGas, double molarVolLiquid);
CANTERA_CAPI double th_enthalpy_mass(int n);
CANTERA_CAPI double th_intEnergy_mass(int n);
CANTERA_CAPI double th_entropy_mass(int n);

View file

@ -91,7 +91,7 @@ static void thermoset(int nlhs, mxArray* plhs[],
static void thermoget(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[])
{
double vv, psat, tsat;
double vv, psat, tsat, TK;
int n = getInt(prhs[1]);
int job = getInt(prhs[2]);
@ -174,6 +174,11 @@ static void thermoget(int nlhs, mxArray* plhs[],
break;
case 25:
vv = th_electricPotential(n);
break;
case 26:
double molarVolGas, molarVolLiquid;
TK = getDouble(prhs[3]);
vv = th_calculatePsat(n,TK,molarVolGas,molarVolLiquid);
break;
default:
ok = false;