*** empty log message ***
This commit is contained in:
parent
cc30cac07f
commit
4cdb8aa015
14 changed files with 79 additions and 60 deletions
|
|
@ -35,18 +35,24 @@ def IdealGasMix(src="", id = ""):
|
|||
## ext = ''
|
||||
return Solution(src=src,id=id)
|
||||
|
||||
def GRI30():
|
||||
def GRI30(transport = ""):
|
||||
"""Return a Solution instance implementing reaction mechanism
|
||||
GRI-Mech 3.0."""
|
||||
return Solution(src="gri30.xml", id="gri30_hw")
|
||||
if transport == "":
|
||||
return Solution(src="gri30.cti", id="gri30")
|
||||
elif transport == "Mix":
|
||||
return Solution(src="gri30.cti", id="gri30_mix")
|
||||
elif transport == "Multi":
|
||||
return Solution(src="gri30.cti", id="gri30_multi")
|
||||
|
||||
|
||||
def Air():
|
||||
"""Return a Solution instance implementing the O/N/Ar portion of
|
||||
reaction mechanism GRI-Mech 3.0. The initial composition is set to
|
||||
that of air"""
|
||||
return Solution(src="air.xml", id="air")
|
||||
return Solution(src="air.cti", id="air")
|
||||
|
||||
def Argon():
|
||||
"""Return a Solution instance representing pure argon."""
|
||||
return Solution(src="argon.xml#argon")
|
||||
return Solution(src="argon.cti", id="argon")
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import os
|
|||
from Cantera import units
|
||||
from Cantera.flame import *
|
||||
|
||||
gas = IdealGasMix(src = 'h2o2.xml', transport='Mix')
|
||||
gas = IdealGasMix(src = 'h2o2.cti')
|
||||
|
||||
# create a burner-stabilized flame in the domain z = 0 to z = 20 cm,
|
||||
# define the fuel to be pure hydrogen, and the oxidizer to be
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from Cantera import units
|
|||
#from Cantera.gases import H_O_AR
|
||||
|
||||
|
||||
gas = GRI30(transport = 'Mix')
|
||||
gas = GRI30(transport='Mix')
|
||||
|
||||
flame = BurnerFlame(
|
||||
domain = (0, 0.01),
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ for n in range(100):
|
|||
env.advance(time)
|
||||
print '%10.3e %10.3f %10.3f %14.6e' % (r.time(), r.temperature(),
|
||||
r.pressure(), r.intEnergy_mass())
|
||||
print env.pressure()
|
||||
|
||||
#print gri3
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from Cantera.flame import *
|
|||
# Import the hydrogen/oxygen reaction mechanism
|
||||
# The input file is in directory 'data/inputs'.
|
||||
|
||||
gas = IdealGasMix(src = 'h2o2.xml', transport='Mix')
|
||||
gas = IdealGasMix('h2o2.cti')
|
||||
|
||||
|
||||
# Create a stagnation-point flame in the domain z = 0 (the inlet) to z
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from Cantera.flame import *
|
|||
from Cantera import units
|
||||
|
||||
# start with only a hydrogen/oxygen mechanism
|
||||
gas = IdealGasMix('h2o2.xml', transport='Mix')
|
||||
gas = IdealGasMix('h2o2.cti')
|
||||
|
||||
flame = StagnationFlame(
|
||||
domain = (0, 0.02),
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ namespace Cantera {
|
|||
ff *= 0.5;
|
||||
}
|
||||
m_atol = sqrt(ff);
|
||||
m_rtol = 1.0e-5;
|
||||
}
|
||||
|
||||
void MultiJac::updateTransient(doublereal rdt, integer* mask) {
|
||||
|
|
@ -76,7 +77,7 @@ namespace Cantera {
|
|||
|
||||
// perturb x(n)
|
||||
xsave = x0[ipt];
|
||||
dx = m_atol;
|
||||
dx = m_atol + fabs(xsave)*m_rtol;
|
||||
x0[ipt] = xsave + dx;
|
||||
dx = x0[ipt] - xsave;
|
||||
rdx = 1.0/dx;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Cantera {
|
|||
|
||||
OneDim* m_resid;
|
||||
vector_fp m_r1;
|
||||
doublereal m_atol;
|
||||
doublereal m_rtol, m_atol;
|
||||
doublereal m_elapsed;
|
||||
vector_fp m_ssdiag;
|
||||
vector_int m_mask;
|
||||
|
|
|
|||
|
|
@ -1047,7 +1047,7 @@ namespace Cantera {
|
|||
throw CanteraError("StFlow::restore","No solution with id = "+id);
|
||||
}
|
||||
|
||||
const XML_Node& flow = f->child("flowfield");
|
||||
const XML_Node& flow = f->child("domain");
|
||||
f = &flow;
|
||||
|
||||
//if (f->name() != "flowfield") {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,8 @@ namespace Cantera {
|
|||
for (n = 0; n < m_nsp; n++) {
|
||||
ydot[2+n] -= mdot_out * mf[n];
|
||||
}
|
||||
ydot[0] -= mdot_out * enthalpy;
|
||||
if (m_energy)
|
||||
ydot[0] -= mdot_out * enthalpy;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -289,7 +290,8 @@ namespace Cantera {
|
|||
for (n = 0; n < m_nsp; n++) {
|
||||
ydot[2+n] += m_inlet[i]->massFlowRate(n);
|
||||
}
|
||||
ydot[0] += mdot_in * m_inlet[i]->enthalpy_mass();
|
||||
if (m_energy)
|
||||
ydot[0] += mdot_in * m_inlet[i]->enthalpy_mass();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,20 +35,12 @@ namespace Cantera {
|
|||
m_nwalls(0)
|
||||
{}
|
||||
|
||||
// void ReactorBase::setMixture(phase_t& mix, thermo_t& thermo){
|
||||
// m_mix = &mix;
|
||||
// m_thermo = &thermo;
|
||||
// m_nsp = m_mix->nSpecies();
|
||||
// void ReactorBase::resetState() {
|
||||
// m_mix->saveState(m_state);
|
||||
// m_enthalpy = m_thermo->enthalpy_mass();
|
||||
// m_intEnergy = m_thermo->intEnergy_mass();
|
||||
// m_pressure = m_thermo->pressure();
|
||||
// }
|
||||
|
||||
// void ReactorBase::setPhase(phase_t& ph){
|
||||
// m_mix = &ph;
|
||||
// m_nsp = m_mix->nSpecies();
|
||||
// m_mix->saveState(m_state);
|
||||
// m_init = false;
|
||||
// }
|
||||
|
||||
void ReactorBase::setThermoMgr(thermo_t& thermo){
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ namespace Cantera {
|
|||
* a pointer to this substance is stored, and as the integration
|
||||
* proceeds, the state of the substance is modified.
|
||||
*/
|
||||
//void setMixture(phase_t& mix, thermo_t& thermo);
|
||||
//void setPhase(phase_t& phase);
|
||||
void setThermoMgr(thermo_t& thermo);
|
||||
|
||||
void addInlet(FlowDevice& inlet);
|
||||
|
|
@ -106,28 +104,26 @@ namespace Cantera {
|
|||
|
||||
//@}
|
||||
|
||||
/// return a reference to the mixture.
|
||||
thermo_t& contents() {
|
||||
return *m_mix;
|
||||
}
|
||||
void resetState();
|
||||
|
||||
const thermo_t& contents() const {
|
||||
return *m_mix;
|
||||
}
|
||||
/// return a reference to the contents.
|
||||
thermo_t& contents() { return *m_mix; }
|
||||
|
||||
const thermo_t& contents() const { return *m_mix; }
|
||||
|
||||
doublereal residenceTime();
|
||||
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
|
||||
/** @name Solution components. */
|
||||
/**
|
||||
* @name Solution components.
|
||||
* The values returned are those after the last call to advance
|
||||
* or step.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/// the current time (s).
|
||||
doublereal time() const { return m_time; }
|
||||
|
||||
// property values after the last call to advance.
|
||||
doublereal volume() const { return m_vol; }
|
||||
doublereal density() const { return m_state[1]; }
|
||||
doublereal temperature() const { return m_state[0]; }
|
||||
|
|
@ -139,23 +135,16 @@ namespace Cantera {
|
|||
doublereal massFraction(int k) const { return m_state[k+2]; }
|
||||
//@}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
|
||||
int error(string msg) const {
|
||||
cout << "Error: " << msg << endl;
|
||||
writelog("Error: "+msg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
int m_nsp;
|
||||
thermo_t* m_mix;
|
||||
thermo_t* m_thermo;
|
||||
// kinetics_t* m_kin;
|
||||
doublereal m_time;
|
||||
doublereal m_vol, m_vol0;
|
||||
bool m_init;
|
||||
|
|
@ -173,8 +162,9 @@ namespace Cantera {
|
|||
|
||||
private:
|
||||
|
||||
void tilt() const { throw error("ReactorBase method called!"); }
|
||||
|
||||
void tilt(string method="") const {
|
||||
throw CanteraError("ReactorBase::"+method,
|
||||
"ReactorBase method called!"); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,22 +28,40 @@ namespace Cantera {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Wall::setKinetics(Kinetics* left,
|
||||
Kinetics* right) {
|
||||
m_chem[0] = left;
|
||||
m_chem[1] = right;
|
||||
if (left) {
|
||||
m_surf[0] = (SurfPhase*)&left->thermo(left->surfacePhaseIndex());
|
||||
/** Specify the kinetics managers for the surface mechanisms on
|
||||
* the left side and right side of the wall. Enter 0 if there is
|
||||
* no reaction mechanism.
|
||||
*/
|
||||
void Wall::setKinetics(Kinetics* left, Kinetics* right) {
|
||||
m_chem[0] = left;
|
||||
m_chem[1] = right;
|
||||
int ileft = 0, iright = 0;
|
||||
if (left) {
|
||||
ileft = left->surfacePhaseIndex();
|
||||
if (ileft >= 0) {
|
||||
m_surf[0] = (SurfPhase*)&left->thermo(ileft);
|
||||
m_nsp[0] = m_surf[0]->nSpecies();
|
||||
}
|
||||
if (right) {
|
||||
m_surf[1] = (SurfPhase*)&right->thermo(right->surfacePhaseIndex());
|
||||
}
|
||||
if (right) {
|
||||
iright = right->surfacePhaseIndex();
|
||||
if (iright >= 0) {
|
||||
m_surf[1] = (SurfPhase*)&right->thermo(iright);
|
||||
m_nsp[1] = m_surf[1]->nSpecies();
|
||||
}
|
||||
|
||||
}
|
||||
if (ileft < 0 || iright < 0) {
|
||||
throw CanteraError("Wall::setKinetics",
|
||||
"specified surface kinetics manager does not "
|
||||
"represent a surface reaction mechanism.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The volume rate of change is given by
|
||||
* \f[ \dot V = K A (P_{left} - P_{right}) + F(t) \f]
|
||||
* where \f$ F(t) \f$ is a specified function of time.
|
||||
*/
|
||||
doublereal Wall::vdot(doublereal t) {
|
||||
double rate1 = m_k * m_area *
|
||||
(m_left->pressure() - m_right->pressure());
|
||||
|
|
@ -51,6 +69,12 @@ namespace Cantera {
|
|||
return rate1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The heat flux is given by
|
||||
* \f[ Q = h A (T_{left} - T_{right}) + G(t) \f]
|
||||
* where h is the heat transfer coefficient, and
|
||||
* \f$ G(t) \f$ is a specified function of time.
|
||||
*/
|
||||
doublereal Wall::Q(doublereal t) {
|
||||
double q1 = (m_area * m_rrth) *
|
||||
(m_left->temperature() - m_right->temperature());
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ namespace Cantera {
|
|||
virtual ~Wall() {}
|
||||
|
||||
/**
|
||||
* Rate of volume change (kg/s). Positive value increases volume
|
||||
* Of reactor on left, and decreases volume on right.
|
||||
* Rate of volume change (kg/s). Positive value increases
|
||||
* volume of reactor on left, and decreases volume on right.
|
||||
*/
|
||||
virtual doublereal vdot(doublereal t);
|
||||
virtual doublereal Q(doublereal t);
|
||||
|
|
@ -57,8 +57,12 @@ namespace Cantera {
|
|||
/// Set the overall heat transfer coefficient [W/m^2/K].
|
||||
void setHeatTransferCoeff(doublereal U) { m_rrth = U; }
|
||||
|
||||
/** Set the rate of volume change to a specified function.*/
|
||||
void setExpansionRate(Func1* f=0) {if (f) m_vf = f;}
|
||||
|
||||
/**
|
||||
* Set the expansion rate coefficient.
|
||||
*/
|
||||
void setExpansionRateCoeff(doublereal k) {m_k = k;}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue