Cantera  2.1.2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CVodesIntegrator Class Reference

Wrapper class for 'cvodes' integrator from LLNL. More...

#include <CVodesIntegrator.h>

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

Public Member Functions

 CVodesIntegrator ()
 Constructor. More...
 
virtual void setTolerances (double reltol, size_t n, double *abstol)
 Set or reset the number of equations. More...
 
virtual void setTolerances (double reltol, double abstol)
 Set error tolerances. More...
 
virtual void setSensitivityTolerances (double reltol, double abstol)
 Set the sensitivity error tolerances. More...
 
virtual void setProblemType (int probtype)
 Set the problem type. More...
 
virtual void initialize (double t0, FuncEval &func)
 Initialize the integrator for a new problem. More...
 
virtual void reinitialize (double t0, FuncEval &func)
 
virtual void integrate (double tout)
 Integrate the system of equations. More...
 
virtual doublereal step (double tout)
 Integrate the system of equations. More...
 
virtual double & solution (size_t k)
 The current value of the solution of equation k. More...
 
virtual double * solution ()
 The current value of the solution of the system of equations. More...
 
virtual int nEquations () const
 The number of equations. More...
 
virtual int nEvals () const
 The number of function evaluations. More...
 
virtual void setMaxOrder (int n)
 Set the maximum integration order that will be used. More...
 
virtual void setMethod (MethodType t)
 Set the solution method. More...
 
virtual void setIterator (IterType t)
 Set the linear iterator. More...
 
virtual void setMaxStepSize (double hmax)
 Set the maximum step size. More...
 
virtual void setMinStepSize (double hmin)
 Set the minimum step size. More...
 
virtual void setMaxSteps (int nmax)
 
virtual void setMaxErrTestFails (int n)
 Set the maximum permissible number of error test failures. More...
 
virtual void setBandwidth (int N_Upper, int N_Lower)
 
virtual int nSensParams ()
 
virtual double sensitivity (size_t k, size_t p)
 
virtual std::string getErrorInfo (int N)
 Returns a string listing the weighted error estimates associated with each solution component. More...
 
- Public Member Functions inherited from Integrator
 Integrator ()
 Default Constructor. More...
 
virtual ~Integrator ()
 Destructor. More...
 

Protected Member Functions

void applyOptions ()
 Applies user-specified options to the underlying CVODES solver. More...
 

Private Member Functions

void sensInit (double t0, FuncEval &func)
 

Private Attributes

size_t m_neq
 
void * m_cvode_mem
 
double m_t0
 
double m_time
 The current integrator time. More...
 
N_Vector m_y
 
N_Vector m_abstol
 
int m_type
 
int m_itol
 
int m_method
 
int m_iter
 
int m_maxord
 
double m_reltol
 
double m_abstols
 
double m_reltolsens
 
double m_abstolsens
 
size_t m_nabs
 
double m_hmax
 
double m_hmin
 
int m_maxsteps
 
int m_maxErrTestFails
 
FuncData * m_fdata
 
N_Vector * m_yS
 
size_t m_np
 
int m_mupper
 
int m_mlower
 
bool m_sens_ok
 Indicates whether the sensitivities stored in m_yS have been updated for at the current integrator time. More...
 

Detailed Description

Wrapper class for 'cvodes' integrator from LLNL.

See Also
FuncEval.h. Classes that use CVodeInt: ImplicitChem, ImplicitSurfChem, Reactor
Deprecated:
Support for Sundials 2.2 and 2.3 is deprecated. Starting with Cantera 2.2, only Sundials versions 2.4 and newer will be supported. (The CVodesIntegrator class itself is not deprecated).

Definition at line 46 of file CVodesIntegrator.h.

Constructor & Destructor Documentation

Constructor.

Default settings: dense jacobian, no user-supplied Jacobian function, Newton iteration.

Definition at line 106 of file CVodesIntegrator.cpp.

References Cantera::warn_deprecated().

Member Function Documentation

void setTolerances ( double  reltol,
size_t  n,
double *  abstol 
)
virtual

Set or reset the number of equations.

Set error tolerances.

Parameters
reltolscalar relative tolerance
nNumber of equations
abstolarray of N absolute tolerance values

Reimplemented from Integrator.

Definition at line 169 of file CVodesIntegrator.cpp.

void setTolerances ( double  reltol,
double  abstol 
)
virtual

Set error tolerances.

Parameters
reltolscalar relative tolerance
abstolscalar absolute tolerance

Reimplemented from Integrator.

Definition at line 185 of file CVodesIntegrator.cpp.

void setSensitivityTolerances ( double  reltol,
double  abstol 
)
virtual

Set the sensitivity error tolerances.

Parameters
reltolscalar relative tolerance
abstolscalar absolute tolerance

Reimplemented from Integrator.

Definition at line 192 of file CVodesIntegrator.cpp.

void setProblemType ( int  probtype)
virtual

Set the problem type.

Parameters
probtypeType of the problem

Reimplemented from Integrator.

Definition at line 198 of file CVodesIntegrator.cpp.

void initialize ( double  t0,
FuncEval func 
)
virtual

Initialize the integrator for a new problem.

Call after all options have been set.

Parameters
t0initial time
funcRHS evaluator object for system of equations.

Reimplemented from Integrator.

Definition at line 298 of file CVodesIntegrator.cpp.

References CVodesIntegrator::applyOptions(), cvodes_rhs(), DATA_PTR, FuncEval::getInitialConditions(), CVodesIntegrator::m_time, FuncEval::neq(), and FuncEval::nparams().

void integrate ( double  tout)
virtual

Integrate the system of equations.

Parameters
toutIntegrate to this time. Note that this is the absolute time value, not a time interval.

Reimplemented from Integrator.

Definition at line 479 of file CVodesIntegrator.cpp.

References CVodesIntegrator::getErrorInfo(), Cantera::int2str(), CVodesIntegrator::m_sens_ok, and CVodesIntegrator::m_time.

double step ( double  tout)
virtual

Integrate the system of equations.

Parameters
toutintegrate to this time. Note that this is the absolute time value, not a time interval.

Reimplemented from Integrator.

Definition at line 489 of file CVodesIntegrator.cpp.

References CVodesIntegrator::getErrorInfo(), Cantera::int2str(), CVodesIntegrator::m_sens_ok, and CVodesIntegrator::m_time.

double & solution ( size_t  k)
virtual

The current value of the solution of equation k.

Reimplemented from Integrator.

Definition at line 159 of file CVodesIntegrator.cpp.

double * solution ( )
virtual

The current value of the solution of the system of equations.

Reimplemented from Integrator.

Definition at line 164 of file CVodesIntegrator.cpp.

virtual int nEquations ( ) const
inlinevirtual

The number of equations.

Reimplemented from Integrator.

Definition at line 65 of file CVodesIntegrator.h.

int nEvals ( ) const
virtual

The number of function evaluations.

Reimplemented from Integrator.

Definition at line 501 of file CVodesIntegrator.cpp.

virtual void setMaxOrder ( int  n)
inlinevirtual

Set the maximum integration order that will be used.

Reimplemented from Integrator.

Definition at line 69 of file CVodesIntegrator.h.

void setMethod ( MethodType  t)
virtual

Set the solution method.

Reimplemented from Integrator.

Definition at line 203 of file CVodesIntegrator.cpp.

References Cantera::Adams_Method, and Cantera::BDF_Method.

void setIterator ( IterType  t)
virtual

Set the linear iterator.

Reimplemented from Integrator.

Definition at line 246 of file CVodesIntegrator.cpp.

References Cantera::Functional_Iter, and Cantera::Newton_Iter.

void setMaxStepSize ( double  hmax)
virtual

Set the maximum step size.

Reimplemented from Integrator.

Definition at line 214 of file CVodesIntegrator.cpp.

void setMinStepSize ( double  hmin)
virtual

Set the minimum step size.

Reimplemented from Integrator.

Definition at line 222 of file CVodesIntegrator.cpp.

void setMaxErrTestFails ( int  n)
virtual

Set the maximum permissible number of error test failures.

Reimplemented from Integrator.

Definition at line 238 of file CVodesIntegrator.cpp.

string getErrorInfo ( int  N)
virtual

Returns a string listing the weighted error estimates associated with each solution component.

This information can be used to identify which variables are responsible for integrator failures or unexpected small timesteps.

Definition at line 536 of file CVodesIntegrator.cpp.

Referenced by CVodesIntegrator::integrate(), and CVodesIntegrator::step().

void applyOptions ( )
protected

Applies user-specified options to the underlying CVODES solver.

Called during integrator initialization or reinitialization.

Definition at line 444 of file CVodesIntegrator.cpp.

Referenced by CVodesIntegrator::initialize().

Member Data Documentation

double m_time
private

The current integrator time.

Definition at line 104 of file CVodesIntegrator.h.

Referenced by CVodesIntegrator::initialize(), CVodesIntegrator::integrate(), and CVodesIntegrator::step().

bool m_sens_ok
private

Indicates whether the sensitivities stored in m_yS have been updated for at the current integrator time.

Definition at line 125 of file CVodesIntegrator.h.

Referenced by CVodesIntegrator::integrate(), and CVodesIntegrator::step().


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