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;
46 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
64 return (m_type >= cConnectorType);
110 virtual void setInitialState(doublereal* xlocal = 0) {}
111 virtual void setState(
size_t point,
const doublereal* state, doublereal* x) {}
125 virtual void resize(
size_t nv,
size_t np);
141 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n, m_nv-1);
150 throw ArraySizeError(
"Domain1D::checkComponentArraySize", nn, m_nv);
163 throw IndexError(
"Domain1D::checkPointIndex",
"points", n, m_points-1);
172 throw ArraySizeError(
"Domain1D::checkPointArraySize", nn, m_points);
179 void setComponentName(
size_t n,
const std::string& name) {
186 void setBounds(
size_t n, doublereal lower, doublereal upper) {
213 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
218 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
256 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
270 return (m_rdt == 0.0);
275 return (m_rdt != 0.0);
298 virtual void eval(
size_t j, doublereal* x, doublereal* r,
299 integer* mask, doublereal rdt=0.0) {
303 size_t index(
size_t n,
size_t j)
const {
306 doublereal value(
const doublereal* x,
size_t n,
size_t j)
const {
307 return x[index(n,j)];
310 virtual void setJac(MultiJac* jac) {}
326 virtual XML_Node&
save(XML_Node& o,
const doublereal*
const sol);
342 virtual void restore(
const XML_Node& dom, doublereal* soln,
int loglevel);
348 virtual AnyMap
serialize(
const double* soln)
const;
357 virtual void restore(
const AnyMap& state,
double* soln,
int loglevel);
359 size_t size()
const {
360 return m_nv*m_points;
373 virtual size_t loc(
size_t j = 0)
const {
390 return m_jstart + m_points - 1;
425 return m_slast[m_nv*j + n];
433 std::string id()
const {
437 return fmt::format(
"domain {}", m_index);
441 virtual void showSolution_s(std::ostream& s,
const doublereal* x) {}
446 doublereal z(
size_t jlocal)
const {
449 doublereal zmin()
const {
452 doublereal zmax()
const {
453 return m_z[m_points - 1];
456 void setProfile(
const std::string& name,
double* values,
double* soln);
464 doublereal grid(
size_t point)
const {
469 virtual void setupGrid(
size_t n,
const doublereal* z);
500 m_force_full_update = update;
530 std::unique_ptr<Refiner> m_refiner;
531 std::vector<std::string> m_name;
533 bool m_force_full_update;
Base class for one-dimensional domains.
virtual void resetBadValues(double *xg)
size_t lastPoint() const
The index of the last (that is, right-most) grid point belonging to this domain.
size_t m_iloc
Starting location within the solution vector for unknowns that correspond to this domain.
void checkPointArraySize(size_t nn) const
Check that an array size is at least nPoints().
size_t domainIndex()
The left-to-right location of this domain.
size_t nComponents() const
Number of components at each grid point.
size_t bandwidth()
Set the Jacobian bandwidth for this domain.
virtual doublereal initialValue(size_t n, size_t j)
Initial value of solution component n at grid point j.
virtual AnyMap serialize(const double *soln) const
Save the state of this domain as an AnyMap.
virtual void showSolution(const doublereal *x)
Print the solution.
doublereal atol(size_t n)
Absolute tolerance of the nth component.
Domain1D * left() const
Return a pointer to the left neighbor.
std::string m_id
Identity tag for the domain.
virtual void _finalize(const doublereal *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate.
void setContainer(OneDim *c, size_t index)
Specify the container object for this domain, and the position of this domain in the list.
size_t nPoints() const
Number of grid points in this domain.
virtual std::string componentName(size_t n) const
Name of the nth component. May be overloaded.
void setSteadyTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for steady-state mode.
void checkComponentIndex(size_t n) const
Check that the specified component index is in range.
void linkLeft(Domain1D *left)
Set the left neighbor to domain 'left.
virtual XML_Node & save(XML_Node &o, const doublereal *const sol)
Save the current solution for this domain into an XML_Node.
virtual void resize(size_t nv, size_t np)
bool isConnector()
True if the domain is a connector domain.
void initTimeInteg(doublereal dt, const doublereal *x0)
Prepare to do time stepping with time step dt.
Refiner & refiner()
Return a reference to the grid refiner.
Domain1D * right() const
Return a pointer to the right neighbor.
virtual void restore(const XML_Node &dom, doublereal *soln, int loglevel)
Restore the solution for this domain from an XML_Node.
doublereal upperBound(size_t n) const
Upper bound on the nth component.
double steady_atol(size_t n)
Steady absolute tolerance of the nth component.
double transient_atol(size_t n)
Transient absolute tolerance of the nth component.
doublereal lowerBound(size_t n) const
Lower bound on 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 forceFullUpdate(bool update)
In some cases, for computational efficiency some properties (such as transport coefficients) may not ...
const OneDim & container() const
The container holding this domain.
bool steady()
True if in steady-state mode.
virtual void _getInitialSoln(doublereal *x)
Writes some or all initial solution values into the global solution array, beginning at the location ...
void setBandwidth(int bw=-1)
Set the Jacobian bandwidth. See the discussion of method bandwidth().
double steady_rtol(size_t n)
Steady relative tolerance of the nth component.
void append(Domain1D *right)
Append domain 'right' to this one, and update all links.
void setSteadyMode()
Prepare to solve the steady-state problem.
int domainType()
Domain type flag.
void setID(const std::string &s)
Specify an identifying tag for this domain.
void checkPointIndex(size_t n) const
Check that the specified point index is in range.
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
size_t firstPoint() const
The index of the first (that is, left-most) grid point belonging to this domain.
void linkRight(Domain1D *right)
Set the right neighbor to domain 'right.'.
Domain1D(size_t nv=1, size_t points=1, double time=0.0)
Constructor.
void checkComponentArraySize(size_t nn) const
Check that an array size is at least nComponents().
virtual void setupGrid(size_t n, const doublereal *z)
called to set up initial grid, and after grid refinement
doublereal rtol(size_t n)
Relative tolerance of the nth component.
double transient_rtol(size_t n)
Transient relative tolerance of the nth component.
virtual size_t componentIndex(const std::string &name) const
index of component with name name.
virtual size_t loc(size_t j=0) const
Location of the start of the local solution vector in the global solution vector,.
void locate()
Find the index of the first grid point in this domain, and the start of its variables in the global s...
void setTransientTolerances(doublereal rtol, doublereal atol, size_t n=npos)
Set tolerances for time-stepping mode.
An array index is out of range.
An error indicating that an unimplemented function has been called.
Container class for multiple-domain 1D problems.
Refine Domain1D grids so that profiles satisfy adaptation tolerances.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.