26 size_t nv_old = oldmech.
nSpecies() + 4;
27 size_t nv_new = newmech.
nSpecies() + 4;
29 if (size_new < nv_new*points) {
31 "new solution array must have length "+
39 for (j = 0; j < points; j++)
40 for (n = 0; n < 4; n++) {
41 newSoln[nv_new*j + n] = oldSoln[nv_old*j + n];
49 for (
size_t k = 0; k < nsp0; k++) {
58 for (j = 0; j < points; j++) {
59 newSoln[nv_new*j + 4 + knew] = oldSoln[nv_old*j + 4 + k];
66 for (j = 0; j < points; j++) {
72 static void st_drawline()
74 writelog(
"\n-------------------------------------"
75 "------------------------------------------");
92 m_transport_option(-1)
119 m_nv = c_offset_Y + m_nsp;
122 m_do_species.resize(m_nsp,
true);
125 m_do_energy.resize(m_points,
false);
127 m_diff.resize(m_nsp*m_points);
128 m_multidiff.resize(m_nsp*m_nsp*m_points);
129 m_flux.
resize(m_nsp,m_points);
130 m_wdot.
resize(m_nsp,m_points, 0.0);
131 m_surfdot.resize(m_nsp, 0.0);
132 m_ybar.resize(m_nsp);
143 for (
size_t k = 0; k < m_nsp; k++) {
152 m_refiner->setActive(0,
false);
153 m_refiner->setActive(1,
false);
154 m_refiner->setActive(2,
false);
155 m_refiner->setActive(3,
false);
158 for (
size_t ng = 0; ng < m_points; ng++) {
159 gr.push_back(1.0*ng/m_points);
162 setID(
"stagnation flow");
168 m_rho.resize(m_points, 0.0);
169 m_wtm.resize(m_points, 0.0);
170 m_cp.resize(m_points, 0.0);
171 m_enth.resize(m_points, 0.0);
172 m_visc.resize(m_points, 0.0);
173 m_tcon.resize(m_points, 0.0);
175 if (m_transport_option == c_Mixav_Transport) {
176 m_diff.resize(m_nsp*m_points);
178 m_multidiff.resize(m_nsp*m_nsp*m_points);
179 m_diff.resize(m_nsp*m_points);
180 m_dthermal.
resize(m_nsp, m_points, 0.0);
182 m_flux.
resize(m_nsp,m_points);
183 m_wdot.
resize(m_nsp,m_points, 0.0);
184 m_do_energy.resize(m_points,
false);
186 m_fixedy.
resize(m_nsp, m_points);
187 m_fixedtemp.resize(m_points);
189 m_dz.resize(m_points-1);
190 m_z.resize(m_points);
199 for (j = 1; j < m_points; j++) {
201 m_dz[j-1] = m_z[j] - m_z[j-1];
208 m_do_soret = withSoret;
210 if (m_trans->
model() == cMulticomponent) {
211 m_transport_option = c_Multi_Transport;
212 m_multidiff.resize(m_nsp*m_nsp*m_points);
213 m_diff.resize(m_nsp*m_points);
214 m_dthermal.
resize(m_nsp, m_points, 0.0);
215 }
else if (m_trans->
model() == cMixtureAveraged) {
216 m_transport_option = c_Mixav_Transport;
217 m_diff.resize(m_nsp*m_points);
220 "Thermal diffusion (the Soret effect) "
221 "requires using a multicomponent transport model.");
223 throw CanteraError(
"setTransport",
"unknown transport model.");
227 void StFlow::enableSoret(
bool withSoret)
229 if (m_transport_option == c_Multi_Transport) {
230 m_do_soret = withSoret;
232 throw CanteraError(
"setTransport",
233 "Thermal diffusion (the Soret effect) "
234 "requires using a multicomponent transport model.");
241 const doublereal* yy = x + m_nv*j + c_offset_Y;
249 const doublereal* yyj = x + m_nv*j + c_offset_Y;
250 const doublereal* yyjp = x + m_nv*(j+1) + c_offset_Y;
251 for (
size_t k = 0; k < m_nsp; k++) {
252 m_ybar[k] = 0.5*(yyj[k] + yyjp[k]);
262 size_t nz = m_zfix.size();
263 bool e = m_do_energy[0];
264 for (j = 0; j < m_points; j++) {
268 zz = (z(j) - z(0))/(z(m_points - 1) - z(0));
272 for (k = 0; k < m_nsp; k++) {
283 if (m_tfixed !=
Undef) {
284 bool found_zfix =
false;
285 for (
size_t j = 0; j < m_points; j++) {
286 if (z(j) == m_zfixed) {
292 for (
size_t j = 0; j < m_points - 1; j++) {
295 if ((T(x, j) - m_tfixed) * (T(x, j+1) - m_tfixed) <= 0.0) {
296 m_tfixed = T(x, j+1);
306 doublereal* rg, integer* diagg, doublereal rdt)
321 doublereal* x = xg +
loc();
322 doublereal* rsd = rg +
loc();
323 integer* diag = diagg +
loc();
331 size_t jpt = (jg == 0) ? 0 : jg -
firstPoint();
332 jmin = std::max<size_t>(jpt, 1) - 1;
333 jmax = std::min(jpt+1,m_points-1);
337 size_t j0 = std::max<size_t>(jmin, 1) - 1;
338 size_t j1 = std::min(jmax+1,m_points-1);
363 doublereal sum, sum2, dtdzj;
365 for (j = jmin; j <= jmax; j++) {
379 rsd[index(c_offset_U,0)] =
380 -(rho_u(x,1) - rho_u(x,0))/m_dz[0]
381 -(density(1)*V(x,1) + density(0)*V(x,0));
388 rsd[index(c_offset_V,0)] = V(x,0);
389 rsd[index(c_offset_T,0)] = T(x,0);
390 rsd[index(c_offset_L,0)] = -rho_u(x,0);
396 for (k = 0; k < m_nsp; k++) {
398 rsd[index(c_offset_Y + k, 0)] =
399 -(m_flux(k,0) + rho_u(x,0)* Y(x,k,0));
401 rsd[index(c_offset_Y, 0)] = 1.0 - sum;
405 else if (j == m_points - 1) {
418 rsd[index(c_offset_V,j)]
419 = (shear(x,j) - lambda(x,j) - rho_u(x,j)*dVdz(x,j)
420 - m_rho[j]*V(x,j)*V(x,j))/m_rho[j]
421 - rdt*(V(x,j) - V_prev(j));
422 diag[index(c_offset_V, j)] = 1;
433 doublereal convec, diffus;
434 for (k = 0; k < m_nsp; k++) {
435 convec = rho_u(x,j)*dYdz(x,k,j);
436 diffus = 2.0*(m_flux(k,j) - m_flux(k,j-1))
438 rsd[index(c_offset_Y + k, j)]
439 = (m_wt[k]*(wdot(k,j))
440 - convec - diffus)/m_rho[j]
441 - rdt*(Y(x,k,j) - Y_prev(k,j));
442 diag[index(c_offset_Y + k, j)] = 1;
454 if (m_do_energy[j]) {
465 for (k = 0; k < m_nsp; k++) {
466 flxk = 0.5*(m_flux(k,j-1) + m_flux(k,j));
467 sum += wdot(k,j)*h_RT[k];
468 sum2 += flxk*cp_R[k]/m_wt[k];
474 rsd[index(c_offset_T, j)] =
475 - m_cp[j]*rho_u(x,j)*dtdzj
476 - divHeatFlux(x,j) - sum - sum2;
477 rsd[index(c_offset_T, j)] /= (m_rho[j]*m_cp[j]);
479 rsd[index(c_offset_T, j)] -= rdt*(T(x,j) - T_prev(j));
480 diag[index(c_offset_T, j)] = 1;
483 rsd[index(c_offset_T, j)] = T(x,j) -
T_fixed(j);
484 diag[index(c_offset_T, j)] = 0;
487 rsd[index(c_offset_L, j)] = lambda(x,j) - lambda(x,j-1);
488 diag[index(c_offset_L, j)] = 0;
495 if (m_transport_option == c_Mixav_Transport) {
496 for (
size_t j = j0; j < j1; j++) {
498 m_visc[j] = (m_dovisc ? m_trans->
viscosity() : 0.0);
502 }
else if (m_transport_option == c_Multi_Transport) {
503 doublereal sum, sumx, wtm, dz;
504 doublereal eps = 1.0e-12;
505 for (
size_t m = j0; m < j1; m++) {
507 dz = m_z[m+1] - m_z[m];
510 m_visc[m] = (m_dovisc ? m_trans->
viscosity() : 0.0);
513 DATA_PTR(m_multidiff) + mindex(0,0,m));
515 for (
size_t k = 0; k < m_nsp; k++) {
518 for (
size_t j = 0; j < m_nsp; j++) {
520 sum += m_wt[j]*m_multidiff[mindex(k,j,m)]*
521 ((X(x,j,m+1) - X(x,j,m))/dz + eps);
522 sumx += (X(x,j,m+1) - X(x,j,m))/dz;
525 m_diff[k + m*m_nsp] = sum/(wtm*(sumx+eps));
546 sprintf(buf,
" Pressure: %10.4g Pa \n", m_press);
548 for (i = 0; i < nn; i++) {
550 sprintf(buf,
"\n z ");
552 for (n = 0; n < 5; n++) {
557 for (j = 0; j < m_points; j++) {
558 sprintf(buf,
"\n %10.4g ",m_z[j]);
560 for (n = 0; n < 5; n++) {
561 sprintf(buf,
" %10.4g ",component(x, i*5+n,j));
567 size_t nrem = m_nv - 5*nn;
569 sprintf(buf,
"\n z ");
571 for (n = 0; n < nrem; n++) {
576 for (j = 0; j < m_points; j++) {
577 sprintf(buf,
"\n %10.4g ",m_z[j]);
579 for (n = 0; n < nrem; n++) {
580 sprintf(buf,
" %10.4g ",component(x, nn*5+n,j));
590 doublereal sum, wtm, rho, dz, gradlogT;
592 switch (m_transport_option) {
594 case c_Mixav_Transport:
595 case c_Multi_Transport:
596 for (j = j0; j < j1; j++) {
602 for (k = 0; k < m_nsp; k++) {
603 m_flux(k,j) = m_wt[k]*(rho*m_diff[k+m_nsp*j]/wtm);
604 m_flux(k,j) *= (X(x,k,j) - X(x,k,j+1))/dz;
608 for (k = 0; k < m_nsp; k++) {
609 m_flux(k,j) += sum*Y(x,k,j);
615 throw CanteraError(
"updateDiffFluxes",
"unknown transport model");
619 for (m = j0; m < j1; m++) {
620 gradlogT = 2.0 * (T(x,m+1) - T(x,m)) /
621 ((T(x,m+1) + T(x,m)) * (z(m+1) - z(m)));
622 for (k = 0; k < m_nsp; k++) {
623 m_flux(k,m) -= m_dthermal(k,m)*gradlogT;
641 if (n >= c_offset_Y && n < (c_offset_Y + m_nsp)) {
649 size_t StFlow::componentIndex(
const std::string& name)
const
653 }
else if (name==
"V") {
655 }
else if (name==
"T") {
657 }
else if (name==
"lambda") {
660 for (
size_t n=4; n<m_nsp+4; n++) {
673 vector<string> ignored;
677 vector<XML_Node*> str;
679 int nstr =
static_cast<int>(str.size());
680 for (
int istr = 0; istr < nstr; istr++) {
687 pp =
getFloat(dom,
"pressure",
"pressure");
695 size_t nd = d.size();
698 size_t n, np = 0, j, ks, k;
700 bool readgrid =
false, wrote_header =
false;
701 for (n = 0; n < nd; n++) {
714 "domain contains no grid points.");
717 writelog(
"Importing datasets:\n", loglevel >= 2);
718 for (n = 0; n < nd; n++) {
723 writelog(
"axial velocity ", loglevel >= 2);
724 if (x.size() != np) {
726 "axial velocity array size error");
728 for (j = 0; j < np; j++) {
729 soln[index(0,j)] = x[j];
731 }
else if (nm ==
"z") {
733 }
else if (nm ==
"V") {
734 writelog(
"radial velocity ", loglevel >= 2);
735 if (x.size() != np) {
737 "radial velocity array size error");
739 for (j = 0; j < np; j++) {
740 soln[index(1,j)] = x[j];
742 }
else if (nm ==
"T") {
743 writelog(
"temperature ", loglevel >= 2);
744 if (x.size() != np) {
746 "temperature array size error");
748 for (j = 0; j < np; j++) {
749 soln[index(2,j)] = x[j];
758 for (
size_t jj = 0; jj < np; jj++) {
759 zz[jj] = (grid(jj) - zmin())/(zmax() - zmin());
762 }
else if (nm ==
"L") {
764 if (x.size() != np) {
766 "lambda arary size error");
768 for (j = 0; j < np; j++) {
769 soln[index(3,j)] = x[j];
773 if (x.size() == np) {
776 for (j = 0; j < np; j++) {
777 soln[index(k+4,j)] = x[j];
781 ignored.push_back(nm);
785 if (loglevel >=2 && !ignored.empty()) {
788 size_t nn = ignored.size();
789 for (
size_t n = 0; n < nn; n++) {
795 for (ks = 0; ks < nsp; ks++) {
796 if (did_species[ks] == 0) {
798 writelog(
"Missing data for species:\n");
806 if (dom.
hasChild(
"energy_enabled")) {
809 for (
size_t i = 0; i < x.size(); i++) {
810 m_do_energy[i] = x[i];
812 }
else if (!x.empty()) {
813 throw CanteraError(
"StFlow::restore",
"energy_enabled is length" +
814 int2str(x.size()) +
"but should be length" +
819 if (dom.
hasChild(
"species_enabled")) {
821 if (x.size() == m_nsp) {
822 for (
size_t i = 0; i < x.size(); i++) {
823 m_do_species[i] = x[i];
825 }
else if (!x.empty()) {
829 writelog(
"\nWarning: StFlow::restore: species_enabled is length " +
830 int2str(x.size()) +
" but should be length " +
831 int2str(m_nsp) +
". Enabling all species equations by default.");
833 m_do_species.assign(m_nsp,
true);
837 if (dom.
hasChild(
"refine_criteria")) {
857 XML_Node& gv = flow.addChild(
"grid_data");
858 addFloat(flow,
"pressure", m_press,
"Pa",
"pressure");
860 if (m_zfixed !=
Undef) {
861 addFloat(flow,
"z_fixed", m_zfixed,
"m");
862 addFloat(flow,
"t_fixed", m_tfixed,
"K");
882 for (k = 0; k < m_nsp; k++) {
885 x.size(),
DATA_PTR(x),
"",
"massFraction");
889 for (
size_t i = 0; i <
nPoints(); i++) {
890 values[i] = m_do_energy[i];
894 values.resize(m_nsp);
895 for (
size_t i = 0; i < m_nsp; i++) {
896 values[i] = m_do_species[i];
900 XML_Node& ref = flow.addChild(
"refine_criteria");
916 integer* diag, doublereal rdt)
918 size_t j = m_points - 1;
923 rsd[index(0,j)] = rho_u(x,j);
924 rsd[index(1,j)] = V(x,j);
925 rsd[index(2,j)] = T(x,j);
926 rsd[index(c_offset_L, j)] = lambda(x,j) - lambda(x,j-1);
927 diag[index(c_offset_L, j)] = 0;
928 doublereal sum = 0.0;
929 for (
size_t k = 0; k < m_nsp; k++) {
931 rsd[index(k+4,j)] = m_flux(k,j-1) + rho_u(x,j)*Y(x,k,j);
933 rsd[index(4,j)] = 1.0 - sum;
934 diag[index(4,j)] = 0;
938 integer* diag, doublereal rdt)
951 rsd[index(c_offset_U,j)] =
952 -(rho_u(x,j+1) - rho_u(x,j))/m_dz[j]
953 -(density(j+1)*V(x,j+1) + density(j)*V(x,j));
956 diag[index(c_offset_U, j)] = 0;
960 integer* diag, doublereal rdt)
962 size_t j = m_points - 1;
969 rsd[index(0,j)] = rho_u(x,j) - rho_u(x,j-1);
970 rsd[index(1,j)] = V(x,j);
971 rsd[index(2,j)] = T(x,j) - T(x,j-1);
972 doublereal sum = 0.0;
973 rsd[index(c_offset_L, j)] = lambda(x,j) - lambda(x,j-1);
974 diag[index(c_offset_L, j)] = 0;
975 for (
size_t k = 0; k < m_nsp; k++) {
977 rsd[index(k+4,j)] = m_flux(k,j-1) + rho_u(x,j)*Y(x,k,j);
979 rsd[index(4,j)] = 1.0 - sum;
980 diag[index(4,j)] = 0;
984 integer* diag, doublereal rdt)
993 if (grid(j) > m_zfixed) {
994 rsd[index(c_offset_U,j)] =
995 - (rho_u(x,j) - rho_u(x,j-1))/m_dz[j-1]
996 - (density(j-1)*V(x,j-1) + density(j)*V(x,j));
999 else if (grid(j) == m_zfixed) {
1000 if (m_do_energy[j]) {
1001 rsd[index(c_offset_U,j)] = (T(x,j) - m_tfixed);
1003 rsd[index(c_offset_U,j)] = (rho_u(x,j)
1006 }
else if (grid(j) < m_zfixed) {
1007 rsd[index(c_offset_U,j)] =
1008 - (rho_u(x,j+1) - rho_u(x,j))/m_dz[j]
1009 - (density(j+1)*V(x,j+1) + density(j)*V(x,j));
1012 diag[index(c_offset_U, j)] = 0;
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
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...
size_t nPoints() const
Number of grid points in this domain.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)=0
Evaluate all residual components at the right boundary.
virtual int model() const
Transport model.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with 'v'.
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"
size_t firstPoint() const
The index of the first (i.e., left-most) grid point belonging to this domain.
void addNamedFloatArray(Cantera::XML_Node &node, const std::string &name, const int n, const doublereal *const vals, const std::string units, const std::string type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name given by the first parameter with a value consisting of...
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...
virtual size_t loc(size_t j=0) const
Location of the start of the local solution vector in the global solution vector,.
Class XML_Node is a tree-based representation of the contents of an XML file.
bool getOptionalFloat(const Cantera::XML_Node &parent, const std::string &name, doublereal &fltRtn, const std::string &type)
Get an optional floating-point value from a child element.
Base class for transport property managers.
void setPressure(doublereal p)
Set the pressure.
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
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...
void addString(Cantera::XML_Node &node, const std::string &titleString, const std::string &valueString, const std::string &typeString)
This function adds a child node with the name string with a string value to the current node...
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
const doublereal Undef
Fairly random number to be used to initialize variables against to see if they are subsequently defin...
A class for 2D arrays stored in column-major (Fortran-compatible) form.
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
std::vector< int > vector_int
Vector of ints.
void setBounds(size_t nl, const doublereal *lower, size_t nu, const doublereal *upper)
Set the lower and upper bounds for each solution component.
Base class for one-dimensional domains.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
doublereal T_fixed(size_t j) const
The fixed temperature value at point j.
void setCriteria(doublereal ratio=10.0, doublereal slope=0.8, doublereal curve=0.8, doublereal prune=-0.1)
Set grid refinement criteria.
size_t lastPoint() const
The index of the last (i.e., right-most) grid point belonging to this domain.
void setID(const std::string &s)
Specify an identifying tag for this domain.
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)
Evaluate all residual components at the right boundary.
size_t nColumns() const
Number of columns.
void setFixedTempProfile(vector_fp &zfixed, vector_fp &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile...
void addFloatArray(Cantera::XML_Node &node, const std::string &title, const size_t n, const doublereal *const vals, const std::string &units, const std::string &type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name, "floatArray", with a value consisting of a comma separ...
void addFloat(Cantera::XML_Node &node, const std::string &title, const doublereal val, const std::string &units, const std::string &type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name, "float", with a value consisting of a single floating ...
Base class for exceptions thrown by Cantera classes.
void setTemperature(size_t j, doublereal t)
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
virtual doublereal viscosity()
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
virtual void resize(size_t nv, size_t np)
void setGridMin(double gridmin)
Set the minimum allowable spacing between adjacent grid points [m].
void addAttribute(const std::string &attrib, const std::string &value)
Add or modify an attribute of the current node.
Refiner & refiner()
Return a reference to the grid refiner.
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 setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
size_t nSpecies() const
Returns the number of species in the phase.
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 MultiJac evaluates the Jacobian of a system of equations defined by a residual function supplie...
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
void setGas(const doublereal *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
std::string value() const
Return the value of an XML node as a string.
virtual void showSolution(const doublereal *x)
Print the solution.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
void setSteadyTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for steady-state mode.
const vector_fp & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
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 getMixDiffCoeffs(doublereal *const d)
Returns a vector of mixture averaged diffusion coefficients.
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
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the dimensionless reference state enthalpy vector.
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.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return a vector of Thermal diffusion coefficients [kg/m/sec].
void getRow(size_t n, doublereal *const rw)
Get the nth row and return it in a vector.
void writelog(const std::string &msg)
Write a message to the screen.
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)
void setTransientTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for time-stepping mode.
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt)
std::string speciesName(size_t k) const
Name of the species with index k.
size_t getFloatArray(const Cantera::XML_Node &node, std::vector< doublereal > &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name...
void getChildren(const std::string &name, std::vector< XML_Node * > &children) const
Get a vector of pointers to XML_Node containing all of the children of the current node which matches...
doublereal linearInterp(doublereal x, const vector_fp &xpts, const vector_fp &fpts)
Linearly interpolate a function defined on a discrete grid.
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature and composition.