Cantera  3.2.0a4
Loading...
Searching...
No Matches
Domain1D Class Reference

Base class for one-dimensional domains. More...

#include <Domain1D.h>

Inheritance diagram for Domain1D:
[legend]

Detailed Description

Base class for one-dimensional domains.

Definition at line 28 of file Domain1D.h.

Public Member Functions

 Domain1D (size_t nv=1, size_t points=1, double time=0.0)
 Constructor.
 
 Domain1D (const Domain1D &)=delete
 
Domain1Doperator= (const Domain1D &)=delete
 
virtual string domainType () const
 Domain type flag.
 
string type () const
 String indicating the domain implemented.
 
size_t domainIndex ()
 The left-to-right location of this domain.
 
virtual bool isConnector ()
 True if the domain is a connector domain.
 
void setSolution (shared_ptr< Solution > sol)
 Set the solution manager.
 
virtual void setKinetics (shared_ptr< Kinetics > kin)
 Set the kinetics manager.
 
virtual void setTransport (shared_ptr< Transport > trans)
 Set transport model to existing instance.
 
virtual void setTransportModel (const string &model)
 Set transport model by name.
 
const OneDimcontainer () const
 The container holding this domain.
 
void setContainer (OneDim *c, size_t index)
 Specify the container object for this domain, and the position of this domain in the list.
 
void setBandwidth (int bw=-1)
 Set the Jacobian bandwidth. See the discussion of method bandwidth().
 
size_t bandwidth ()
 Set the Jacobian bandwidth for this domain.
 
virtual void init ()
 Initialize.
 
virtual void resetBadValues (double *xg)
 When called, this function should reset "bad" values in the state vector such as negative species concentrations.
 
virtual void resize (size_t nv, size_t np)
 Resize the domain to have nv components and np grid points.
 
Refinerrefiner ()
 Return a reference to the grid refiner.
 
size_t nComponents () const
 Number of components at each grid point.
 
void checkComponentIndex (size_t n) const
 Check that the specified component index is in range.
 
void checkComponentArraySize (size_t nn) const
 Check that an array size is at least nComponents().
 
size_t nPoints () const
 Number of grid points in this domain.
 
void checkPointIndex (size_t n) const
 Check that the specified point index is in range.
 
void checkPointArraySize (size_t nn) const
 Check that an array size is at least nPoints().
 
virtual string componentName (size_t n) const
 Name of component n. May be overloaded.
 
void setComponentName (size_t n, const string &name)
 Set the name of the component n to name.
 
virtual size_t componentIndex (const string &name, bool checkAlias=true) const
 Index of component with name name.
 
virtual bool hasComponent (const string &name, bool checkAlias=true) const
 Check whether the Domain contains a component.
 
virtual void updateState (size_t loc)
 Update state at given location to state of associated Solution object.
 
void setBounds (size_t n, double lower, double upper)
 Set the upper and lower bounds for a solution component, n.
 
void setTransientTolerances (double rtol, double atol, size_t n=npos)
 Set tolerances for time-stepping mode.
 
void setSteadyTolerances (double rtol, double atol, size_t n=npos)
 Set tolerances for steady-state mode.
 
double rtol (size_t n)
 Relative tolerance of the nth component.
 
double atol (size_t n)
 Absolute tolerance of the nth component.
 
double steady_rtol (size_t n)
 Steady relative tolerance of the nth component.
 
double steady_atol (size_t n)
 Steady absolute tolerance of the nth component.
 
double transient_rtol (size_t n)
 Transient relative tolerance of the nth component.
 
double transient_atol (size_t n)
 Transient absolute tolerance of the nth component.
 
double upperBound (size_t n) const
 Upper bound on the nth component.
 
double lowerBound (size_t n) const
 Lower bound on the nth component.
 
void initTimeInteg (double dt, const double *x0)
 Performs the setup required before starting a time-stepping solution.
 
void setSteadyMode ()
 Set the internally-stored reciprocal of the time step to 0.0, which is used to indicate that the problem is in steady-state mode.
 
bool steady ()
 True if in steady-state mode.
 
bool transient ()
 True if not in steady-state mode.
 
void needJacUpdate ()
 Set this if something has changed in the governing equations (for example, the value of a constant has been changed, so that the last-computed Jacobian is no longer valid.
 
virtual void eval (size_t j, double *x, double *r, integer *mask, double rdt=0.0)
 Evaluate the residual function at point j.
 
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.
 
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.
 
virtual double value (const string &component) const
 Set a single component value at a boundary.
 
virtual void setValue (const string &component, double value)
 Set a single component value in a flow domain or at a boundary.
 
vector< double > values (const string &component) const
 Retrieve component values.
 
virtual void getValues (const string &component, vector< double > &values) const
 Retrieve component values.
 
virtual void setValues (const string &component, const vector< double > &values)
 Specify component values.
 
vector< double > residuals (const string &component) const
 Retrieve internal work array values for a component.
 
virtual void getResiduals (const string &component, vector< double > &values) const
 Retrieve internal work array values for a component.
 
virtual void setProfile (const string &component, const vector< double > &pos, const vector< double > &values)
 Specify a profile for a component.
 
virtual void setFlatProfile (const string &component, double value)
 Specify a flat profile for a component.
 
shared_ptr< SolutionArrayasArray (const double *soln) const
 Save the state of this domain as a SolutionArray.
 
virtual shared_ptr< SolutionArraytoArray (bool normalize=false) const
 Save the state of this domain to a SolutionArray.
 
void fromArray (SolutionArray &arr, double *soln)
 Restore the solution for this domain from a SolutionArray.
 
virtual void fromArray (const shared_ptr< SolutionArray > &arr)
 Restore the solution for this domain from a SolutionArray.
 
shared_ptr< Solutionsolution () const
 Return thermo/kinetics/transport manager used in the domain.
 
size_t size () const
 Return the size of the solution vector (the product of m_nv and m_points).
 
void locate ()
 Find the index of the first grid point in this domain, and the start of its variables in the global solution vector.
 
virtual size_t loc (size_t j=0) const
 Location of the start of the local solution vector in the global solution vector.
 
size_t firstPoint () const
 The index of the first (that is, left-most) grid point belonging to this domain.
 
size_t lastPoint () const
 The index of the last (that is, right-most) grid point belonging to this domain.
 
void linkLeft (Domain1D *left)
 Set the left neighbor to domain 'left.
 
void linkRight (Domain1D *right)
 Set the right neighbor to domain 'right.'.
 
void append (Domain1D *right)
 Append domain 'right' to this one, and update all links.
 
Domain1Dleft () const
 Return a pointer to the left neighbor.
 
Domain1Dright () const
 Return a pointer to the right neighbor.
 
double prevSoln (size_t n, size_t j) const
 Value of component n at point j in the previous solution.
 
void setID (const string &s)
 Specify an identifying tag for this domain.
 
string id () const
 Returns the identifying tag for this domain.
 
virtual void show (const double *x)
 Print the solution.
 
double z (size_t jlocal) const
 Get the coordinate [m] of the point with local index jlocal
 
double zmin () const
 Get the coordinate [m] of the first (leftmost) grid point in this domain.
 
double zmax () const
 Get the coordinate [m] of the last (rightmost) grid point in this domain.
 
void setProfile (const string &name, double *values, double *soln)
 Set initial values for a component at each grid point.
 
vector< double > & grid ()
 Access the array of grid coordinates [m].
 
const vector< double > & grid () const
 Access the array of grid coordinates [m].
 
void setupGrid (const vector< double > &grid)
 Set up initial grid.
 
virtual void setupGrid (size_t n, const double *z)
 called to set up initial grid, and after grid refinement
 
void setupUniformGrid (size_t points, double length, double start=0.)
 Set up uniform grid.
 
virtual void _getInitialSoln (double *x)
 Writes some or all initial solution values into the global solution array, beginning at the location pointed to by x.
 
virtual double initialValue (size_t n, size_t j)
 Initial value of solution component n at grid point j.
 
virtual void _finalize (const double *x)
 In some cases, a domain may need to set parameters that depend on the initial solution estimate.
 
void forceFullUpdate (bool update)
 In some cases, for computational efficiency some properties (such as transport coefficients) may not be updated during Jacobian evaluations.
 
void setData (shared_ptr< vector< double > > &data)
 Set shared data pointer.
 

Protected Member Functions

virtual AnyMap getMeta () const
 Retrieve meta data.
 
virtual void setMeta (const AnyMap &meta)
 Retrieve meta data.
 

Protected Attributes

shared_ptr< vector< double > > m_state
 data pointer shared from OneDim
 
double m_rdt = 0.0
 Reciprocal of the time step.
 
size_t m_nv = 0
 Number of solution components.
 
size_t m_points
 Number of grid points.
 
vector< double > m_slast
 Solution vector at the last time step.
 
vector< double > m_max
 Upper bounds on solution components.
 
vector< double > m_min
 Lower bounds on solution components.
 
vector< double > m_rtol_ss
 Relative tolerances for steady mode.
 
vector< double > m_rtol_ts
 Relative tolerances for transient mode.
 
vector< double > m_atol_ss
 Absolute tolerances for steady mode.
 
vector< double > m_atol_ts
 Absolute tolerances for transient mode.
 
vector< double > m_z
 1D spatial grid coordinates
 
OneDimm_container = nullptr
 Parent OneDim simulation containing this and adjacent domains.
 
size_t m_index
 Left-to-right location of this domain.
 
size_t m_iloc = 0
 Starting location within the solution vector for unknowns that correspond to this domain.
 
size_t m_jstart = 0
 Index of the first point in this domain in the global point list.
 
Domain1Dm_left = nullptr
 Pointer to the domain to the left.
 
Domain1Dm_right = nullptr
 Pointer to the domain to the right.
 
string m_id
 Identity tag for the domain.
 
unique_ptr< Refinerm_refiner
 Refiner object used for placing grid points.
 
vector< string > m_name
 Names of solution components.
 
int m_bw = -1
 See bandwidth()
 
bool m_force_full_update = false
 see forceFullUpdate()
 
shared_ptr< Solutionm_solution
 Composite thermo/kinetics/transport handler.
 

Constructor & Destructor Documentation

◆ Domain1D()

Domain1D ( size_t  nv = 1,
size_t  points = 1,
double  time = 0.0 
)

Constructor.

Parameters
nvNumber of variables at each grid point.
pointsNumber of grid points.
time(unused)

Definition at line 19 of file Domain1D.cpp.

◆ ~Domain1D()

~Domain1D ( )
virtual

Definition at line 24 of file Domain1D.cpp.

Member Function Documentation

◆ domainType()

virtual string domainType ( ) const
inlinevirtual

Domain type flag.

Since
Starting in Cantera 3.1, the return type is a string.

Reimplemented in Boundary1D, Inlet1D, Empty1D, Symm1D, Outlet1D, OutletRes1D, Surf1D, ReactingSurf1D, Flow1D, and IonFlow.

Definition at line 45 of file Domain1D.h.

◆ type()

string type ( ) const
inline

String indicating the domain implemented.

Since
New in Cantera 3.0.
Deprecated:
Transitional method. Use domainType() instead.

Definition at line 50 of file Domain1D.h.

◆ domainIndex()

size_t domainIndex ( )
inline

The left-to-right location of this domain.

Definition at line 53 of file Domain1D.h.

◆ isConnector()

virtual bool isConnector ( )
inlinevirtual

True if the domain is a connector domain.

Reimplemented in Boundary1D.

Definition at line 58 of file Domain1D.h.

◆ setSolution()

void setSolution ( shared_ptr< Solution sol)

Set the solution manager.

Since
New in Cantera 3.0.

Definition at line 31 of file Domain1D.cpp.

◆ setKinetics()

virtual void setKinetics ( shared_ptr< Kinetics kin)
inlinevirtual

Set the kinetics manager.

Since
New in Cantera 3.0.

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 68 of file Domain1D.h.

◆ setTransport()

virtual void setTransport ( shared_ptr< Transport trans)
inlinevirtual

Set transport model to existing instance.

Since
New in Cantera 3.0.

Reimplemented in Flow1D.

Definition at line 74 of file Domain1D.h.

◆ setTransportModel()

virtual void setTransportModel ( const string &  model)
inlinevirtual

Set transport model by name.

Parameters
modelString specifying model name.
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 81 of file Domain1D.h.

◆ container()

const OneDim & container ( ) const
inline

The container holding this domain.

Definition at line 86 of file Domain1D.h.

◆ setContainer()

void setContainer ( OneDim c,
size_t  index 
)
inline

Specify the container object for this domain, and the position of this domain in the list.

Definition at line 92 of file Domain1D.h.

◆ setBandwidth()

void setBandwidth ( int  bw = -1)
inline

Set the Jacobian bandwidth. See the discussion of method bandwidth().

Definition at line 98 of file Domain1D.h.

◆ bandwidth()

size_t bandwidth ( )
inline

Set the Jacobian bandwidth for this domain.

When class OneDim computes the bandwidth of the overall multi-domain problem (in OneDim::resize()), it calls this method for the bandwidth of each domain. If setBandwidth has not been called, then a negative bandwidth is returned, in which case OneDim assumes that this domain is dense – that is, at each point, all components depend on the value of all other components at that point. In this case, the bandwidth is bw = 2*nComponents() - 1. However, if this domain contains some components that are uncoupled from other components at the same point, then this default bandwidth may greatly overestimate the true bandwidth, with a substantial penalty in performance. For such domains, use method setBandwidth to specify the bandwidth before passing this domain to the Sim1D or OneDim constructor.

Definition at line 117 of file Domain1D.h.

◆ init()

virtual void init ( )
inlinevirtual

Initialize.

This method is called by OneDim::init() for each domain once at the beginning of a simulation. Base class method does nothing, but may be overloaded.

Reimplemented in Boundary1D, Inlet1D, Empty1D, Symm1D, Outlet1D, OutletRes1D, Surf1D, and ReactingSurf1D.

Definition at line 126 of file Domain1D.h.

◆ resetBadValues()

virtual void resetBadValues ( double *  xg)
inlinevirtual

When called, this function should reset "bad" values in the state vector such as negative species concentrations.

This function may be called after a failed solution attempt.

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 133 of file Domain1D.h.

◆ resize()

void resize ( size_t  nv,
size_t  np 
)
virtual

Resize the domain to have nv components and np grid points.

This method is virtual so that subclasses can perform other actions required to resize the domain.

Reimplemented in Flow1D, and IonFlow.

Definition at line 44 of file Domain1D.cpp.

◆ refiner()

Refiner & refiner ( )
inline

Return a reference to the grid refiner.

Definition at line 143 of file Domain1D.h.

◆ nComponents()

size_t nComponents ( ) const
inline

Number of components at each grid point.

Definition at line 148 of file Domain1D.h.

◆ checkComponentIndex()

void checkComponentIndex ( size_t  n) const
inline

Check that the specified component index is in range.

Throws an exception if n is greater than nComponents()-1

Deprecated:
To be removed after Cantera 3.2. Only used by legacy CLib.

Definition at line 155 of file Domain1D.h.

◆ checkComponentArraySize()

void checkComponentArraySize ( size_t  nn) const
inline

Check that an array size is at least nComponents().

Throws an exception if nn is less than nComponents(). Used before calls which take an array pointer.

Deprecated:
To be removed after Cantera 3.2. Unused.

Definition at line 167 of file Domain1D.h.

◆ nPoints()

size_t nPoints ( ) const
inline

Number of grid points in this domain.

Definition at line 176 of file Domain1D.h.

◆ checkPointIndex()

void checkPointIndex ( size_t  n) const
inline

Check that the specified point index is in range.

Throws an exception if n is greater than nPoints()-1

Deprecated:
To be removed after Cantera 3.2. Only used by legacy CLib.

Definition at line 183 of file Domain1D.h.

◆ checkPointArraySize()

void checkPointArraySize ( size_t  nn) const
inline

Check that an array size is at least nPoints().

Throws an exception if nn is less than nPoints(). Used before calls which take an array pointer.

Deprecated:
To be removed after Cantera 3.2. Unused.

Definition at line 195 of file Domain1D.h.

◆ componentName()

string componentName ( size_t  n) const
virtual

Name of component n. May be overloaded.

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 67 of file Domain1D.cpp.

◆ setComponentName()

void setComponentName ( size_t  n,
const string &  name 
)
inline

Set the name of the component n to name.

Definition at line 207 of file Domain1D.h.

◆ componentIndex()

size_t componentIndex ( const string &  name,
bool  checkAlias = true 
) const
virtual

Index of component with name name.

Parameters
namename of component
checkAliasif true (default), check alias mapping

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 76 of file Domain1D.cpp.

◆ hasComponent()

bool hasComponent ( const string &  name,
bool  checkAlias = true 
) const
virtual

Check whether the Domain contains a component.

Parameters
namename of component
checkAliasif true (default), check alias mapping
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 87 of file Domain1D.cpp.

◆ updateState()

virtual void updateState ( size_t  loc)
inlinevirtual

Update state at given location to state of associated Solution object.

Reimplemented in Flow1D.

Definition at line 230 of file Domain1D.h.

◆ setBounds()

void setBounds ( size_t  n,
double  lower,
double  upper 
)
inline

Set the upper and lower bounds for a solution component, n.

Parameters
nsolution component index
lowerlower bound on component n
upperupper bound on component n

Definition at line 242 of file Domain1D.h.

◆ setTransientTolerances()

void setTransientTolerances ( double  rtol,
double  atol,
size_t  n = npos 
)

Set tolerances for time-stepping mode.

Parameters
rtolRelative tolerance
atolAbsolute tolerance
ncomponent index these tolerances apply to. If set to -1 (the default), these tolerances will be applied to all solution components.

Definition at line 98 of file Domain1D.cpp.

◆ setSteadyTolerances()

void setSteadyTolerances ( double  rtol,
double  atol,
size_t  n = npos 
)

Set tolerances for steady-state mode.

Parameters
rtolRelative tolerance
atolAbsolute tolerance
ncomponent index these tolerances apply to. If set to -1 (the default), these tolerances will be applied to all solution components.

Definition at line 111 of file Domain1D.cpp.

◆ rtol()

double rtol ( size_t  n)
inline

Relative tolerance of the nth component.

Definition at line 268 of file Domain1D.h.

◆ atol()

double atol ( size_t  n)
inline

Absolute tolerance of the nth component.

Definition at line 273 of file Domain1D.h.

◆ steady_rtol()

double steady_rtol ( size_t  n)
inline

Steady relative tolerance of the nth component.

Definition at line 278 of file Domain1D.h.

◆ steady_atol()

double steady_atol ( size_t  n)
inline

Steady absolute tolerance of the nth component.

Definition at line 283 of file Domain1D.h.

◆ transient_rtol()

double transient_rtol ( size_t  n)
inline

Transient relative tolerance of the nth component.

Definition at line 288 of file Domain1D.h.

◆ transient_atol()

double transient_atol ( size_t  n)
inline

Transient absolute tolerance of the nth component.

Definition at line 293 of file Domain1D.h.

◆ upperBound()

double upperBound ( size_t  n) const
inline

Upper bound on the nth component.

Definition at line 298 of file Domain1D.h.

◆ lowerBound()

double lowerBound ( size_t  n) const
inline

Lower bound on the nth component.

Definition at line 303 of file Domain1D.h.

◆ initTimeInteg()

void initTimeInteg ( double  dt,
const double *  x0 
)
inline

Performs the setup required before starting a time-stepping solution.

Stores the solution provided in x0 to the internal storage, and sets the reciprocal of the time step to 1/dt.

Parameters
[in]dtTime step
[in]x0Array to store the solution at the last time step

Definition at line 315 of file Domain1D.h.

◆ setSteadyMode()

void setSteadyMode ( )
inline

Set the internally-stored reciprocal of the time step to 0.0, which is used to indicate that the problem is in steady-state mode.

Definition at line 324 of file Domain1D.h.

◆ steady()

bool steady ( )
inline

True if in steady-state mode.

Definition at line 329 of file Domain1D.h.

◆ transient()

bool transient ( )
inline

True if not in steady-state mode.

Definition at line 334 of file Domain1D.h.

◆ needJacUpdate()

void needJacUpdate ( )

Set this if something has changed in the governing equations (for example, the value of a constant has been changed, so that the last-computed Jacobian is no longer valid.

Definition at line 124 of file Domain1D.cpp.

◆ eval()

virtual void eval ( size_t  j,
double *  x,
double *  r,
integer *  mask,
double  rdt = 0.0 
)
inlinevirtual

Evaluate the residual function at point j.

If j == npos, evaluate the residual function at all points.

This function must be implemented in classes derived from Domain1D.

Parameters
[in]jGrid point at which to update the residual
[in]xState vector
[out]rresidual vector
[out]maskBoolean mask indicating whether each solution component has a time derivative (1) or not (0).
[in]rdtReciprocal of the timestep (rdt=0 implies steady-state.)

Reimplemented in Inlet1D, Empty1D, Symm1D, Outlet1D, OutletRes1D, Surf1D, ReactingSurf1D, and Flow1D.

Definition at line 357 of file Domain1D.h.

◆ index()

size_t index ( size_t  n,
size_t  j 
) const
inline

Returns the index of the solution vector, which corresponds to component n at grid point j.

Parameters
ncomponent index
jgrid point index

Definition at line 368 of file Domain1D.h.

◆ value() [1/2]

double value ( const double *  x,
size_t  n,
size_t  j 
) const
inline

Returns the value of solution component n at grid point j of the solution vector x.

Parameters
xsolution vector
ncomponent index
jgrid point index
Deprecated:
To be removed after Cantera 3.2. Replaceable with version accessing component by name.

Definition at line 383 of file Domain1D.h.

◆ value() [2/2]

virtual double value ( const string &  component) const
inlinevirtual

Set a single component value at a boundary.

Parameters
componentName of the component.
Since
New in Cantera 3.2.

Reimplemented in ReactingSurf1D.

Definition at line 395 of file Domain1D.h.

◆ setValue()

virtual void setValue ( const string &  component,
double  value 
)
inlinevirtual

Set a single component value in a flow domain or at a boundary.

Parameters
componentName of the component.
valueValue of the component.
Since
New in Cantera 3.2.

Definition at line 407 of file Domain1D.h.

◆ values()

vector< double > values ( const string &  component) const
inline

Retrieve component values.

Parameters
componentName of the component.
Returns
Vector of length nPoints() containing values at grid points.
Since
New in Cantera 3.2.

Definition at line 419 of file Domain1D.h.

◆ getValues()

virtual void getValues ( const string &  component,
vector< double > &  values 
) const
inlinevirtual

Retrieve component values.

Parameters
componentName of the component.
[out]valuesVector of length nPoints() containing values at grid points.
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 432 of file Domain1D.h.

◆ setValues()

virtual void setValues ( const string &  component,
const vector< double > &  values 
)
inlinevirtual

Specify component values.

Parameters
componentName of the component.
[in]valuesVector of length nPoints() containing values at grid points.
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 444 of file Domain1D.h.

◆ residuals()

vector< double > residuals ( const string &  component) const
inline

Retrieve internal work array values for a component.

After calling Sim1D::eval(), this array contains the values of the residual function.

Parameters
componentName of the component.
Returns
Vector of length nPoints() containing residuals at grid points.
Since
New in Cantera 3.2.

Definition at line 458 of file Domain1D.h.

◆ getResiduals()

virtual void getResiduals ( const string &  component,
vector< double > &  values 
) const
inlinevirtual

Retrieve internal work array values for a component.

After calling Sim1D::eval(), this array contains the values of the residual function.

Parameters
componentName of the component.
[out]valuesVector of length nPoints() containing residuals at grid points.
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 474 of file Domain1D.h.

◆ setProfile() [1/2]

virtual void setProfile ( const string &  component,
const vector< double > &  pos,
const vector< double > &  values 
)
inlinevirtual

Specify a profile for a component.

Parameters
componentName of the component.
[in]posA vector of relative positions, beginning with 0.0 at the left of the domain, and ending with 1.0 at the right of the domain.
[in]valuesA vector of values corresponding to the relative position locations.

Note that the vector pos and values can have lengths different than the number of grid points, but their lengths must be equal. The values at the grid points will be linearly interpolated based on the (pos, values) specification.

Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 494 of file Domain1D.h.

◆ setFlatProfile()

virtual void setFlatProfile ( const string &  component,
double  value 
)
inlinevirtual

Specify a flat profile for a component.

Parameters
componentName of the component.
valueConstant value.
Since
New in Cantera 3.2.

Reimplemented in Flow1D.

Definition at line 507 of file Domain1D.h.

◆ asArray()

shared_ptr< SolutionArray > asArray ( const double *  soln) const
inline

Save the state of this domain as a SolutionArray.

Parameters
solnlocal solution vector for this domain
Todo:
Despite the method's name, data are copied; the intent is to access data directly in future revisions, where a non-const version will be implemented.
Since
New in Cantera 3.0.
Deprecated:
To be removed after Cantera 3.2. Replaceable by toArray().

Definition at line 521 of file Domain1D.h.

◆ toArray()

virtual shared_ptr< SolutionArray > toArray ( bool  normalize = false) const
inlinevirtual

Save the state of this domain to a SolutionArray.

This method serves as an external interface for high-level API's; it does not provide direct access to memory.

Parameters
normalizeIf true, normalize concentrations (default=false)
Since
New in Cantera 3.0.

Reimplemented in Inlet1D, Empty1D, Symm1D, Outlet1D, OutletRes1D, Surf1D, ReactingSurf1D, and Flow1D.

Definition at line 535 of file Domain1D.h.

◆ fromArray() [1/2]

void fromArray ( SolutionArray arr,
double *  soln 
)
inline

Restore the solution for this domain from a SolutionArray.

Parameters
[in]arrSolutionArray defining the state of this domain
[out]solnValue of the solution vector, local to this domain
Since
New in Cantera 3.0.
Deprecated:
To be removed after Cantera 3.2. Replaceable by version that does not require solution vector.

Definition at line 548 of file Domain1D.h.

◆ fromArray() [2/2]

virtual void fromArray ( const shared_ptr< SolutionArray > &  arr)
inlinevirtual

Restore the solution for this domain from a SolutionArray.

This method serves as an external interface for high-level API's.

Parameters
arrSolutionArray defining the state of this domain
Since
New in Cantera 3.0.

Reimplemented in Boundary1D, Inlet1D, OutletRes1D, Surf1D, ReactingSurf1D, and Flow1D.

Definition at line 563 of file Domain1D.h.

◆ solution()

shared_ptr< Solution > solution ( ) const
inline

Return thermo/kinetics/transport manager used in the domain.

Since
New in Cantera 3.0.

Definition at line 569 of file Domain1D.h.

◆ size()

size_t size ( ) const
inline

Return the size of the solution vector (the product of m_nv and m_points).

Definition at line 574 of file Domain1D.h.

◆ locate()

void locate ( )

Find the index of the first grid point in this domain, and the start of its variables in the global solution vector.

Definition at line 192 of file Domain1D.cpp.

◆ loc()

virtual size_t loc ( size_t  j = 0) const
inlinevirtual

Location of the start of the local solution vector in the global solution vector.

Definition at line 585 of file Domain1D.h.

◆ firstPoint()

size_t firstPoint ( ) const
inline

The index of the first (that is, left-most) grid point belonging to this domain.

Definition at line 590 of file Domain1D.h.

◆ lastPoint()

size_t lastPoint ( ) const
inline

The index of the last (that is, right-most) grid point belonging to this domain.

Definition at line 595 of file Domain1D.h.

◆ linkLeft()

void linkLeft ( Domain1D left)
inline

Set the left neighbor to domain 'left.

' Method 'locate' is called to update the global positions of this domain and all those to its right.

Definition at line 603 of file Domain1D.h.

◆ linkRight()

void linkRight ( Domain1D right)
inline

Set the right neighbor to domain 'right.'.

Definition at line 612 of file Domain1D.h.

◆ append()

void append ( Domain1D right)
inline

Append domain 'right' to this one, and update all links.

Definition at line 620 of file Domain1D.h.

◆ left()

Domain1D * left ( ) const
inline

Return a pointer to the left neighbor.

Definition at line 626 of file Domain1D.h.

◆ right()

Domain1D * right ( ) const
inline

Return a pointer to the right neighbor.

Definition at line 631 of file Domain1D.h.

◆ prevSoln()

double prevSoln ( size_t  n,
size_t  j 
) const
inline

Value of component n at point j in the previous solution.

Definition at line 636 of file Domain1D.h.

◆ setID()

void setID ( const string &  s)
inline

Specify an identifying tag for this domain.

Definition at line 641 of file Domain1D.h.

◆ id()

string id ( ) const
inline

Returns the identifying tag for this domain.

Definition at line 646 of file Domain1D.h.

◆ show()

void show ( const double *  x)
virtual

Print the solution.

Parameters
xPointer to the local portion of the system state vector

Reimplemented in Inlet1D, Empty1D, OutletRes1D, Surf1D, ReactingSurf1D, and Flow1D.

Definition at line 237 of file Domain1D.cpp.

◆ z()

double z ( size_t  jlocal) const
inline

Get the coordinate [m] of the point with local index jlocal

Definition at line 659 of file Domain1D.h.

◆ zmin()

double zmin ( ) const
inline

Get the coordinate [m] of the first (leftmost) grid point in this domain.

Definition at line 664 of file Domain1D.h.

◆ zmax()

double zmax ( ) const
inline

Get the coordinate [m] of the last (rightmost) grid point in this domain.

Definition at line 669 of file Domain1D.h.

◆ setProfile() [2/2]

void setProfile ( const string &  name,
double *  values,
double *  soln 
)

Set initial values for a component at each grid point.

Parameters
nameName of the component
valuesArray of length nPoints() containing the initial values
solnPointer to the local portion of the system state vector
Deprecated:
To be removed after Cantera 3.2. Replaceable by version using vectors arguments.

Definition at line 271 of file Domain1D.cpp.

◆ grid() [1/2]

vector< double > & grid ( )
inline

Access the array of grid coordinates [m].

Definition at line 682 of file Domain1D.h.

◆ grid() [2/2]

const vector< double > & grid ( ) const
inline

Access the array of grid coordinates [m].

Definition at line 687 of file Domain1D.h.

◆ setupGrid() [1/2]

void setupGrid ( const vector< double > &  grid)

Set up initial grid.

Since
New in Cantera 3.2.

Definition at line 212 of file Domain1D.cpp.

◆ setupGrid() [2/2]

void setupGrid ( size_t  n,
const double *  z 
)
virtual

called to set up initial grid, and after grid refinement

Reimplemented in Boundary1D, and Flow1D.

Definition at line 217 of file Domain1D.cpp.

◆ setupUniformGrid()

void setupUniformGrid ( size_t  points,
double  length,
double  start = 0. 
)

Set up uniform grid.

Parameters
pointsNumber of grid points
lengthLength of domain
startStart position of domain (default=0.)
Since
New in Cantera 3.2.

Definition at line 227 of file Domain1D.cpp.

◆ _getInitialSoln()

void _getInitialSoln ( double *  x)
virtual

Writes some or all initial solution values into the global solution array, beginning at the location pointed to by x.

This method is called by the Sim1D constructor, and allows default values or ones that have been set locally prior to installing this domain into the container to be written to the global solution vector.

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 287 of file Domain1D.cpp.

◆ initialValue()

double initialValue ( size_t  n,
size_t  j 
)
virtual

Initial value of solution component n at grid point j.

Definition at line 296 of file Domain1D.cpp.

◆ _finalize()

virtual void _finalize ( const double *  x)
inlinevirtual

In some cases, a domain may need to set parameters that depend on the initial solution estimate.

In such cases, the parameters may be set in method _finalize. This method is called just before the Newton solver is called, and the x array is guaranteed to be the local solution vector for this domain that will be used as the initial guess. If no such parameters need to be set, then method _finalize does not need to be overloaded.

Reimplemented in ReactingSurf1D, and Flow1D.

Definition at line 725 of file Domain1D.h.

◆ forceFullUpdate()

void forceFullUpdate ( bool  update)
inline

In some cases, for computational efficiency some properties (such as transport coefficients) may not be updated during Jacobian evaluations.

Set this to true to force these properties to be updated even while calculating Jacobian elements.

Definition at line 733 of file Domain1D.h.

◆ setData()

void setData ( shared_ptr< vector< double > > &  data)
inline

Set shared data pointer.

Definition at line 738 of file Domain1D.h.

◆ getMeta()

AnyMap getMeta ( ) const
protectedvirtual

Retrieve meta data.

Reimplemented in Flow1D.

Definition at line 132 of file Domain1D.cpp.

◆ setMeta()

void setMeta ( const AnyMap meta)
protectedvirtual

Retrieve meta data.

Reimplemented in Flow1D.

Definition at line 160 of file Domain1D.cpp.

Member Data Documentation

◆ m_state

shared_ptr<vector<double> > m_state
protected

data pointer shared from OneDim

Definition at line 749 of file Domain1D.h.

◆ m_rdt

double m_rdt = 0.0
protected

Reciprocal of the time step.

Definition at line 751 of file Domain1D.h.

◆ m_nv

size_t m_nv = 0
protected

Number of solution components.

Definition at line 752 of file Domain1D.h.

◆ m_points

size_t m_points
protected

Number of grid points.

Definition at line 753 of file Domain1D.h.

◆ m_slast

vector<double> m_slast
protected

Solution vector at the last time step.

Definition at line 754 of file Domain1D.h.

◆ m_max

vector<double> m_max
protected

Upper bounds on solution components.

Definition at line 755 of file Domain1D.h.

◆ m_min

vector<double> m_min
protected

Lower bounds on solution components.

Definition at line 756 of file Domain1D.h.

◆ m_rtol_ss

vector<double> m_rtol_ss
protected

Relative tolerances for steady mode.

Definition at line 757 of file Domain1D.h.

◆ m_rtol_ts

vector<double> m_rtol_ts
protected

Relative tolerances for transient mode.

Definition at line 758 of file Domain1D.h.

◆ m_atol_ss

vector<double> m_atol_ss
protected

Absolute tolerances for steady mode.

Definition at line 759 of file Domain1D.h.

◆ m_atol_ts

vector<double> m_atol_ts
protected

Absolute tolerances for transient mode.

Definition at line 760 of file Domain1D.h.

◆ m_z

vector<double> m_z
protected

1D spatial grid coordinates

Definition at line 761 of file Domain1D.h.

◆ m_container

OneDim* m_container = nullptr
protected

Parent OneDim simulation containing this and adjacent domains.

Definition at line 764 of file Domain1D.h.

◆ m_index

size_t m_index
protected

Left-to-right location of this domain.

Definition at line 766 of file Domain1D.h.

◆ m_iloc

size_t m_iloc = 0
protected

Starting location within the solution vector for unknowns that correspond to this domain.

Remember there may be multiple domains associated with this problem

Definition at line 773 of file Domain1D.h.

◆ m_jstart

size_t m_jstart = 0
protected

Index of the first point in this domain in the global point list.

See also
firstPoint(), lastPoint()

Definition at line 777 of file Domain1D.h.

◆ m_left

Domain1D* m_left = nullptr
protected

Pointer to the domain to the left.

Definition at line 779 of file Domain1D.h.

◆ m_right

Domain1D* m_right = nullptr
protected

Pointer to the domain to the right.

Definition at line 780 of file Domain1D.h.

◆ m_id

string m_id
protected

Identity tag for the domain.

Definition at line 783 of file Domain1D.h.

◆ m_refiner

unique_ptr<Refiner> m_refiner
protected

Refiner object used for placing grid points.

Definition at line 784 of file Domain1D.h.

◆ m_name

vector<string> m_name
protected

Names of solution components.

Definition at line 785 of file Domain1D.h.

◆ m_bw

int m_bw = -1
protected

See bandwidth()

Definition at line 786 of file Domain1D.h.

◆ m_force_full_update

bool m_force_full_update = false
protected

see forceFullUpdate()

Definition at line 787 of file Domain1D.h.

◆ m_solution

shared_ptr<Solution> m_solution
protected

Composite thermo/kinetics/transport handler.

Definition at line 790 of file Domain1D.h.


The documentation for this class was generated from the following files: