10#define CT_IDA_SOLVER_H
15#include "sundials/sundials_nvector.h"
23#define REAL_WORKSPACE_SIZE 0
58 virtual void setTolerances(doublereal reltol, doublereal abstol);
60 virtual void setLinearSolverType(
int solverType);
72 virtual void setMaxOrder(
int n);
108 virtual void setMaxErrTestFailures(
int n);
123 virtual void inclAlgebraicInErrorTest(
bool yesno);
206 virtual int solve(doublereal tout);
208 virtual doublereal
step(doublereal tout);
210 virtual void init(doublereal t0);
212 virtual doublereal
solution(
int k)
const;
214 virtual const doublereal* solutionVector()
const;
218 virtual const doublereal* derivativeVector()
const;
240 N_Vector m_constraints;
247 doublereal m_abstols;
304 std::unique_ptr<ResidData> m_fdata;
Header file for class DAE_Solver.
Wrapper for Sundials IDA solver.
virtual doublereal step(doublereal tout)
Take one internal step.
virtual void setStopTime(doublereal tstop)
Set the stop time.
virtual void correctInitial_Y_given_Yp(doublereal *y, doublereal *yp, doublereal tout)
Calculate consistent value of the starting solution given the starting solution derivatives.
virtual void setMaxNumSteps(int n)
Set the maximum number of time steps.
virtual void setBandedLinearSolver(int m_upper, int m_lower)
Set up the problem to use a band solver.
virtual doublereal solution(int k) const
the current value of solution component k.
N_Vector m_y
Current value of the solution vector.
virtual void setJacobianType(int formJac)
Set the form of the Jacobian.
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.
void * m_linsol
Sundials linear solver object.
int m_maxNonlinConvFails
Maximum number of nonlinear convergence failures.
virtual void setInitialStepSize(doublereal h0)
Set the initial step size.
virtual int solve(doublereal tout)
Step the system to a final value of the time.
int m_maxNonlinIters
Maximum number of nonlinear solver iterations at one solution.
SundialsContext m_sundials_ctx
SUNContext object for Sundials>=6.0.
IDA_Solver(ResidJacEval &f)
Constructor.
doublereal m_told
Value of the previous time.
virtual void setDenseLinearSolver()
Set up the problem to use a dense linear direct solver.
doublereal m_deltat
Value of deltaT for the current step.
int m_maxErrTestFails
maximum number of error test failures
virtual void setTolerances(doublereal reltol, doublereal *abstol)
Set error tolerances.
virtual void setMaxNonlinIterations(int n)
Set the maximum number of nonlinear iterations on a timestep.
doublereal m_tcurrent
Value of the current time.
int m_maxord
maximum time step order of the method
virtual doublereal getOutputParameter(int flag) const
Get the value of a solver-specific output parameter.
virtual void init(doublereal t0)
initialize.
int m_formJac
Form of the Jacobian.
doublereal m_hmin
Minimum value of the timestep allowed.
doublereal m_hmax
Maximum value of the timestep allowed.
doublereal m_told_old
Value of the previous, previous time.
virtual void setMaxNonlinConvFailures(int n)
Set the maximum number of nonlinear solver convergence failures.
virtual double getCurrentStepFromIDA()
Get the current step size from IDA via a call.
virtual doublereal derivative(int k) const
the current value of the derivative of solution component k.
doublereal m_h0
Value of the initial time step.
void * m_linsol_matrix
matrix used by Sundials
N_Vector m_ydot
Current value of the derivative of the solution vector.
doublereal m_t0
Initial value of the time.
int m_maxsteps
Maximum number of time steps allowed.
doublereal m_tstop
maximum time
int m_setSuppressAlg
If true, the algebraic variables don't contribute to error tolerances.
void * m_ida_mem
Pointer to the IDA memory for the problem.
Wrappers for the function evaluators for Nonlinear solvers and Time steppers.
A wrapper for managing a SUNContext object, need for Sundials >= 6.0.
Namespace for the Cantera kernel.