25 const size_t c_offset_U = 0;
26 const size_t c_offset_V = 1;
27 const size_t c_offset_T = 2;
28 const size_t c_offset_L = 3;
29 const size_t c_offset_Y = 4;
32 const int c_Mixav_Transport = 0;
33 const int c_Multi_Transport = 1;
34 const int c_Soret = 2;
58 virtual void setupGrid(
size_t n,
const doublereal* z);
85 void enableSoret(
bool withSoret);
86 bool withSoret()
const {
103 virtual void setState(
size_t point,
const doublereal* state,
107 for (
size_t k = 0; k < m_nsp; k++) {
114 for (
size_t j = 0; j < m_points; j++) {
120 virtual void _finalize(
const doublereal* x);
136 m_do_energy[j] =
false;
146 m_do_species[k] =
true;
151 return m_fixedtemp[j];
155 doublereal
Y_fixed(
size_t k,
size_t j)
const {
156 return m_fixedy(k,j);
163 virtual size_t componentIndex(
const std::string& name)
const;
181 virtual std::string flowType() {
185 void solveEnergyEqn(
size_t j=
npos) {
187 for (
size_t i = 0; i < m_points; i++) {
188 m_do_energy[i] =
true;
191 m_do_energy[j] =
true;
193 m_refiner->setActive(0,
true);
194 m_refiner->setActive(1,
true);
195 m_refiner->setActive(2,
true);
199 void fixTemperature(
size_t j=
npos) {
201 for (
size_t i = 0; i < m_points; i++) {
202 m_do_energy[i] =
false;
205 m_do_energy[j] =
false;
207 m_refiner->setActive(0,
false);
208 m_refiner->setActive(1,
false);
209 m_refiner->setActive(2,
false);
213 bool doSpecies(
size_t k) {
214 return m_do_species[k];
216 bool doEnergy(
size_t j) {
217 return m_do_energy[j];
220 void solveSpecies(
size_t k=
npos) {
222 for (
size_t i = 0; i < m_nsp; i++) {
223 m_do_species[i] =
true;
226 m_do_species[k] =
true;
231 void fixSpecies(
size_t k=
npos) {
233 for (
size_t i = 0; i < m_nsp; i++) {
234 m_do_species[i] =
false;
237 m_do_species[k] =
false;
242 void integrateChem(doublereal* x,doublereal dt);
245 void resize(
size_t components,
size_t points);
247 virtual void setFixedPoint(
int j0, doublereal t0) {}
249 void setJac(MultiJac* jac);
252 void setGas(
const doublereal* x,
size_t j);
258 doublereal density(
size_t j)
const {
262 virtual bool fixed_mdot() {
265 void setViscosityFlag(
bool dovisc) {
276 virtual void eval(
size_t j, doublereal* x, doublereal* r,
277 integer* mask, doublereal rdt);
281 integer* diag, doublereal rdt) = 0;
285 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
286 integer* diag, doublereal rdt) = 0;
289 doublereal component(
const doublereal* x,
size_t i,
size_t j)
const {
290 return x[index(i,j)];
293 doublereal conc(
const doublereal* x,
size_t k,
size_t j)
const {
294 return Y(x,k,j)*density(j)/m_wt[k];
297 doublereal cbar(
const doublereal* x,
size_t k,
size_t j)
const {
301 doublereal wdot(
size_t k,
size_t j)
const {
316 for (
size_t j = j0; j <= j1; j++) {
318 m_rho[j] = m_thermo->
density();
328 doublereal cdif2(
const doublereal* x,
size_t n,
size_t j,
329 const doublereal* f)
const {
330 doublereal c1 = (f[j] + f[j-1])*(x[index(n,j)] - x[index(n,j-1)]);
331 doublereal c2 = (f[j+1] + f[j])*(x[index(n,j+1)] - x[index(n,j)]);
332 return (c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
339 doublereal T(
const doublereal* x,
size_t j)
const {
340 return x[index(c_offset_T, j)];
342 doublereal& T(doublereal* x,
size_t j) {
343 return x[index(c_offset_T, j)];
345 doublereal T_prev(
size_t j)
const {
349 doublereal rho_u(
const doublereal* x,
size_t j)
const {
350 return m_rho[j]*x[index(c_offset_U, j)];
353 doublereal u(
const doublereal* x,
size_t j)
const {
354 return x[index(c_offset_U, j)];
357 doublereal V(
const doublereal* x,
size_t j)
const {
358 return x[index(c_offset_V, j)];
360 doublereal V_prev(
size_t j)
const {
364 doublereal lambda(
const doublereal* x,
size_t j)
const {
365 return x[index(c_offset_L, j)];
368 doublereal Y(
const doublereal* x,
size_t k,
size_t j)
const {
369 return x[index(c_offset_Y + k, j)];
372 doublereal& Y(doublereal* x,
size_t k,
size_t j) {
373 return x[index(c_offset_Y + k, j)];
376 doublereal Y_prev(
size_t k,
size_t j)
const {
380 doublereal X(
const doublereal* x,
size_t k,
size_t j)
const {
381 return m_wtm[j]*Y(x,k,j)/m_wt[k];
384 doublereal flux(
size_t k,
size_t j)
const {
392 doublereal dVdz(
const doublereal* x,
size_t j)
const {
393 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
394 return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
397 doublereal dYdz(
const doublereal* x,
size_t k,
size_t j)
const {
398 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
399 return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
402 doublereal dTdz(
const doublereal* x,
size_t j)
const {
403 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
404 return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
408 doublereal shear(
const doublereal* x,
size_t j)
const {
409 doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
410 doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
411 return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
414 doublereal divHeatFlux(
const doublereal* x,
size_t j)
const {
415 doublereal c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
416 doublereal c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
417 return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
420 size_t mindex(
size_t k,
size_t j,
size_t m) {
421 return m*m_nsp*m_nsp + m_nsp*j + k;
432 doublereal m_inlet_u;
433 doublereal m_inlet_V;
434 doublereal m_inlet_T;
435 doublereal m_rho_inlet;
439 doublereal m_surface_T;
470 IdealGasPhase* m_thermo;
479 std::vector<bool> m_do_energy;
481 std::vector<bool> m_do_species;
482 int m_transport_option;
517 integer* diag, doublereal rdt);
518 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
519 integer* diag, doublereal rdt);
521 virtual std::string flowType() {
522 return "Axisymmetric Stagnation";
540 integer* diag, doublereal rdt);
541 virtual void evalContinuity(
size_t j, doublereal* x, doublereal* r,
542 integer* diag, doublereal rdt);
544 virtual std::string flowType() {
547 virtual bool fixed_mdot() {
562 size_t size_new, doublereal* newSoln,
IdealGasPhase& newmech);
doublereal Y_fixed(size_t k, size_t j) const
The fixed mass fraction value of species k at point j.
virtual doublereal density() const
Density (kg/m^3).
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.
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)
Evaluate all residual components at the right boundary.
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"
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
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 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...
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
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 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.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
Base class for a phase with thermodynamic properties.
Header file for class Cantera::Array2D.
Base class for one-dimensional domains.
doublereal T_fixed(size_t j) const
The fixed temperature value at point j.
void setID(const std::string &s)
Specify an identifying tag for this domain.
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.
void setFixedTempProfile(vector_fp &zfixed, vector_fp &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile...
doublereal cp_mass() const
Specific heat at constant pressure.
Public interface for kinetics managers.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
void setTemperature(size_t j, doublereal t)
void getWdot(doublereal *x, size_t j)
Write the net production rates at point j into array m_wdot
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
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.
doublereal temperature() const
Temperature (K).
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
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...
void setTransport(Transport &trans, bool withSoret=false)
set the transport manager
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
void updateDiffFluxes(const doublereal *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
void importSolution(size_t points, doublereal *oldSoln, IdealGasPhase &oldmech, size_t size_new, doublereal *newSoln, IdealGasPhase &newmech)
Import a previous solution to use as an initial estimate.
virtual void _getInitialSoln(doublereal *x)
Write the initial solution estimate into array x.
doublereal pressure() const
The current pressure [Pa].
void resize(size_t components, size_t points)
Change the grid size. Called after grid refinement.
void setMassFraction(size_t j, size_t k, doublereal y)
StFlow(IdealGasPhase *ph=0, size_t nsp=1, size_t points=1)
Create a new flow domain.
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
Header for a file containing miscellaneous numerical functions.
virtual void setState(size_t point, const doublereal *state, doublereal *x)
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.