Wrapper class for the Sundials CVODE solver.
More...
#include <sundialsUtils.h>
|
| | SundialsCvode (unsigned int n) |
| | Create a solver for a problem with n variables.
|
| |
| | ~SundialsCvode () |
| |
| void | setBandwidth (int upper, int lower) |
| | Set the upper and lower bandwidth of the banded Jacobian.
|
| |
| void | setODE (sdODE *newODE) |
| | Set the ODE to be solved.
|
| |
| void | initialize () |
| | Initialize the CVODE solver object using the previously-specified options.
|
| |
| bool | initialized () const |
| | true if initialize() has already been called.
|
| |
| int | integrateToTime (realtype t) |
| | Take as many steps as needed to reach t (up to maxNumSteps)
|
| |
| int | integrateOneStep (realtype tf) |
| | Take one step towards tf without stepping past it.
|
| |
| int | getRootInfo () |
| | Update rootsFound to indicate any roots that have been found.
|
| |
| void | printStats () |
| | Print solver statistics.
|
| |
| long int | getNumSteps () |
| | Returns the cumulative number of internal steps taken.
|
| |
| int | getLastOrder () |
| | Returns the order of the integration method used during the last step.
|
| |
| realtype | getLastStep () |
| | Get the step size used for the last step.
|
| |
|
| static int | check_flag (void *flagvalue, const char *funcname, int opt) |
| | Check function return value for Sundials functions.
|
| |
|
| realtype | t0 |
| | initial time
|
| |
| sdVector | y |
| | initial or current state vector
|
| |
| realtype | reltol |
| | scalar relative tolerance
|
| |
| sdVector | abstol |
| | absolute tolerance for each solution component
|
| |
| int | linearMultistepMethod |
| | CV_ADAMS for non-stiff problems, CV_BDF for stiff problems.
|
| |
| bool | findRoots |
| | Specify whether or not to use the function g for rootfinding.
|
| |
| int | maxNumSteps |
| | Maximum number of internal timesteps taken in one call to integrateToTime.
|
| |
| realtype | minStep |
| | minimum step size
|
| |
| realtype | tInt |
| | time reached by integrator
|
| |
| std::vector< int > | rootsFound |
| | Root information populated by getRootInfo()
|
| |
| unsigned int | nRoots |
| | number of root functions to be called
|
| |
| int | errorCount |
| | Number of integration failures.
|
| |
| int | errorStopCount |
| | Maximum permissible number of integration failures.
|
| |
|
| static int | f (realtype t, N_Vector yIn, N_Vector ydotIn, void *f_data) |
| |
| static int | g (realtype t, N_Vector yIn, realtype *gout, void *g_data) |
| |
| static int | denseJac (realtype t, N_Vector yIn, N_Vector fy, SUNMatrix Jin, void *jac_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) |
| |
| static int | bandJac (realtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) |
| |
Wrapper class for the Sundials CVODE solver.
Use of this class has the following restrictions:
- Configuration variables for CVODE may only be set before calling initialize(). The following must be initialized:
- The following configuration variables are optional:
- Methods which call the CVODE solver, such as integrateToTime() may only be called after calling initialize().
◆ SundialsCvode()
| SundialsCvode::SundialsCvode |
( |
unsigned int | n | ) |
|
Create a solver for a problem with n variables.
◆ ~SundialsCvode()
| SundialsCvode::~SundialsCvode |
( |
| ) |
|
◆ setBandwidth()
| void SundialsCvode::setBandwidth |
( |
int | upper, |
|
|
int | lower ) |
Set the upper and lower bandwidth of the banded Jacobian.
◆ setODE()
| void SundialsCvode::setODE |
( |
sdODE * | newODE | ) |
|
Set the ODE to be solved.
◆ initialize()
| void SundialsCvode::initialize |
( |
| ) |
|
Initialize the CVODE solver object using the previously-specified options.
Integration may be restarted by reassigning y and t0 and calling initialize again, provided that the problem size has not changed.
◆ initialized()
| bool SundialsCvode::initialized |
( |
| ) |
const |
◆ integrateToTime()
| int SundialsCvode::integrateToTime |
( |
realtype | t | ) |
|
Take as many steps as needed to reach t (up to maxNumSteps)
◆ integrateOneStep()
| int SundialsCvode::integrateOneStep |
( |
realtype | tf | ) |
|
Take one step towards tf without stepping past it.
◆ getRootInfo()
| int SundialsCvode::getRootInfo |
( |
| ) |
|
Update rootsFound to indicate any roots that have been found.
◆ printStats()
| void SundialsCvode::printStats |
( |
| ) |
|
◆ getNumSteps()
| long int SundialsCvode::getNumSteps |
( |
| ) |
|
Returns the cumulative number of internal steps taken.
◆ getLastOrder()
| int SundialsCvode::getLastOrder |
( |
| ) |
|
Returns the order of the integration method used during the last step.
◆ getLastStep()
| realtype SundialsCvode::getLastStep |
( |
| ) |
|
Get the step size used for the last step.
◆ check_flag()
| int SundialsCvode::check_flag |
( |
void * | flagvalue, |
|
|
const char * | funcname, |
|
|
int | opt ) |
|
static |
Check function return value for Sundials functions.
opt == 0 means SUNDIALS function allocates memory so check if returned NULL pointer
opt == 1 means SUNDIALS function returns a flag so check if flag >= 0
◆ f()
| int SundialsCvode::f |
( |
realtype | t, |
|
|
N_Vector | yIn, |
|
|
N_Vector | ydotIn, |
|
|
void * | f_data ) |
|
staticprivate |
◆ g()
| int SundialsCvode::g |
( |
realtype | t, |
|
|
N_Vector | yIn, |
|
|
realtype * | gout, |
|
|
void * | g_data ) |
|
staticprivate |
◆ denseJac()
| int SundialsCvode::denseJac |
( |
realtype | t, |
|
|
N_Vector | yIn, |
|
|
N_Vector | fy, |
|
|
SUNMatrix | Jin, |
|
|
void * | jac_data, |
|
|
N_Vector | tmp1, |
|
|
N_Vector | tmp2, |
|
|
N_Vector | tmp3 ) |
|
staticprivate |
◆ bandJac()
| int SundialsCvode::bandJac |
( |
realtype | t, |
|
|
N_Vector | y, |
|
|
N_Vector | fy, |
|
|
SUNMatrix | Jac, |
|
|
void * | user_data, |
|
|
N_Vector | tmp1, |
|
|
N_Vector | tmp2, |
|
|
N_Vector | tmp3 ) |
|
staticprivate |
◆ sunContext
◆ t0
| realtype SundialsCvode::t0 |
initial or current state vector
◆ reltol
| realtype SundialsCvode::reltol |
scalar relative tolerance
◆ abstol
absolute tolerance for each solution component
◆ linearMultistepMethod
| int SundialsCvode::linearMultistepMethod |
CV_ADAMS for non-stiff problems, CV_BDF for stiff problems.
◆ findRoots
| bool SundialsCvode::findRoots |
Specify whether or not to use the function g for rootfinding.
◆ maxNumSteps
| int SundialsCvode::maxNumSteps |
Maximum number of internal timesteps taken in one call to integrateToTime.
◆ minStep
| realtype SundialsCvode::minStep |
◆ tInt
| realtype SundialsCvode::tInt |
time reached by integrator
◆ rootsFound
| std::vector<int> SundialsCvode::rootsFound |
◆ nRoots
| unsigned int SundialsCvode::nRoots |
number of root functions to be called
◆ errorCount
| int SundialsCvode::errorCount |
Number of integration failures.
◆ errorStopCount
| int SundialsCvode::errorStopCount |
Maximum permissible number of integration failures.
◆ theODE
| sdODE* SundialsCvode::theODE |
|
private |
◆ sundialsMem
| void* SundialsCvode::sundialsMem |
|
private |
◆ sundialsLinsol
| void* SundialsCvode::sundialsLinsol |
|
private |
Sundials linear solver object.
◆ sundialsLinsolMatrix
| void* SundialsCvode::sundialsLinsolMatrix |
|
private |
◆ bandwidth_upper
| int SundialsCvode::bandwidth_upper |
|
private |
◆ bandwidth_lower
| int SundialsCvode::bandwidth_lower |
|
private |
◆ _initialized
| bool SundialsCvode::_initialized |
|
private |
The documentation for this class was generated from the following files: