mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
*** empty log message ***
This commit is contained in:
@@ -16,7 +16,7 @@ if nargin == 5
|
||||
end
|
||||
|
||||
if strcmp(component,'default')
|
||||
nc = nComponents(d)
|
||||
nc = nComponents(d);
|
||||
for ii = 1:nc
|
||||
domain_methods(d.dom_id, 52, ii, rtol, atol, ityp);
|
||||
end
|
||||
|
||||
@@ -81,7 +81,7 @@ f = sqrt(a/(2.0*diff(ioxidizer)));
|
||||
|
||||
x0 = massFlux(left)*dz/(massFlux(left) + massFlux(right));
|
||||
|
||||
nz = nPoints(flow)
|
||||
nz = nPoints(flow);
|
||||
for j = 1:nz
|
||||
x = zz(j);
|
||||
zeta = f*(x - x0);
|
||||
|
||||
@@ -13,9 +13,9 @@ function x = Reactor(contents, typ)
|
||||
%
|
||||
if nargin == 0
|
||||
contents = 0;
|
||||
typ = 1;
|
||||
typ = 2;
|
||||
elseif nargin == 1
|
||||
typ = 1;
|
||||
typ = 2;
|
||||
elseif nargin > 2
|
||||
error('too many arguments');
|
||||
end
|
||||
|
||||
@@ -16,6 +16,6 @@ function r = Reservoir(contents)
|
||||
% See also: Reactor
|
||||
%
|
||||
if nargin == 0
|
||||
contents = 0
|
||||
contents = 0;
|
||||
end
|
||||
r = Reactor(contents, 2);
|
||||
r = Reactor(contents, 1);
|
||||
|
||||
@@ -31,11 +31,11 @@ if ~isFlow(flow)
|
||||
error('flow object of wrong type.');
|
||||
end
|
||||
|
||||
flametype = 0
|
||||
flametype = 0;
|
||||
if isSurface(right)
|
||||
flametype = 1
|
||||
flametype = 1;
|
||||
elseif isInlet(right)
|
||||
flametype = 3
|
||||
flametype = 3;
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
function [work, efficiency] = rankine(t1, p2, eta_pump, ...
|
||||
eta_turbine)
|
||||
%
|
||||
% RANKINE
|
||||
%
|
||||
% This example computes the efficiency of a simple vapor power
|
||||
% cycle.
|
||||
%
|
||||
help rankine
|
||||
|
||||
% create an object representing water
|
||||
w = Water;
|
||||
@@ -23,12 +30,12 @@ s3 = entropy_mass(w);
|
||||
heat_added = h3 - h2;
|
||||
|
||||
% expand adiabatically back to the initial pressure
|
||||
work = expand(w, p1, eta_turbine);
|
||||
work = expand(w, p1, eta_turbine)
|
||||
h4 = enthalpy_mass(w);
|
||||
x4 = vaporFraction(w);
|
||||
|
||||
% compute the efficiency
|
||||
efficiency = (work - pump_work)/heat_added;
|
||||
efficiency = (work - pump_work)/heat_added
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -48,10 +48,12 @@ setHeatTransferCoeff(w,1.0e1); % W/m2/K
|
||||
setExpansionRateCoeff(w, 1.0e2);
|
||||
|
||||
network = ReactorNet({r});
|
||||
% setTolerances(network, 1.0e-8, 1.0e-12);
|
||||
|
||||
t = 0;
|
||||
dt = 0.1;
|
||||
t0 = cputime;
|
||||
p0 = pressure(r);
|
||||
names = {'CH4','CO','CO2','H2O'};
|
||||
x = zeros([100 4]);
|
||||
for n = 1:100
|
||||
@@ -59,7 +61,7 @@ for n = 1:100
|
||||
advance(network, t);
|
||||
tim(n) = t;
|
||||
temp(n) = temperature(r);
|
||||
pres(n) = pressure(r);
|
||||
pres(n) = pressure(r) - p0;
|
||||
cov(n,:) = coverages(surf)';
|
||||
x(n,:) = moleFraction(gas,names);
|
||||
end
|
||||
@@ -72,8 +74,9 @@ xlabel('Time (s)');
|
||||
ylabel('Temperature (K)');
|
||||
subplot(2,2,2);
|
||||
plot(tim,pres);
|
||||
axis([0 5 -0.1 0.1]);
|
||||
xlabel('Time (s)');
|
||||
ylabel('Pressure (Pa)');
|
||||
ylabel('Delta Pressure (Pa)');
|
||||
subplot(2,2,3);
|
||||
semilogy(tim,cov);
|
||||
xlabel('Time (s)');
|
||||
|
||||
@@ -29,8 +29,8 @@ class ReactorBase:
|
||||
type = -1, verbose = 0):
|
||||
"""
|
||||
See class 'Reactor' for a description of the constructor parameters.
|
||||
The 'type' parameter specifies whether a Reactor (type = 1) or
|
||||
Reservoir (type = 2) will be created.
|
||||
The 'type' parameter specifies whether a Reactor (type = 2) or
|
||||
Reservoir (type = 1) will be created.
|
||||
"""
|
||||
self.__reactor_id = _cantera.reactor_new(type)
|
||||
self._type = type
|
||||
@@ -245,21 +245,21 @@ class ReactorBase:
|
||||
"""For internal use. Store a reference to 'inlet'
|
||||
so that it will not be deleted before this object."""
|
||||
self._inlets.append(inlet)
|
||||
if self._type == 1 and other._type == 2:
|
||||
if self._type == 2 and other._type == 1:
|
||||
self._reservoirs.append(other)
|
||||
|
||||
def _addOutlet(self, outlet, other):
|
||||
"""For internal use. Store a reference to 'outlet'
|
||||
so that it will not be deleted before this object."""
|
||||
self._outlets.append(outlet)
|
||||
if self._type == 1 and other._type == 2:
|
||||
if self._type == 2 and other._type == 1:
|
||||
self._reservoirs.append(other)
|
||||
|
||||
def _addWall(self, wall, other):
|
||||
"""For internal use. Store a reference to 'wall'
|
||||
so that it will not be deleted before this object."""
|
||||
self._walls.append(wall)
|
||||
if self._type == 1 and other._type == 2:
|
||||
if self._type == 2 and other._type == 1:
|
||||
self._reservoirs.append(other)
|
||||
|
||||
def syncContents(self):
|
||||
@@ -374,7 +374,7 @@ class Reactor(ReactorBase):
|
||||
_reactorcount += 1
|
||||
ReactorBase.__init__(self, contents = contents, name = name,
|
||||
volume = volume, energy = energy,
|
||||
verbose = verbose, type = 1)
|
||||
verbose = verbose, type = 2)
|
||||
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ class Reservoir(ReactorBase):
|
||||
name = 'Reservoir_'+`_reservoircount`
|
||||
_reservoircount += 1
|
||||
ReactorBase.__init__(self, contents = contents,
|
||||
name = name, verbose = verbose, type = 2)
|
||||
name = name, verbose = verbose, type = 1)
|
||||
|
||||
def advance(self, time):
|
||||
"""Deprecated. Do nothing."""
|
||||
|
||||
@@ -99,7 +99,7 @@ print 'Directory: '+os.getcwd()
|
||||
args = sys.argv
|
||||
if len(args) > 1 and args[1] == '-plot':
|
||||
try:
|
||||
from matplotlib.matlab import *
|
||||
from matplotlib.pylab import *
|
||||
clf
|
||||
subplot(2,2,1)
|
||||
plot(tm, temp[:,0],'g-',tm, temp[:,1],'b-')
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace CanteraZeroD {
|
||||
if (m_verbose) {
|
||||
writelog("Initializing reactor network.\n");
|
||||
}
|
||||
if (m_nr == 0)
|
||||
throw CanteraError("ReactorNet::initialize",
|
||||
"no reactors in network!");
|
||||
for (n = 0; n < m_nr; n++) {
|
||||
if (m_r[n]->type() >= ReactorType) {
|
||||
m_r[n]->initialize(t0);
|
||||
|
||||
@@ -91,6 +91,15 @@ namespace CanteraZeroD {
|
||||
if (r->type() >= ReactorType) {
|
||||
m_r.push_back(r);
|
||||
m_nr++;
|
||||
if (m_verbose) {
|
||||
writelog("Adding reactor "+r->name()+"\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_verbose) {
|
||||
writelog("Not adding reactor "+r->name()+
|
||||
", since type = "+int2str(r->type()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user