*** empty log message ***
This commit is contained in:
parent
59f5666c85
commit
fc80f228ab
19 changed files with 160 additions and 20 deletions
|
|
@ -40,6 +40,8 @@ hval = -999;
|
||||||
uval = -999;
|
uval = -999;
|
||||||
sval = -999;
|
sval = -999;
|
||||||
vval = -999;
|
vval = -999;
|
||||||
|
qval = -999;
|
||||||
|
|
||||||
np = 0;
|
np = 0;
|
||||||
nt = 0;
|
nt = 0;
|
||||||
nv = 0;
|
nv = 0;
|
||||||
|
|
@ -48,6 +50,7 @@ ny = 0;
|
||||||
ns = 0;
|
ns = 0;
|
||||||
nh = 0;
|
nh = 0;
|
||||||
nu = 0;
|
nu = 0;
|
||||||
|
nq = 0;
|
||||||
|
|
||||||
while length(property_argin) >= 2,
|
while length(property_argin) >= 2,
|
||||||
prop = property_argin{1};
|
prop = property_argin{1};
|
||||||
|
|
@ -105,6 +108,9 @@ while length(property_argin) >= 2,
|
||||||
case 'S'
|
case 'S'
|
||||||
sval = val;
|
sval = val;
|
||||||
ns = ns + 1;
|
ns = ns + 1;
|
||||||
|
case 'Sat'
|
||||||
|
qval = val;
|
||||||
|
nq = nq + 1;
|
||||||
otherwise
|
otherwise
|
||||||
error(['unknown property ' char(prop)])
|
error(['unknown property ' char(prop)])
|
||||||
end
|
end
|
||||||
|
|
@ -114,7 +120,7 @@ if nx + ny > 1
|
||||||
error('composition specified multiple times');
|
error('composition specified multiple times');
|
||||||
end
|
end
|
||||||
|
|
||||||
ntot = nt + np + nv + ns + nh + nu;
|
ntot = nt + np + nv + ns + nh + nu + nq;
|
||||||
|
|
||||||
if ntot == 1
|
if ntot == 1
|
||||||
%
|
%
|
||||||
|
|
@ -138,7 +144,13 @@ elseif ntot == 2
|
||||||
if nv == 1
|
if nv == 1
|
||||||
setDensity(a,1.0/vval); % temperature held fixed
|
setDensity(a,1.0/vval); % temperature held fixed
|
||||||
elseif np == 1
|
elseif np == 1
|
||||||
setPressure(a, pval); % temperature held fixed
|
setPressure(a, pval); % temperature held fixed
|
||||||
|
elseif nq == 1
|
||||||
|
if qval == 'Liquid'
|
||||||
|
setState_satLiquid(a);
|
||||||
|
elseif qval == 'Vapor'
|
||||||
|
setState_satVapor(a);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error('unimplemented property pair');
|
error('unimplemented property pair');
|
||||||
end
|
end
|
||||||
|
|
|
||||||
4
Cantera/matlab/cantera/@ThermoPhase/critDensity.m
Normal file
4
Cantera/matlab/cantera/@ThermoPhase/critDensity.m
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
function v = critDensity(a)
|
||||||
|
% CRITDENSITY - Critical density [kg/m3].
|
||||||
|
%
|
||||||
|
v = thermo_get(a.tp_id,21);
|
||||||
4
Cantera/matlab/cantera/@ThermoPhase/critPressure.m
Normal file
4
Cantera/matlab/cantera/@ThermoPhase/critPressure.m
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
function v = critPressure(a)
|
||||||
|
% CRITPRESSURE - Critical pressure [Pa].
|
||||||
|
%
|
||||||
|
v = thermo_get(a.tp_id,20);
|
||||||
4
Cantera/matlab/cantera/@ThermoPhase/critTemperature.m
Normal file
4
Cantera/matlab/cantera/@ThermoPhase/critTemperature.m
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
function v = critTemperature(a)
|
||||||
|
% CRITTEMPERATURE - Critical temperature [K].
|
||||||
|
%
|
||||||
|
v = thermo_get(a.tp_id,19);
|
||||||
|
|
@ -1,12 +1,6 @@
|
||||||
function v = minTemp(p)
|
function v = critTemperature(a)
|
||||||
% MINTEMP - Minimum temperature.
|
% CRITTEMPERATURE - Critical temperature [K].
|
||||||
%
|
|
||||||
% The parameterizations used to represent the temperature-dependent
|
|
||||||
% species thermodynamic properties are generally only valid in some
|
|
||||||
% finite temperature range, which may be different for each species
|
|
||||||
% in the phase. This method returns the lowest temperature at which
|
|
||||||
% the parameterizations are valid for all species in the phase.
|
|
||||||
%
|
%
|
||||||
% See also: maxTemp
|
% The critical temperature is the temperature at the critical point
|
||||||
%
|
%
|
||||||
v = thermo_get(p.tp_id,16);
|
v = thermo_get(p.tp_id,19);
|
||||||
|
|
|
||||||
3
Cantera/matlab/cantera/@ThermoPhase/satPressure.m
Normal file
3
Cantera/matlab/cantera/@ThermoPhase/satPressure.m
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function v = satPressure(a, T)
|
||||||
|
% SATPRESSURE - Saturation pressure for temperature T.
|
||||||
|
v = thermo_get(a.tp_id,24,T);
|
||||||
3
Cantera/matlab/cantera/@ThermoPhase/satTemperature.m
Normal file
3
Cantera/matlab/cantera/@ThermoPhase/satTemperature.m
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function v = satTemperature(a, p)
|
||||||
|
% SATTEMPERATURE - Saturation temperature for pressure p.
|
||||||
|
v = thermo_get(a.tp_id,23,p);
|
||||||
5
Cantera/matlab/cantera/@ThermoPhase/setState_satLiquid.m
Normal file
5
Cantera/matlab/cantera/@ThermoPhase/setState_satLiquid.m
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
function a = setState_satLiquid(a)
|
||||||
|
% SETSTATE_SATLIQUID Set the fluid to the saturated liquid state
|
||||||
|
% at the current temperature.
|
||||||
|
%
|
||||||
|
thermo_set(a.tp_id,2,0);
|
||||||
5
Cantera/matlab/cantera/@ThermoPhase/setState_satVapor.m
Normal file
5
Cantera/matlab/cantera/@ThermoPhase/setState_satVapor.m
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
function a = setState_satVapor(a)
|
||||||
|
% SETSTATE_SATVAPOR Set the fluid to the saturated vapor state at the
|
||||||
|
% current temperature.
|
||||||
|
%
|
||||||
|
thermo_set(a.tp_id,3,0);
|
||||||
5
Cantera/matlab/cantera/@ThermoPhase/vaporFraction.m
Normal file
5
Cantera/matlab/cantera/@ThermoPhase/vaporFraction.m
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
function v = vaporFraction(a)
|
||||||
|
% VAPORFRACTION - Vapor fraction.
|
||||||
|
% If object 'a' represents a liquid/vapor mixture, this method
|
||||||
|
% returns the vapor fraction.
|
||||||
|
v = thermo_get(a.tp_id,22);
|
||||||
|
|
@ -15,7 +15,7 @@ if nargin == 4
|
||||||
node = child(xml_phase,'transport');
|
node = child(xml_phase,'transport');
|
||||||
tr.model = attrib(node,'model');
|
tr.model = attrib(node,'model');
|
||||||
catch
|
catch
|
||||||
tr.model = '';
|
tr.model = 'None';
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
tr.model = model;
|
tr.model = model;
|
||||||
|
|
|
||||||
11
Cantera/matlab/cantera/Hydrogen.m
Normal file
11
Cantera/matlab/cantera/Hydrogen.m
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function n = Hydrogen()
|
||||||
|
% HYDROGEN - Return an object representing hydrogen.
|
||||||
|
%
|
||||||
|
% The object returned by this method implements an accurate equation of
|
||||||
|
% state for hydrogen that can be used in the liquid, vapor, saturated
|
||||||
|
% liquid/vapor, and supercritical regions of the phase diagram. The
|
||||||
|
% equation of state is taken from W. C. Reynolds, "Thermodynamic
|
||||||
|
% Properties in SI."
|
||||||
|
%
|
||||||
|
n = importPhase('purefluids.cti','hydrogen');
|
||||||
|
|
||||||
11
Cantera/matlab/cantera/Methane.m
Normal file
11
Cantera/matlab/cantera/Methane.m
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function n = Methane()
|
||||||
|
% METHANE - Return an object representing methane.
|
||||||
|
%
|
||||||
|
% The object returned by this method implements an accurate equation of
|
||||||
|
% state for methane that can be used in the liquid, vapor, saturated
|
||||||
|
% liquid/vapor, and supercritical regions of the phase diagram. The
|
||||||
|
% equation of state is taken from W. C. Reynolds, "Thermodynamic
|
||||||
|
% Properties in SI."
|
||||||
|
%
|
||||||
|
n = importPhase('purefluids.cti','methane');
|
||||||
|
|
||||||
11
Cantera/matlab/cantera/Nitrogen.m
Normal file
11
Cantera/matlab/cantera/Nitrogen.m
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function n = Nitrogen()
|
||||||
|
% NITROGEN - Return an object representing nitrogen.
|
||||||
|
%
|
||||||
|
% The object returned by this method implements an accurate equation of
|
||||||
|
% state for nitrogen that can be used in the liquid, vapor, saturated
|
||||||
|
% liquid/vapor, and supercritical regions of the phase diagram. The
|
||||||
|
% equation of state is taken from W. C. Reynolds, "Thermodynamic
|
||||||
|
% Properties in SI."
|
||||||
|
%
|
||||||
|
n = importPhase('purefluids.cti','nitrogen');
|
||||||
|
|
||||||
11
Cantera/matlab/cantera/Oxygen.m
Normal file
11
Cantera/matlab/cantera/Oxygen.m
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function n = Oxygen()
|
||||||
|
% OXYGEN - Return an object representing oxygen.
|
||||||
|
%
|
||||||
|
% The object returned by this method implements an accurate equation of
|
||||||
|
% state for oxygen that can be used in the liquid, vapor, saturated
|
||||||
|
% liquid/vapor, and supercritical regions of the phase diagram. The
|
||||||
|
% equation of state is taken from W. C. Reynolds, "Thermodynamic
|
||||||
|
% Properties in SI."
|
||||||
|
%
|
||||||
|
n = importPhase('purefluids.cti','oxygen');
|
||||||
|
|
||||||
11
Cantera/matlab/cantera/Water.m
Normal file
11
Cantera/matlab/cantera/Water.m
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function w = Water()
|
||||||
|
% WATER - Return an object representing water.
|
||||||
|
%
|
||||||
|
% The object returned by this method implements an accurate equation of
|
||||||
|
% state for water that can be used in the liquid, vapor, saturated
|
||||||
|
% liquid/vapor, and supercritical regions of the phase diagram. The
|
||||||
|
% equation of state is taken from W. C. Reynolds, "Thermodynamic
|
||||||
|
% Properties in SI."
|
||||||
|
%
|
||||||
|
w = importPhase('purefluids.cti','water');
|
||||||
|
|
||||||
42
Cantera/matlab/cantera/examples/rankine.m
Normal file
42
Cantera/matlab/cantera/examples/rankine.m
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%
|
||||||
|
% An ideal Rankine cycle.
|
||||||
|
%
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|
||||||
|
% create an object representing water
|
||||||
|
w = Water;
|
||||||
|
|
||||||
|
% start with saturated liquid water at 300 K
|
||||||
|
set(w,'T',300.0,'Sat','Liquid');
|
||||||
|
h1 = enthalpy_mass(w);
|
||||||
|
s1 = entropy_mass(w);
|
||||||
|
p1 = pressure(w);
|
||||||
|
|
||||||
|
% pump it isentropically to 10 MPa
|
||||||
|
set(w,'S',s1,'P',1.0e7);
|
||||||
|
h2 = enthalpy_mass(w);
|
||||||
|
p2 = pressure(w);
|
||||||
|
|
||||||
|
pump_work = h2 - h1;
|
||||||
|
|
||||||
|
|
||||||
|
% heat to 1500 K at constant pressure
|
||||||
|
set(w,'T',1500.0,'P',p2);
|
||||||
|
h3 = enthalpy_mass(w);
|
||||||
|
s3 = entropy_mass(w);
|
||||||
|
|
||||||
|
heat_added = h3 - h2;
|
||||||
|
|
||||||
|
|
||||||
|
% expand isentropically to the initial pressure
|
||||||
|
set(w,'S',s3,'P',p1);
|
||||||
|
h4 = enthalpy_mass(w);
|
||||||
|
x4 = vaporFraction(w);
|
||||||
|
|
||||||
|
work_output = h3 - h4;
|
||||||
|
|
||||||
|
% compute the efficiency
|
||||||
|
efficiency = (work_output - pump_work)/heat_added
|
||||||
|
|
||||||
|
|
@ -27,7 +27,11 @@ static void thermoset( int nlhs, mxArray *plhs[],
|
||||||
case 10:
|
case 10:
|
||||||
ierr = delThermo(th); break;
|
ierr = delThermo(th); break;
|
||||||
case 1:
|
case 1:
|
||||||
ierr = th_setPressure(th,*ptr); break;
|
ierr = th_setPressure(th,*ptr); break;
|
||||||
|
case 2:
|
||||||
|
ierr = th_setState_satLiquid(th); break;
|
||||||
|
case 3:
|
||||||
|
ierr = th_setState_satVapor(th); break;
|
||||||
default:
|
default:
|
||||||
mexErrMsgTxt("unknown attribute.");
|
mexErrMsgTxt("unknown attribute.");
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +73,7 @@ static void thermoset( int nlhs, mxArray *plhs[],
|
||||||
static void thermoget( int nlhs, mxArray *plhs[],
|
static void thermoget( int nlhs, mxArray *plhs[],
|
||||||
int nrhs, const mxArray *prhs[] )
|
int nrhs, const mxArray *prhs[] )
|
||||||
{
|
{
|
||||||
double vv;
|
double vv, psat, tsat;
|
||||||
int n = getInt(prhs[1]);
|
int n = getInt(prhs[1]);
|
||||||
int job = getInt(prhs[2]);
|
int job = getInt(prhs[2]);
|
||||||
|
|
||||||
|
|
@ -123,11 +127,11 @@ static void thermoget( int nlhs, mxArray *plhs[],
|
||||||
case 22:
|
case 22:
|
||||||
vv = th_vaporFraction(n); break;
|
vv = th_vaporFraction(n); break;
|
||||||
case 23:
|
case 23:
|
||||||
double p = getDouble(prhs[3]);
|
psat = getDouble(prhs[3]);
|
||||||
vv = th_satTemperature(n, p); break;
|
vv = th_satTemperature(n, psat); break;
|
||||||
case 24:
|
case 24:
|
||||||
double t = getDouble(prhs[3]);
|
tsat = getDouble(prhs[3]);
|
||||||
vv = th_satPressure(n, t); break;
|
vv = th_satPressure(n, tsat); break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
bindir = '/home/goodwin/ct153d/bin'
|
bindir = '/home/goodwin/ctt/bin'
|
||||||
libdir = '/home/goodwin/dv/sf/cantera/build/lib/i686-pc-linux-gnu'
|
libdir = '/home/goodwin/dv/sf/cantera/build/lib/i686-pc-linux-gnu'
|
||||||
incdir = '/home/goodwin/dv/sf/cantera/build/include'
|
incdir = '/home/goodwin/dv/sf/cantera/build/include'
|
||||||
dflibdir = ''
|
dflibdir = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue