59 StFlow(shared_ptr<ThermoPhase> th,
size_t nsp = 1,
size_t points = 1);
66 StFlow(shared_ptr<Solution> sol,
const string&
id=
"",
size_t points=1);
75 void setupGrid(
size_t n,
const double* z)
override;
87 void setKinetics(shared_ptr<Kinetics> kin)
override;
103 m_do_soret = withSoret;
105 bool withSoret()
const {
123 void _finalize(
const double* x)
override;
139 m_do_energy[j] =
false;
144 return m_fixedtemp[j];
157 void show(
const double* x)
override;
159 shared_ptr<SolutionArray>
asArray(
const double* soln)
const override;
167 m_usesLambda =
false;
183 m_usesLambda =
false;
186 void solveEnergyEqn(
size_t j=
npos);
237 void fixTemperature(
size_t j=
npos);
239 bool doEnergy(
size_t j) {
240 return m_do_energy[j];
244 void resize(
size_t components,
size_t points)
override;
247 void setGas(
const double* x,
size_t j);
253 double density(
size_t j)
const {
278 void setViscosityFlag(
bool dovisc) {
302 void eval(
size_t jGlobal,
double* xGlobal,
double* rsdGlobal,
303 integer* diagGlobal,
double rdt)
override;
312 return m_kExcessRight;
319 double wdot(
size_t k,
size_t j)
const {
326 virtual void updateProperties(
size_t jg,
double* x,
size_t jmin,
size_t jmax);
379 double rdt,
size_t jmin,
size_t jmax);
397 virtual void evalMomentum(
double* x,
double* rsd,
int* diag,
398 double rdt,
size_t jmin,
size_t jmax);
416 virtual void evalLambda(
double* x,
double* rsd,
int* diag,
417 double rdt,
size_t jmin,
size_t jmax);
437 virtual void evalEnergy(
double* x,
double* rsd,
int* diag,
438 double rdt,
size_t jmin,
size_t jmax);
454 virtual void evalSpecies(
double* x,
double* rsd,
int* diag,
455 double rdt,
size_t jmin,
size_t jmax);
467 double rdt,
size_t jmin,
size_t jmax);
484 for (
size_t j = j0; j <= j1; j++) {
486 m_rho[j] = m_thermo->
density();
497 double T(
const double* x,
size_t j)
const {
500 double& T(
double* x,
size_t j) {
503 double T_prev(
size_t j)
const {
507 double rho_u(
const double* x,
size_t j)
const {
511 double u(
const double* x,
size_t j)
const {
515 double V(
const double* x,
size_t j)
const {
518 double V_prev(
size_t j)
const {
522 double lambda(
const double* x,
size_t j)
const {
526 double Y(
const double* x,
size_t k,
size_t j)
const {
530 double& Y(
double* x,
size_t k,
size_t j) {
534 double Y_prev(
size_t k,
size_t j)
const {
538 double X(
const double* x,
size_t k,
size_t j)
const {
539 return m_wtm[j]*Y(x,k,j)/m_wt[k];
542 double flux(
size_t k,
size_t j)
const {
551 double dVdz(
const double* x,
size_t j)
const {
552 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
553 return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
556 double dYdz(
const double* x,
size_t k,
size_t j)
const {
557 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
558 return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
561 double dTdz(
const double* x,
size_t j)
const {
562 size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
563 return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
567 double shear(
const double* x,
size_t j)
const {
568 double c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
569 double c2 = m_visc[j]*(V(x,j+1) - V(x,j));
570 return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
573 double divHeatFlux(
const double* x,
size_t j)
const {
574 double c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
575 double c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
576 return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
579 size_t mindex(
size_t k,
size_t j,
size_t m) {
587 virtual void grad_hk(
const double* x,
size_t j);
593 double m_press = -1.0;
599 vector<double> m_rho;
600 vector<double> m_wtm;
607 vector<double> m_visc;
608 vector<double> m_tcon;
612 vector<double> m_multidiff;
632 double m_epsilon_left = 0.0;
633 double m_epsilon_right = 0.0;
640 vector<bool> m_do_energy;
641 bool m_do_soret =
false;
642 vector<bool> m_do_species;
643 bool m_do_multicomponent =
false;
652 vector<double> m_fixedtemp;
653 vector<double> m_zfix;
654 vector<double> m_tfix;
660 size_t m_kExcessRight = 0;
678 vector<double> m_ybar;
Header file for class Cantera::Array2D.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Base class for one-dimensional domains.
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
Public interface for kinetics managers.
virtual void getNetProductionRates(double *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double density() const
Density (kg/m^3).
A container class holding arrays of state information.
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
void eval(size_t jGlobal, double *xGlobal, double *rsdGlobal, integer *diagGlobal, double rdt) override
Evaluate the residual functions for axisymmetric stagnation flow.
void setTemperature(size_t j, double t)
Set the temperature fixed point at grid point j, and disable the energy equation so that the solution...
size_t m_kExcessLeft
Index of species with a large mass fraction at each boundary, for which the mass fraction may be calc...
void setMeta(const AnyMap &state) override
Retrieve meta data.
void setTransportModel(const string &trans)
Set the transport model.
double leftEmissivity() const
Return emissivity at left boundary.
void setTransport(shared_ptr< Transport > trans) override
Set transport model to existing instance.
void setUnstrainedFlow()
Set flow configuration for burner-stabilized flames, using specified inlet mass fluxes.
void setKinetics(shared_ptr< Kinetics > kin) override
Set the kinetics manager.
void resetBadValues(double *xg) override
When called, this function should reset "bad" values in the state vector such as negative species con...
size_t rightExcessSpecies() const
Index of the species on the right boundary with the largest mass fraction.
vector< double > m_qdotRadiation
radiative heat loss vector
virtual void evalMomentum(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the momentum equation residual.
double pressure() const
The current pressure [Pa].
void updateThermo(const double *x, size_t j0, size_t j1)
Update the thermodynamic properties from point j0 to point j1 (inclusive), based on solution x.
void resize(size_t components, size_t points) override
Change the grid size. Called after grid refinement.
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 setFixedTempProfile(vector< double > &zfixed, vector< double > &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile,...
virtual void evalContinuity(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the continuity equation residual.
void setBoundaryEmissivities(double e_left, double e_right)
Set the emissivities for the boundary values.
virtual void evalEnergy(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the energy equation residual.
void enableRadiation(bool doRadiation)
Turn radiation on / off.
vector< double > m_diff
Array of size m_nsp by m_points for saving density times diffusion coefficient times species molar ma...
shared_ptr< SolutionArray > asArray(const double *soln) const override
Save the state of this domain as a SolutionArray.
size_t componentIndex(const string &name) const override
index of component with name name.
double rightEmissivity() const
Return emissivity at right boundary.
void setGas(const double *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
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.
Array2D m_hk
Array of size m_nsp by m_points for saving molar enthalpies.
void setFreeFlow()
Set flow configuration for freely-propagating flames, using an internal point with a fixed temperatur...
virtual bool doElectricField(size_t j) const
Retrieve flag indicating whether electric field is solved or not (used by IonFlow specialization)
virtual void evalSpecies(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the species equations' residuals.
void setupGrid(size_t n, const double *z) override
called to set up initial grid, and after grid refinement
size_t leftExcessSpecies() const
Index of the species on the left boundary with the largest mass fraction.
Array2D m_dhk_dz
Array of size m_nsp by m_points-1 for saving enthalpy fluxes.
virtual void evalElectricField(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the electric field equation residual to be zero everywhere.
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 _finalize(const double *x) override
In some cases, a domain may need to set parameters that depend on the initial solution estimate.
virtual size_t getSolvingStage() const
Get the solving stage (used by IonFlow specialization)
size_t m_nsp
Number of species in the mechanism.
virtual void evalLambda(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the lambda equation residual.
void fromArray(SolutionArray &arr, double *soln) override
Restore the solution for this domain from a SolutionArray.
AnyMap getMeta() const override
Retrieve meta data.
virtual void updateDiffFluxes(const double *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
string componentName(size_t n) const override
Name of the nth component. May be overloaded.
bool isFree() const
Retrieve flag indicating whether flow is freely propagating.
void setGasAtMidpoint(const double *x, size_t j)
Set the gas state to be consistent with the solution at the midpoint between j and j + 1.
virtual void grad_hk(const double *x, size_t j)
Get the gradient of species specific molar enthalpies.
bool isStrained() const
Retrieve flag indicating whether flow uses radial momentum.
string transportModel() const
Retrieve transport model.
void computeRadiation(double *x, size_t jmin, size_t jmax)
Computes the radiative heat loss vector over points jmin to jmax and stores the data in the qdotRadia...
virtual void updateProperties(size_t jg, double *x, size_t jmin, size_t jmax)
Update the properties (thermo, transport, and diffusion flux).
string domainType() const override
Domain type flag.
void show(const double *x) override
Print the solution.
virtual void setSolvingStage(const size_t stage)
Solving stage mode for handling ionized species (used by IonFlow specialization)
void setPressure(double p)
Set the pressure.
virtual void fixElectricField(size_t j=npos)
Set to fix voltage in a point (used by IonFlow specialization)
void setAxisymmetricFlow()
Set flow configuration for axisymmetric counterflow flames, using specified inlet mass fluxes.
virtual void updateTransport(double *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 solveElectricField(size_t j=npos)
Set to solve electric field in a point (used by IonFlow specialization)
void _getInitialSoln(double *x) override
Write the initial solution estimate into array x.
vector< size_t > m_kRadiating
Indices within the ThermoPhase of the radiating species.
double T_fixed(size_t j) const
The fixed temperature value at point j.
bool m_do_radiation
flag for the radiative heat loss
Base class for a phase with thermodynamic properties.
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
double cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
Base class for transport property managers.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
const double Undef
Fairly random number to be used to initialize variables against to see if they are subsequently defin...
offset
Offsets of solution components in the 1D solution array.
@ c_offset_U
axial velocity
@ c_offset_E
electric field equation
@ c_offset_Y
mass fractions