22const size_t c_offset_U = 0;
23const size_t c_offset_V = 1;
24const size_t c_offset_T = 2;
25const size_t c_offset_L = 3;
26const size_t c_offset_E = 4;
27const size_t c_offset_Y = 5;
51 StFlow(shared_ptr<ThermoPhase> th,
size_t nsp = 1,
size_t points = 1) :
52 StFlow(th.get(), nsp, points) {
58 virtual void setupGrid(
size_t n,
const doublereal* z);
66 Kinetics& kinetics() {
90 m_do_soret = withSoret;
92 bool withSoret()
const {
110 virtual void _finalize(
const doublereal* x);
126 m_do_energy[j] =
false;
131 return m_fixedtemp[j];
162 virtual void restore(
const AnyMap& state,
double* soln,
int loglevel);
175 m_type = cAxisymmetricStagnationFlow;
183 if (m_type == cFreeFlow) {
185 }
else if (m_type == cAxisymmetricStagnationFlow) {
186 return "Axisymmetric Stagnation";
188 throw CanteraError(
"StFlow::flowType",
"Unknown value for 'm_type'");
192 void solveEnergyEqn(
size_t j=
npos);
229 void fixTemperature(
size_t j=
npos);
231 bool doEnergy(
size_t j) {
232 return m_do_energy[j];
236 virtual void resize(
size_t components,
size_t points);
239 void setGas(
const doublereal* x,
size_t j);
245 doublereal density(
size_t j)
const {
249 virtual bool fixed_mdot() {
252 void setViscosityFlag(
bool dovisc) {
263 virtual void eval(
size_t j, doublereal* x, doublereal* r,
264 integer* mask, doublereal rdt);
273 int* diag,
double rdt);
282 return m_kExcessRight;
286 doublereal wdot(
size_t k,
size_t j)
const {
299 virtual void updateProperties(
size_t jg,
double* x,
size_t jmin,
size_t jmax);
303 virtual void evalResidual(
double* x,
double* rsd,
int* diag,
304 double rdt,
size_t jmin,
size_t jmax);
311 for (
size_t j = j0; j <= j1; j++) {
313 m_rho[j] = m_thermo->
density();
322 doublereal T(
const doublereal* x,
size_t j)
const {
323 return x[index(c_offset_T, j)];
325 doublereal& T(doublereal* x,
size_t j) {
326 return x[index(c_offset_T, j)];
328 doublereal T_prev(
size_t j)
const {
332 doublereal rho_u(
const doublereal* x,
size_t j)
const {
333 return m_rho[j]*x[index(c_offset_U, j)];
336 doublereal u(
const doublereal* x,
size_t j)
const {
337 return x[index(c_offset_U, j)];
340 doublereal V(
const doublereal* x,
size_t j)
const {
341 return x[index(c_offset_V, j)];
343 doublereal V_prev(
size_t j)
const {
347 doublereal lambda(
const doublereal* x,
size_t j)
const {
348 return x[index(c_offset_L, j)];
351 doublereal Y(
const doublereal* x,
size_t k,
size_t j)
const {
352 return x[index(c_offset_Y + k, j)];
355 doublereal& Y(doublereal* x,
size_t k,
size_t j) {
356 return x[index(c_offset_Y + k, j)];
359 doublereal Y_prev(
size_t k,
size_t j)
const {
363 doublereal X(
const doublereal* x,
size_t k,
size_t j)
const {
364 return m_wtm[j]*Y(x,k,j)/m_wt[k];
367 doublereal flux(
size_t k,
size_t j)
const {
375 doublereal dVdz(
const doublereal* x,
size_t j)
const {
376 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
377 return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
380 doublereal dYdz(
const doublereal* x,
size_t k,
size_t j)
const {
381 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
382 return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
385 doublereal dTdz(
const doublereal* x,
size_t j)
const {
386 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
387 return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
391 doublereal shear(
const doublereal* x,
size_t j)
const {
392 doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
393 doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
394 return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
397 doublereal divHeatFlux(
const doublereal* x,
size_t j)
const {
398 doublereal c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
399 doublereal c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
400 return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
403 size_t mindex(
size_t k,
size_t j,
size_t m) {
404 return m*m_nsp*m_nsp + m_nsp*j + k;
440 IdealGasPhase* m_thermo;
445 doublereal m_epsilon_left;
446 doublereal m_epsilon_right;
453 std::vector<bool> m_do_energy;
455 std::vector<bool> m_do_species;
456 bool m_do_multicomponent;
473 size_t m_kExcessRight;
Header file for class Cantera::Array2D.
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
A map of string keys to values whose type can vary at runtime.
Base class for exceptions thrown by Cantera classes.
Base class for one-dimensional domains.
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.
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state.
Public interface for kinetics managers.
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double density() const
Density (kg/m^3).
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
virtual void evalResidual(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the residual function.
virtual void evalRightBoundary(double *x, double *res, int *diag, double rdt)
Evaluate all residual components at the right boundary.
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.
size_t m_kExcessLeft
Index of species with a large mass fraction at each boundary, for which the mass fraction may be calc...
virtual AnyMap serialize(const double *soln) const
Save the state of this domain as an AnyMap.
double leftEmissivity() const
Return emissivitiy at left boundary.
virtual void showSolution(const doublereal *x)
Print the solution.
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.
size_t rightExcessSpecies() const
Index of the species on the right boundary with the largest mass fraction.
doublereal T_fixed(size_t j) const
The fixed temperature value at point j.
doublereal pressure() const
The current pressure [Pa].
StFlow(shared_ptr< ThermoPhase > th, size_t nsp=1, size_t points=1)
Delegating constructor.
StFlow(ThermoPhase *ph=0, size_t nsp=1, size_t points=1)
Create a new flow domain.
void enableSoret(bool withSoret)
Enable thermal diffusion, also known as Soret diffusion.
void setBoundaryEmissivities(double e_left, double e_right)
Set the emissivities for the boundary values.
void enableRadiation(bool doRadiation)
Turn radiation on / off.
std::vector< size_t > m_kRadiating
Indices within the ThermoPhase of the radiating species.
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt)
double rightEmissivity() const
Return emissivitiy at right boundary.
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
double m_tfixed
Temperature at the point used to fix the flame location.
bool radiationEnabled() const
Returns true if the radiation term in the energy equation is enabled.
virtual bool componentActive(size_t n) const
Returns true if the specified component is an active part of the solver state.
void setPressure(doublereal p)
Set the pressure.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
void getWdot(doublereal *x, size_t j)
Write the net production rates at point j into array m_wdot
void setThermo(IdealGasPhase &th)
Set the thermo manager.
void setFreeFlow()
Set flow configuration for freely-propagating flames, using an internal point with a fixed temperatur...
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate.
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
void setGas(const doublereal *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
virtual void updateDiffFluxes(const doublereal *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
void setFixedTempProfile(vector_fp &zfixed, vector_fp &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile,...
virtual void resize(size_t components, size_t points)
Change the grid size. Called after grid refinement.
size_t leftExcessSpecies() const
Index of the species on the left boundary with the largest mass fraction.
double radiativeHeatLoss(size_t j) const
Return radiative heat loss at grid point j.
double m_zfixed
Location of the point where temperature is fixed.
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.
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.
vector_fp m_qdotRadiation
radiative heat loss vector
void setKinetics(Kinetics &kin)
Set the kinetics manager. The kinetics manager must.
virtual void resetBadValues(double *xg)
void setTemperature(size_t j, doublereal t)
virtual void _getInitialSoln(double *x)
Write the initial solution estimate into array x.
virtual void updateProperties(size_t jg, double *x, size_t jmin, size_t jmax)
Update the properties (thermo, transport, and diffusion flux).
virtual std::string flowType() const
Return the type of flow domain being represented, either "Free Flame" or "Axisymmetric Stagnation".
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
void setTransport(Transport &trans)
set the transport manager
void setAxisymmetricFlow()
Set flow configuration for axisymmetric counterflow or burner-stabilized flames, using specified inle...
virtual size_t componentIndex(const std::string &name) const
index of component with name name.
bool m_do_radiation
flag for the radiative heat loss
Base class for a phase with thermodynamic properties.
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
Base class for transport property managers.
Class XML_Node is a tree-based representation of the contents of an XML file.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.