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_Y = 4;
52 virtual void setupGrid(
size_t n,
const doublereal* z);
88 void enableSoret(
bool withSoret);
89 bool withSoret()
const {
107 virtual void _finalize(
const doublereal* x);
123 m_do_energy[j] =
false;
128 return m_fixedtemp[j];
135 virtual size_t componentIndex(
const std::string& name)
const;
153 virtual std::string flowType() {
157 void solveEnergyEqn(
size_t j=
npos);
183 void fixTemperature(
size_t j=
npos);
185 bool doEnergy(
size_t j) {
186 return m_do_energy[j];
190 void resize(
size_t components,
size_t points);
192 virtual void setFixedPoint(
int j0, doublereal t0) {}
195 void setGas(
const doublereal* x,
size_t j);
201 doublereal density(
size_t j)
const {
205 virtual bool fixed_mdot() {
208 void setViscosityFlag(
bool dovisc) {
219 virtual void eval(
size_t j, doublereal* x, doublereal* r,
220 integer* mask, doublereal rdt);
224 integer* diag, doublereal rdt) = 0;
228 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
229 integer* diag, doublereal rdt) = 0;
238 return m_kExcessRight;
242 doublereal wdot(
size_t k,
size_t j)
const {
257 for (
size_t j = j0; j <= j1; j++) {
259 m_rho[j] = m_thermo->
density();
268 doublereal T(
const doublereal* x,
size_t j)
const {
269 return x[index(c_offset_T, j)];
271 doublereal& T(doublereal* x,
size_t j) {
272 return x[index(c_offset_T, j)];
274 doublereal T_prev(
size_t j)
const {
278 doublereal rho_u(
const doublereal* x,
size_t j)
const {
279 return m_rho[j]*x[index(c_offset_U, j)];
282 doublereal u(
const doublereal* x,
size_t j)
const {
283 return x[index(c_offset_U, j)];
286 doublereal V(
const doublereal* x,
size_t j)
const {
287 return x[index(c_offset_V, j)];
289 doublereal V_prev(
size_t j)
const {
293 doublereal lambda(
const doublereal* x,
size_t j)
const {
294 return x[index(c_offset_L, j)];
297 doublereal Y(
const doublereal* x,
size_t k,
size_t j)
const {
298 return x[index(c_offset_Y + k, j)];
301 doublereal& Y(doublereal* x,
size_t k,
size_t j) {
302 return x[index(c_offset_Y + k, j)];
305 doublereal Y_prev(
size_t k,
size_t j)
const {
309 doublereal X(
const doublereal* x,
size_t k,
size_t j)
const {
310 return m_wtm[j]*Y(x,k,j)/m_wt[k];
313 doublereal flux(
size_t k,
size_t j)
const {
321 doublereal dVdz(
const doublereal* x,
size_t j)
const {
322 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
323 return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
326 doublereal dYdz(
const doublereal* x,
size_t k,
size_t j)
const {
327 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
328 return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
331 doublereal dTdz(
const doublereal* x,
size_t j)
const {
332 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
333 return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
337 doublereal shear(
const doublereal* x,
size_t j)
const {
338 doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
339 doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
340 return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
343 doublereal divHeatFlux(
const doublereal* x,
size_t j)
const {
344 doublereal c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
345 doublereal c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
346 return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
349 size_t mindex(
size_t k,
size_t j,
size_t m) {
350 return m*m_nsp*m_nsp + m_nsp*j + k;
386 IdealGasPhase* m_thermo;
391 doublereal m_epsilon_left;
392 doublereal m_epsilon_right;
399 std::vector<bool> m_do_energy;
401 std::vector<bool> m_do_species;
402 bool m_do_multicomponent;
419 size_t m_kExcessRight;
444 integer* diag, doublereal rdt);
445 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
446 integer* diag, doublereal rdt);
448 virtual std::string flowType() {
449 return "Axisymmetric Stagnation";
462 integer* diag, doublereal rdt);
463 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
464 integer* diag, doublereal rdt);
466 virtual std::string flowType() {
469 virtual bool fixed_mdot() {
472 virtual void _finalize(
const doublereal* x);
473 virtual void restore(
const XML_Node& dom, doublereal* soln,
int loglevel);
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
void setKinetics(Kinetics &kin)
Set the kinetics manager. The kinetics manager must.
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 evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)=0
Evaluate all residual components at the right boundary.
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].
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)
Evaluate all residual components at the right boundary.
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 restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
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 evalContinuity(size_t j, doublereal *x, doublereal *r, integer *diag, doublereal rdt)
Evaluate the residual corresponding to the continuity equation at all interior grid points...
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
Base class for transport property managers.
void setPressure(doublereal p)
Set the pressure.
virtual doublereal density() const
Density (kg/m^3).
virtual void evalContinuity(size_t j, doublereal *x, doublereal *r, integer *diag, doublereal rdt)=0
Evaluate the residual corresponding to the continuity equation at all interior grid points...
A class for freely-propagating premixed flames.
doublereal m_tfixed
Temperature at the point used to fix the flame location.
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.
vector_fp m_qdotRadiation
radiative heat loss vector
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)
Evaluate all residual components at the right boundary.
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 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.
doublereal m_zfixed
Location of the point where temperature is fixed.
void getWdot(doublereal *x, size_t j)
Write the net production rates at point j into array m_wdot
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
virtual void evalContinuity(size_t j, doublereal *x, doublereal *r, integer *diag, doublereal rdt)
Evaluate the residual corresponding to the continuity equation at all interior grid points...
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.
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...
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)
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 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.
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.