mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Added 'Q' as a PureFluid property replacing 'vaporFraction'.
This commit is contained in:
parent
6b1bcd089a
commit
798dd7f3a4
@ -84,6 +84,8 @@ classdef ThermoPhase < handle
|
||||
|
||||
G % Gibbs free energy depending on the basis. Units: J/kmol (molar) J/kg (mass).
|
||||
|
||||
Q % Vapor fraction of the phase.
|
||||
|
||||
% Chemical potentials of the species ::
|
||||
%
|
||||
% >> mu = tp.chemPotentials
|
||||
@ -234,8 +236,6 @@ classdef ThermoPhase < handle
|
||||
|
||||
thermalExpansionCoeff % Thermal expansion coefficient. Units: 1/K.
|
||||
|
||||
vaporFraction % Vapor fraction of the phase.
|
||||
|
||||
end
|
||||
|
||||
properties (Dependent = true)
|
||||
@ -251,6 +251,9 @@ classdef ThermoPhase < handle
|
||||
% Get/Set density [kg/m^3 or kmol/m^3], pressure [Pa], and mass fractions.
|
||||
DPY
|
||||
|
||||
% Get density [kg/m^3 or kmol/m^3], pressure [Pa], and vapor fraction.
|
||||
DPQ
|
||||
|
||||
% Get/Set enthalpy [J/kg or J/kmol] and pressure [Pa].
|
||||
HP
|
||||
|
||||
@ -260,6 +263,9 @@ classdef ThermoPhase < handle
|
||||
% Get/Set enthalpy [J/kg or J/kmol], pressure [Pa], and mass fractions.
|
||||
HPY
|
||||
|
||||
% Get enthalpy [J/kg or J/kmol], pressure [Pa], and vapor fraction.
|
||||
HPQ
|
||||
|
||||
% Get/Set pressure [Pa] and specific volume [m^3/kg or m^3/kmol].
|
||||
PV
|
||||
|
||||
@ -271,6 +277,9 @@ classdef ThermoPhase < handle
|
||||
% and mass fractions.
|
||||
PVY
|
||||
|
||||
% Get/Set pressure [Pa] and vapor fraction of a two-phase state.
|
||||
PQ
|
||||
|
||||
% Get/Set entropy [J/kg-K or J/kmol-K] and enthalpy [J/kg or J/kmol].
|
||||
SH
|
||||
|
||||
@ -291,6 +300,9 @@ classdef ThermoPhase < handle
|
||||
% Get/Set entropy [J/kg-K or J/kmol-K], pressure [Pa], and mass fractions.
|
||||
SPY
|
||||
|
||||
% Get entropy [J/kg-K or J/kmol-K], pressure [Pa], and vapor fraction.
|
||||
SPQ
|
||||
|
||||
% Get/Set entropy [J/kg-K or J/kmol-K] and temperature [K].
|
||||
ST
|
||||
|
||||
@ -311,6 +323,10 @@ classdef ThermoPhase < handle
|
||||
% and mass fractions.
|
||||
SVY
|
||||
|
||||
% Get/Set entropy [J/kg-K or J/kmol-K], specific volume [m^3/kg or m^3/kmol],
|
||||
% and vapor fraction.
|
||||
SVQ
|
||||
|
||||
% Get/Set temperature [K] and density [kg/m^3 or kmol/m^3].
|
||||
TD
|
||||
|
||||
@ -320,6 +336,9 @@ classdef ThermoPhase < handle
|
||||
% Get/Set temperature [K], density [kg/m^3 or kmol/m^3], and mass fractions.
|
||||
TDY
|
||||
|
||||
% Get temperature [K], density [kg/m^3 or kmol/m^3], and vapor fraction.
|
||||
TDQ
|
||||
|
||||
% Get/Set temperature [K] and enthalpy [J/kg or J/kmol].
|
||||
TH
|
||||
|
||||
@ -338,6 +357,12 @@ classdef ThermoPhase < handle
|
||||
% Get/Set temperature [K], pressure [Pa], and mass fractions.
|
||||
TPY
|
||||
|
||||
% Get temperature [K], pressure [Pa], and vapor fraction.
|
||||
TPQ
|
||||
|
||||
% Get/Set temperature [K] and vapor fraction of a two-phase state.
|
||||
TQ
|
||||
|
||||
% Get/Set temperature [K] and specific volume [m^3/kg or m^3/kmol].
|
||||
TV
|
||||
|
||||
@ -361,6 +386,10 @@ classdef ThermoPhase < handle
|
||||
% [m^3/kg or m^3/kmol], and mass fractions.
|
||||
UVY
|
||||
|
||||
% Get internal energy [J/kg or J/kmol], specific volume
|
||||
% [m^3/kg or m^3/kmol], and vapor fraction.
|
||||
UVQ
|
||||
|
||||
% Get/Set internal energy [J/kg or J/kmol] and pressure [Pa].
|
||||
UP
|
||||
|
||||
@ -965,10 +994,6 @@ classdef ThermoPhase < handle
|
||||
a = ctFunc('thermo_thermalExpansionCoeff', tp.tpID);
|
||||
end
|
||||
|
||||
function v = get.vaporFraction(tp)
|
||||
v = ctFunc('thermo_vaporFraction', tp.tpID);
|
||||
end
|
||||
|
||||
function temperature = get.T(tp)
|
||||
temperature = ctFunc('thermo_temperature', tp.tpID);
|
||||
end
|
||||
@ -977,6 +1002,10 @@ classdef ThermoPhase < handle
|
||||
pressure = ctFunc('thermo_pressure', tp.tpID);
|
||||
end
|
||||
|
||||
function v = get.Q(tp)
|
||||
v = ctFunc('thermo_vaporFraction', tp.tpID);
|
||||
end
|
||||
|
||||
function density = get.D(tp)
|
||||
density = ctFunc('thermo_density', tp.tpID);
|
||||
end
|
||||
@ -1055,6 +1084,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.D, tp.P, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.DPQ(tp)
|
||||
output = {tp.D, tp.P, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.HP(tp)
|
||||
output = {tp.H, tp.P};
|
||||
end
|
||||
@ -1067,6 +1100,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.H, tp.P, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.HPQ(tp)
|
||||
output = {tp.H, tp.P, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.PV(tp)
|
||||
output = {tp.P, tp.V};
|
||||
end
|
||||
@ -1079,6 +1116,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.P, tp.V, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.PQ(tp)
|
||||
output = {tp.P, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.SH(tp)
|
||||
output = {tp.S, tp.H};
|
||||
end
|
||||
@ -1103,6 +1144,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.S, tp.P, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.SPQ(tp)
|
||||
output = {tp.S, tp.P, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.ST(tp)
|
||||
output = {tp.S, tp.T};
|
||||
end
|
||||
@ -1127,6 +1172,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.S, tp.V, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.SVQ(tp)
|
||||
output = {tp.S, tp.V, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.TD(tp)
|
||||
output = {tp.T, tp.D};
|
||||
end
|
||||
@ -1139,6 +1188,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.T, tp.D, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.TDQ(tp)
|
||||
output = {tp.T, tp.D, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.TH(tp)
|
||||
output = {tp.T, tp.H};
|
||||
end
|
||||
@ -1163,6 +1216,14 @@ classdef ThermoPhase < handle
|
||||
output = {tp.T, tp.P, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.TPQ(tp)
|
||||
output = {tp.T, tp.P, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.TQ(tp)
|
||||
output = {tp.T, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.TV(tp)
|
||||
output = {tp.T, tp.V};
|
||||
end
|
||||
@ -1187,6 +1248,10 @@ classdef ThermoPhase < handle
|
||||
output = {tp.U, tp.V, tp.Y};
|
||||
end
|
||||
|
||||
function output = get.UVQ(tp)
|
||||
output = {tp.U, tp.V, tp.Q};
|
||||
end
|
||||
|
||||
function output = get.UP(tp)
|
||||
output = {tp.U, tp.P};
|
||||
end
|
||||
@ -1217,46 +1282,6 @@ classdef ThermoPhase < handle
|
||||
ctFunc('thermo_setElectricPotential', tp.tpID, phi);
|
||||
end
|
||||
|
||||
function tp = setState_Psat(tp, p, q)
|
||||
% Set the fluid state using the given pressure and quality ::
|
||||
%
|
||||
% >> tp.setState_Psat(p, q)
|
||||
%
|
||||
% The fluid state will be set to a saturated liquid-vapor state using the
|
||||
% input pressure and vapor fraction (quality) as the independent,
|
||||
% intensive variables.
|
||||
%
|
||||
% :param tp:
|
||||
% Instance of class :mat:class:`ThermoPhase` (or another
|
||||
% class derived from ThermoPhase)
|
||||
% :param p:
|
||||
% Pressure (Pa)
|
||||
% :param q:
|
||||
% Vapor fraction
|
||||
|
||||
ctFunc('thermo_setState_Psat', tp.tpID, p, q);
|
||||
end
|
||||
|
||||
function tp = setState_Tsat(tp, t, q)
|
||||
% Set the fluid state using the given temperature and quality ::
|
||||
%
|
||||
% >> tp.setState_Tsat(t, q)
|
||||
%
|
||||
% The fluid state will be set to a saturated liquid-vapor state using the
|
||||
% input temperature and vapor fraction (quality) as the independent,
|
||||
% intensive variables.
|
||||
%
|
||||
% :param tp:
|
||||
% Instance of class :mat:class:`ThermoPhase` (or another
|
||||
% class derived from ThermoPhase)
|
||||
% :param t:
|
||||
% Temperature (K)
|
||||
% :param q:
|
||||
% Vapor fraction
|
||||
|
||||
ctFunc('thermo_setState_Tsat', tp.tpID, t, 1 - q);
|
||||
end
|
||||
|
||||
function tp = set.basis(tp, b)
|
||||
|
||||
if strcmp(b, 'mole') || strcmp(b, 'molar') ...
|
||||
@ -1317,7 +1342,7 @@ classdef ThermoPhase < handle
|
||||
function set.DP(tp, input)
|
||||
d = input{1};
|
||||
p = input{2};
|
||||
ctFunc('thermo_set_RP', tp.tpID, [d, p]);
|
||||
ctFunc('thermo_set_DP', tp.tpID, [d, p]);
|
||||
end
|
||||
|
||||
function set.DPX(tp, input)
|
||||
@ -1362,6 +1387,12 @@ classdef ThermoPhase < handle
|
||||
tp.PV = input(1:2);
|
||||
end
|
||||
|
||||
function tp = set.PQ(tp, input)
|
||||
p = input{1};
|
||||
q = input{2};
|
||||
ctFunc('thermo_setState_Psat', tp.tpID, p, q);
|
||||
end
|
||||
|
||||
function set.SH(tp, input)
|
||||
s = input{1};
|
||||
h = input{2};
|
||||
@ -1429,8 +1460,7 @@ classdef ThermoPhase < handle
|
||||
function set.TD(tp, input)
|
||||
t = input{1};
|
||||
d = input{2};
|
||||
ctFunc('thermo_setTemperature', tp.tpID, t);
|
||||
ctFunc('thermo_setDensity', tp.tpID, d);
|
||||
ctFunc('thermo_set_TD', tp.tpID, [t, d]);
|
||||
end
|
||||
|
||||
function set.TDX(tp, input)
|
||||
@ -1475,6 +1505,12 @@ classdef ThermoPhase < handle
|
||||
tp.TP = input(1:2);
|
||||
end
|
||||
|
||||
function tp = set.TQ(tp, input)
|
||||
t = input{1};
|
||||
q = input{2};
|
||||
ctFunc('thermo_setState_Tsat', tp.tpID, t, q);
|
||||
end
|
||||
|
||||
function set.TV(tp, input)
|
||||
t = input{1};
|
||||
v = input{2};
|
||||
|
@ -18,7 +18,7 @@ w = Water;
|
||||
|
||||
% start with saturated liquid water at t1
|
||||
basis = 'mass';
|
||||
w.setState_Tsat(t1, 1.0);
|
||||
w.TQ = {t1, 0};
|
||||
h1 = w.H;
|
||||
p1 = w.P;
|
||||
|
||||
@ -27,7 +27,7 @@ pump_work = pump(w, p_max, eta_pump);
|
||||
h2 = w.H;
|
||||
|
||||
% heat to saturated vapor
|
||||
w.setState_Psat(p_max, 1.0);
|
||||
w.PQ = {p_max, 1.0};
|
||||
h3 = w.H;
|
||||
|
||||
heat_added = h3 - h2;
|
||||
@ -37,7 +37,7 @@ turbine_work = expand(w, p1, eta_turbine);
|
||||
|
||||
% compute the efficiency
|
||||
efficiency = (turbine_work - pump_work) / heat_added;
|
||||
disp(sprintf('efficiency = %d', efficiency));
|
||||
disp(sprintf('efficiency = %.2f%%', efficiency*100));
|
||||
|
||||
function work = pump(fluid, pfinal, eta)
|
||||
% PUMP - Adiabatically pump a fluid to pressure pfinal, using a pump
|
||||
|
Loading…
Reference in New Issue
Block a user