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(
"checkComponentIndex",
"points", n, m_nv-1);
164 throw IndexError(
"checkPointIndex",
"points", n, m_points-1);
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) {}
324 virtual XML_Node&
save(XML_Node& o,
const doublereal*
const sol);
337 virtual void restore(
const XML_Node& dom, doublereal* soln,
int loglevel);
339 size_t size()
const {
340 return m_nv*m_points;
353 virtual size_t loc(
size_t j = 0)
const {
370 return m_jstart + m_points - 1;
405 return m_slast[m_nv*j + n];
413 std::string id()
const {
417 return fmt::format(
"domain {}", m_index);
421 virtual void showSolution_s(std::ostream& s,
const doublereal* x) {}
426 doublereal z(
size_t jlocal)
const {
429 doublereal zmin()
const {
432 doublereal zmax()
const {
433 return m_z[m_points - 1];
436 void setProfile(
const std::string& name,
double* values,
double* soln);
444 doublereal grid(
size_t point)
const {
449 virtual void setupGrid(
size_t n,
const doublereal* z);
480 m_force_full_update = update;
511 std::unique_ptr<Refiner> m_refiner;
512 std::vector<std::string> m_name;
514 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.
An error indicating that an unimplemented function has been called.
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.
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.
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).
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)
void setBandwidth(int bw=-1)
Set the Jacobian bandwidth. See the discussion of method bandwidth().
Base class for one-dimensional domains.
size_t lastPoint() const
The index of the last (i.e., right-most) grid point belonging to this domain.
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...
virtual void showSolution(const doublereal *x)
Print the solution.
doublereal lowerBound(size_t n) const
Lower bound on the nth component.
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.
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.
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.
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 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.