Cantera 2.6.0

Public Member Functions | Protected Attributes | Private Member Functions | List of all members
DAE_Solver Class Reference

Wrapper for DAE solvers. More...

`#include <DAE_Solver.h>`

Inheritance diagram for DAE_Solver:
[legend]
Collaboration diagram for DAE_Solver:
[legend]

## Public Member Functions
| DAE_Solver (ResidJacEval &f)
virtual void | setTolerances (doublereal reltol, doublereal *abstol)
| Set error tolerances. More...
virtual void | setTolerances (doublereal reltol, doublereal abstol)
| Set error tolerances. More...
void | setJacobian (Jacobian &jac)
| Specify a Jacobian evaluator. More...
virtual void | setLinearSolverType (int solverType)
virtual void | setDenseLinearSolver ()
virtual void | setBandedLinearSolver (int m_upper, int m_lower)
virtual void | setMaxStepSize (doublereal dtmax)
virtual void | setMaxOrder (int n)
virtual void | setMaxNumSteps (int n)
virtual void | setInitialStepSize (doublereal h0)
virtual void | setStopTime (doublereal tstop)
virtual void | setMaxErrTestFailures (int n)
virtual void | setMaxNonlinIterations (int n)
virtual void | setMaxNonlinConvFailures (int n)
virtual void | inclAlgebraicInErrorTest (bool yesno)
virtual void | correctInitial_Y_given_Yp (doublereal *y, doublereal *yp, doublereal tout)
| Calculate consistent value of the starting solution given the starting solution derivatives. More...
virtual void | correctInitial_YaYp_given_Yd (doublereal *y, doublereal *yp, doublereal tout)
| Calculate consistent value of the algebraic constraints and derivatives at the start of the problem. More...
virtual int | solve (doublereal tout)
| Solve the system of equations up to time tout. More...
virtual doublereal | step (doublereal tout)
| Take one internal step. More...
int | nEquations () const
| Number of equations. More...
virtual void | init (doublereal t0)
| initialize. More...
virtual void | setInputParameter (int flag, doublereal value)
| Set a solver-specific input parameter. More...
virtual doublereal | getOutputParameter (int flag) const
| Get the value of a solver-specific output parameter. More...
virtual doublereal | solution (int k) const
| the current value of solution component k. More...
virtual const doublereal * | solutionVector () const
virtual doublereal | derivative (int k) const
| the current value of the derivative of solution component k. More...
virtual const doublereal * | derivativeVector () const

## Protected Attributes
doublereal | m_dummy
ResidJacEval & | m_resid
integer | m_neq
| Number of total equations in the system. More...
doublereal | m_time

## Private Member Functions
void | warn (const std::string &msg) const

## Detailed Description

Wrapper for DAE solvers.

Attention
  This class currently does not have any test cases or examples. Its implementation may be incomplete, and future changes to Cantera may unexpectedly cause this class to stop working. If you use this class, please consider contributing examples or test cases. In the absence of new tests or examples, this class may be deprecated and removed in a future version of Cantera. See https://github.com/Cantera/cantera/issues/267 for additional information.

Definition at line 75 of file DAE_Solver.h.

## Constructor & Destructor Documentation

## ◆ DAE_Solver()

DAE_Solver | ( | ResidJacEval & | f | ) |
| inline

Definition at line 78 of file DAE_Solver.h.

## ◆ ~DAE_Solver()

virtual ~DAE_Solver | ( |  | ) |
| inline virtual

Definition at line 84 of file DAE_Solver.h.

## Member Function Documentation

## ◆ setTolerances() [1/2]

virtual void setTolerances | ( | doublereal | reltol,
|  | doublereal * | abstol
| ) |  |
| inline virtual

Set error tolerances.

This version specifies a scalar relative tolerance, and a vector absolute tolerance.

Reimplemented in IDA_Solver.

Definition at line 90 of file DAE_Solver.h.

## ◆ setTolerances() [2/2]

virtual void setTolerances | ( | doublereal | reltol,
|  | doublereal | abstol
| ) |  |
| inline virtual

Set error tolerances.

This version specifies a scalar relative tolerance, and a scalar absolute tolerance.

Reimplemented in IDA_Solver.

Definition at line 99 of file DAE_Solver.h.

## ◆ setJacobian()

void setJacobian | ( | Jacobian & | jac | ) |
| inline

Specify a Jacobian evaluator.

If this method is not called, the Jacobian will be computed by finite difference.

Definition at line 107 of file DAE_Solver.h.

## ◆ setLinearSolverType()

virtual void setLinearSolverType | ( | int | solverType | ) |
| inline virtual

Definition at line 111 of file DAE_Solver.h.

## ◆ setDenseLinearSolver()

virtual void setDenseLinearSolver | ( |  | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 115 of file DAE_Solver.h.

## ◆ setBandedLinearSolver()

virtual void setBandedLinearSolver | ( | int | m_upper,
|  | int | m_lower
| ) |  |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 119 of file DAE_Solver.h.

## ◆ setMaxStepSize()

virtual void setMaxStepSize | ( | doublereal | dtmax | ) |
| inline virtual

Definition at line 122 of file DAE_Solver.h.

## ◆ setMaxOrder()

virtual void setMaxOrder | ( | int | n | ) |
| inline virtual

Definition at line 125 of file DAE_Solver.h.

## ◆ setMaxNumSteps()

virtual void setMaxNumSteps | ( | int | n | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 128 of file DAE_Solver.h.

## ◆ setInitialStepSize()

virtual void setInitialStepSize | ( | doublereal | h0 | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 131 of file DAE_Solver.h.

## ◆ setStopTime()

virtual void setStopTime | ( | doublereal | tstop | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 134 of file DAE_Solver.h.

## ◆ setMaxErrTestFailures()

virtual void setMaxErrTestFailures | ( | int | n | ) |
| inline virtual

Definition at line 137 of file DAE_Solver.h.

## ◆ setMaxNonlinIterations()

virtual void setMaxNonlinIterations | ( | int | n | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 140 of file DAE_Solver.h.

## ◆ setMaxNonlinConvFailures()

virtual void setMaxNonlinConvFailures | ( | int | n | ) |
| inline virtual

Reimplemented in IDA_Solver.

Definition at line 143 of file DAE_Solver.h.

## ◆ inclAlgebraicInErrorTest()

virtual void inclAlgebraicInErrorTest | ( | bool | yesno | ) |
| inline virtual

Definition at line 146 of file DAE_Solver.h.

## ◆ correctInitial_Y_given_Yp()

virtual void correctInitial_Y_given_Yp | ( | doublereal * | y,
|  | doublereal * | yp,
|  | doublereal | tout
| ) |  |
| inline virtual

Calculate consistent value of the starting solution given the starting solution derivatives.

This method may be called if the initial conditions do not satisfy the residual equation F = 0. Given the derivatives of all variables, this method computes the initial y values.

Reimplemented in IDA_Solver.

Definition at line 157 of file DAE_Solver.h.

## ◆ correctInitial_YaYp_given_Yd()

virtual void correctInitial_YaYp_given_Yd | ( | doublereal * | y,
|  | doublereal * | yp,
|  | doublereal | tout
| ) |  |
| inline virtual

Calculate consistent value of the algebraic constraints and derivatives at the start of the problem.

This method may be called if the initial conditions do not satisfy the residual equation F = 0. Given the initial values of all differential variables, it computes the initial values of all algebraic variables and the initial derivatives of all differential variables.

Parameters

  y | Calculated value of the solution vector after the procedure ends
  yp | Calculated value of the solution derivative after the procedure
  tout | The first value of t at which a soluton will be requested (from IDASolve). (This is needed here to determine the direction of integration and rough scale in the independent variable t.

Reimplemented in IDA_Solver.

Definition at line 176 of file DAE_Solver.h.

## ◆ solve()

virtual int solve | ( | doublereal | tout | ) |
| inline virtual

Solve the system of equations up to time tout.

Reimplemented in IDA_Solver.

Definition at line 184 of file DAE_Solver.h.

## ◆ step()

virtual doublereal step | ( | doublereal | tout | ) |
| inline virtual

Take one internal step.

Reimplemented in IDA_Solver.

Definition at line 192 of file DAE_Solver.h.

## ◆ nEquations()

int nEquations | ( |  | ) | const
| inline

Number of equations.

Definition at line 198 of file DAE_Solver.h.

References ResidJacEval::nEquations().

## ◆ init()

virtual void init | ( | doublereal | t0 | ) |
| inline virtual

initialize.

Base class method does nothing.

Reimplemented in IDA_Solver.

Definition at line 205 of file DAE_Solver.h.

## ◆ setInputParameter()

virtual void setInputParameter | ( | int | flag,
|  | doublereal | value
| ) |  |
| inline virtual

Set a solver-specific input parameter.

Definition at line 210 of file DAE_Solver.h.

## ◆ getOutputParameter()

virtual doublereal getOutputParameter | ( | int | flag | ) | const
| inline virtual

Get the value of a solver-specific output parameter.

Reimplemented in IDA_Solver.

Definition at line 217 of file DAE_Solver.h.

## ◆ solution()

virtual doublereal solution | ( | int | k | ) | const
| inline virtual

the current value of solution component k.

Reimplemented in IDA_Solver.

Definition at line 223 of file DAE_Solver.h.

## ◆ solutionVector()

virtual const doublereal * solutionVector | ( |  | ) | const
| inline virtual

Definition at line 228 of file DAE_Solver.h.

## ◆ derivative()

virtual doublereal derivative | ( | int | k | ) | const
| inline virtual

the current value of the derivative of solution component k.

Reimplemented in IDA_Solver.

Definition at line 234 of file DAE_Solver.h.

## ◆ derivativeVector()

virtual const doublereal * derivativeVector | ( |  | ) | const
| inline virtual

Definition at line 239 of file DAE_Solver.h.

## ◆ warn()

void warn | ( | const std::string & | msg | ) | const
| inline private

Definition at line 253 of file DAE_Solver.h.

## Member Data Documentation

## ◆ m_dummy

doublereal m_dummy
| protected

Definition at line 245 of file DAE_Solver.h.

## ◆ m_resid

ResidJacEval& m_resid
| protected

Definition at line 246 of file DAE_Solver.h.

## ◆ m_neq

integer m_neq
| protected

Number of total equations in the system.

Definition at line 249 of file DAE_Solver.h.

Referenced by IDA_Solver::correctInitial_Y_given_Yp(), IDA_Solver::correctInitial_YaYp_given_Yd(), and IDA_Solver::init().

## ◆ m_time

doublereal m_time
| protected

Definition at line 250 of file DAE_Solver.h.

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

- DAE_Solver.h