8#include "cantera/oneD/refine.h"
67 for (
size_t k = 0; k <
m_nsp; k++) {
79 for (
size_t ng = 0; ng <
m_points; ng++) {
91 :
Flow1D(th.get(), nsp, points)
99 :
Flow1D(sol->thermo().get(), sol->thermo()->nSpecies(), points)
107 "An appropriate transport model\nshould be set when instantiating the "
108 "Solution ('gas') object.");
110 m_solution->registerChangedCallback(
this, [
this]() {
128 return "axisymmetric-flow";
130 return "unstrained-flow";
142 throw CanteraError(
"Flow1D::setTransport",
"Unable to set empty transport.");
146 throw CanteraError(
"Flow1D::setTransport",
"Invalid Transport model 'none'.");
190 for (
size_t j = 1; j <
m_points; j++) {
191 if (
z[j] <=
z[j-1]) {
193 "grid points must be monotonically increasing");
202 double* x = xg +
loc();
203 for (
size_t j = 0; j <
m_points; j++) {
223 warn_user(
"Flow1D::setFluxGradientBasis",
224 "Setting fluxGradientBasis only affects "
225 "the mixture-averaged diffusion model.");
231 for (
size_t j = 0; j <
m_points; j++) {
251 for (
size_t k = 0; k <
m_nsp; k++) {
252 m_ybar[k] = 0.5*(yy_j[k] + yy_j_plus1[k]);
262 "Thermal diffusion (the Soret effect) is enabled, and requires "
263 "using a multicomponent transport model.");
266 size_t nz =
m_zfix.size();
268 for (
size_t j = 0; j <
m_points; j++) {
286 for (
size_t j = 0; j <
m_points; j++) {
292 for (
size_t j = 0; j <
m_points - 1; j++) {
306 integer* diagGlobal,
double rdt)
315 double* x = xGlobal +
loc();
316 double* rsd = rsdGlobal +
loc();
317 integer* diag = diagGlobal +
loc();
320 if (jGlobal ==
npos) {
324 size_t jpt = (jGlobal == 0) ? 0 : jGlobal -
firstPoint();
325 jmin = std::max<size_t>(jpt, 1) - 1;
340 evalUo(x, rsd, diag, rdt, jmin, jmax);
347 size_t j0 = std::max<size_t>(jmin, 1) - 1;
348 size_t j1 = std::min(jmax+1,
m_points-1);
371 for (
size_t j = j0; j < j1; j++) {
379 for (
size_t k = 0; k <
m_nsp; k++) {
389 for (
size_t j = j0; j < j1; j++) {
403 for (
size_t k=0; k <
m_nsp; k++) {
407 for (
size_t k=0; k <
m_nsp; k++) {
419 for (
size_t j = j0; j < j1; j++) {
420 double dz =
z(j+1) -
z(j);
421 for (
size_t k = 0; k <
m_nsp; k++) {
423 for (
size_t m = 0; m <
m_nsp; m++) {
430 for (
size_t j = j0; j < j1; j++) {
432 double dz =
z(j+1) -
z(j);
434 for (
size_t k = 0; k <
m_nsp; k++) {
439 for (
size_t k = 0; k <
m_nsp; k++) {
445 for (
size_t k = 0; k <
m_nsp; k++) {
452 for (
size_t m = j0; m < j1; m++) {
453 double gradlogT = 2.0 * (
T(x,m+1) -
T(x,m)) /
454 ((
T(x,m+1) +
T(x,m)) * (
z(m+1) -
z(m)));
455 for (
size_t k = 0; k <
m_nsp; k++) {
466 double k_P_ref = 1.0*
OneAtm;
469 const double c_H2O[6] = {-0.23093, -1.12390, 9.41530, -2.99880,
470 0.51382, -1.86840e-5};
471 const double c_CO2[6] = {18.741, -121.310, 273.500, -194.050,
478 for (
size_t j = jmin; j < jmax; j++) {
484 for (
size_t n = 0; n <= 5; n++) {
485 k_P_H2O += c_H2O[n] * pow(1000 /
T(x, j), (
double) n);
493 for (
size_t n = 0; n <= 5; n++) {
494 k_P_CO2 += c_CO2[n] * pow(1000 /
T(x, j), (
double) n);
501 double radiative_heat_loss = 2 * k_P *(2 *
StefanBoltz * pow(
T(x, j), 4)
502 - boundary_Rad_left - boundary_Rad_right);
510 double rdt,
size_t jmin,
size_t jmax)
530 size_t j0 = std::max<size_t>(jmin, 1);
531 size_t j1 = std::min(jmax,
m_points-2);
533 for (
size_t j = j0; j <= j1; j++) {
543 for (
size_t j = j0; j <= j1; j++) {
559 for (
size_t j = j0; j <= j1; j++) {
567 double rdt,
size_t jmin,
size_t jmax)
570 for (
size_t j = jmin; j <= jmax; j++) {
587 size_t j0 = std::max<size_t>(jmin, 1);
588 size_t j1 = std::min(jmax,
m_points-2);
589 for (
size_t j = j0; j <= j1; j++) {
603 double rdt,
size_t jmin,
size_t jmax)
606 for (
size_t j = jmin; j <= jmax; j++) {
627 size_t j0 = std::max<size_t>(jmin, 1);
628 size_t j1 = std::min(jmax,
m_points-2);
629 for (
size_t j = j0; j <= j1; j++) {
646 double rdt,
size_t jmin,
size_t jmax)
657 size_t j0 = std::max<size_t>(jmin, 1);
658 size_t j1 = std::min(jmax,
m_points-2);
659 for (
size_t j = j0; j <= j1; j++) {
663 for (
size_t k = 0; k <
m_nsp; k++) {
688 double rdt,
size_t jmin,
size_t jmax)
691 for (
size_t j = jmin; j <= jmax; j++) {
711 size_t j0 = std::max<size_t>(jmin, 1);
712 size_t j1 = std::min(jmax,
m_points-2);
713 for (
size_t j = j0; j <= j1; j++) {
728 double rdt,
size_t jmin,
size_t jmax)
732 for (
size_t k = 0; k <
m_nsp; k++) {
735 rho_u(x, jmin) *
Y(x, k, jmin));
743 for (
size_t k = 0; k <
m_nsp; k++) {
746 rho_u(x, jmax)*
Y(x, k, jmax);
753 size_t j0 = std::max<size_t>(jmin, 1);
754 size_t j1 = std::min(jmax,
m_points-2);
755 for (
size_t j = j0; j <= j1; j++) {
756 for (
size_t k = 0; k <
m_nsp; k++) {
757 double convec =
rho_u(x, j)*
dYdz(x, k, j);
758 double diffus = 2*(
m_flux(k, j) -
m_flux(k, j-1)) / (
z(j+1) -
z(j-1));
760 - convec - diffus) /
m_rho[j]
761 - rdt*(
Y(x, k, j) -
Y_prev(k, j));
768 double rdt,
size_t jmin,
size_t jmax)
770 for (
size_t j = jmin; j <= jmax; j++) {
779 "Overloaded by StFlow; to be removed after Cantera 3.1");
789 writeline(
'-', 79,
false,
true);
790 writelog(
"\n z radiative heat loss");
791 writeline(
'-', 79,
false,
true);
792 for (
size_t j = 0; j <
m_points; j++) {
805 return "spread_rate";
825 if (name==
"velocity") {
827 }
else if (name==
"spread_rate") {
829 }
else if (name==
"T") {
831 }
else if (name==
"lambda") {
833 }
else if (name ==
"eField") {
835 }
else if (name ==
"Uo") {
844 "no component named " + name);
871 state[
"phase"][
"source"] = source.
empty() ?
"<unknown>" : source.
asString();
880 if (energy_flags.size() == 1) {
890 state[
"refine-criteria"][
"ratio"] =
m_refiner->maxRatio();
891 state[
"refine-criteria"][
"slope"] =
m_refiner->maxDelta();
892 state[
"refine-criteria"][
"curve"] =
m_refiner->maxSlope();
893 state[
"refine-criteria"][
"prune"] =
m_refiner->prune();
894 state[
"refine-criteria"][
"grid-min"] =
m_refiner->gridMin();
895 state[
"refine-criteria"][
"max-points"] =
896 static_cast<long int>(
m_refiner->maxPoints());
899 state[
"fixed-point"][
"location"] =
m_zfixed;
900 state[
"fixed-point"][
"temperature"] =
m_tfixed;
905 state[
"continuation-method"][
"type"] =
"two-point";
906 state[
"continuation-method"][
"left-location"] =
m_zLeft;
907 state[
"continuation-method"][
"right-location"] =
m_zRight;
908 state[
"continuation-method"][
"left-temperature"] =
m_tLeft;
909 state[
"continuation-method"][
"right-temperature"] =
m_tRight;
919 arr->addExtra(
"grid",
false);
922 arr->setComponent(
"grid",
value);
923 vector<double> data(
nPoints());
927 for (
size_t j = 0; j <
nPoints(); j++) {
928 data[j] = soln[
index(i, j)];
930 if (!arr->hasComponent(name)) {
934 arr->setComponent(name,
value);
938 arr->setComponent(
"D",
value);
941 arr->addExtra(
"radiative-heat-loss",
true);
943 arr->setComponent(
"radiative-heat-loss",
value);
966 const vector<double> data = arr.
getComponent(name).
as<vector<double>>();
967 for (
size_t j = 0; j <
nPoints(); j++) {
968 soln[
index(i,j)] = data[j];
971 warn_user(
"Flow1D::fromArray",
"Saved state does not contain values for "
972 "component '{}' in domain '{}'.", name,
id());
981 if (state.
hasKey(
"energy-enabled")) {
982 const AnyValue& ee = state[
"energy-enabled"];
992 if (state.
hasKey(
"Soret-enabled")) {
996 if (state.
hasKey(
"flux-gradient-basis")) {
998 state[
"flux-gradient-basis"].asInt());
1001 if (state.
hasKey(
"radiation-enabled")) {
1009 if (state.
hasKey(
"refine-criteria")) {
1010 const AnyMap& criteria = state[
"refine-criteria"].as<
AnyMap>();
1015 m_refiner->setCriteria(ratio, slope, curve, prune);
1017 if (criteria.
hasKey(
"grid-min")) {
1018 m_refiner->setGridMin(criteria[
"grid-min"].asDouble());
1020 if (criteria.
hasKey(
"max-points")) {
1021 m_refiner->setMaxPoints(criteria[
"max-points"].asInt());
1025 if (state.
hasKey(
"fixed-point")) {
1026 m_zfixed = state[
"fixed-point"][
"location"].asDouble();
1027 m_tfixed = state[
"fixed-point"][
"temperature"].asDouble();
1031 if (state.
hasKey(
"continuation-method")) {
1032 const AnyMap& cm = state[
"continuation-method"].as<
AnyMap>();
1033 if (cm[
"type"] ==
"two-point") {
1035 m_zLeft = cm[
"left-location"].asDouble();
1036 m_zRight = cm[
"right-location"].asDouble();
1037 m_tLeft = cm[
"left-temperature"].asDouble();
1038 m_tRight = cm[
"right-temperature"].asDouble();
1040 warn_user(
"Flow1D::setMeta",
"Unknown continuation method '{}'.",
1041 cm[
"type"].asString());
1048 bool changed =
false;
1050 for (
size_t i = 0; i <
m_points; i++) {
1073 "Not used by '{}' objects.",
type());
1079 "Not used by '{}' objects.",
type());
1085 "Not used by '{}' objects.",
type());
1091 "Not used by '{}' objects.",
type());
1097 "Not used by '{}' objects.",
type());
1102 if (e_left < 0 || e_left > 1) {
1104 "The left boundary emissivity must be between 0.0 and 1.0!");
1105 }
else if (e_right < 0 || e_right > 1) {
1107 "The right boundary emissivity must be between 0.0 and 1.0!");
1116 bool changed =
false;
1118 for (
size_t i = 0; i <
m_points; i++) {
1140 size_t jloc = (
u(x, j) > 0.0 ? j : j + 1);
1141 for(
size_t k = 0; k <
m_nsp; k++) {
1153 throw CanteraError(
"Flow1D::leftControlPointTemperature",
1154 "Invalid operation: left control point location is not set");
1157 throw CanteraError(
"Flow1D::leftControlPointTemperature",
1158 "Invalid operation: two-point control is not enabled.");
1168 throw CanteraError(
"Flow1D::leftControlPointCoordinate",
1169 "Invalid operation: left control point location is not set");
1172 throw CanteraError(
"Flow1D::leftControlPointCoordinate",
1173 "Invalid operation: two-point control is not enabled.");
1183 throw CanteraError(
"Flow1D::setLeftControlPointTemperature",
1184 "Invalid operation: left control point location is not set");
1187 throw CanteraError(
"Flow1D::setLeftControlPointTemperature",
1188 "Invalid operation: two-point control is not enabled.");
1197 throw CanteraError(
"Flow1D::setLeftControlPointCoordinate",
1198 "Invalid operation: two-point control is not enabled.");
1208 throw CanteraError(
"Flow1D::rightControlPointTemperature",
1209 "Invalid operation: right control point location is not set");
1212 throw CanteraError(
"Flow1D::rightControlPointTemperature",
1213 "Invalid operation: two-point control is not enabled.");
1223 throw CanteraError(
"Flow1D::rightControlPointCoordinate",
1224 "Invalid operation: right control point location is not set");
1227 throw CanteraError(
"Flow1D::rightControlPointCoordinate",
1228 "Invalid operation: two-point control is not enabled.");
1238 throw CanteraError(
"Flow1D::setRightControlPointTemperature",
1239 "Invalid operation: right control point location is not set");
1242 throw CanteraError(
"Flow1D::setRightControlPointTemperature",
1243 "Invalid operation: two-point control is not enabled.");
1252 throw CanteraError(
"Flow1D::setRightControlPointCoordinate",
1253 "Invalid operation: two-point control is not enabled.");
1266 "Invalid operation: two-point control can only be used"
1267 "with axisymmetric flames.");
Header file defining class TransportFactory (see TransportFactory)
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
const AnyValue & getMetadata(const string &key) const
Get a value from the metadata applicable to the AnyMap tree containing this node.
A map of string keys to values whose type can vary at runtime.
double getDouble(const string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
const string & getString(const string &key, const string &default_) const
If key exists, return it as a string, otherwise return default_.
A wrapper for a variable whose type is determined at runtime.
const string & asString() const
Return the held value, if it is a string.
bool & asBool()
Return the held value, if it is a bool.
bool empty() const
Return boolean indicating whether AnyValue is empty.
bool isScalar() const
Returns true if the held value is a scalar type (such as double, long int, string,...
const vector< T > & asVector(size_t nMin=npos, size_t nMax=npos) const
Return the held value, if it is a vector of type T.
const T & as() const
Get the value of this key as the specified type.
double * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Base class for exceptions thrown by Cantera classes.
Base class for one-dimensional domains.
size_t lastPoint() const
The index of the last (that is, right-most) grid point belonging to this domain.
shared_ptr< Solution > m_solution
Composite thermo/kinetics/transport handler.
size_t nComponents() const
Number of components at each grid point.
virtual void setMeta(const AnyMap &meta)
Retrieve meta data.
string id() const
Returns the identifying tag for this domain.
vector< double > & grid()
Access the array of grid coordinates [m].
size_t m_nv
Number of solution components.
size_t nPoints() const
Number of grid points in this domain.
bool m_force_full_update
see forceFullUpdate()
virtual void resize(size_t nv, size_t np)
Resize the domain to have nv components and np grid points.
double z(size_t jlocal) const
Get the coordinate [m] of the point with local index jlocal
void setSolution(shared_ptr< Solution > sol)
Set the solution manager.
vector< double > m_z
1D spatial grid coordinates
size_t m_points
Number of grid points.
string m_id
Identity tag for the domain.
string type() const
String indicating the domain implemented.
unique_ptr< Refiner > m_refiner
Refiner object used for placing grid points.
void setBounds(size_t n, double lower, double upper)
Set the upper and lower bounds for a solution component, n.
double value(const double *x, size_t n, size_t j) const
Returns the value of solution component n at grid point j of the solution vector x.
size_t firstPoint() const
The index of the first (that is, left-most) grid point belonging to this domain.
void needJacUpdate()
Set this if something has changed in the governing equations (for example, the value of a constant ha...
size_t index(size_t n, size_t j) const
Returns the index of the solution vector, which corresponds to component n at grid point j.
virtual size_t loc(size_t j=0) const
Location of the start of the local solution vector in the global solution vector.
virtual AnyMap getMeta() const
Retrieve meta data.
virtual void show(std::ostream &s, const double *x)
Print the solution.
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
double dYdz(const double *x, size_t k, size_t j) const
Calculates the spatial derivative of the species mass fraction with respect to z for species k at po...
void setLeftControlPointTemperature(double temperature)
Sets the temperature of the left control point.
ThermoPhase * m_thermo
Phase object used for calculating thermodynamic properties.
void eval(size_t jGlobal, double *xGlobal, double *rsdGlobal, integer *diagGlobal, double rdt) override
Evaluate the residual functions for axisymmetric stagnation flow.
void setLeftControlPointCoordinate(double z_left)
Sets the coordinate of the left control point.
double dTdz(const double *x, size_t j) const
Calculates the spatial derivative of temperature T with respect to z at point j using upwind differen...
vector< double > m_zfix
Relative coordinates used to specify a fixed temperature profile.
double density(size_t j) const
Get the density [kg/m³] at point j
size_t m_kExcessLeft
Index of species with a large mass fraction at the left boundary, for which the mass fraction may be ...
void setMeta(const AnyMap &state) override
Retrieve meta data.
double m_zLeft
Location of the left control point when two-point control is enabled.
void setTransportModel(const string &trans)
Set the transport model.
void fixTemperature(size_t j=npos)
Specify that the the temperature should be held fixed at point j.
vector< double > m_tfix
Fixed temperature values at the relative coordinates specified in m_zfix.
void setRightControlPointCoordinate(double z_right)
Sets the coordinate of the right control point.
double X(const double *x, size_t k, size_t j) const
Get the mole fraction of species k at point j from the local state vector x.
void setTransport(shared_ptr< Transport > trans) override
Set the transport manager used for transport property calculations.
ThermoPhase & phase()
Access the phase object used to compute thermodynamic properties for points in this domain.
void setKinetics(shared_ptr< Kinetics > kin) override
Set the Kinetics object used for reaction rate calculations.
double T_prev(size_t j) const
Get the temperature at point j from the previous time step.
void resetBadValues(double *xg) override
When called, this function should reset "bad" values in the state vector such as negative species con...
bool twoPointControlEnabled() const
Returns the status of the two-point control.
size_t rightExcessSpecies() const
Index of the species on the right boundary with the largest mass fraction.
bool m_do_soret
true if the Soret diffusion term should be calculated.
Kinetics * m_kin
Kinetics object used for calculating species production rates.
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.
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.
double m_tLeft
Temperature of the left control point when two-point control is enabled.
void setRightControlPointTemperature(double temperature)
Sets the temperature of the right control point.
void resize(size_t components, size_t points) override
Change the grid size. Called after grid refinement.
double dVdz(const double *x, size_t j) const
Calculates the spatial derivative of velocity V with respect to z at point j using upwind differencin...
bool m_usesLambda
Flag that is true for counterflow configurations that use the pressure eigenvalue in the radial mome...
vector< double > m_fixedtemp
Fixed values of the temperature at each grid point that are used when solving with the energy equatio...
virtual void evalContinuity(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the continuity equation residual.
vector< double > m_cp
Specific heat capacity at each grid point.
void enableTwoPointControl(bool twoPointControl)
Sets the status of the two-point control.
double m_tRight
Temperature of the right control point when two-point control is enabled.
void setBoundaryEmissivities(double e_left, double e_right)
Set the emissivities for the boundary values.
double shear(const double *x, size_t j) const
Compute the shear term from the momentum equation using a central three-point differencing scheme.
ThermoBasis m_fluxGradientBasis
Determines whether diffusive fluxes are computed using gradients of mass fraction or mole fraction.
void setFluxGradientBasis(ThermoBasis fluxGradientBasis)
Compute species diffusive fluxes with respect to their mass fraction gradients (fluxGradientBasis = T...
virtual void evalEnergy(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the energy equation residual.
void solveEnergyEqn(size_t j=npos)
Specify that the energy equation should be solved at point j.
vector< double > m_rho
Density at each grid point.
vector< bool > m_do_energy
For each point in the domain, true if energy equation is solved or false if temperature is held const...
double m_epsilon_right
Emissivity of the surface to the right of the domain.
Flow1D(ThermoPhase *ph=0, size_t nsp=1, size_t points=1)
Create a new flow domain.
vector< double > m_tcon
Thermal conductivity at each grid point [W/m/K].
vector< double > m_diff
Coefficient used in diffusion calculations for each species at each grid point.
double Y_prev(size_t k, size_t j) const
Get the mass fraction of species k at point j from the previous time step.
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.
vector< double > m_dz
Grid spacing. Element j holds the value of z(j+1) - z(j).
Array2D m_flux
Array of size m_nsp by m_points for saving diffusive mass fluxes.
void setGas(const double *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
ThermoBasis fluxGradientBasis() const
Compute species diffusive fluxes with respect to their mass fraction gradients (fluxGradientBasis = T...
vector< double > m_visc
Dynamic viscosity at each grid point [Pa∙s].
double Uo(const double *x, size_t j) const
Get the oxidizer inlet velocity [m/s] linked to point j from the local state vector x.
double m_epsilon_left
Emissivity of the surface to the left of the domain.
Transport * m_trans
Transport object used for calculating transport properties.
double m_tfixed
Temperature at the point used to fix the flame location.
virtual bool componentActive(size_t n) const
Returns true if the specified component is an active part of the solver state.
Array2D m_wdot
Array of size m_nsp by m_points for saving species production rates.
Array2D m_hk
Array of size m_nsp by m_points for saving molar enthalpies.
double m_press
pressure [Pa]
double lambda(const double *x, size_t j) const
Get the radial pressure gradient [N/m⁴] at point j from the local state vector x
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.
size_t mindex(size_t k, size_t j, size_t m)
Array access mapping for a 3D array stored in a 1D vector.
bool m_do_multicomponent
true if transport fluxes are computed using the multicomponent diffusion coefficients,...
double V_prev(size_t j) const
Get the spread rate [1/s] at point j from the previous time step.
double conduction(const double *x, size_t j) const
Compute the conduction term from the energy equation using a central three-point differencing scheme.
vector< double > m_wt
Molecular weight of each species.
double Y(const double *x, size_t k, size_t j) const
Get the mass fraction of species k at point j from the local state vector x.
void setupGrid(size_t n, const double *z) override
called to set up initial grid, and after grid refinement
double T(const double *x, size_t j) const
Get the temperature at point j from the local state vector x.
size_t leftExcessSpecies() const
Index of the species on the left boundary with the largest mass fraction.
bool m_isFree
Flag that is true for freely propagating flames anchored by a temperature fixed point.
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.
vector< double > m_wtm
Mean molecular weight at each grid point.
vector< double > m_multidiff
Vector of size m_nsp × m_nsp × m_points for saving multicomponent diffusion coefficients.
bool m_twoPointControl
Flag for activating two-point flame control.
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.
double rho_u(const double *x, size_t j) const
Get the axial mass flux [kg/m²/s] at point j from the local state vector x.
void fromArray(SolutionArray &arr, double *soln) override
Restore the solution for this domain from a SolutionArray.
double leftControlPointCoordinate() const
Returns the z-coordinate of the left control point.
AnyMap getMeta() const override
Retrieve meta data.
virtual void updateDiffFluxes(const double *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
double leftControlPointTemperature() const
Returns the temperature at the left control point.
string componentName(size_t n) const override
Name of component n. May be overloaded.
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)
Compute the spatial derivative of species specific molar enthalpies using upwind differencing.
bool isStrained() const
Retrieve flag indicating whether flow uses radial momentum.
string transportModel() const
Retrieve transport model.
double rightControlPointCoordinate() const
Returns the z-coordinate of the right control point.
double V(const double *x, size_t j) const
Get the spread rate (tangential velocity gradient) [1/s] at point j from the local state vector x.
Array2D m_dthermal
Array of size m_nsp by m_points for saving thermal diffusion coefficients.
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).
virtual void evalUo(double *x, double *rsd, int *diag, double rdt, size_t jmin, size_t jmax)
Evaluate the oxidizer axial velocity equation residual.
string domainType() const override
Domain type flag.
void show(const double *x) override
Print the solution.
bool m_dovisc
Determines whether the viscosity term in the momentum equation is calculated.
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)
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.
double m_zRight
Location of the right control point when two-point control is enabled.
virtual void solveElectricField(size_t j=npos)
Set to solve electric field in a point (used by IonFlow specialization)
double u(const double *x, size_t j) const
Get the axial velocity [m/s] at point j from the local state vector x.
size_t m_kExcessRight
Index of species with a large mass fraction at the right boundary, for which the mass fraction may be...
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 rightControlPointTemperature() const
Returns the temperature at the right control point.
double T_fixed(size_t j) const
The fixed temperature value at point j.
vector< double > m_ybar
Holds the average of the species mass fractions between grid points j and j+1.
bool m_do_radiation
Determines whether radiative heat loss is calculated.
An error indicating that an unimplemented function has been called.
size_t nSpecies() const
Returns the number of species in the phase.
virtual void setMassFractions_NoNorm(const double *const y)
Set the mass fractions to the specified values without normalizing.
double temperature() const
Temperature (K).
virtual void setPressure(double p)
Set the internally stored pressure (Pa) at constant temperature and composition.
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
string speciesName(size_t k) const
Name of the species with index k.
const vector< double > & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
virtual double density() const
Density (kg/m^3).
virtual void setTemperature(double temp)
Set the internally stored temperature of the phase (K).
virtual void setMassFractions(const double *const y)
Set the mass fractions to the specified values and normalize them.
void getMassFractions(double *const y) const
Get the species mass fractions.
virtual double pressure() const
Return the thermodynamic pressure (Pa).
string name() const
Return the name of the phase.
A container class holding arrays of state information.
void setLoc(int loc, bool restore=true)
Update the buffered location used to access SolutionArray entries.
AnyValue getComponent(const string &name) const
Retrieve a component of the SolutionArray by name.
bool hasComponent(const string &name) const
Check whether SolutionArray contains a component.
AnyMap & meta()
SolutionArray meta data.
shared_ptr< ThermoPhase > thermo()
Retrieve associated ThermoPhase object.
static shared_ptr< SolutionArray > create(const shared_ptr< Solution > &sol, int size=0, const AnyMap &meta={})
Instantiate a new SolutionArray reference.
static shared_ptr< Solution > create()
Create an empty Solution object.
Base class for a phase with thermodynamic properties.
virtual double maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
const AnyMap & input() const
Access input data associated with the phase description.
virtual void getThermalDiffCoeffs(double *const dt)
Return a vector of Thermal diffusion coefficients [kg/m/sec].
virtual string transportModel() const
Identifies the model represented by this Transport object.
virtual void getMixDiffCoeffs(double *const d)
Returns a vector of mixture averaged diffusion coefficients.
virtual double thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
virtual void getMixDiffCoeffsMass(double *const d)
Returns a vector of mixture averaged diffusion coefficients.
virtual double viscosity()
The viscosity in Pa-s.
virtual void getMultiDiffCoeffs(const size_t ld, double *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
Header for a file containing miscellaneous numerical functions.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
void writelog(const string &fmt, const Args &... args)
Write a formatted message to the screen.
double linearInterp(double x, const vector< double > &xpts, const vector< double > &fpts)
Linearly interpolate a function defined on a discrete grid.
const double OneAtm
One atmosphere [Pa].
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
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...
@ c_offset_U
axial velocity [m/s]
@ c_offset_E
electric field
@ c_offset_Y
mass fractions
@ c_offset_Uo
oxidizer axial velocity [m/s]
@ c_offset_T
temperature [kelvin]
ThermoBasis
Differentiate between mole fractions and mass fractions for input mixture composition.