37 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
123 warn_deprecated(
"Domain1D::setInitialState",
"To be removed after Cantera 3.1.");
127 virtual void setState(
size_t point,
const double* state,
double* x) {
128 warn_deprecated(
"Domain1D::setState",
"To be removed after Cantera 3.1.");
143 virtual void resize(
size_t nv,
size_t np);
159 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n,
m_nv-1);
300 return (
m_rdt == 0.0);
305 return (
m_rdt != 0.0);
327 virtual void eval(
size_t j,
double* x,
double* r, integer* mask,
double rdt=0.0) {
338 size_t index(
size_t n,
size_t j)
const {
350 double value(
const double* x,
size_t n,
size_t j)
const {
351 return x[
index(n,j)];
356 warn_deprecated(
"Domain1D::setJac",
"To be removed after Cantera 3.1.");
367 virtual shared_ptr<SolutionArray>
asArray(
const double* soln)
const {
379 shared_ptr<SolutionArray>
toArray(
bool normalize=
false)
const;
398 void fromArray(
const shared_ptr<SolutionArray>& arr);
418 virtual size_t loc(
size_t j = 0)
const {
483 return fmt::format(
"domain {}",
m_index);
489 virtual void show(std::ostream& s,
const double* x) {
491 "Not implemented. To be removed after Cantera 3.1.");
496 virtual void show(
const double* x);
499 double z(
size_t jlocal)
const {
517 void setProfile(
const string& name,
double* values,
double* soln);
525 const vector<double>&
grid()
const {
530 double grid(
size_t point)
const {
532 "To be removed after Cantera 3.1. Use z() instead.");
537 virtual void setupGrid(
size_t n,
const double*
z);
572 void setData(shared_ptr<vector<double>>& data) {
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.
Domain1D * m_left
Pointer to the domain to the left.
OneDim * m_container
Parent OneDim simulation containing this and adjacent domains.
bool transient()
True if not in steady-state mode.
void setComponentName(size_t n, const string &name)
Set the name of the component n to name.
double grid(size_t point) const
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.
vector< double > m_atol_ss
Absolute tolerances for steady mode.
vector< double > m_rtol_ts
Relative tolerances for transient mode.
size_t size() const
Return the size of the solution vector (the product of m_nv and m_points).
vector< double > m_atol_ts
Absolute tolerances for transient mode.
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 setJac(MultiJac *jac)
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.
size_t m_index
Left-to-right location of this domain.
Domain1D * left() const
Return a pointer to the left neighbor.
string id() const
Returns the identifying tag for this domain.
vector< double > & grid()
Access the array of grid coordinates [m].
double zmin() const
Get the coordinate [m] of the first (leftmost) grid point in this domain.
size_t m_jstart
Index of the first point in this domain in the global point list.
size_t m_nv
Number of solution components.
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.
vector< string > m_name
Names of solution components.
double m_rdt
Reciprocal of the time step.
virtual string domainType() const
Domain type flag.
bool m_force_full_update
see forceFullUpdate()
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 z(size_t jlocal) const
Get the coordinate [m] of the point with local index jlocal
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.
vector< double > m_rtol_ss
Relative tolerances for steady mode.
vector< double > m_slast
Solution vector at the last time step.
Domain1D * m_right
Pointer to the domain to the right.
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 component n. 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 setProfile(const string &name, double *values, double *soln)
Set initial values for a component at each grid point.
void setID(const string &s)
Specify an identifying tag for this domain.
vector< double > m_z
1D spatial grid coordinates
virtual void setState(size_t point, const double *state, double *x)
void forceFullUpdate(bool update)
In some cases, for computational efficiency some properties (such as transport coefficients) may not ...
const vector< double > & grid() const
Access the array of grid coordinates [m].
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.
vector< double > m_max
Upper bounds on solution components.
unique_ptr< Refiner > m_refiner
Refiner object used for placing grid points.
void initTimeInteg(double dt, const double *x0)
Performs the setup required before starting a time-stepping solution.
void setBounds(size_t n, double lower, double upper)
Set the upper and lower bounds for a solution component, n.
vector< double > m_min
Lower bounds on solution components.
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.
double value(const double *x, size_t n, size_t j) const
Returns the value of solution component n at grid point j of the solution vector x.
void setSteadyMode()
Set the internally-stored reciprocal of the time step to 0.0, which is used to indicate that the prob...
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.
double zmax() const
Get the coordinate [m] of the last (rightmost) grid point in this domain.
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 ...
size_t index(size_t n, size_t j) const
Returns the index of the solution vector, which corresponds to component n at grid point j.
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 setInitialState(double *xlocal=0)
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.
Class MultiJac evaluates the Jacobian of a system of equations defined by a residual function supplie...
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...
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.