37 Domain1D(
size_t nv=1,
size_t points=1,
double time=0.0);
140 virtual void resize(
size_t nv,
size_t np);
157 "To be removed after Cantera 3.2. Only used by legacy CLib.");
159 throw IndexError(
"Domain1D::checkComponentIndex",
"points", n,
m_nv);
169 "To be removed after Cantera 3.2. Unused.");
185 "To be removed after Cantera 3.2. Only used by legacy CLib.");
197 "To be removed after Cantera 3.2. Unused.");
216 virtual size_t componentIndex(
const string& name,
bool checkAlias=
true)
const;
225 virtual bool hasComponent(
const string& name,
bool checkAlias=
true)
const;
232 "Not implemented for domain type '{}'.",
domainType());
330 return (
m_rdt == 0.0);
335 return (
m_rdt != 0.0);
357 virtual void eval(
size_t j,
double* x,
double* r, integer* mask,
double rdt=0.0) {
368 size_t index(
size_t n,
size_t j)
const {
383 double value(
const double* x,
size_t n,
size_t j)
const {
385 "Replaceable with version accessing component by name");
386 return x[
index(n,j)];
395 virtual double value(
const string& component)
const {
397 "Not implemented for domain type '{}'.",
domainType());
409 "Not implemented for domain type '{}'.",
domainType());
419 vector<double>
values(
const string& component)
const {
420 vector<double> data(
nPoints());
434 "Not implemented for domain type '{}'.",
domainType());
446 "Not implemented for domain type '{}'.",
domainType());
458 vector<double>
residuals(
const string& component)
const {
459 vector<double> data(
nPoints());
476 "Not applicable or not implemented for domain type '{}'.",
domainType());
495 const vector<double>& pos,
const vector<double>&
values) {
497 "Not implemented for domain type '{}'.",
domainType());
509 "Not implemented for domain type '{}'.",
domainType());
521 shared_ptr<SolutionArray>
asArray(
const double* soln)
const {
523 "To be removed after Cantera 3.2. Replaceable by 'toArray'.");
535 virtual shared_ptr<SolutionArray>
toArray(
bool normalize=
false)
const {
550 "To be removed after Cantera 3.2. Replaceable by version that does not "
551 "require solution vector.");
553 shared_ptr<SolutionArray> arr_ptr(&arr, [](
SolutionArray*){});
563 virtual void fromArray(
const shared_ptr<SolutionArray>& arr) {
585 virtual size_t loc(
size_t j = 0)
const {
650 return fmt::format(
"domain {}",
m_index);
656 virtual void show(
const double* x);
659 double z(
size_t jlocal)
const {
687 const vector<double>&
grid()
const {
696 virtual void setupGrid(
size_t n,
const double*
z);
738 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.
virtual shared_ptr< SolutionArray > toArray(bool normalize=false) const
Save the state of this domain to a SolutionArray.
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.
void setupUniformGrid(size_t points, double length, double start=0.)
Set up uniform grid.
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 void updateState(size_t loc)
Update state at given location to state of associated Solution object.
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.
size_t m_index
Left-to-right location of this domain.
void setupGrid(const vector< double > &grid)
Set up initial grid.
Domain1D * left() const
Return a pointer to the left neighbor.
vector< double > residuals(const string &component) const
Retrieve internal work array values for a component.
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.
virtual void setTransportModel(const string &model)
Set transport model by name.
virtual size_t componentIndex(const string &name, bool checkAlias=true) const
Index of component with name name.
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.
vector< double > values(const string &component) const
Retrieve component values.
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
virtual void setValue(const string &component, double value)
Set a single component value in a flow domain or at a boundary.
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.
virtual void show(const double *x)
Print the solution.
vector< double > m_rtol_ss
Relative tolerances for steady mode.
void fromArray(SolutionArray &arr, double *soln)
Restore the solution for this domain from a SolutionArray.
vector< double > m_slast
Solution vector at the last time step.
virtual double value(const string &component) const
Set a single component value at a boundary.
virtual void fromArray(const shared_ptr< SolutionArray > &arr)
Restore the solution for this domain from a SolutionArray.
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 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 getValues(const string &component, vector< double > &values) const
Retrieve component values.
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.
vector< double > m_z
1D spatial grid coordinates
shared_ptr< SolutionArray > asArray(const double *soln) const
Save the state of this domain as a SolutionArray.
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.
virtual void setValues(const string &component, const vector< double > &values)
Specify component values.
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.
virtual void setProfile(const string &component, const vector< double > &pos, const vector< double > &values)
Specify a profile for a component.
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.
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.
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 bool hasComponent(const string &name, bool checkAlias=true) const
Check whether the Domain contains a component.
virtual void setFlatProfile(const string &component, double value)
Specify a flat profile for a component.
virtual void getResiduals(const string &component, vector< double > &values) const
Retrieve internal work array values for a component.
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...
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.