Cantera  2.1.2
Domain1D.h
Go to the documentation of this file.
1 /**
2  * @file Domain1D.h
3  */
4 /*
5  * Copyright 2002 California Institute of Technology
6  */
7 
8 #ifndef CT_DOMAIN1D_H
9 #define CT_DOMAIN1D_H
10 
11 #include "cantera/base/xml.h"
14 #include "refine.h"
15 
16 namespace Cantera
17 {
18 
19 // domain types
20 const int cFlowType = 50;
21 const int cConnectorType = 100;
22 const int cSurfType = 102;
23 const int cInletType = 104;
24 const int cSymmType = 105;
25 const int cOutletType = 106;
26 const int cEmptyType = 107;
27 const int cOutletResType = 108;
28 const int cPorousType = 109;
29 
30 class MultiJac;
31 class OneDim;
32 
33 /**
34  * Base class for one-dimensional domains.
35  * @ingroup onedim
36  */
37 class Domain1D
38 {
39 public:
40  /**
41  * Constructor.
42  * @param nv Number of variables at each grid point.
43  * @param points Number of grid points.
44  * @param time (unused)
45  */
46  Domain1D(size_t nv=1, size_t points=1,
47  doublereal time = 0.0) :
48  m_rdt(0.0),
49  m_nv(0),
50  m_time(time),
51  m_container(0),
52  m_index(npos),
53  m_type(0),
54  m_iloc(0),
55  m_jstart(0),
56  m_left(0),
57  m_right(0),
58  m_id(""), m_desc(""),
59  m_refiner(0), m_bw(-1) {
60  resize(nv, points);
61  }
62 
63  virtual ~Domain1D() {
64  delete m_refiner;
65  }
66 
67  //! Domain type flag.
68  int domainType() {
69  return m_type;
70  }
71 
72  //! The left-to-right location of this domain.
73  size_t domainIndex() {
74  return m_index;
75  }
76 
77  //! True if the domain is a connector domain.
78  bool isConnector() {
79  return (m_type >= cConnectorType);
80  }
81 
82  //! The container holding this domain.
83  const OneDim& container() const {
84  return *m_container;
85  }
86 
87  /*!
88  * Specify the container object for this domain, and the
89  * position of this domain in the list.
90  */
91  void setContainer(OneDim* c, size_t index) {
92  m_container = c;
93  m_index = index;
94  }
95 
96  //! Set the Jacobian bandwidth. See the discussion of method bandwidth().
97  void setBandwidth(int bw = -1) {
98  m_bw = bw;
99  }
100 
101  //! Set the Jacobian bandwidth for this domain.
102  /**
103  * When class OneDim computes the bandwidth of the overall multi-domain
104  * problem (in OneDim::resize()), it calls this method for the bandwidth
105  * of each domain. If setBandwidth has not been called, then a negative
106  * bandwidth is returned, in which case OneDim assumes that this domain is
107  * dense -- that is, at each point, all components depend on the value of
108  * all other components at that point. In this case, the bandwidth is bw =
109  * 2*nComponents() - 1. However, if this domain contains some components
110  * that are uncoupled from other components at the same point, then this
111  * default bandwidth may greatly overestimate the true bandwidth, with a
112  * substantial penalty in performance. For such domains, use method
113  * setBandwidth to specify the bandwidth before passing this domain to the
114  * Sim1D or OneDim constructor.
115  */
116  size_t bandwidth() {
117  return m_bw;
118  }
119 
120  /*!
121  * Initialize. This method is called by OneDim::init() for
122  * each domain once at the beginning of a simulation. Base
123  * class method does nothing, but may be overloaded.
124  */
125  virtual void init() { }
126 
127  virtual void setInitialState(doublereal* xlocal = 0) {}
128  virtual void setState(size_t point, const doublereal* state, doublereal* x) {}
129 
130  /*!
131  * Resize the domain to have nv components and np grid points.
132  * This method is virtual so that subclasses can perform other
133  * actions required to resize the domain.
134  */
135  virtual void resize(size_t nv, size_t np) {
136  // if the number of components is being changed, then a
137  // new grid refiner is required.
138  if (nv != m_nv || !m_refiner) {
139  m_nv = nv;
140  delete m_refiner;
141  m_refiner = new Refiner(*this);
142  }
143  m_nv = nv;
144  m_td.resize(m_nv, 1);
145  m_name.resize(m_nv,"");
146  m_max.resize(m_nv, 0.0);
147  m_min.resize(m_nv, 0.0);
148  m_rtol_ss.resize(m_nv, 1.0e-8);
149  m_atol_ss.resize(m_nv, 1.0e-15);
150  m_rtol_ts.resize(m_nv, 1.0e-8);
151  m_atol_ts.resize(m_nv, 1.0e-15);
152  m_points = np;
153  m_z.resize(np, 0.0);
154  m_slast.resize(m_nv * m_points, 0.0);
155  locate();
156  }
157 
158  //! Return a reference to the grid refiner.
160  return *m_refiner;
161  }
162 
163  //! Number of components at each grid point.
164  size_t nComponents() const {
165  return m_nv;
166  }
167 
168  //! Check that the specified component index is in range
169  //! Throws an exception if n is greater than nComponents()-1
170  void checkComponentIndex(size_t n) const {
171  if (n >= m_nv) {
172  throw IndexError("checkComponentIndex", "points", n, m_nv-1);
173  }
174  }
175 
176  //! Check that an array size is at least nComponents()
177  //! Throws an exception if nn is less than nComponents(). Used before calls
178  //! which take an array pointer.
179  void checkComponentArraySize(size_t nn) const {
180  if (m_nv > nn) {
181  throw ArraySizeError("checkComponentArraySize", nn, m_nv);
182  }
183  }
184 
185  //! Number of grid points in this domain.
186  size_t nPoints() const {
187  return m_points;
188  }
189 
190  //! Check that the specified point index is in range
191  //! Throws an exception if n is greater than nPoints()-1
192  void checkPointIndex(size_t n) const {
193  if (n >= m_points) {
194  throw IndexError("checkPointIndex", "points", n, m_points-1);
195  }
196  }
197 
198  //! Check that an array size is at least nPoints()
199  //! Throws an exception if nn is less than nPoints(). Used before calls
200  //! which take an array pointer.
201  void checkPointArraySize(size_t nn) const {
202  if (m_points > nn) {
203  throw ArraySizeError("checkPointArraySize", nn, m_points);
204  }
205  }
206 
207  //! Name of the nth component. May be overloaded.
208  virtual std::string componentName(size_t n) const {
209  if (m_name[n] != "") {
210  return m_name[n];
211  } else {
212  return "component " + int2str(n);
213  }
214  }
215 
216  void setComponentName(size_t n, const std::string& name) {
217  m_name[n] = name;
218  }
219 
220  void setComponentType(size_t n, int ctype) {
221  if (ctype == 0) {
222  setAlgebraic(n);
223  }
224  }
225 
226  //! index of component with name \a name.
227  size_t componentIndex(const std::string& name) const {
228  size_t nc = nComponents();
229  for (size_t n = 0; n < nc; n++) {
230  if (name == componentName(n)) {
231  return n;
232  }
233  }
234  throw CanteraError("Domain1D::componentIndex",
235  "no component named "+name);
236  }
237 
238  //! Set the lower and upper bounds for each solution component.
239  //! @deprecated Use the scalar version
240  void setBounds(size_t nl, const doublereal* lower,
241  size_t nu, const doublereal* upper) {
242  warn_deprecated("setBounds", "Use the scalar version.");
243  if (nl < m_nv || nu < m_nv)
244  throw CanteraError("Domain1D::setBounds",
245  "wrong array size for solution bounds. "
246  "Size should be at least "+int2str(m_nv));
247  std::copy(upper, upper + m_nv, m_max.begin());
248  std::copy(lower, lower + m_nv, m_min.begin());
249  }
250 
251  void setBounds(size_t n, doublereal lower, doublereal upper) {
252  m_min[n] = lower;
253  m_max[n] = upper;
254  }
255 
256  //! set the error tolerances for all solution components.
257  //! @deprecated Use setTransientTolerances() and setSteadyTolerances().
258  void setTolerances(size_t nr, const doublereal* rtol,
259  size_t na, const doublereal* atol, int ts = 0);
260 
261  //! set the error tolerances for solution component \a n.
262  //! @deprecated Use setTransientTolerances() and setSteadyTolerances().
263  void setTolerances(size_t n, doublereal rtol, doublereal atol, int ts = 0);
264 
265  //! set scalar error tolerances. All solution components will have the
266  //! same relative and absolute error tolerances.
267  //! @deprecated Use setTransientTolerances() and setSteadyTolerances().
268  void setTolerances(doublereal rtol, doublereal atol,int ts=0);
269 
270  //! Set tolerances for time-stepping mode
271  /*!
272  * @param rtol Relative tolerance
273  * @param atol Absolute tolerance
274  * @param n component index these tolerances apply to. If set to -1
275  * (the default), these tolerances will be applied to all solution
276  * components.
277  */
278  void setTransientTolerances(doublereal rtol, doublereal atol, size_t n=npos);
279 
280  //! @deprecated use setTransientTolerances()
281  void setTolerancesTS(doublereal rtol, doublereal atol, size_t n=npos);
282 
283  //! Set tolerances for steady-state mode
284  /*!
285  * @param rtol Relative tolerance
286  * @param atol Absolute tolerance
287  * @param n component index these tolerances apply to. If set to -1
288  * (the default), these tolerances will be applied to all solution
289  * components.
290  */
291  void setSteadyTolerances(doublereal rtol, doublereal atol, size_t n=npos);
292 
293  //! @deprecated use setSteadyTolerances()
294  void setTolerancesSS(doublereal rtol, doublereal atol, size_t n=npos);
295 
296  //! Relative tolerance of the nth component.
297  doublereal rtol(size_t n) {
298  return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
299  }
300 
301  //! Absolute tolerance of the nth component.
302  doublereal atol(size_t n) {
303  return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
304  }
305 
306  //! Upper bound on the nth component.
307  doublereal upperBound(size_t n) const {
308  return m_max[n];
309  }
310 
311  //! Lower bound on the nth component
312  doublereal lowerBound(size_t n) const {
313  return m_min[n];
314  }
315 
316  /*!
317  * Prepare to do time stepping with time step dt. Copy the internally-
318  * stored solution at the last time step to array x0.
319  */
320  void initTimeInteg(doublereal dt, const doublereal* x0) {
321  std::copy(x0 + loc(), x0 + loc() + size(), m_slast.begin());
322  m_rdt = 1.0/dt;
323  }
324 
325  /*!
326  * Prepare to solve the steady-state problem. Set the internally-stored
327  * reciprocal of the time step to 0,0
328  */
329  void setSteadyMode() {
330  m_rdt = 0.0;
331  }
332 
333  //! True if in steady-state mode
334  bool steady() {
335  return (m_rdt == 0.0);
336  }
337 
338  //! True if not in steady-state mode
339  bool transient() {
340  return (m_rdt != 0.0);
341  }
342 
343  /*!
344  * Set this if something has changed in the governing
345  * equations (e.g. the value of a constant has been changed,
346  * so that the last-computed Jacobian is no longer valid.
347  * Note: see file OneDim.cpp for the implementation of this method.
348  */
349  void needJacUpdate();
350 
351  /*!
352  * Evaluate the steady-state residual at all points, even if in
353  * transient mode. Used only to print diagnostic output.
354  */
355  void evalss(doublereal* x, doublereal* r, integer* mask) {
356  eval(npos,x,r,mask,0.0);
357  }
358 
359  //! Evaluate the residual function at point j. If j == npos,
360  //! evaluate the residual function at all points.
361  /*!
362  * @param j Grid point at which to update the residual
363  * @param[in] x State vector
364  * @param[out] r residual vector
365  * @param[out] mask Boolean mask indicating whether each solution
366  * component has a time derivative (1) or not (0).
367  * @param[in] rdt Reciprocal of the timestep (`rdt=0` implies steady-
368  * state.)
369  */
370  virtual void eval(size_t j, doublereal* x, doublereal* r,
371  integer* mask, doublereal rdt=0.0);
372 
373  virtual doublereal residual(doublereal* x, size_t n, size_t j) {
374  throw CanteraError("Domain1D::residual","residual function must be overloaded in derived class "+id());
375  }
376 
377  int timeDerivativeFlag(size_t n) {
378  return m_td[n];
379  }
380  void setAlgebraic(size_t n) {
381  m_td[n] = 0;
382  }
383 
384  virtual void update(doublereal* x) {}
385 
386  doublereal time() const {
387  return m_time;
388  }
389  void incrementTime(doublereal dt) {
390  m_time += dt;
391  }
392  size_t index(size_t n, size_t j) const {
393  return m_nv*j + n;
394  }
395  doublereal value(const doublereal* x, size_t n, size_t j) const {
396  return x[index(n,j)];
397  }
398 
399  virtual void setJac(MultiJac* jac) {}
400 
401  //! Save the current solution for this domain into an XML_Node
402  /*!
403  * Base class version of the general domain1D save function. Derived
404  * classes should call the base class method in addition to saving their
405  * own data.
406  *
407  * @param o XML_Node to save the solution to.
408  * @param sol Current value of the solution vector.
409  * The object will pick out which part of the solution
410  * vector pertains to this object.
411  * @return XML_Node created to represent this domain
412  */
413  virtual XML_Node& save(XML_Node& o, const doublereal* const sol);
414 
415  //! Restore the solution for this domain from an XML_Node
416  /*!
417  * Base class version of the general Domain1D restore function. Derived
418  * classes should call the base class method in addition to restoring
419  * their own data.
420  *
421  * @param dom XML_Node for this domain
422  * @param soln Current value of the solution vector, local to this object.
423  * @param loglevel 0 to suppress all output; 1 to show warnings; 2 for
424  * verbose output
425  */
426  virtual void restore(const XML_Node& dom, doublereal* soln, int loglevel);
427 
428  size_t size() const {
429  return m_nv*m_points;
430  }
431 
432  /**
433  * Find the index of the first grid point in this domain, and
434  * the start of its variables in the global solution vector.
435  */
436  void locate() {
437 
438  if (m_left) {
439  // there is a domain on the left, so the first grid point
440  // in this domain is one more than the last one on the left
441  m_jstart = m_left->lastPoint() + 1;
442 
443  // the starting location in the solution vector
444  m_iloc = m_left->loc() + m_left->size();
445  } else {
446  // this is the left-most domain
447  m_jstart = 0;
448  m_iloc = 0;
449  }
450  // if there is a domain to the right of this one, then
451  // repeat this for it
452  if (m_right) {
453  m_right->locate();
454  }
455  }
456 
457  /**
458  * Location of the start of the local solution vector in the global
459  * solution vector,
460  */
461  virtual size_t loc(size_t j = 0) const {
462  return m_iloc;
463  }
464 
465  /**
466  * The index of the first (i.e., left-most) grid point
467  * belonging to this domain.
468  */
469  size_t firstPoint() const {
470  return m_jstart;
471  }
472 
473  /**
474  * The index of the last (i.e., right-most) grid point
475  * belonging to this domain.
476  */
477  size_t lastPoint() const {
478  return m_jstart + m_points - 1;
479  }
480 
481  /**
482  * Set the left neighbor to domain 'left.' Method 'locate' is called to
483  * update the global positions of this domain and all those to its right.
484  */
486  m_left = left;
487  locate();
488  }
489 
490  //! Set the right neighbor to domain 'right.'
492  m_right = right;
493  }
494 
495  //! Append domain 'right' to this one, and update all links.
497  linkRight(right);
498  right->linkLeft(this);
499  }
500 
501  //! Return a pointer to the left neighbor.
502  Domain1D* left() const {
503  return m_left;
504  }
505 
506  //! Return a pointer to the right neighbor.
507  Domain1D* right() const {
508  return m_right;
509  }
510 
511  //! Value of component n at point j in the previous solution.
512  double prevSoln(size_t n, size_t j) const {
513  return m_slast[m_nv*j + n];
514  }
515 
516  //! Specify an identifying tag for this domain.
517  void setID(const std::string& s) {
518  m_id = s;
519  }
520 
521  std::string id() const {
522  if (m_id != "") {
523  return m_id;
524  } else {
525  return std::string("domain ") + int2str(m_index);
526  }
527  }
528 
529  //! Specify descriptive text for this domain.
530  void setDesc(const std::string& s) {
531  m_desc = s;
532  }
533  const std::string& desc() {
534  return m_desc;
535  }
536 
537  virtual void getTransientMask(integer* mask) {}
538 
539  virtual void showSolution_s(std::ostream& s, const doublereal* x) {}
540 
541  //! Print the solution.
542  virtual void showSolution(const doublereal* x);
543 
544  doublereal z(size_t jlocal) const {
545  return m_z[jlocal];
546  }
547  doublereal zmin() const {
548  return m_z[0];
549  }
550  doublereal zmax() const {
551  return m_z[m_points - 1];
552  }
553 
554  void setProfile(const std::string& name, doublereal* values, doublereal* soln) {
555  for (size_t n = 0; n < m_nv; n++) {
556  if (name == componentName(n)) {
557  for (size_t j = 0; j < m_points; j++) {
558  soln[index(n, j) + m_iloc] = values[j];
559  }
560  return;
561  }
562  }
563  throw CanteraError("Domain1D::setProfile",
564  "unknown component: "+name);
565  }
566 
567  vector_fp& grid() {
568  return m_z;
569  }
570  const vector_fp& grid() const {
571  return m_z;
572  }
573  doublereal grid(size_t point) {
574  return m_z[point];
575  }
576 
577  //! called to set up initial grid, and after grid refinement
578  virtual void setupGrid(size_t n, const doublereal* z);
579 
580  void setGrid(size_t n, const doublereal* z);
581 
582  /**
583  * Writes some or all initial solution values into the global
584  * solution array, beginning at the location pointed to by
585  * x. This method is called by the Sim1D constructor, and
586  * allows default values or ones that have been set locally
587  * prior to installing this domain into the container to be
588  * written to the global solution vector.
589  */
590  virtual void _getInitialSoln(doublereal* x);
591 
592  //! Initial value of solution component \a n at grid point \a j.
593  virtual doublereal initialValue(size_t n, size_t j);
594 
595  /**
596  * In some cases, a domain may need to set parameters that
597  * depend on the initial solution estimate. In such cases, the
598  * parameters may be set in method _finalize. This method is
599  * called just before the Newton solver is called, and the x
600  * array is guaranteed to be the local solution vector for
601  * this domain that will be used as the initial guess. If no
602  * such parameters need to be set, then method _finalize does
603  * not need to be overloaded.
604  */
605  virtual void _finalize(const doublereal* x) {}
606 
607  doublereal m_zfixed;
608  doublereal m_tfixed;
609 
610  bool m_adiabatic;
611 
612 protected:
613  doublereal m_rdt;
614  size_t m_nv;
615  size_t m_points;
616  vector_fp m_slast;
617  doublereal m_time;
618  vector_fp m_max;
619  vector_fp m_min;
620  vector_fp m_rtol_ss, m_rtol_ts;
621  vector_fp m_atol_ss, m_atol_ts;
622  vector_fp m_z;
623  OneDim* m_container;
624  size_t m_index;
625  int m_type;
626 
627  //! Starting location within the solution vector for unknowns that
628  //! correspond to this domain
629  /*!
630  * Remember there may be multiple domains associated with this problem
631  */
632  size_t m_iloc;
633 
634  size_t m_jstart;
635 
636  Domain1D* m_left, *m_right;
637 
638  //! Identity tag for the domain
639  std::string m_id;
640  std::string m_desc;
641  Refiner* m_refiner;
642  vector_int m_td;
643  std::vector<std::string> m_name;
644  int m_bw;
645 };
646 }
647 
648 #endif
Container class for multiple-domain 1D problems.
Definition: OneDim.h:22
Array size error.
Definition: ctexceptions.h:123
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
Definition: stringUtils.cpp:40
virtual void _getInitialSoln(doublereal *x)
Writes some or all initial solution values into the global solution array, beginning at the location ...
Definition: Domain1D.cpp:273
size_t componentIndex(const std::string &name) const
index of component with name name.
Definition: Domain1D.h:227
size_t nPoints() const
Number of grid points in this domain.
Definition: Domain1D.h:186
Domain1D * left() const
Return a pointer to the left neighbor.
Definition: Domain1D.h:502
void locate()
Find the index of the first grid point in this domain, and the start of its variables in the global s...
Definition: Domain1D.h:436
void setSteadyMode()
Definition: Domain1D.h:329
void checkPointIndex(size_t n) const
Check that the specified point index is in range Throws an exception if n is greater than nPoints()-1...
Definition: Domain1D.h:192
size_t m_iloc
Starting location within the solution vector for unknowns that correspond to this domain...
Definition: Domain1D.h:632
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:173
size_t firstPoint() const
The index of the first (i.e., left-most) grid point belonging to this domain.
Definition: Domain1D.h:469
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
Definition: Domain1D.h:208
virtual size_t loc(size_t j=0) const
Location of the start of the local solution vector in the global solution vector,.
Definition: Domain1D.h:461
void setTolerancesSS(doublereal rtol, doublereal atol, size_t n=npos)
Definition: Domain1D.cpp:101
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:76
void setContainer(OneDim *c, size_t index)
Definition: Domain1D.h:91
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
Definition: Domain1D.cpp:167
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
Definition: Domain1D.cpp:154
void linkLeft(Domain1D *left)
Set the left neighbor to domain 'left.
Definition: Domain1D.h:485
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:167
void checkComponentIndex(size_t n) const
Check that the specified component index is in range Throws an exception if n is greater than nCompon...
Definition: Domain1D.h:170
void setBounds(size_t nl, const doublereal *lower, size_t nu, const doublereal *upper)
Set the lower and upper bounds for each solution component.
Definition: Domain1D.h:240
void setBandwidth(int bw=-1)
Set the Jacobian bandwidth. See the discussion of method bandwidth().
Definition: Domain1D.h:97
size_t nComponents() const
Number of components at each grid point.
Definition: Domain1D.h:164
Base class for one-dimensional domains.
Definition: Domain1D.h:37
std::string m_id
Identity tag for the domain.
Definition: Domain1D.h:639
void setTolerances(size_t nr, const doublereal *rtol, size_t na, const doublereal *atol, int ts=0)
set the error tolerances for all solution components.
Definition: Domain1D.cpp:17
size_t bandwidth()
Set the Jacobian bandwidth for this domain.
Definition: Domain1D.h:116
size_t lastPoint() const
The index of the last (i.e., right-most) grid point belonging to this domain.
Definition: Domain1D.h:477
void setID(const std::string &s)
Specify an identifying tag for this domain.
Definition: Domain1D.h:517
doublereal lowerBound(size_t n) const
Lower bound on the nth component.
Definition: Domain1D.h:312
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
Definition: Domain1D.h:605
Classes providing support for XML data files.
virtual void showSolution(const doublereal *x)
Print the solution.
Definition: Domain1D.cpp:225
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:68
Domain1D * right() const
Return a pointer to the right neighbor.
Definition: Domain1D.h:507
virtual void resize(size_t nv, size_t np)
Definition: Domain1D.h:135
void setDesc(const std::string &s)
Specify descriptive text for this domain.
Definition: Domain1D.h:530
Refiner & refiner()
Return a reference to the grid refiner.
Definition: Domain1D.h:159
doublereal upperBound(size_t n) const
Upper bound on the nth component.
Definition: Domain1D.h:307
void evalss(doublereal *x, doublereal *r, integer *mask)
Definition: Domain1D.h:355
void checkPointArraySize(size_t nn) const
Check that an array size is at least nPoints() Throws an exception if nn is less than nPoints()...
Definition: Domain1D.h:201
int domainType()
Domain type flag.
Definition: Domain1D.h:68
size_t domainIndex()
The left-to-right location of this domain.
Definition: Domain1D.h:73
Domain1D(size_t nv=1, size_t points=1, doublereal time=0.0)
Constructor.
Definition: Domain1D.h:46
void setSteadyTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for steady-state mode.
Definition: Domain1D.cpp:88
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt=0.0)
Evaluate the residual function at point j.
Definition: Domain1D.cpp:109
void append(Domain1D *right)
Append domain 'right' to this one, and update all links.
Definition: Domain1D.h:496
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:165
bool steady()
True if in steady-state mode.
Definition: Domain1D.h:334
void setTolerancesTS(doublereal rtol, doublereal atol, size_t n=npos)
Definition: Domain1D.cpp:81
Contains declarations for string manipulation functions within Cantera.
void linkRight(Domain1D *right)
Set the right neighbor to domain 'right.'.
Definition: Domain1D.h:491
void checkComponentArraySize(size_t nn) const
Check that an array size is at least nComponents() Throws an exception if nn is less than nComponents...
Definition: Domain1D.h:179
doublereal atol(size_t n)
Absolute tolerance of the nth component.
Definition: Domain1D.h:302
const OneDim & container() const
The container holding this domain.
Definition: Domain1D.h:83
Refine Domain1D grids so that profiles satisfy adaptation tolerances.
Definition: refine.h:13
doublereal rtol(size_t n)
Relative tolerance of the nth component.
Definition: Domain1D.h:297
An array index is out of range.
Definition: ctexceptions.h:153
void needJacUpdate()
Definition: OneDim.cpp:323
bool isConnector()
True if the domain is a connector domain.
Definition: Domain1D.h:78
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
Definition: Domain1D.h:512
void setTransientTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for time-stepping mode.
Definition: Domain1D.cpp:68
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
Definition: Domain1D.cpp:209
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
virtual void init()
Definition: Domain1D.h:125
virtual doublereal initialValue(size_t n, size_t j)
Initial value of solution component n at grid point j.
Definition: Domain1D.cpp:282
void initTimeInteg(doublereal dt, const doublereal *x0)
Definition: Domain1D.h:320