18 const int cFlowType = 50;
19 const int cFreeFlow = 51;
20 const int cAxisymmetricStagnationFlow = 52;
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;
47 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
65 return (m_type >= cConnectorType);
111 virtual void setInitialState(doublereal* xlocal = 0) {}
112 virtual void setState(
size_t point,
const doublereal* state, doublereal* x) {}
126 virtual void resize(
size_t nv,
size_t np);
142 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n, m_nv-1);
151 throw ArraySizeError(
"Domain1D::checkComponentArraySize", nn, m_nv);
164 throw IndexError(
"Domain1D::checkPointIndex",
"points", n, m_points-1);
173 throw ArraySizeError(
"Domain1D::checkPointArraySize", nn, m_points);
180 void setComponentName(
size_t n,
const std::string& name) {
187 void setBounds(
size_t n, doublereal lower, doublereal upper) {
214 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
219 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
257 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
271 return (m_rdt == 0.0);
276 return (m_rdt != 0.0);
299 virtual void eval(
size_t j, doublereal* x, doublereal* r,
300 integer* mask, doublereal rdt=0.0) {
304 size_t index(
size_t n,
size_t j)
const {
307 doublereal value(
const doublereal* x,
size_t n,
size_t j)
const {
308 return x[index(n,j)];
311 virtual void setJac(MultiJac* jac) {}
327 virtual XML_Node&
save(XML_Node& o,
const doublereal*
const sol);
343 virtual void restore(
const XML_Node& dom, doublereal* soln,
int loglevel);
345 size_t size()
const {
346 return m_nv*m_points;
359 virtual size_t loc(
size_t j = 0)
const {
376 return m_jstart + m_points - 1;
411 return m_slast[m_nv*j + n];
419 std::string id()
const {
423 return fmt::format(
"domain {}", m_index);
427 virtual void showSolution_s(std::ostream& s,
const doublereal* x) {}
432 doublereal z(
size_t jlocal)
const {
435 doublereal zmin()
const {
438 doublereal zmax()
const {
439 return m_z[m_points - 1];
442 void setProfile(
const std::string& name,
double* values,
double* soln);
450 doublereal grid(
size_t point)
const {
455 virtual void setupGrid(
size_t n,
const doublereal* z);
486 m_force_full_update = update;
517 std::unique_ptr<Refiner> m_refiner;
518 std::vector<std::string> m_name;
520 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 (i.e., 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 void showSolution(const doublereal *x)
Print the solution.
Domain1D * left() const
Return a pointer to the left neighbor.
doublereal atol(size_t n)
Absolute tolerance of the nth component.
Domain1D * right() const
Return a pointer to the right 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.
const OneDim & container() const
The container holding this domain.
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.
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 (e.g.
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().
Refiner & refiner()
Return a reference to the grid refiner.
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 (i.e., 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...
This file contains definitions for utility functions and text for modules, inputfiles,...
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.
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.