OGS
|
This class provides concrete access to Sundials' CVode solver.
This class is the implementation part in the pimpl idiom used by the CVodeSolver class. Therefore all if this classes methods are only forwarded from CVodeSolver.
Definition at line 84 of file CVodeSolver.cpp.
Public Member Functions | |
CVodeSolverImpl (BaseLib::ConfigTree const &config, unsigned const num_equations) | |
void | setFunction (std::unique_ptr< detail::FunctionHandles > &&f) |
void | preSolve () |
bool | solve (const double t_end) |
double const * | getSolution () const |
double | getTime () const |
void | getYDot (const double t, double const *const y, double *const y_dot) |
void | setTolerance (const double *abstol, const double reltol) |
void | setTolerance (const double abstol, const double reltol) |
void | setIC (const double t0, double const *const y0) |
~CVodeSolverImpl () | |
Private Attributes | |
N_Vector | y_ = nullptr |
The solution vector. | |
realtype | t_ |
N_Vector | abstol_ = nullptr |
current time | |
realtype | reltol_ |
Relative tolerance. | |
unsigned | num_equations_ |
Number of equations in the ODE system. | |
void * | cvode_mem_ |
CVode's internal memory. | |
std::unique_ptr< detail::FunctionHandles > | f_ |
int | linear_multistep_method_ = CV_ADAMS |
The multistep method used for solving the ODE. | |
int | nonlinear_solver_iteration_ = CV_FUNCTIONAL |
Either solve via fixed-point iteration or via Newton-Raphson method. | |
MathLib::ODE::CVodeSolverImpl::CVodeSolverImpl | ( | BaseLib::ConfigTree const & | config, |
unsigned const | num_equations ) |
Definition at line 131 of file CVodeSolver.cpp.
References abstol_, check_error(), cvode_mem_, DBUG(), BaseLib::ConfigTree::getConfigParameterOptional(), linear_multistep_method_, nonlinear_solver_iteration_, num_equations_, OGS_FATAL, MathLib::t, and y_.
MathLib::ODE::CVodeSolverImpl::~CVodeSolverImpl | ( | ) |
Definition at line 303 of file CVodeSolver.cpp.
References abstol_, cvode_mem_, printStats(), and y_.
|
inline |
|
inline |
void MathLib::ODE::CVodeSolverImpl::getYDot | ( | const double | t, |
double const *const | y, | ||
double *const | y_dot ) |
Definition at line 296 of file CVodeSolver.cpp.
References f_, and MathLib::t.
void MathLib::ODE::CVodeSolverImpl::preSolve | ( | ) |
Definition at line 238 of file CVodeSolver.cpp.
References abstol_, check_error(), cvode_mem_, f_, num_equations_, reltol_, MathLib::t, t_, and y_.
void MathLib::ODE::CVodeSolverImpl::setFunction | ( | std::unique_ptr< detail::FunctionHandles > && | f | ) |
Definition at line 222 of file CVodeSolver.cpp.
References f_, and num_equations_.
void MathLib::ODE::CVodeSolverImpl::setIC | ( | const double | t0, |
double const *const | y0 ) |
Definition at line 228 of file CVodeSolver.cpp.
References num_equations_, t_, and y_.
void MathLib::ODE::CVodeSolverImpl::setTolerance | ( | const double * | abstol, |
const double | reltol ) |
Definition at line 202 of file CVodeSolver.cpp.
References abstol_, num_equations_, and reltol_.
void MathLib::ODE::CVodeSolverImpl::setTolerance | ( | const double | abstol, |
const double | reltol ) |
Definition at line 212 of file CVodeSolver.cpp.
References abstol_, num_equations_, and reltol_.
bool MathLib::ODE::CVodeSolverImpl::solve | ( | const double | t_end | ) |
Definition at line 283 of file CVodeSolver.cpp.
References check_error(), cvode_mem_, t_, and y_.
|
private |
current time
Array of absolute tolerances.
Definition at line 112 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl(), ~CVodeSolverImpl(), preSolve(), setTolerance(), and setTolerance().
|
private |
CVode's internal memory.
Definition at line 116 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl(), ~CVodeSolverImpl(), preSolve(), and solve().
|
private |
Function handles that compute \(\partial \dot y/\partial y\) and \(\dot y\).
Definition at line 120 of file CVodeSolver.cpp.
Referenced by getYDot(), preSolve(), and setFunction().
|
private |
The multistep method used for solving the ODE.
Definition at line 123 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl().
|
private |
Either solve via fixed-point iteration or via Newton-Raphson method.
Definition at line 126 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl().
|
private |
Number of equations in the ODE system.
Definition at line 115 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl(), preSolve(), setFunction(), setIC(), setTolerance(), and setTolerance().
|
private |
Relative tolerance.
Definition at line 113 of file CVodeSolver.cpp.
Referenced by preSolve(), setTolerance(), and setTolerance().
|
private |
Definition at line 110 of file CVodeSolver.cpp.
Referenced by getTime(), preSolve(), setIC(), and solve().
|
private |
The solution vector.
Definition at line 108 of file CVodeSolver.cpp.
Referenced by CVodeSolverImpl(), ~CVodeSolverImpl(), getSolution(), preSolve(), setIC(), and solve().