Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StFlow.h
Go to the documentation of this file.
1 /**
2  * @file StFlow.h
3  */
4 // Copyright 2001 California Institute of Technology
5 
6 #ifndef CT_STFLOW_H
7 #define CT_STFLOW_H
8 
9 #include "Domain1D.h"
10 #include "cantera/base/Array.h"
13 
14 namespace Cantera
15 {
16 //------------------------------------------
17 // constants
18 //------------------------------------------
19 
20 // Offsets of solution components in the solution array.
21 const size_t c_offset_U = 0; // axial velocity
22 const size_t c_offset_V = 1; // strain rate
23 const size_t c_offset_T = 2; // temperature
24 const size_t c_offset_L = 3; // (1/r)dP/dr
25 const size_t c_offset_Y = 4; // mass fractions
26 
27 // Transport option flags
28 const int c_Mixav_Transport = 0;
29 const int c_Multi_Transport = 1;
30 const int c_Soret = 2;
31 
32 class Transport;
33 
34 /**
35  * This class represents 1D flow domains that satisfy the one-dimensional
36  * similarity solution for chemically-reacting, axisymmetric, flows.
37  * @ingroup onedim
38  */
39 class StFlow : public Domain1D
40 {
41 public:
42  //--------------------------------
43  // construction and destruction
44  //--------------------------------
45 
46  //! Create a new flow domain.
47  //! @param ph Object representing the gas phase. This object will be used
48  //! to evaluate all thermodynamic, kinetic, and transport properties.
49  //! @param nsp Number of species.
50  //! @param points Initial number of grid points
51  StFlow(IdealGasPhase* ph = 0, size_t nsp = 1, size_t points = 1);
52 
53  //! @name Problem Specification
54  //! @{
55 
56  virtual void setupGrid(size_t n, const doublereal* z);
57 
58  thermo_t& phase() {
59  return *m_thermo;
60  }
61  Kinetics& kinetics() {
62  return *m_kin;
63  }
64 
65  virtual void init() {
66  }
67 
68  /**
69  * Set the thermo manager. Note that the flow equations assume
70  * the ideal gas equation.
71  */
73  m_thermo = &th;
74  }
75 
76  //! Set the kinetics manager. The kinetics manager must
77  void setKinetics(Kinetics& kin) {
78  m_kin = &kin;
79  }
80 
81  //! set the transport manager
82  void setTransport(Transport& trans, bool withSoret = false);
83  void enableSoret(bool withSoret);
84  bool withSoret() const {
85  return m_do_soret;
86  }
87 
88  //! Set the pressure. Since the flow equations are for the limit of
89  //! small Mach number, the pressure is very nearly constant
90  //! throughout the flow.
91  void setPressure(doublereal p) {
92  m_press = p;
93  }
94 
95  //! The current pressure [Pa].
96  doublereal pressure() const {
97  return m_press;
98  }
99 
100  //! Write the initial solution estimate into array x.
101  virtual void _getInitialSoln(doublereal* x) {
102  for (size_t j = 0; j < m_points; j++) {
103  T(x,j) = m_thermo->temperature();
104  m_thermo->getMassFractions(&Y(x, 0, j));
105  }
106  }
107 
108  virtual void _finalize(const doublereal* x);
109 
110  //! Sometimes it is desired to carry out the simulation using a specified
111  //! temperature profile, rather than computing it by solving the energy
112  //! equation. This method specifies this profile.
113  void setFixedTempProfile(vector_fp& zfixed, vector_fp& tfixed) {
114  m_zfix = zfixed;
115  m_tfix = tfixed;
116  }
117 
118  /*!
119  * Set the temperature fixed point at grid point j, and disable the energy
120  * equation so that the solution will be held to this value.
121  */
122  void setTemperature(size_t j, doublereal t) {
123  m_fixedtemp[j] = t;
124  m_do_energy[j] = false;
125  }
126 
127  /*!
128  * Set the mass fraction fixed point for species k at grid point j, and
129  * disable the species equation so that the solution will be held to this
130  * value. Note: in practice, the species are hardly ever held fixed.
131  */
132  void setMassFraction(size_t j, size_t k, doublereal y) {
133  m_fixedy(k,j) = y;
134  m_do_species[k] = true;
135  }
136 
137  //! The fixed temperature value at point j.
138  doublereal T_fixed(size_t j) const {
139  return m_fixedtemp[j];
140  }
141 
142  //! The fixed mass fraction value of species k at point j.
143  //! @deprecated Unused. To be removed after Cantera 2.2.
144  doublereal Y_fixed(size_t k, size_t j) const {
145  warn_deprecated("StFlow::Y_fixed", "To be removed after Cantera 2.2.");
146  return m_fixedy(k,j);
147  }
148 
149  // @}
150 
151  virtual std::string componentName(size_t n) const;
152 
153  virtual size_t componentIndex(const std::string& name) const;
154 
155  //! Print the solution.
156  virtual void showSolution(const doublereal* x);
157 
158  //! Save the current solution for this domain into an XML_Node
159  /*!
160  * @param o XML_Node to save the solution to.
161  * @param sol Current value of the solution vector. The object will pick
162  * out which part of the solution vector pertains to this
163  * object.
164  */
165  virtual XML_Node& save(XML_Node& o, const doublereal* const sol);
166 
167  virtual void restore(const XML_Node& dom, doublereal* soln,
168  int loglevel);
169 
170  // overloaded in subclasses
171  virtual std::string flowType() {
172  return "<none>";
173  }
174 
175  void solveEnergyEqn(size_t j=npos) {
176  bool changed = false;
177  if (j == npos)
178  for (size_t i = 0; i < m_points; i++) {
179  if (!m_do_energy[i]) {
180  changed = true;
181  }
182  m_do_energy[i] = true;
183  }
184  else {
185  if (!m_do_energy[j]) {
186  changed = true;
187  }
188  m_do_energy[j] = true;
189  }
190  m_refiner->setActive(0, true);
191  m_refiner->setActive(1, true);
192  m_refiner->setActive(2, true);
193  if (changed) {
194  needJacUpdate();
195  }
196  }
197 
198  //! Turn radiation on / off.
199  /*!
200  * The simple radiation model used was established by Y. Liu and B. Rogg
201  * [Y. Liu and B. Rogg, Modelling of thermally radiating diffusion flames
202  * with detailed chemistry and transport, EUROTHERM Seminars, 17:114-127,
203  * 1991]. This model considers the radiation of CO2 and H2O.
204  */
205  void enableRadiation(bool doRadiation) {
206  m_do_radiation = doRadiation;
207  }
208 
209  //! Returns `true` if the radiation term in the energy equation is enabled
210  bool radiationEnabled() const {
211  return m_do_radiation;
212  }
213 
214  //! Set the emissivities for the boundary values
215  /*!
216  * Reads the emissivities for the left and right boundary values in the
217  * radiative term and writes them into the variables, which are used for
218  * the calculation.
219  */
220  void setBoundaryEmissivities(doublereal e_left, doublereal e_right) {
221  if (e_left < 0 || e_left > 1) {
222  throw CanteraError("setBoundaryEmissivities",
223  "The left boundary emissivity must be between 0.0 and 1.0!");
224  } else if (e_right < 0 || e_right > 1) {
225  throw CanteraError("setBoundaryEmissivities",
226  "The right boundary emissivity must be between 0.0 and 1.0!");
227  } else {
228  m_epsilon_left = e_left;
229  m_epsilon_right = e_right;
230  }
231  }
232 
233  void fixTemperature(size_t j=npos) {
234  bool changed = false;
235  if (j == npos)
236  for (size_t i = 0; i < m_points; i++) {
237  if (m_do_energy[i]) {
238  changed = true;
239  }
240  m_do_energy[i] = false;
241  }
242  else {
243  if (m_do_energy[j]) {
244  changed = true;
245  }
246  m_do_energy[j] = false;
247  }
248  m_refiner->setActive(0, false);
249  m_refiner->setActive(1, false);
250  m_refiner->setActive(2, false);
251  if (changed) {
252  needJacUpdate();
253  }
254  }
255 
256  //! @deprecated Species equations are always solved. To be removed after
257  //! Cantera 2.2.
258  bool doSpecies(size_t k) {
259  warn_deprecated("StFlow::doSpecies", "To be removed after Cantera 2.2.");
260  return m_do_species[k];
261  }
262  bool doEnergy(size_t j) {
263  return m_do_energy[j];
264  }
265 
266  //! @deprecated Species equations are always solved. To be removed after
267  //! Cantera 2.2.
268  void solveSpecies(size_t k=npos) {
269  warn_deprecated("StFlow::solveSpecies", "To be removed after Cantera 2.2.");
270  if (k == npos) {
271  for (size_t i = 0; i < m_nsp; i++) {
272  m_do_species[i] = true;
273  }
274  } else {
275  m_do_species[k] = true;
276  }
277  needJacUpdate();
278  }
279 
280  //! @deprecated Species equations are always solved. To be removed after
281  //! Cantera 2.2.
282  void fixSpecies(size_t k=npos) {
283  warn_deprecated("StFlow::fixSpecies", "To be removed after Cantera 2.2.");
284  if (k == npos) {
285  for (size_t i = 0; i < m_nsp; i++) {
286  m_do_species[i] = false;
287  }
288  } else {
289  m_do_species[k] = false;
290  }
291  needJacUpdate();
292  }
293 
294  void integrateChem(doublereal* x,doublereal dt);
295 
296  //! Change the grid size. Called after grid refinement.
297  void resize(size_t components, size_t points);
298 
299  virtual void setFixedPoint(int j0, doublereal t0) {}
300 
301  void setJac(MultiJac* jac);
302 
303  //! Set the gas object state to be consistent with the solution at point j.
304  void setGas(const doublereal* x, size_t j);
305 
306  //! Set the gas state to be consistent with the solution at the midpoint
307  //! between j and j + 1.
308  void setGasAtMidpoint(const doublereal* x, size_t j);
309 
310  doublereal density(size_t j) const {
311  return m_rho[j];
312  }
313 
314  virtual bool fixed_mdot() {
315  return true;
316  }
317  void setViscosityFlag(bool dovisc) {
318  m_dovisc = dovisc;
319  }
320 
321  /*!
322  * Evaluate the residual function for axisymmetric stagnation flow. If
323  * jpt is less than zero, the residual function is evaluated at all grid
324  * points. If jpt >= 0, then the residual function is only evaluated at
325  * grid points jpt-1, jpt, and jpt+1. This option is used to efficiently
326  * evaluate the Jacobian numerically.
327  */
328  virtual void eval(size_t j, doublereal* x, doublereal* r,
329  integer* mask, doublereal rdt);
330 
331  //! Evaluate all residual components at the right boundary.
332  virtual void evalRightBoundary(doublereal* x, doublereal* res,
333  integer* diag, doublereal rdt) = 0;
334 
335  //! Evaluate the residual corresponding to the continuity equation at all
336  //! interior grid points.
337  virtual void evalContinuity(size_t j, doublereal* x, doublereal* r,
338  integer* diag, doublereal rdt) = 0;
339 
340 protected:
341  doublereal component(const doublereal* x, size_t i, size_t j) const {
342  return x[index(i,j)];
343  }
344 
345  doublereal conc(const doublereal* x, size_t k,size_t j) const {
346  return Y(x,k,j)*density(j)/m_wt[k];
347  }
348 
349  doublereal cbar(const doublereal* x, size_t k, size_t j) const {
350  return std::sqrt(8.0*GasConstant * T(x,j) / (Pi * m_wt[k]));
351  }
352 
353  doublereal wdot(size_t k, size_t j) const {
354  return m_wdot(k,j);
355  }
356 
357  //! Write the net production rates at point `j` into array `m_wdot`
358  void getWdot(doublereal* x, size_t j) {
359  setGas(x,j);
360  m_kin->getNetProductionRates(&m_wdot(0,j));
361  }
362 
363  /**
364  * Update the thermodynamic properties from point j0 to point j1
365  * (inclusive), based on solution x.
366  */
367  void updateThermo(const doublereal* x, size_t j0, size_t j1) {
368  for (size_t j = j0; j <= j1; j++) {
369  setGas(x,j);
370  m_rho[j] = m_thermo->density();
371  m_wtm[j] = m_thermo->meanMolecularWeight();
372  m_cp[j] = m_thermo->cp_mass();
373  }
374  }
375 
376  //--------------------------------
377  // central-differenced derivatives
378  //--------------------------------
379 
380  doublereal cdif2(const doublereal* x, size_t n, size_t j,
381  const doublereal* f) const {
382  doublereal c1 = (f[j] + f[j-1])*(x[index(n,j)] - x[index(n,j-1)]);
383  doublereal c2 = (f[j+1] + f[j])*(x[index(n,j+1)] - x[index(n,j)]);
384  return (c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
385  }
386 
387 
388  //! @name Solution components
389  //! @{
390 
391  doublereal T(const doublereal* x, size_t j) const {
392  return x[index(c_offset_T, j)];
393  }
394  doublereal& T(doublereal* x, size_t j) {
395  return x[index(c_offset_T, j)];
396  }
397  doublereal T_prev(size_t j) const {
398  return prevSoln(c_offset_T, j);
399  }
400 
401  doublereal rho_u(const doublereal* x, size_t j) const {
402  return m_rho[j]*x[index(c_offset_U, j)];
403  }
404 
405  doublereal u(const doublereal* x, size_t j) const {
406  return x[index(c_offset_U, j)];
407  }
408 
409  doublereal V(const doublereal* x, size_t j) const {
410  return x[index(c_offset_V, j)];
411  }
412  doublereal V_prev(size_t j) const {
413  return prevSoln(c_offset_V, j);
414  }
415 
416  doublereal lambda(const doublereal* x, size_t j) const {
417  return x[index(c_offset_L, j)];
418  }
419 
420  doublereal Y(const doublereal* x, size_t k, size_t j) const {
421  return x[index(c_offset_Y + k, j)];
422  }
423 
424  doublereal& Y(doublereal* x, size_t k, size_t j) {
425  return x[index(c_offset_Y + k, j)];
426  }
427 
428  doublereal Y_prev(size_t k, size_t j) const {
429  return prevSoln(c_offset_Y + k, j);
430  }
431 
432  doublereal X(const doublereal* x, size_t k, size_t j) const {
433  return m_wtm[j]*Y(x,k,j)/m_wt[k];
434  }
435 
436  doublereal flux(size_t k, size_t j) const {
437  return m_flux(k, j);
438  }
439  //! @}
440 
441  //! @name convective spatial derivatives.
442  //! These use upwind differencing, assuming u(z) is negative
443  //! @{
444  doublereal dVdz(const doublereal* x, size_t j) const {
445  size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
446  return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
447  }
448 
449  doublereal dYdz(const doublereal* x, size_t k, size_t j) const {
450  size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
451  return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
452  }
453 
454  doublereal dTdz(const doublereal* x, size_t j) const {
455  size_t jloc = (u(x,j) > 0.0 ? j : j + 1);
456  return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
457  }
458  //! @}
459 
460  doublereal shear(const doublereal* x, size_t j) const {
461  doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
462  doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
463  return 2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
464  }
465 
466  doublereal divHeatFlux(const doublereal* x, size_t j) const {
467  doublereal c1 = m_tcon[j-1]*(T(x,j) - T(x,j-1));
468  doublereal c2 = m_tcon[j]*(T(x,j+1) - T(x,j));
469  return -2.0*(c2/(z(j+1) - z(j)) - c1/(z(j) - z(j-1)))/(z(j+1) - z(j-1));
470  }
471 
472  size_t mindex(size_t k, size_t j, size_t m) {
473  return m*m_nsp*m_nsp + m_nsp*j + k;
474  }
475 
476  //! Update the diffusive mass fluxes.
477  void updateDiffFluxes(const doublereal* x, size_t j0, size_t j1);
478 
479  //---------------------------------------------------------
480  // member data
481  //---------------------------------------------------------
482 
483  doublereal m_press; // pressure
484 
485  // grid parameters
486  vector_fp m_dz;
487 
488  // mixture thermo properties
489  vector_fp m_rho;
490  vector_fp m_wtm;
491 
492  // species thermo properties
493  vector_fp m_wt;
494  vector_fp m_cp;
495 
496  // transport properties
497  vector_fp m_visc;
498  vector_fp m_tcon;
499  vector_fp m_diff;
500  vector_fp m_multidiff;
501  Array2D m_dthermal;
502  Array2D m_flux;
503 
504  // production rates
505  Array2D m_wdot;
506 
507  size_t m_nsp;
508 
509  IdealGasPhase* m_thermo;
510  Kinetics* m_kin;
511  Transport* m_trans;
512 
513  MultiJac* m_jac;
514 
515  // boundary emissivities for the radiation calculations
516  doublereal m_epsilon_left;
517  doublereal m_epsilon_right;
518 
519  //! Indices within the ThermoPhase of the radiating species. First index is
520  //! for CO2, second is for H2O.
521  std::vector<size_t> m_kRadiating;
522 
523  // flags
524  std::vector<bool> m_do_energy;
525  bool m_do_soret;
526  std::vector<bool> m_do_species;
527  int m_transport_option;
528 
529  // flag for the radiative heat loss
530  bool m_do_radiation;
531 
532  // radiative heat loss vector
533  // vector which contains the values of the radiative heat loss
534  vector_fp m_qdotRadiation;
535 
536  // fixed T and Y values
537  Array2D m_fixedy; //!< @deprecated
538  vector_fp m_fixedtemp;
539  vector_fp m_zfix;
540  vector_fp m_tfix;
541 
542  bool m_dovisc;
543 
544  //! Update the transport properties at grid points in the range from `j0`
545  //! to `j1`, based on solution `x`.
546  void updateTransport(doublereal* x, size_t j0, size_t j1);
547 
548 private:
549  vector_fp m_ybar;
550 };
551 
552 /**
553  * A class for axisymmetric stagnation flows.
554  * @ingroup onedim
555  */
556 class AxiStagnFlow : public StFlow
557 {
558 public:
559  AxiStagnFlow(IdealGasPhase* ph = 0, size_t nsp = 1, size_t points = 1) :
560  StFlow(ph, nsp, points) {
561  m_dovisc = true;
562  }
563 
564  virtual void evalRightBoundary(doublereal* x, doublereal* res,
565  integer* diag, doublereal rdt);
566  virtual void evalContinuity(size_t j, doublereal* x, doublereal* r,
567  integer* diag, doublereal rdt);
568 
569  virtual std::string flowType() {
570  return "Axisymmetric Stagnation";
571  }
572 };
573 
574 /**
575  * A class for freely-propagating premixed flames.
576  * @ingroup onedim
577  */
578 class FreeFlame : public StFlow
579 {
580 public:
581  FreeFlame(IdealGasPhase* ph = 0, size_t nsp = 1, size_t points = 1);
582  virtual void evalRightBoundary(doublereal* x, doublereal* res,
583  integer* diag, doublereal rdt);
584  virtual void evalContinuity(size_t j, doublereal* x, doublereal* r,
585  integer* diag, doublereal rdt);
586 
587  virtual std::string flowType() {
588  return "Free Flame";
589  }
590  virtual bool fixed_mdot() {
591  return false;
592  }
593  virtual void _finalize(const doublereal* x);
594  virtual void restore(const XML_Node& dom, doublereal* soln, int loglevel);
595 
596  virtual XML_Node& save(XML_Node& o, const doublereal* const sol);
597 
598  //! Location of the point where temperature is fixed
599  doublereal m_zfixed;
600 
601  //! Temperature at the point used to fix the flame location
602  doublereal m_tfixed;
603 };
604 
605 }
606 
607 #endif
doublereal Y_fixed(size_t k, size_t j) const
The fixed mass fraction value of species k at point j.
Definition: StFlow.h:144
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:608
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
Definition: StFlow.cpp:1009
void setKinetics(Kinetics &kin)
Set the kinetics manager. The kinetics manager must.
Definition: StFlow.h:77
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...
Definition: StFlow.h:367
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...
Definition: StFlow.h:39
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
Definition: Phase.cpp:598
virtual void evalRightBoundary(doublereal *x, doublereal *res, integer *diag, doublereal rdt)
Evaluate all residual components at the right boundary.
Definition: StFlow.cpp:953
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"
Definition: ct_defs.h:165
A class for axisymmetric stagnation flows.
Definition: StFlow.h:556
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
Definition: StFlow.cpp:1034
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
Definition: StFlow.cpp:204
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...
Definition: StFlow.cpp:922
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
Definition: StFlow.cpp:1041
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.
Definition: global.cpp:78
void setPressure(doublereal p)
Set the pressure.
Definition: StFlow.h:91
const doublereal Pi
Pi.
Definition: ct_defs.h:51
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.
Definition: StFlow.h:578
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Definition: Array.h:29
doublereal m_tfixed
Temperature at the point used to fix the flame location.
Definition: StFlow.h:602
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
Definition: StFlow.cpp:664
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
Definition: Kinetics.cpp:501
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
Header file for class Cantera::Array2D.
void fixSpecies(size_t k=npos)
Definition: StFlow.h:282
Base class for one-dimensional domains.
Definition: Domain1D.h:37
virtual void init()
Definition: StFlow.h:65
doublereal T_fixed(size_t j) const
The fixed temperature value at point j.
Definition: StFlow.h:138
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.
Definition: StFlow.cpp:900
void setThermo(IdealGasPhase &th)
Set the thermo manager.
Definition: StFlow.h:72
void setFixedTempProfile(vector_fp &zfixed, vector_fp &tfixed)
Sometimes it is desired to carry out the simulation using a specified temperature profile...
Definition: StFlow.h:113
doublereal cp_mass() const
Specific heat at constant pressure.
Definition: ThermoPhase.h:920
bool doSpecies(size_t k)
Definition: StFlow.h:258
Public interface for kinetics managers.
Definition: Kinetics.h:128
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
void setTemperature(size_t j, doublereal t)
Definition: StFlow.h:122
std::vector< size_t > m_kRadiating
Indices within the ThermoPhase of the radiating species.
Definition: StFlow.h:521
doublereal m_zfixed
Location of the point where temperature is fixed.
Definition: StFlow.h:599
void getWdot(doublereal *x, size_t j)
Write the net production rates at point j into array m_wdot
Definition: StFlow.h:358
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
Definition: StFlow.cpp:623
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...
Definition: StFlow.cpp:977
void setGas(const doublereal *x, size_t j)
Set the gas object state to be consistent with the solution at point j.
Definition: StFlow.cpp:184
virtual void showSolution(const doublereal *x)
Print the solution.
Definition: StFlow.cpp:507
bool radiationEnabled() const
Returns true if the radiation term in the energy equation is enabled.
Definition: StFlow.h:210
void solveSpecies(size_t k=npos)
Definition: StFlow.h:268
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
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...
Definition: StFlow.cpp:477
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
Definition: StFlow.cpp:134
void enableRadiation(bool doRadiation)
Turn radiation on / off.
Definition: StFlow.h:205
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
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...
Definition: StFlow.cpp:192
void setTransport(Transport &trans, bool withSoret=false)
set the transport manager
Definition: StFlow.cpp:150
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:669
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
Array2D m_fixedy
Definition: StFlow.h:537
void updateDiffFluxes(const doublereal *x, size_t j0, size_t j1)
Update the diffusive mass fluxes.
Definition: StFlow.cpp:568
virtual void _getInitialSoln(doublereal *x)
Write the initial solution estimate into array x.
Definition: StFlow.h:101
doublereal pressure() const
The current pressure [Pa].
Definition: StFlow.h:96
void needJacUpdate()
Definition: Domain1D.cpp:42
void resize(size_t components, size_t points)
Change the grid size. Called after grid refinement.
Definition: StFlow.cpp:106
void setMassFraction(size_t j, size_t k, doublereal y)
Definition: StFlow.h:132
StFlow(IdealGasPhase *ph=0, size_t nsp=1, size_t points=1)
Create a new flow domain.
Definition: StFlow.cpp:18
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
Definition: Domain1D.h:478
void setBoundaryEmissivities(doublereal e_left, doublereal e_right)
Set the emissivities for the boundary values.
Definition: StFlow.h:220
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt)
Definition: StFlow.cpp:227
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
Definition: StFlow.cpp:832