18 const int cFlowType = 50;
19 const int cConnectorType = 100;
20 const int cSurfType = 102;
21 const int cInletType = 104;
22 const int cSymmType = 105;
23 const int cOutletType = 106;
24 const int cEmptyType = 107;
25 const int cOutletResType = 108;
26 const int cPorousType = 109;
61 return (m_type >= cConnectorType);
107 virtual void setInitialState(doublereal* xlocal = 0) {}
108 virtual void setState(
size_t point,
const doublereal* state, doublereal* x) {}
122 virtual void resize(
size_t nv,
size_t np);
138 throw IndexError(
"checkComponentIndex",
"points", n, m_nv-1);
160 throw IndexError(
"checkPointIndex",
"points", n, m_points-1);
176 void setComponentName(
size_t n,
const std::string& name) {
183 "To be removed after Cantera 2.3.");
192 void setBounds(
size_t n, doublereal lower, doublereal upper) {
219 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
224 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
262 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
276 return (m_rdt == 0.0);
281 return (m_rdt != 0.0);
296 void evalss(doublereal* x, doublereal* r, integer* mask) {
297 warn_deprecated(
"Domain1D::evalss",
"To be removed after Cantera 2.3");
314 virtual void eval(
size_t j, doublereal* x, doublereal* r,
315 integer* mask, doublereal rdt=0.0);
319 virtual doublereal
residual(doublereal* x,
size_t n,
size_t j) {
320 warn_deprecated(
"Domain1D::residual",
"To be removed after Cantera 2.3.");
321 throw CanteraError(
"Domain1D::residual",
"residual function must be overloaded in derived class "+
id());
327 "To be removed after Cantera 2.3.");
334 "To be removed after Cantera 2.3.");
340 warn_deprecated(
"Domain1D::update",
"To be removed after Cantera 2.3.");
351 "To be removed after Cantera 2.3.");
354 size_t index(
size_t n,
size_t j)
const {
357 doublereal value(
const doublereal* x,
size_t n,
size_t j)
const {
358 return x[index(n,j)];
361 virtual void setJac(MultiJac* jac) {}
374 virtual XML_Node&
save(XML_Node& o,
const doublereal*
const sol);
387 virtual void restore(
const XML_Node& dom, doublereal* soln,
int loglevel);
389 size_t size()
const {
390 return m_nv*m_points;
403 virtual size_t loc(
size_t j = 0)
const {
420 return m_jstart + m_points - 1;
455 return m_slast[m_nv*j + n];
463 std::string id()
const {
467 return fmt::format(
"domain {}", m_index);
474 warn_deprecated(
"Domain1D::setDesc",
"To be removed after Cantera 2.3.");
487 "To be removed after Cantera 2.3.");
490 virtual void showSolution_s(std::ostream& s,
const doublereal* x) {}
495 doublereal z(
size_t jlocal)
const {
498 doublereal zmin()
const {
501 doublereal zmax()
const {
502 return m_z[m_points - 1];
505 void setProfile(
const std::string& name,
double* values,
double* soln);
513 doublereal grid(
size_t point)
const {
518 virtual void setupGrid(
size_t n,
const doublereal* z);
549 m_force_full_update =
update;
581 std::unique_ptr<Refiner> m_refiner;
583 std::vector<std::string> m_name;
585 bool m_force_full_update;
Domain1D(size_t nv=1, size_t points=1, double time=0.0)
Constructor.
Container class for multiple-domain 1D problems.
const OneDim & container() const
The container holding this domain.
virtual void _getInitialSoln(doublereal *x)
Writes some or all initial solution values into the global solution array, beginning at the location ...
double steady_rtol(size_t n)
Steady relative tolerance of the nth component.
void locate()
Find the index of the first grid point in this domain, and the start of its variables in the global s...
void setSteadyMode()
Prepare to solve the steady-state problem.
size_t m_iloc
Starting location within the solution vector for unknowns that correspond to this domain...
const size_t npos
index returned by functions to indicate "no position"
Domain1D * right() const
Return a pointer to the right neighbor.
size_t firstPoint() const
The index of the first (i.e., left-most) grid point belonging to this domain.
void setAlgebraic(size_t n)
virtual doublereal residual(doublereal *x, size_t n, size_t j)
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
void forceFullUpdate(bool update)
In some cases, for computational efficiency some properties (e.g.
void checkPointIndex(size_t n) const
Check that the specified point index is in range.
void setContainer(OneDim *c, size_t index)
Specify the container object for this domain, and the position of this domain in the list...
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, (see Input File Handling, Diagnostic Output, and Writing messages to the screen).
const std::string & desc()
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
void linkLeft(Domain1D *left)
Set the left neighbor to domain 'left.
virtual void resetBadValues(double *xg)
std::vector< int > vector_int
Vector of ints.
void setBandwidth(int bw=-1)
Set the Jacobian bandwidth. See the discussion of method bandwidth().
Base class for one-dimensional domains.
void setComponentType(size_t n, int ctype)
size_t lastPoint() const
The index of the last (i.e., right-most) grid point belonging to this domain.
virtual void getTransientMask(integer *mask)
std::string m_id
Identity tag for the domain.
void checkComponentArraySize(size_t nn) const
Check that an array size is at least nComponents().
virtual void resize(size_t nv, size_t np)
size_t bandwidth()
Set the Jacobian bandwidth for this domain.
void setID(const std::string &s)
Specify an identifying tag for this domain.
Domain1D * left() const
Return a pointer to the left neighbor.
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate...
void incrementTime(doublereal dt)
virtual void showSolution(const doublereal *x)
Print the solution.
Base class for exceptions thrown by Cantera classes.
doublereal lowerBound(size_t n) const
Lower bound on the nth component.
void setDesc(const std::string &s)
Specify descriptive text for this domain.
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
Refiner & refiner()
Return a reference to the grid refiner.
void evalss(doublereal *x, doublereal *r, integer *mask)
size_t componentIndex(const std::string &name) const
index of component with name name.
int domainType()
Domain type flag.
size_t domainIndex()
The left-to-right location of this domain.
void checkPointArraySize(size_t nn) const
Check that an array size is at least nPoints().
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
size_t nComponents() const
Number of components at each grid point.
void setSteadyTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for steady-state mode.
double transient_atol(size_t n)
Transient absolute tolerance of the nth component.
virtual void eval(size_t j, doublereal *x, doublereal *r, integer *mask, doublereal rdt=0.0)
Evaluate the residual function at point j.
void append(Domain1D *right)
Append domain 'right' to this one, and update all links.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
bool steady()
True if in steady-state mode.
int timeDerivativeFlag(size_t n)
void checkComponentIndex(size_t n) const
Check that the specified component index is in range.
double steady_atol(size_t n)
Steady absolute tolerance of the nth component.
Contains declarations for string manipulation functions within Cantera.
double transient_rtol(size_t n)
Transient relative tolerance of the nth component.
void linkRight(Domain1D *right)
Set the right neighbor to domain 'right.'.
doublereal atol(size_t n)
Absolute tolerance of the nth component.
Refine Domain1D grids so that profiles satisfy adaptation tolerances.
doublereal rtol(size_t n)
Relative tolerance of the nth component.
An array index is out of range.
bool isConnector()
True if the domain is a connector domain.
doublereal upperBound(size_t n) const
Upper bound on the nth component.
size_t nPoints() const
Number of grid points in this domain.
Namespace for the Cantera kernel.
void setTransientTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for time-stepping mode.
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
virtual size_t loc(size_t j=0) const
Location of the start of the local solution vector in the global solution vector,.
virtual void update(doublereal *x)
virtual doublereal initialValue(size_t n, size_t j)
Initial value of solution component n at grid point j.
void initTimeInteg(doublereal dt, const doublereal *x0)
Prepare to do time stepping with time step dt.