Cantera  3.0.0
Loading...
Searching...
No Matches
Domain1D.h
Go to the documentation of this file.
1 //! @file Domain1D.h
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
6#ifndef CT_DOMAIN1D_H
7#define CT_DOMAIN1D_H
8
10
11namespace Cantera
12{
13
14// domain types (deprecated); to be removed after Cantera 3.0
15const int cFlowType = 50;
16const int cFreeFlow = 51;
17const int cAxisymmetricStagnationFlow = 52;
18const int cConnectorType = 100;
19const int cSurfType = 102;
20const int cInletType = 104;
21const int cSymmType = 105;
22const int cOutletType = 106;
23const int cEmptyType = 107;
24const int cOutletResType = 108;
25const int cPorousType = 109;
26
27class MultiJac;
28class OneDim;
29class Refiner;
30class AnyMap;
31class Kinetics;
32class Transport;
33class Solution;
34class SolutionArray;
35
36/**
37 * Base class for one-dimensional domains.
38 * @ingroup flowGroup
39 */
41{
42public:
43 /**
44 * Constructor.
45 * @param nv Number of variables at each grid point.
46 * @param points Number of grid points.
47 * @param time (unused)
48 */
49 Domain1D(size_t nv=1, size_t points=1, double time=0.0);
50
51 virtual ~Domain1D();
52 Domain1D(const Domain1D&) = delete;
53 Domain1D& operator=(const Domain1D&) = delete;
54
55 //! Domain type flag.
56 //! @deprecated To be changed after %Cantera 3.0; for new behavior, see type.
57 int domainType();
58
59 //! String indicating the domain implemented.
60 //! @since New in %Cantera 3.0.
61 //! @todo Transition back to domainType after %Cantera 3.0
62 virtual string type() const {
63 return "domain";
64 }
65
66 //! The left-to-right location of this domain.
67 size_t domainIndex() {
68 return m_index;
69 }
70
71 //! True if the domain is a connector domain.
72 virtual bool isConnector() {
73 return false;
74 }
75
76 //! Set the solution manager.
77 //! @since New in %Cantera 3.0.
78 void setSolution(shared_ptr<Solution> sol) {
79 m_solution = sol;
80 }
81
82 //! Set the kinetics manager.
83 //! @since New in %Cantera 3.0.
84 virtual void setKinetics(shared_ptr<Kinetics> kin) {
85 throw NotImplementedError("Domain1D::setKinetics");
86 }
87
88 //! Set transport model to existing instance
89 //! @since New in %Cantera 3.0.
90 virtual void setTransport(shared_ptr<Transport> trans) {
91 throw NotImplementedError("Domain1D::setTransport");
92 }
93
94 //! The container holding this domain.
95 const OneDim& container() const {
96 return *m_container;
97 }
98
99 //! Specify the container object for this domain, and the position of this
100 //! domain in the list.
101 void setContainer(OneDim* c, size_t index) {
102 m_container = c;
103 m_index = index;
104 }
105
106 //! Set the Jacobian bandwidth. See the discussion of method bandwidth().
107 void setBandwidth(int bw = -1) {
108 m_bw = bw;
109 }
110
111 //! Set the Jacobian bandwidth for this domain.
112 /**
113 * When class OneDim computes the bandwidth of the overall multi-domain
114 * problem (in OneDim::resize()), it calls this method for the bandwidth
115 * of each domain. If setBandwidth has not been called, then a negative
116 * bandwidth is returned, in which case OneDim assumes that this domain is
117 * dense -- that is, at each point, all components depend on the value of
118 * all other components at that point. In this case, the bandwidth is bw =
119 * 2*nComponents() - 1. However, if this domain contains some components
120 * that are uncoupled from other components at the same point, then this
121 * default bandwidth may greatly overestimate the true bandwidth, with a
122 * substantial penalty in performance. For such domains, use method
123 * setBandwidth to specify the bandwidth before passing this domain to the
124 * Sim1D or OneDim constructor.
125 */
126 size_t bandwidth() {
127 return m_bw;
128 }
129
130 /**
131 * Initialize. This method is called by OneDim::init() for each domain once
132 * at the beginning of a simulation. Base class method does nothing, but may
133 * be overloaded.
134 */
135 virtual void init() { }
136
137 virtual void setInitialState(double* xlocal = 0) {}
138 virtual void setState(size_t point, const double* state, double* x) {}
139
140 /**
141 * When called, this function should reset "bad" values in the state vector
142 * such as negative species concentrations. This function may be called
143 * after a failed solution attempt.
144 */
145 virtual void resetBadValues(double* xg) {}
146
147 /**
148 * Resize the domain to have nv components and np grid points. This method
149 * is virtual so that subclasses can perform other actions required to
150 * resize the domain.
151 */
152 virtual void resize(size_t nv, size_t np);
153
154 //! Return a reference to the grid refiner.
156 return *m_refiner;
157 }
158
159 //! Number of components at each grid point.
160 size_t nComponents() const {
161 return m_nv;
162 }
163
164 //! Check that the specified component index is in range.
165 //! Throws an exception if n is greater than nComponents()-1
166 void checkComponentIndex(size_t n) const {
167 if (n >= m_nv) {
168 throw IndexError("Domain1D::checkComponentIndex", "points", n, m_nv-1);
169 }
170 }
171
172 //! Check that an array size is at least nComponents().
173 //! Throws an exception if nn is less than nComponents(). Used before calls
174 //! which take an array pointer.
175 void checkComponentArraySize(size_t nn) const {
176 if (m_nv > nn) {
177 throw ArraySizeError("Domain1D::checkComponentArraySize", nn, m_nv);
178 }
179 }
180
181 //! Number of grid points in this domain.
182 size_t nPoints() const {
183 return m_points;
184 }
185
186 //! Check that the specified point index is in range.
187 //! Throws an exception if n is greater than nPoints()-1
188 void checkPointIndex(size_t n) const {
189 if (n >= m_points) {
190 throw IndexError("Domain1D::checkPointIndex", "points", n, m_points-1);
191 }
192 }
193
194 //! Check that an array size is at least nPoints().
195 //! Throws an exception if nn is less than nPoints(). Used before calls
196 //! which take an array pointer.
197 void checkPointArraySize(size_t nn) const {
198 if (m_points > nn) {
199 throw ArraySizeError("Domain1D::checkPointArraySize", nn, m_points);
200 }
201 }
202
203 //! Name of the nth component. May be overloaded.
204 virtual string componentName(size_t n) const;
205
206 void setComponentName(size_t n, const string& name) {
207 m_name[n] = name;
208 }
209
210 //! index of component with name @e name.
211 virtual size_t componentIndex(const string& name) const;
212
213 void setBounds(size_t n, double lower, double upper) {
214 m_min[n] = lower;
215 m_max[n] = upper;
216 }
217
218 //! Set tolerances for time-stepping mode
219 /*!
220 * @param rtol Relative tolerance
221 * @param atol Absolute tolerance
222 * @param n component index these tolerances apply to. If set to -1 (the
223 * default), these tolerances will be applied to all solution
224 * components.
225 */
226 void setTransientTolerances(double rtol, double atol, size_t n=npos);
227
228 //! Set tolerances for steady-state mode
229 /*!
230 * @param rtol Relative tolerance
231 * @param atol Absolute tolerance
232 * @param n component index these tolerances apply to. If set to -1 (the
233 * default), these tolerances will be applied to all solution
234 * components.
235 */
236 void setSteadyTolerances(double rtol, double atol, size_t n=npos);
237
238 //! Relative tolerance of the nth component.
239 double rtol(size_t n) {
240 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
241 }
242
243 //! Absolute tolerance of the nth component.
244 double atol(size_t n) {
245 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
246 }
247
248 //! Steady relative tolerance of the nth component
249 double steady_rtol(size_t n) {
250 return m_rtol_ss[n];
251 }
252
253 //! Steady absolute tolerance of the nth component
254 double steady_atol(size_t n) {
255 return m_atol_ss[n];
256 }
257
258 //! Transient relative tolerance of the nth component
259 double transient_rtol(size_t n) {
260 return m_rtol_ts[n];
261 }
262
263 //! Transient absolute tolerance of the nth component
264 double transient_atol(size_t n) {
265 return m_atol_ts[n];
266 }
267
268 //! Upper bound on the nth component.
269 double upperBound(size_t n) const {
270 return m_max[n];
271 }
272
273 //! Lower bound on the nth component
274 double lowerBound(size_t n) const {
275 return m_min[n];
276 }
277
278 //! Prepare to do time stepping with time step dt
279 /*!
280 * Copy the internally-stored solution at the last time step to array x0.
281 */
282 void initTimeInteg(double dt, const double* x0) {
283 std::copy(x0 + loc(), x0 + loc() + size(), m_slast.begin());
284 m_rdt = 1.0/dt;
285 }
286
287 //! Prepare to solve the steady-state problem
288 /*!
289 * Set the internally-stored reciprocal of the time step to 0.0
290 */
292 m_rdt = 0.0;
293 }
294
295 //! True if in steady-state mode
296 bool steady() {
297 return (m_rdt == 0.0);
298 }
299
300 //! True if not in steady-state mode
301 bool transient() {
302 return (m_rdt != 0.0);
303 }
304
305 /**
306 * Set this if something has changed in the governing
307 * equations (for example, the value of a constant has been changed,
308 * so that the last-computed Jacobian is no longer valid.
309 */
310 void needJacUpdate();
311
312 //! Evaluate the residual function at point j. If j == npos,
313 //! evaluate the residual function at all points.
314 /*!
315 * This function must be implemented in classes derived from Domain1D.
316 *
317 * @param j Grid point at which to update the residual
318 * @param[in] x State vector
319 * @param[out] r residual vector
320 * @param[out] mask Boolean mask indicating whether each solution
321 * component has a time derivative (1) or not (0).
322 * @param[in] rdt Reciprocal of the timestep (`rdt=0` implies steady-
323 * state.)
324 */
325 virtual void eval(size_t j, double* x, double* r, integer* mask, double rdt=0.0) {
326 throw NotImplementedError("Domain1D::eval");
327 }
328
329 size_t index(size_t n, size_t j) const {
330 return m_nv*j + n;
331 }
332 double value(const double* x, size_t n, size_t j) const {
333 return x[index(n,j)];
334 }
335
336 virtual void setJac(MultiJac* jac) {}
337
338 //! Save the state of this domain as an AnyMap
339 /*!
340 * @param soln local solution vector for this domain
341 *
342 * @deprecated To be removed after %Cantera 3.0; superseded by asArray().
343 */
344 AnyMap serialize(const double* soln) const;
345
346 //! Save the state of this domain as a SolutionArray.
347 /*!
348 * @param soln local solution vector for this domain
349 * @todo Despite the method's name, data are copied; the intent is to access data
350 * directly in future revisions, where a non-const version will be implemented.
351 *
352 * @since New in %Cantera 3.0.
353 */
354 virtual shared_ptr<SolutionArray> asArray(const double* soln) const {
355 throw NotImplementedError("Domain1D::asArray", "Needs to be overloaded.");
356 }
357
358 //! Save the state of this domain to a SolutionArray.
359 /*!
360 * This method serves as an external interface for high-level API's; it does not
361 * provide direct access to memory.
362 * @param normalize If true, normalize concentrations (default=false)
363 *
364 * @since New in %Cantera 3.0.
365 */
366 shared_ptr<SolutionArray> toArray(bool normalize=false) const;
367
368 //! Restore the solution for this domain from an AnyMap
369 /*!
370 * @param[in] state AnyMap defining the state of this domain
371 * @param[out] soln Value of the solution vector, local to this domain
372 * @param[in] loglevel 0 to suppress all output; 1 to show warnings; 2 for
373 * verbose output
374 *
375 * @deprecated To be removed after %Cantera 3.0; restore from SolutionArray instead.
376 */
377 void restore(const AnyMap& state, double* soln, int loglevel);
378
379 //! Restore the solution for this domain from a SolutionArray
380 /*!
381 * @param[in] arr SolutionArray defining the state of this domain
382 * @param[out] soln Value of the solution vector, local to this domain
383 *
384 * @since New in %Cantera 3.0.
385 */
386 virtual void fromArray(SolutionArray& arr, double* soln) {
387 throw NotImplementedError("Domain1D::fromArray", "Needs to be overloaded.");
388 }
389
390 //! Restore the solution for this domain from a SolutionArray.
391 /*!
392 * This method serves as an external interface for high-level API's.
393 * @param arr SolutionArray defining the state of this domain
394 * @since New in %Cantera 3.0.
395 */
396 void fromArray(const shared_ptr<SolutionArray>& arr);
397
398 //! Return thermo/kinetics/transport manager used in the domain
399 //! @since New in %Cantera 3.0.
400 shared_ptr<Solution> solution() const {
401 return m_solution;
402 }
403
404 size_t size() const {
405 return m_nv*m_points;
406 }
407
408 /**
409 * Find the index of the first grid point in this domain, and
410 * the start of its variables in the global solution vector.
411 */
412 void locate();
413
414 /**
415 * Location of the start of the local solution vector in the global
416 * solution vector,
417 */
418 virtual size_t loc(size_t j = 0) const {
419 return m_iloc;
420 }
421
422 /**
423 * The index of the first (that is, left-most) grid point belonging to this
424 * domain.
425 */
426 size_t firstPoint() const {
427 return m_jstart;
428 }
429
430 /**
431 * The index of the last (that is, right-most) grid point belonging to this
432 * domain.
433 */
434 size_t lastPoint() const {
435 return m_jstart + m_points - 1;
436 }
437
438 /**
439 * Set the left neighbor to domain 'left.' Method 'locate' is called to
440 * update the global positions of this domain and all those to its right.
441 */
443 m_left = left;
444 if (!m_solution && left && left->solution()) {
446 }
447 locate();
448 }
449
450 //! Set the right neighbor to domain 'right.'
452 m_right = right;
453 if (!m_solution && right && right->solution()) {
455 }
456 }
457
458 //! Append domain 'right' to this one, and update all links.
461 right->linkLeft(this);
462 }
463
464 //! Return a pointer to the left neighbor.
465 Domain1D* left() const {
466 return m_left;
467 }
468
469 //! Return a pointer to the right neighbor.
470 Domain1D* right() const {
471 return m_right;
472 }
473
474 //! Value of component n at point j in the previous solution.
475 double prevSoln(size_t n, size_t j) const {
476 return m_slast[m_nv*j + n];
477 }
478
479 //! Specify an identifying tag for this domain.
480 void setID(const string& s) {
481 m_id = s;
482 }
483
484 string id() const {
485 if (m_id != "") {
486 return m_id;
487 } else {
488 return fmt::format("domain {}", m_index);
489 }
490 }
491
492 //! @deprecated To be removed after %Cantera 3.0; replaced by show()
493 virtual void showSolution_s(std::ostream& s, const double* x);
494
495 //! Print the solution.
496 //! @deprecated To be removed after %Cantera 3.0; replaced by show()
497 virtual void showSolution(const double* x);
498
499 //! Print the solution.
500 virtual void show(std::ostream& s, const double* x) {}
501
502 //! Print the solution.
503 virtual void show(const double* x);
504
505 double z(size_t jlocal) const {
506 return m_z[jlocal];
507 }
508 double zmin() const {
509 return m_z[0];
510 }
511 double zmax() const {
512 return m_z[m_points - 1];
513 }
514
515 void setProfile(const string& name, double* values, double* soln);
516
517 vector<double>& grid() {
518 return m_z;
519 }
520 const vector<double>& grid() const {
521 return m_z;
522 }
523 double grid(size_t point) const {
524 return m_z[point];
525 }
526
527 //! called to set up initial grid, and after grid refinement
528 virtual void setupGrid(size_t n, const double* z);
529
530 /**
531 * Writes some or all initial solution values into the global solution
532 * array, beginning at the location pointed to by x. This method is called
533 * by the Sim1D constructor, and allows default values or ones that have
534 * been set locally prior to installing this domain into the container to be
535 * written to the global solution vector.
536 */
537 virtual void _getInitialSoln(double* x);
538
539 //! Initial value of solution component @e n at grid point @e j.
540 virtual double initialValue(size_t n, size_t j);
541
542 /**
543 * In some cases, a domain may need to set parameters that depend on the
544 * initial solution estimate. In such cases, the parameters may be set in
545 * method _finalize. This method is called just before the Newton solver is
546 * called, and the x array is guaranteed to be the local solution vector for
547 * this domain that will be used as the initial guess. If no such parameters
548 * need to be set, then method _finalize does not need to be overloaded.
549 */
550 virtual void _finalize(const double* x) {}
551
552 /**
553 * In some cases, for computational efficiency some properties (such as
554 * transport coefficients) may not be updated during Jacobian evaluations.
555 * Set this to `true` to force these properties to be updated even while
556 * calculating Jacobian elements.
557 */
558 void forceFullUpdate(bool update) {
559 m_force_full_update = update;
560 }
561
562 //! Set shared data pointer
563 void setData(shared_ptr<vector<double>>& data) {
564 m_state = data;
565 }
566
567protected:
568 //! Retrieve meta data
569 virtual AnyMap getMeta() const;
570
571 //! Retrieve meta data
572 virtual void setMeta(const AnyMap& meta);
573
574 shared_ptr<vector<double>> m_state; //!< data pointer shared from OneDim
575
576 double m_rdt = 0.0;
577 size_t m_nv = 0;
578 size_t m_points; //!< Number of grid points
579 vector<double> m_slast;
580 vector<double> m_max;
581 vector<double> m_min;
582 vector<double> m_rtol_ss, m_rtol_ts;
583 vector<double> m_atol_ss, m_atol_ts;
584 vector<double> m_z;
585 OneDim* m_container = nullptr;
586 size_t m_index;
587 int m_type = 0; //!< @deprecated To be removed after %Cantera 3.0
588
589 //! Starting location within the solution vector for unknowns that
590 //! correspond to this domain
591 /*!
592 * Remember there may be multiple domains associated with this problem
593 */
594 size_t m_iloc = 0;
595
596 size_t m_jstart = 0;
597
598 Domain1D* m_left = nullptr;
599 Domain1D* m_right = nullptr;
600
601 //! Identity tag for the domain
602 string m_id;
603 unique_ptr<Refiner> m_refiner;
604 vector<string> m_name;
605 int m_bw = -1;
606 bool m_force_full_update = false;
607
608 //! Composite thermo/kinetics/transport handler
609 shared_ptr<Solution> m_solution;
610};
611}
612
613#endif
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Array size error.
Base class for one-dimensional domains.
Definition Domain1D.h:41
void setTransientTolerances(double rtol, double atol, size_t n=npos)
Set tolerances for time-stepping mode.
Definition Domain1D.cpp:76
virtual void resetBadValues(double *xg)
When called, this function should reset "bad" values in the state vector such as negative species con...
Definition Domain1D.h:145
size_t lastPoint() const
The index of the last (that is, right-most) grid point belonging to this domain.
Definition Domain1D.h:434
size_t m_iloc
Starting location within the solution vector for unknowns that correspond to this domain.
Definition Domain1D.h:594
void checkPointArraySize(size_t nn) const
Check that an array size is at least nPoints().
Definition Domain1D.h:197
size_t domainIndex()
The left-to-right location of this domain.
Definition Domain1D.h:67
shared_ptr< Solution > m_solution
Composite thermo/kinetics/transport handler.
Definition Domain1D.h:609
bool transient()
True if not in steady-state mode.
Definition Domain1D.h:301
size_t nComponents() const
Number of components at each grid point.
Definition Domain1D.h:160
size_t bandwidth()
Set the Jacobian bandwidth for this domain.
Definition Domain1D.h:126
double rtol(size_t n)
Relative tolerance of the nth component.
Definition Domain1D.h:239
AnyMap serialize(const double *soln) const
Save the state of this domain as an AnyMap.
Definition Domain1D.cpp:138
shared_ptr< Solution > solution() const
Return thermo/kinetics/transport manager used in the domain.
Definition Domain1D.h:400
virtual bool isConnector()
True if the domain is a connector domain.
Definition Domain1D.h:72
virtual void setTransport(shared_ptr< Transport > trans)
Set transport model to existing instance.
Definition Domain1D.h:90
virtual void setMeta(const AnyMap &meta)
Retrieve meta data.
Definition Domain1D.cpp:172
virtual void _finalize(const double *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate.
Definition Domain1D.h:550
virtual string type() const
String indicating the domain implemented.
Definition Domain1D.h:62
Domain1D * left() const
Return a pointer to the left neighbor.
Definition Domain1D.h:465
void setContainer(OneDim *c, size_t index)
Specify the container object for this domain, and the position of this domain in the list.
Definition Domain1D.h:101
size_t nPoints() const
Number of grid points in this domain.
Definition Domain1D.h:182
double lowerBound(size_t n) const
Lower bound on the nth component.
Definition Domain1D.h:274
void checkComponentIndex(size_t n) const
Check that the specified component index is in range.
Definition Domain1D.h:166
shared_ptr< vector< double > > m_state
data pointer shared from OneDim
Definition Domain1D.h:574
void linkLeft(Domain1D *left)
Set the left neighbor to domain 'left.
Definition Domain1D.h:442
virtual void resize(size_t nv, size_t np)
Resize the domain to have nv components and np grid points.
Definition Domain1D.cpp:33
double upperBound(size_t n) const
Upper bound on the nth component.
Definition Domain1D.h:269
Refiner & refiner()
Return a reference to the grid refiner.
Definition Domain1D.h:155
Domain1D * right() const
Return a pointer to the right neighbor.
Definition Domain1D.h:470
double steady_atol(size_t n)
Steady absolute tolerance of the nth component.
Definition Domain1D.h:254
void setSteadyTolerances(double rtol, double atol, size_t n=npos)
Set tolerances for steady-state mode.
Definition Domain1D.cpp:89
virtual shared_ptr< SolutionArray > asArray(const double *soln) const
Save the state of this domain as a SolutionArray.
Definition Domain1D.h:354
virtual string componentName(size_t n) const
Name of the nth component. May be overloaded.
Definition Domain1D.cpp:56
double transient_atol(size_t n)
Transient absolute tolerance of the nth component.
Definition Domain1D.h:264
void setSolution(shared_ptr< Solution > sol)
Set the solution manager.
Definition Domain1D.h:78
virtual void init()
Initialize.
Definition Domain1D.h:135
double atol(size_t n)
Absolute tolerance of the nth component.
Definition Domain1D.h:244
void setID(const string &s)
Specify an identifying tag for this domain.
Definition Domain1D.h:480
void forceFullUpdate(bool update)
In some cases, for computational efficiency some properties (such as transport coefficients) may not ...
Definition Domain1D.h:558
const OneDim & container() const
The container holding this domain.
Definition Domain1D.h:95
virtual void setKinetics(shared_ptr< Kinetics > kin)
Set the kinetics manager.
Definition Domain1D.h:84
void restore(const AnyMap &state, double *soln, int loglevel)
Restore the solution for this domain from an AnyMap.
Definition Domain1D.cpp:204
shared_ptr< SolutionArray > toArray(bool normalize=false) const
Save the state of this domain to a SolutionArray.
Definition Domain1D.cpp:148
size_t m_points
Number of grid points.
Definition Domain1D.h:578
bool steady()
True if in steady-state mode.
Definition Domain1D.h:296
void setBandwidth(int bw=-1)
Set the Jacobian bandwidth. See the discussion of method bandwidth().
Definition Domain1D.h:107
double steady_rtol(size_t n)
Steady relative tolerance of the nth component.
Definition Domain1D.h:249
string m_id
Identity tag for the domain.
Definition Domain1D.h:602
void initTimeInteg(double dt, const double *x0)
Prepare to do time stepping with time step dt.
Definition Domain1D.h:282
virtual void showSolution(const double *x)
Print the solution.
Definition Domain1D.cpp:250
void setData(shared_ptr< vector< double > > &data)
Set shared data pointer.
Definition Domain1D.h:563
virtual void eval(size_t j, double *x, double *r, integer *mask, double rdt=0.0)
Evaluate the residual function at point j.
Definition Domain1D.h:325
void append(Domain1D *right)
Append domain 'right' to this one, and update all links.
Definition Domain1D.h:459
void setSteadyMode()
Prepare to solve the steady-state problem.
Definition Domain1D.h:291
int domainType()
Domain type flag.
Definition Domain1D.cpp:26
virtual double initialValue(size_t n, size_t j)
Initial value of solution component n at grid point j.
Definition Domain1D.cpp:315
void checkPointIndex(size_t n) const
Check that the specified point index is in range.
Definition Domain1D.h:188
virtual size_t componentIndex(const string &name) const
index of component with name name.
Definition Domain1D.cpp:65
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
Definition Domain1D.h:475
virtual void fromArray(SolutionArray &arr, double *soln)
Restore the solution for this domain from a SolutionArray.
Definition Domain1D.h:386
size_t firstPoint() const
The index of the first (that is, left-most) grid point belonging to this domain.
Definition Domain1D.h:426
virtual void showSolution_s(std::ostream &s, const double *x)
Definition Domain1D.cpp:243
void needJacUpdate()
Set this if something has changed in the governing equations (for example, the value of a constant ha...
Definition Domain1D.cpp:102
void linkRight(Domain1D *right)
Set the right neighbor to domain 'right.'.
Definition Domain1D.h:451
virtual void _getInitialSoln(double *x)
Writes some or all initial solution values into the global solution array, beginning at the location ...
Definition Domain1D.cpp:306
void checkComponentArraySize(size_t nn) const
Check that an array size is at least nComponents().
Definition Domain1D.h:175
double transient_rtol(size_t n)
Transient relative tolerance of the nth component.
Definition Domain1D.h:259
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:418
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.cpp:213
virtual AnyMap getMeta() const
Retrieve meta data.
Definition Domain1D.cpp:110
virtual void show(std::ostream &s, const double *x)
Print the solution.
Definition Domain1D.h:500
virtual void setupGrid(size_t n, const double *z)
called to set up initial grid, and after grid refinement
Definition Domain1D.cpp:233
An array index is out of range.
An error indicating that an unimplemented function has been called.
Container class for multiple-domain 1D problems.
Definition OneDim.h:27
Refine Domain1D grids so that profiles satisfy adaptation tolerances.
Definition refine.h:17
A container class holding arrays of state information.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:195