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;
49 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
62 virtual string type()
const {
137 virtual void setInitialState(
double* xlocal = 0) {}
138 virtual void setState(
size_t point,
const double* state,
double* x) {}
152 virtual void resize(
size_t nv,
size_t np);
168 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n, m_nv-1);
177 throw ArraySizeError(
"Domain1D::checkComponentArraySize", nn, m_nv);
206 void setComponentName(
size_t n,
const string& name) {
213 void setBounds(
size_t n,
double lower,
double upper) {
240 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
245 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
283 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
297 return (m_rdt == 0.0);
302 return (m_rdt != 0.0);
325 virtual void eval(
size_t j,
double* x,
double* r, integer* mask,
double rdt=0.0) {
329 size_t index(
size_t n,
size_t j)
const {
332 double value(
const double* x,
size_t n,
size_t j)
const {
333 return x[index(n,j)];
336 virtual void setJac(MultiJac* jac) {}
344 AnyMap
serialize(
const double* soln)
const;
354 virtual shared_ptr<SolutionArray>
asArray(
const double* soln)
const {
366 shared_ptr<SolutionArray>
toArray(
bool normalize=
false)
const;
377 void restore(
const AnyMap& state,
double* soln,
int loglevel);
396 void fromArray(
const shared_ptr<SolutionArray>& arr);
404 size_t size()
const {
418 virtual size_t loc(
size_t j = 0)
const {
476 return m_slast[m_nv*j + n];
488 return fmt::format(
"domain {}", m_index);
500 virtual void show(std::ostream& s,
const double* x) {}
503 virtual void show(
const double* x);
505 double z(
size_t jlocal)
const {
508 double zmin()
const {
511 double zmax()
const {
515 void setProfile(
const string& name,
double* values,
double* soln);
517 vector<double>& grid() {
520 const vector<double>& grid()
const {
523 double grid(
size_t point)
const {
528 virtual void setupGrid(
size_t n,
const double* z);
559 m_force_full_update = update;
563 void setData(shared_ptr<vector<double>>& data) {
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;
585 OneDim* m_container =
nullptr;
603 unique_ptr<Refiner> m_refiner;
604 vector<string> m_name;
606 bool m_force_full_update =
false;
A map of string keys to values whose type can vary at runtime.
Base class for one-dimensional domains.
void setTransientTolerances(double rtol, double atol, size_t n=npos)
Set tolerances for time-stepping mode.
virtual void resetBadValues(double *xg)
When called, this function should reset "bad" values in the state vector such as negative species con...
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.
shared_ptr< Solution > m_solution
Composite thermo/kinetics/transport handler.
bool transient()
True if not in steady-state mode.
size_t nComponents() const
Number of components at each grid point.
size_t bandwidth()
Set the Jacobian bandwidth for this domain.
double rtol(size_t n)
Relative tolerance of the nth component.
AnyMap serialize(const double *soln) const
Save the state of this domain as an AnyMap.
shared_ptr< Solution > solution() const
Return thermo/kinetics/transport manager used in the domain.
virtual bool isConnector()
True if the domain is a connector domain.
virtual void setTransport(shared_ptr< Transport > trans)
Set transport model to existing instance.
virtual void setMeta(const AnyMap &meta)
Retrieve meta data.
virtual void _finalize(const double *x)
In some cases, a domain may need to set parameters that depend on the initial solution estimate.
virtual string type() const
String indicating the domain implemented.
Domain1D * left() const
Return a pointer to the left neighbor.
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.
double lowerBound(size_t n) const
Lower bound on the nth component.
void checkComponentIndex(size_t n) const
Check that the specified component index is in range.
shared_ptr< vector< double > > m_state
data pointer shared from OneDim
void linkLeft(Domain1D *left)
Set the left neighbor to domain 'left.
virtual void resize(size_t nv, size_t np)
Resize the domain to have nv components and np grid points.
double upperBound(size_t n) const
Upper bound on the nth component.
Refiner & refiner()
Return a reference to the grid refiner.
Domain1D * right() const
Return a pointer to the right neighbor.
double steady_atol(size_t n)
Steady absolute tolerance of the nth component.
void setSteadyTolerances(double rtol, double atol, size_t n=npos)
Set tolerances for steady-state mode.
virtual shared_ptr< SolutionArray > asArray(const double *soln) const
Save the state of this domain as a SolutionArray.
virtual string componentName(size_t n) const
Name of the nth component. May be overloaded.
double transient_atol(size_t n)
Transient absolute tolerance of the nth component.
void setSolution(shared_ptr< Solution > sol)
Set the solution manager.
virtual void init()
Initialize.
double atol(size_t n)
Absolute tolerance of the nth component.
void setID(const string &s)
Specify an identifying tag for this domain.
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.
virtual void setKinetics(shared_ptr< Kinetics > kin)
Set the kinetics manager.
void restore(const AnyMap &state, double *soln, int loglevel)
Restore the solution for this domain from an AnyMap.
shared_ptr< SolutionArray > toArray(bool normalize=false) const
Save the state of this domain to a SolutionArray.
size_t m_points
Number of grid points.
bool steady()
True if in steady-state mode.
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.
string m_id
Identity tag for the domain.
void initTimeInteg(double dt, const double *x0)
Prepare to do time stepping with time step dt.
virtual void showSolution(const double *x)
Print the solution.
void setData(shared_ptr< vector< double > > &data)
Set shared data pointer.
virtual void eval(size_t j, double *x, double *r, integer *mask, double rdt=0.0)
Evaluate the residual function at point j.
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.
virtual double initialValue(size_t n, size_t j)
Initial value of solution component n at grid point j.
void checkPointIndex(size_t n) const
Check that the specified point index is in range.
virtual size_t componentIndex(const string &name) const
index of component with name name.
double prevSoln(size_t n, size_t j) const
Value of component n at point j in the previous solution.
virtual void fromArray(SolutionArray &arr, double *soln)
Restore the solution for this domain from a SolutionArray.
size_t firstPoint() const
The index of the first (that is, left-most) grid point belonging to this domain.
virtual void showSolution_s(std::ostream &s, const double *x)
void needJacUpdate()
Set this if something has changed in the governing equations (for example, the value of a constant ha...
void linkRight(Domain1D *right)
Set the right neighbor to domain 'right.'.
virtual void _getInitialSoln(double *x)
Writes some or all initial solution values into the global solution array, beginning at the location ...
void checkComponentArraySize(size_t nn) const
Check that an array size is at least nComponents().
double transient_rtol(size_t n)
Transient relative tolerance of the nth component.
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...
virtual AnyMap getMeta() const
Retrieve meta data.
virtual void show(std::ostream &s, const double *x)
Print the solution.
virtual void setupGrid(size_t n, const double *z)
called to set up initial grid, and after grid refinement
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.
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.
const size_t npos
index returned by functions to indicate "no position"