22 const size_t c_offset_U = 0;
23 const size_t c_offset_V = 1;
24 const size_t c_offset_T = 2;
25 const size_t c_offset_L = 3;
26 const size_t c_offset_E = 4;
27 const size_t c_offset_Y = 5;
53 virtual void setupGrid(
size_t n,
const doublereal* z);
85 m_do_soret = withSoret;
87 bool withSoret()
const {
105 virtual void _finalize(
const doublereal* x);
121 m_do_energy[j] =
false;
126 return m_fixedtemp[j];
133 virtual size_t componentIndex(
const std::string& name)
const;
161 m_type = cAxisymmetricStagnationFlow;
169 if (m_type == cFreeFlow) {
171 }
else if (m_type == cAxisymmetricStagnationFlow) {
172 return "Axisymmetric Stagnation";
174 throw CanteraError(
"StFlow::flowType",
"Unknown value for 'm_type'");
178 void solveEnergyEqn(
size_t j=
npos);
204 void fixTemperature(
size_t j=
npos);
206 bool doEnergy(
size_t j) {
207 return m_do_energy[j];
211 virtual void resize(
size_t components,
size_t points);
213 virtual void setFixedPoint(
int j0, doublereal t0) {}
216 void setGas(
const doublereal* x,
size_t j);
222 doublereal density(
size_t j)
const {
226 virtual bool fixed_mdot() {
229 void setViscosityFlag(
bool dovisc) {
240 virtual void eval(
size_t j, doublereal* x, doublereal* r,
241 integer* mask, doublereal rdt);
250 int* diag,
double rdt);
259 return m_kExcessRight;
263 doublereal wdot(
size_t k,
size_t j)
const {
276 virtual void updateProperties(
size_t jg,
double* x,
size_t jmin,
size_t jmax);
280 virtual void evalResidual(
double* x,
double* rsd,
int* diag,
281 double rdt,
size_t jmin,
size_t jmax);
288 for (
size_t j = j0; j <= j1; j++) {
290 m_rho[j] = m_thermo->
density();
299 doublereal T(
const doublereal* x,
size_t j)
const {
300 return x[index(c_offset_T, j)];
302 doublereal& T(doublereal* x,
size_t j) {
303 return x[index(c_offset_T, j)];
305 doublereal T_prev(
size_t j)
const {
309 doublereal rho_u(
const doublereal* x,
size_t j)
const {
310 return m_rho[j]*x[index(c_offset_U, j)];
313 doublereal u(
const doublereal* x,
size_t j)
const {
314 return x[index(c_offset_U, j)];
317 doublereal V(
const doublereal* x,
size_t j)
const {
318 return x[index(c_offset_V, j)];
320 doublereal V_prev(
size_t j)
const {
324 doublereal lambda(
const doublereal* x,
size_t j)
const {
325 return x[index(c_offset_L, j)];
328 doublereal Y(
const doublereal* x,
size_t k,
size_t j)
const {
329 return x[index(c_offset_Y + k, j)];
332 doublereal& Y(doublereal* x,
size_t k,
size_t j) {
333 return x[index(c_offset_Y + k, j)];
336 doublereal Y_prev(
size_t k,
size_t j)
const {
340 doublereal X(
const doublereal* x,
size_t k,
size_t j)
const {
341 return m_wtm[j]*Y(x,k,j)/m_wt[k];
344 doublereal flux(
size_t k,
size_t j)
const {
352 doublereal dVdz(
const doublereal* x,
size_t j)
const {
353 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
354 return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
357 doublereal dYdz(
const doublereal* x,
size_t k,
size_t j)
const {
358 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
359 return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
362 doublereal dTdz(
const doublereal* x,
size_t j)
const {
363 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
364 return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
368 doublereal shear(
const doublereal* x,
size_t j)
const {
369 doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
370 doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
371 return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
374 doublereal divHeatFlux(
const doublereal* x,
size_t j)
const {
375 doublereal c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
376 doublereal c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
377 return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
380 size_t mindex(
size_t k,
size_t j,
size_t m) {
381 return m*m_nsp*m_nsp + m_nsp*j + k;
417 IdealGasPhase* m_thermo;
422 doublereal m_epsilon_left;
423 doublereal m_epsilon_right;
430 std::vector<bool> m_do_energy;
432 std::vector<bool> m_do_species;
433 bool m_do_multicomponent;
450 size_t m_kExcessRight;
483 m_type = cAxisymmetricStagnationFlow;
485 "Use StFlow with setAxisymmetricFlow() instead. To be removed after Cantera 2.4.");
505 "Use StFlow with setFreeFlow() instead. To be removed after Cantera 2.4.");
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
void setKinetics(Kinetics &kin)
Set the kinetics manager. The kinetics manager must.
virtual void evalContinuity(size_t j, double *x, double *r, int *diag, double rdt)
Evaluate the residual corresponding to the continuity equation at all interior grid points...
void updateThermo(const doublereal *x, size_t j0, size_t j1)
Update the thermodynamic properties from point j0 to point j1 (inclusive), based on solution x...
bool m_do_radiation
flag for the radiative heat loss
size_t leftExcessSpecies() const
Index of the species on the left boundary with the largest mass fraction.
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
doublereal pressure() const
The current pressure [Pa].
void setAxisymmetricFlow()
Set flow configuration for axisymmetric counterflow or burner-stabilized flames, using specified inle...
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state...
const size_t npos
index returned by functions to indicate "no position"
A class for axisymmetric stagnation flows.
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
virtual void evalRightBoundary(double *x, double *res, int *diag, double rdt)
Evaluate all residual components at the right boundary.
Class XML_Node is a tree-based representation of the contents of an XML file.
Base class for transport property managers.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
void setPressure(doublereal p)
Set the pressure.
virtual doublereal density() const
Density (kg/m^3).
virtual void updateProperties(size_t jg, double *x, size_t jmin, size_t jmax)
Update the properties (thermo, transport, and diffusion flux).
A class for freely-propagating premixed flames.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
Base class for a phase with thermodynamic properties.
Header file for class Cantera::Array2D.
Base class for one-dimensional domains.
virtual void evalResidual(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the residual function.
void setFreeFlow()
Set flow configuration for freely-propagating flames, using an internal point with a fixed temperatur...
vector_fp m_qdotRadiation
radiative heat loss vector
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
void setThermo(IdealGasPhase &th)
Set the thermo manager.
bool radiationEnabled() const
Returns true if the radiation term in the energy equation is enabled.
void setFixedTempProfile(vector_fp &zfixed, vector_fp &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile...
void setTransport(Transport &trans)
set the transport manager
Public interface for kinetics managers.
virtual void resetBadValues(double *xg)
Base class for exceptions thrown by Cantera classes.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
void setTemperature(size_t j, doublereal t)
std::vector< size_t > m_kRadiating
Indices within the ThermoPhase of the radiating species.
void getWdot(doublereal *x, size_t j)
Write the net production rates at point j into array m_wdot
int domainType()
Domain type flag.
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
virtual std::string flowType()
Return the type of flow domain being represented, either "Free Flame" or "Axisymmetric Stagnation"...
void setGas(const doublereal *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
virtual void showSolution(const doublereal *x)
Print the solution.
virtual void updateTransport(doublereal *x, size_t j0, size_t j1)
Update the transport properties at grid points in the range from j0 to j1, based on solution x...
double m_tfixed
Temperature at the point used to fix the flame location.
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
void enableRadiation(bool doRadiation)
Turn radiation on / off.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void setGasAtMidpoint(const doublereal *x, size_t j)
Set the gas state to be consistent with the solution at the midpoint between j and j + 1...
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual void updateDiffFluxes(const doublereal *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
doublereal T_fixed(size_t j) const
The fixed temperature value at point j.
size_t rightExcessSpecies() const
Index of the species on the right boundary with the largest mass fraction.
size_t m_kExcessLeft
Index of species with a large mass fraction at each boundary, for which the mass fraction may be calc...
virtual void _getInitialSoln(double *x)
Write the initial solution estimate into array x.
void enableSoret(bool withSoret)
Enable thermal diffusion, also known as Soret diffusion.
virtual void resize(size_t components, size_t points)
Change the grid size. Called after grid refinement.
StFlow(IdealGasPhase *ph=0, size_t nsp=1, size_t points=1)
Create a new flow domain.
Namespace for the Cantera kernel.
double m_zfixed
Location of the point where temperature is fixed.
void setBoundaryEmissivities(doublereal e_left, doublereal e_right)
Set the emissivities for the boundary values.
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt)
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.