[Matlab] Add isothermalCompressibility and thermalExpansionCoeff functions

Resolves Issue 157.
This commit is contained in:
Bryan W. Weber 2014-01-08 17:10:41 +00:00
parent a8d8f3f0ca
commit a689717a7a
5 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,8 @@
function b = isothermalCompressibility(a)
% ISOTHERMALCOMPRESSIBILITY - Isothermal Compressibility [1/Pa]
%
% b = isothermalCompressibility(a)
% Return the isothermal compressibility of ThermoPhase a
% in units of 1/Pa
%
b = thermo_get(a.tp_id,26);

View file

@ -0,0 +1,8 @@
function a = thermalExpansionCoeff(p)
% THERMALEXPANSIONCOEFF - Thermal Expansion Coefficient [1/K]
%
% a = thermalExpansionCoeff(p)
% Return the thermal expansion coefficient of ThermoPhase p
% in units of 1/K
%
a = thermo_get(p.tp_id,27);

View file

@ -693,6 +693,24 @@ extern "C" {
}
}
doublereal th_thermalExpansionCoeff(int n)
{
try {
return ThermoCabinet::item(n).thermalExpansionCoeff();
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
doublereal th_isothermalCompressibility(int n)
{
try {
return ThermoCabinet::item(n).isothermalCompressibility();
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
//-------------- pure fluids ---------------//
double th_critTemperature(int n)

View file

@ -65,6 +65,8 @@ extern "C" {
CANTERA_CAPI double th_cp_mass(int n);
CANTERA_CAPI double th_cv_mass(int n);
CANTERA_CAPI double th_electricPotential(int n);
CANTERA_CAPI double th_thermalExpansionCoeff(int n);
CANTERA_CAPI double th_isothermalCompressibility(int n);
CANTERA_CAPI int th_chemPotentials(int n, size_t lenm, double* murt);
CANTERA_CAPI int th_elementPotentials(int n, size_t lenm, double* lambda);
CANTERA_CAPI int th_getEnthalpies_RT(int n, size_t lenm, double* h_rt);

View file

@ -175,6 +175,12 @@ static void thermoget(int nlhs, mxArray* plhs[],
case 25:
vv = th_electricPotential(n);
break;
case 26:
vv = th_isothermalCompressibility(n);
break;
case 27:
vv = th_thermalExpansionCoeff(n);
break;
default:
ok = false;
}