36 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
122 virtual void setInitialState(
double* xlocal = 0) {}
123 virtual void setState(
size_t point,
const double* state,
double* x) {}
137 virtual void resize(
size_t nv,
size_t np);
153 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n, m_nv-1);
162 throw ArraySizeError(
"Domain1D::checkComponentArraySize", nn, m_nv);
191 void setComponentName(
size_t n,
const string& name) {
198 void setBounds(
size_t n,
double lower,
double upper) {
225 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
230 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
268 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
282 return (m_rdt == 0.0);
287 return (m_rdt != 0.0);
310 virtual void eval(
size_t j,
double* x,
double* r, integer* mask,
double rdt=0.0) {
314 size_t index(
size_t n,
size_t j)
const {
317 double value(
const double* x,
size_t n,
size_t j)
const {
318 return x[index(n,j)];
321 virtual void setJac(MultiJac* jac) {}
331 virtual shared_ptr<SolutionArray>
asArray(
const double* soln)
const {
343 shared_ptr<SolutionArray>
toArray(
bool normalize=
false)
const;
362 void fromArray(
const shared_ptr<SolutionArray>& arr);
370 size_t size()
const {
384 virtual size_t loc(
size_t j = 0)
const {
442 return m_slast[m_nv*j + n];
454 return fmt::format(
"domain {}", m_index);
459 virtual void show(std::ostream& s,
const double* x) {}
462 virtual void show(
const double* x);
464 double z(
size_t jlocal)
const {
467 double zmin()
const {
470 double zmax()
const {
474 void setProfile(
const string& name,
double* values,
double* soln);
476 vector<double>& grid() {
479 const vector<double>& grid()
const {
482 double grid(
size_t point)
const {
487 virtual void setupGrid(
size_t n,
const double* z);
518 m_force_full_update = update;
522 void setData(shared_ptr<vector<double>>& data) {
538 vector<double> m_slast;
539 vector<double> m_max;
540 vector<double> m_min;
541 vector<double> m_rtol_ss, m_rtol_ts;
542 vector<double> m_atol_ss, m_atol_ts;
544 OneDim* m_container =
nullptr;
561 unique_ptr<Refiner> m_refiner;
562 vector<string> m_name;
564 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.
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.
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.
virtual string domainType() const
Domain type flag.
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.
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.
string type() const
String indicating the domain implemented.
void initTimeInteg(double dt, const double *x0)
Prepare to do time stepping with time step dt.
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.
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.
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"