Cantera  3.3.0a1
Loading...
Searching...
No Matches
IdasIntegrator.cpp
Go to the documentation of this file.
1//! @file IdasIntegrator.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at http://www.cantera.org/license.txt for license and copyright information.
5
8
9#include "cantera/numerics/sundials_headers.h"
10
11using namespace std;
12
13namespace {
14
15N_Vector newNVector(size_t N, Cantera::SundialsContext& context)
16{
17 return N_VNew_Serial(static_cast<sd_size_t>(N), context.get());
18}
19
20} // end anonymous namespace
21
22namespace Cantera
23{
24
25extern "C" {
26
27//! Function called by IDA to evaluate the residual, given y and ydot.
28/*!
29* IDA allows passing in a void* pointer to access external data. Instead of requiring
30* the user to provide a residual function directly to IDA (which would require using the
31* Sundials data types N_Vector, etc.), we define this function as the single function
32* that IDA always calls. The real evaluation of the residual is done by the
33* FuncEval::evalDae() method of an instance of a subclass of FuncEval that is passed
34* into this function as the `f_data` parameter.
35*/
36static int ida_rhs(sunrealtype t, N_Vector y, N_Vector ydot, N_Vector r, void* f_data)
37{
38 FuncEval* f = (FuncEval*) f_data;
39 return f->evalDaeNoThrow(t, NV_DATA_S(y), NV_DATA_S(ydot), NV_DATA_S(r));
40}
41
42#if SUNDIALS_VERSION_MAJOR >= 7
43 //! Function called by CVodes when an error is encountered instead of
44 //! writing to stdout. Here, save the error message provided by CVodes so
45 //! that it can be included in the subsequently raised CanteraError. Used by
46 //! SUNDIALS 7.0 and newer.
47 static void sundials_err(int line, const char *func, const char *file,
48 const char *msg, SUNErrCode err_code,
49 void *err_user_data, SUNContext sunctx)
50 {
51 IdasIntegrator* integrator = (IdasIntegrator*) err_user_data;
52 integrator->m_error_message = fmt::format("{}: {}\n", func, msg);
53 }
54#else
55 //! Function called by IDA when an error is encountered instead of writing to
56 //! stdout. Here, save the error message provided by IDA so that it can be included
57 //! in the subsequently raised CanteraError.
58 static void ida_err(int error_code, const char* module,
59 const char* function, char* msg, void* eh_data)
60 {
61 IdasIntegrator* integrator = (IdasIntegrator*) eh_data;
62 integrator->m_error_message = msg;
63 integrator->m_error_message += "\n";
64 }
65#endif
66
67}
68
70 : m_itol(IDA_SS)
71{
72}
73
74IdasIntegrator::~IdasIntegrator()
75{
76 if (m_ida_mem) {
77 IDAFree(&m_ida_mem);
78 }
79 if (m_y) {
80 N_VDestroy_Serial(m_y);
81 }
82 if (m_ydot) {
83 N_VDestroy_Serial(m_ydot);
84 }
85 if (m_abstol) {
86 N_VDestroy_Serial(m_abstol);
87 }
88 if (m_constraints) {
89 N_VDestroy_Serial(m_constraints);
90 }
91}
92
93double& IdasIntegrator::solution(size_t k)
94{
95 return NV_Ith_S(m_y, k);
96}
97
99{
100 return NV_DATA_S(m_y);
101}
102
103void IdasIntegrator::setTolerances(double reltol, size_t n, double* abstol)
104{
105 m_itol = IDA_SV;
106 if (n != m_nabs) {
107 m_nabs = n;
108 if (m_abstol) {
109 N_VDestroy_Serial(m_abstol);
110 }
111 m_abstol = newNVector(static_cast<sd_size_t>(n), m_sundials_ctx);
112 }
113 for (size_t i=0; i<n; i++) {
114 NV_Ith_S(m_abstol, i) = abstol[i];
115 }
116 m_reltol = reltol;
117}
118
119void IdasIntegrator::setTolerances(double reltol, double abstol)
120{
121 m_itol = IDA_SS;
122 m_reltol = reltol;
123 m_abstols = abstol;
124}
125
126void IdasIntegrator::setSensitivityTolerances(double reltol, double abstol)
127{
128 m_reltolsens = reltol;
129 m_abstolsens = abstol;
130}
131
132
133void IdasIntegrator::setLinearSolverType(const string& linearSolverType)
134{
136}
137
139{
140 if (m_ida_mem) {
141 int flag = IDASetMaxOrd(m_ida_mem, n);
142 checkError(flag, "setMaxOrder", "IDASetMaxOrd");
143 }
144 m_maxord = n;
145}
146
148{
149 m_hmax = hmax;
150 if (m_ida_mem) {
151 int flag = IDASetMaxStep(m_ida_mem, hmax);
152 checkError(flag, "setMaxStepSize", "IDASetMaxStep");
153 }
154}
155
157{
158 m_maxsteps = nmax;
159 if (m_ida_mem) {
160 IDASetMaxNumSteps(m_ida_mem, m_maxsteps);
161 }
162}
163
165{
166 return m_maxsteps;
167}
168
170{
172 if (m_ida_mem) {
173 IDASetMaxErrTestFails(m_ida_mem, n);
174 }
175}
176
178{
179 AnyMap stats;
180 long int val;
181 int lastOrder;
182
183 int flag = IDAGetNumSteps(m_ida_mem, &val);
184 checkError(flag, "solverStats", "IDAGetNumSteps");
185 stats["steps"] = val;
186 IDAGetNumResEvals(m_ida_mem, &val);
187 stats["res_evals"] = val;
188 IDAGetNumLinSolvSetups(m_ida_mem, &val);
189 stats["lin_solve_setups"] = val;
190 IDAGetNumErrTestFails(m_ida_mem, &val);
191 stats["err_tests_fails"] = val;
192 IDAGetLastOrder(m_ida_mem, &lastOrder);
193 stats["last_order"] = lastOrder;
194 IDAGetNumNonlinSolvIters(m_ida_mem, &val);
195 stats["nonlinear_iters"] = val;
196 IDAGetNumNonlinSolvConvFails(m_ida_mem, &val);
197 stats["nonlinear_conv_fails"] = val;
198 return stats;
199}
200
201void IdasIntegrator::setMaxNonlinIterations(int n)
202{
204 if (m_ida_mem) {
205 int flag = IDASetMaxNonlinIters(m_ida_mem, m_maxNonlinIters);
206 checkError(flag, "setMaxNonlinIterations", "IDASetMaxNonlinIters");
207 }
208}
209
210void IdasIntegrator::setMaxNonlinConvFailures(int n)
211{
213 if (m_ida_mem) {
214 int flag = IDASetMaxConvFails(m_ida_mem, m_maxNonlinConvFails);
215 checkError(flag, "setMaxNonlinConvFailures", "IDASetMaxConvFails");
216 }
217}
218
219void IdasIntegrator::includeAlgebraicInErrorTest(bool yesno)
220{
221 m_setSuppressAlg = !yesno;
222 if (m_ida_mem) {
223 int flag = IDASetSuppressAlg(m_ida_mem, m_setSuppressAlg);
224 checkError(flag, "inclAlgebraicInErrorTest", "IDASetSuppressAlg");
225 }
226}
227
229{
230 m_neq = func.neq();
231 m_t0 = t0;
232 m_time = t0;
233 m_tInteg = t0;
234 m_func = &func;
235 func.clearErrors();
236
237 if (m_y) {
238 N_VDestroy_Serial(m_y); // free solution vector if already allocated
239 }
240 m_y = newNVector(static_cast<sd_size_t>(m_neq), m_sundials_ctx);
241 N_VConst(0.0, m_y);
242
243 if (m_ydot) {
244 N_VDestroy_Serial(m_ydot); // free derivative vector if already allocated
245 }
246 m_ydot = newNVector(m_neq, m_sundials_ctx);
247 N_VConst(0.0, m_ydot);
248
249 // check abs tolerance array size
250 if (m_itol == IDA_SV && m_nabs < m_neq) {
251 throw CanteraError("IdasIntegrator::initialize",
252 "not enough absolute tolerance values specified.");
253 }
254
255 if (m_constraints) {
256 N_VDestroy_Serial(m_constraints);
257 }
258 m_constraints = newNVector(static_cast<sd_size_t>(m_neq), m_sundials_ctx);
259 // set the constraints
260 func.getConstraints(NV_DATA_S(m_constraints));
261
262 // get the initial conditions
263 func.getStateDae(NV_DATA_S(m_y), NV_DATA_S(m_ydot));
264
265 if (m_ida_mem) {
266 IDAFree(&m_ida_mem);
267 }
268
269 //! Create the IDA solver
270 m_ida_mem = IDACreate(m_sundials_ctx.get());
271 if (!m_ida_mem) {
272 throw CanteraError("IdasIntegrator::initialize", "IDACreate failed.");
273 }
274
275 int flag = IDAInit(m_ida_mem, ida_rhs, m_t0, m_y, m_ydot);
276 if (flag != IDA_SUCCESS) {
277 if (flag == IDA_MEM_FAIL) {
278 throw CanteraError("IdasIntegrator::initialize",
279 "Memory allocation failed.");
280 } else if (flag == IDA_ILL_INPUT) {
281 throw CanteraError("IdasIntegrator::initialize",
282 "Illegal value for IDAInit input argument.");
283 } else {
284 throw CanteraError("IdasIntegrator::initialize", "IDAInit failed.");
285 }
286 }
287
288 #if SUNDIALS_VERSION_MAJOR >= 7
289 flag = SUNContext_PushErrHandler(m_sundials_ctx.get(), &sundials_err, this);
290 #else
291 flag = IDASetErrHandlerFn(m_ida_mem, &ida_err, this);
292 #endif
293
294 // set constraints
295 flag = IDASetId(m_ida_mem, m_constraints);
296 checkError(flag, "initialize", "IDASetId");
297
298 if (m_itol == IDA_SV) {
299 flag = IDASVtolerances(m_ida_mem, m_reltol, m_abstol);
300 checkError(flag, "initialize", "IDASVtolerances");
301 } else {
302 flag = IDASStolerances(m_ida_mem, m_reltol, m_abstols);
303 checkError(flag, "initialize", "IDASStolerances");
304 }
305
306 flag = IDASetUserData(m_ida_mem, &func);
307 checkError(flag, "initialize", "IDASetUserData");
308
309 if (func.nparams() > 0) {
310 throw CanteraError("IdasIntegrator::initialize", "Sensitivity analysis "
311 "for DAE systems is not fully implemented");
312 sensInit(t0, func);
313 flag = IDASetSensParams(m_ida_mem, func.m_sens_params.data(),
314 func.m_paramScales.data(), NULL);
315 checkError(flag, "initialize", "IDASetSensParams");
316 }
317 applyOptions();
318}
319
320void IdasIntegrator::reinitialize(double t0, FuncEval& func)
321{
322 m_t0 = t0;
323 m_time = t0;
324 m_tInteg = t0;
325 func.getStateDae(NV_DATA_S(m_y), NV_DATA_S(m_ydot));
326 m_func = &func;
327 func.clearErrors();
328
329 int result = IDAReInit(m_ida_mem, m_t0, m_y, m_ydot);
330 checkError(result, "reinitialize", "IDAReInit");
331 applyOptions();
332}
333
335{
336 if (m_type == "DENSE") {
337 sd_size_t N = static_cast<sd_size_t>(m_neq);
338 SUNLinSolFree((SUNLinearSolver) m_linsol);
339 SUNMatDestroy((SUNMatrix) m_linsol_matrix);
340 m_linsol_matrix = SUNDenseMatrix(N, N, m_sundials_ctx.get());
341 #if CT_SUNDIALS_USE_LAPACK
342 m_linsol = SUNLinSol_LapackDense(m_y, (SUNMatrix) m_linsol_matrix,
343 m_sundials_ctx.get());
344 #else
345 m_linsol = SUNLinSol_Dense(m_y, (SUNMatrix) m_linsol_matrix,
346 m_sundials_ctx.get());
347 #endif
348 IDASetLinearSolver(m_ida_mem, (SUNLinearSolver) m_linsol,
349 (SUNMatrix) m_linsol_matrix);
350 } else if (m_type == "GMRES") {
351 SUNLinSolFree((SUNLinearSolver) m_linsol);
352 m_linsol = SUNLinSol_SPGMR(m_y, SUN_PREC_NONE, 0, m_sundials_ctx.get());
353 IDASetLinearSolver(m_ida_mem, (SUNLinearSolver) m_linsol, nullptr);
354 } else {
355 throw CanteraError("IdasIntegrator::applyOptions",
356 "unsupported linear solver flag '{}'", m_type);
357 }
358
359 if (m_init_step > 0) {
360 IDASetInitStep(m_ida_mem, m_init_step);
361 }
362
363 if (m_maxord > 0) {
364 int flag = IDASetMaxOrd(m_ida_mem, m_maxord);
365 checkError(flag, "applyOptions", "IDASetMaxOrd");
366 }
367 if (m_maxsteps > 0) {
368 IDASetMaxNumSteps(m_ida_mem, m_maxsteps);
369 }
370 if (m_hmax > 0) {
371 IDASetMaxStep(m_ida_mem, m_hmax);
372 }
373 if (m_maxNonlinIters > 0) {
374 int flag = IDASetMaxNonlinIters(m_ida_mem, m_maxNonlinIters);
375 checkError(flag, "applyOptions", "IDASetMaxNonlinIters");
376 }
377 if (m_maxNonlinConvFails > 0) {
378 int flag = IDASetMaxConvFails(m_ida_mem, m_maxNonlinConvFails);
379 checkError(flag, "applyOptions", "IDASetMaxConvFails");
380 }
381 if (m_setSuppressAlg != 0) {
382 int flag = IDASetSuppressAlg(m_ida_mem, m_setSuppressAlg);
383 checkError(flag, "applyOptions", "IDASetSuppressAlg");
384 }
385}
386
387void IdasIntegrator::sensInit(double t0, FuncEval& func)
388{
389 m_np = func.nparams();
390 m_sens_ok = false;
391
392 N_Vector y = newNVector(static_cast<sd_size_t>(func.neq()), m_sundials_ctx);
393 m_yS = N_VCloneVectorArray(static_cast<int>(m_np), y);
394 for (size_t n = 0; n < m_np; n++) {
395 N_VConst(0.0, m_yS[n]);
396 }
397 N_VDestroy_Serial(y);
398 N_Vector ydot = newNVector(static_cast<sd_size_t>(func.neq()), m_sundials_ctx);
399 m_ySdot = N_VCloneVectorArray(static_cast<int>(m_np), ydot);
400 for (size_t n = 0; n < m_np; n++) {
401 N_VConst(0.0, m_ySdot[n]);
402 }
403
404 int flag = IDASensInit(m_ida_mem, static_cast<sd_size_t>(m_np),
405 IDA_STAGGERED, IDASensResFn(0), m_yS, m_ySdot);
406 checkError(flag, "sensInit", "IDASensInit");
407
408 vector<double> atol(m_np);
409 for (size_t n = 0; n < m_np; n++) {
410 // This scaling factor is tuned so that reaction and species enthalpy
411 // sensitivities can be computed simultaneously with the same abstol.
412 atol[n] = m_abstolsens / func.m_paramScales[n];
413 }
414 flag = IDASensSStolerances(m_ida_mem, m_reltolsens, atol.data());
415 checkError(flag, "sensInit", "IDASensSStolerances");
416}
417
419{
420 if (tout == m_time) {
421 return;
422 } else if (tout < m_time) {
423 throw CanteraError("IdasIntegrator::integrate",
424 "Cannot integrate backwards in time.\n"
425 "Requested time {} < current time {}",
426 tout, m_time);
427 }
428 int nsteps = 0;
429 while (m_tInteg < tout) {
430 if (nsteps >= m_maxsteps) {
431 throw CanteraError("IdasIntegrator::integrate",
432 "Maximum number of timesteps ({}) taken without reaching output "
433 "time ({}).\nCurrent integrator time: {}",
434 nsteps, tout, m_time);
435 }
436 int flag = IDASolve(m_ida_mem, tout, &m_tInteg, m_y, m_ydot, IDA_ONE_STEP);
437 if (flag != IDA_SUCCESS) {
438 string f_errs = m_func->getErrors();
439 if (!f_errs.empty()) {
440 f_errs = "Exceptions caught during RHS evaluation:\n" + f_errs;
441 }
442 throw CanteraError("IdasIntegrator::integrate",
443 "IDA error encountered. Error code: {}\n{}\n"
444 "{}"
445 "Components with largest weighted error estimates:\n{}",
446 flag, m_error_message, f_errs, getErrorInfo(10));
447 }
448 nsteps++;
449 }
450 int flag = IDAGetDky(m_ida_mem, tout, 0, m_y);
451 checkError(flag, "integrate", "IDAGetDky");
452 m_time = tout;
453}
454
455double IdasIntegrator::step(double tout)
456{
457 int flag = IDASolve(m_ida_mem, tout, &m_tInteg, m_y, m_ydot, IDA_ONE_STEP);
458 if (flag != IDA_SUCCESS) {
459 string f_errs = m_func->getErrors();
460 if (!f_errs.empty()) {
461 f_errs = "Exceptions caught during RHS evaluation:\n" + f_errs;
462 }
463 throw CanteraError("IdasIntegrator::step",
464 "IDA error encountered. Error code: {}\n{}\n"
465 "{}"
466 "Components with largest weighted error estimates:\n{}",
467 flag, f_errs, m_error_message, getErrorInfo(10));
468
469 }
471 return m_time;
472}
473
474double IdasIntegrator::sensitivity(size_t k, size_t p)
475{
476 if (m_time == m_t0) {
477 // calls to IDAGetSens are only allowed after a successful time step.
478 return 0.0;
479 }
480 if (!m_sens_ok && m_np) {
481 int flag = IDAGetSensDky(m_ida_mem, m_time, 0, m_yS);
482 checkError(flag, "sensitivity", "IDAGetSens");
483 m_sens_ok = true;
484 }
485
486 if (k >= m_neq) {
487 throw CanteraError("IdasIntegrator::sensitivity",
488 "sensitivity: k out of range ({})", k);
489 }
490 if (p >= m_np) {
491 throw CanteraError("IdasIntegrator::sensitivity",
492 "sensitivity: p out of range ({})", p);
493 }
494 return NV_Ith_S(m_yS[p],k);
495}
496
498{
499 N_Vector errs = newNVector(static_cast<sd_size_t>(m_neq), m_sundials_ctx);
500 N_Vector errw = newNVector(static_cast<sd_size_t>(m_neq), m_sundials_ctx);
501 IDAGetErrWeights(m_ida_mem, errw);
502 IDAGetEstLocalErrors(m_ida_mem, errs);
503
504 vector<tuple<double, double, size_t>> weightedErrors;
505 for (size_t i=0; i<m_neq; i++) {
506 double err = NV_Ith_S(errs, i) * NV_Ith_S(errw, i);
507 weightedErrors.emplace_back(-abs(err), err, i);
508 }
509 N_VDestroy(errs);
510 N_VDestroy(errw);
511
512 N = std::min(N, static_cast<int>(m_neq));
513 sort(weightedErrors.begin(), weightedErrors.end());
514 fmt::memory_buffer s;
515 for (int i=0; i<N; i++) {
516 fmt_append(s, "{}: {}\n", get<2>(weightedErrors[i]), get<1>(weightedErrors[i]));
517 }
518 return to_string(s);
519}
520
521void IdasIntegrator::checkError(long flag, const string& ctMethod,
522 const string& idaMethod) const
523{
524 if (flag == IDA_SUCCESS) {
525 return;
526 } else if (flag == IDA_MEM_NULL) {
527 throw CanteraError("IdasIntegrator::" + ctMethod,
528 "IDAS integrator is not initialized");
529 } else {
530 const char* flagname = IDAGetReturnFlagName(flag);
531 throw CanteraError("IdasIntegrator::" + ctMethod,
532 "{} returned error code {} ({}):\n{}",
533 idaMethod, flag, flagname, m_error_message);
534 }
535}
536
538{
539 if (t != BDF_Method) {
540 // IDA only has the BDF method
541 throw CanteraError("IdasIntegrator::setMethod", "unknown method");
542 }
543}
544
545}
Header file for class IdasIntegrator.
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
Base class for exceptions thrown by Cantera classes.
Virtual base class for ODE/DAE right-hand-side function evaluators.
Definition FuncEval.h:32
virtual void getStateDae(double *y, double *ydot)
Fill in the vectors y and ydot with the current state of the system.
Definition FuncEval.h:170
vector< double > m_paramScales
Scaling factors for each sensitivity parameter.
Definition FuncEval.h:206
int evalDaeNoThrow(double t, double *y, double *ydot, double *residual)
Evaluate the right-hand side using return code to indicate status.
Definition FuncEval.cpp:39
void clearErrors()
Clear any previously-stored suppressed errors.
Definition FuncEval.h:196
virtual size_t neq() const =0
Number of equations.
virtual void getConstraints(double *constraints)
Given a vector of length neq(), mark which variables should be considered algebraic constraints.
Definition FuncEval.h:63
virtual size_t nparams() const
Number of sensitivity parameters.
Definition FuncEval.h:178
string getErrors() const
Return a string containing the text of any suppressed errors.
Definition FuncEval.cpp:71
vector< double > m_sens_params
Values for the problem parameters for which sensitivities are computed This is the array which is per...
Definition FuncEval.h:203
Wrapper for Sundials IDAS solver.
double step(double tout) override
Integrate the system of equations.
void setMaxStepSize(double hmax) override
Set the maximum step size.
double * solution() override
The current value of the solution of the system of equations.
double m_t0
The start time for the integrator.
N_Vector m_y
The current system state.
void * m_linsol
Sundials linear solver object.
int m_maxNonlinConvFails
Maximum number of nonlinear convergence failures.
double m_init_step
Initial IDA step size.
void checkError(long flag, const string &ctMethod, const string &idaMethod) const
Check whether an IDAS method indicated an error.
double m_abstolsens
Scalar absolute tolerance for sensitivities.
size_t m_nabs
! Number of variables for which absolute tolerances were provided
void setMaxOrder(int n) override
Set the maximum integration order that will be used.
double m_time
The current integrator time, corresponding to m_y.
int m_maxNonlinIters
Maximum number of nonlinear solver iterations at one solution.
bool m_sens_ok
Indicates whether the sensitivities stored in m_yS and m_ySdot have been updated for the current inte...
int maxSteps() override
Returns the maximum number of time-steps the integrator can take before reaching the next output time...
SundialsContext m_sundials_ctx
SUNContext object for Sundials>=6.0.
FuncEval * m_func
Object implementing the DAE residual function .
double m_abstols
Scalar absolute tolerance.
double m_hmax
Maximum time step size.
int m_itol
Flag indicating whether scalar (IDA_SS) or vector (IDA_SV) absolute tolerances are being used.
int m_maxErrTestFails
Maximum number of error test failures in attempting one step.
int m_maxord
Maximum order allowed for the BDF method.
void setSensitivityTolerances(double reltol, double abstol) override
Set the sensitivity error tolerances.
void applyOptions()
Applies user-specified options to the underlying IDAS solver.
void integrate(double tout) override
Integrate the system of equations.
void setTolerances(double reltol, size_t n, double *abstol) override
Set error tolerances.
void setLinearSolverType(const string &linearSolverType) override
Set the linear solver type.
double m_reltol
Relative tolerance for all state variables.
string m_error_message
Error message information provide by IDAS.
double m_reltolsens
Scalar relative tolerance for sensitivities.
N_Vector * m_yS
Sensitivities of y, size m_np by m_neq.
void setMaxErrTestFails(int n) override
Set the maximum permissible number of error test failures.
void setMaxSteps(int nmax) override
Set the maximum number of time-steps the integrator can take before reaching the next output time.
size_t m_neq
Number of equations/variables in the system.
AnyMap solverStats() const override
Get solver stats from integrator.
string m_type
The linear solver type.
size_t m_np
Number of sensitivity parameters.
void * m_linsol_matrix
matrix used by Sundials
N_Vector m_ydot
The time derivatives of the system state.
N_Vector * m_ySdot
Sensitivities of ydot, size m_np by m_neq.
double m_tInteg
The latest time reached by the integrator. May be greater than m_time.
void initialize(double t0, FuncEval &func) override
Initialize the integrator for a new problem.
int m_maxsteps
Maximum number of internal steps taken in a call to integrate()
string getErrorInfo(int N)
Returns a string listing the weighted error estimates associated with each solution component.
void setMethod(MethodType t) override
Set the solution method.
void * m_ida_mem
Pointer to the IDA memory for the problem.
bool m_setSuppressAlg
If true, the algebraic variables don't contribute to error tolerances.
N_Vector m_abstol
Absolute tolerances for each state variable.
virtual string linearSolverType() const
Return the integrator problem type.
Definition Integrator.h:142
virtual int lastOrder() const
Order used during the last solution step.
Definition Integrator.h:199
A wrapper for managing a SUNContext object.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
static int ida_rhs(sunrealtype t, N_Vector y, N_Vector ydot, N_Vector r, void *f_data)
Function called by IDA to evaluate the residual, given y and ydot.
static void ida_err(int error_code, const char *module, const char *function, char *msg, void *eh_data)
Function called by IDA when an error is encountered instead of writing to stdout.
MethodType
Specifies the method used to integrate the system of equations.
Definition Integrator.h:23
@ BDF_Method
Backward Differentiation.
Definition Integrator.h:24
Contains declarations for string manipulation functions within Cantera.