13 #ifndef FINITE_DIFFERENCE 18 #include "sundials/sundials_types.h" 19 #include "sundials/sundials_math.h" 20 #include "sundials/sundials_nvector.h" 21 #include "nvector/nvector_serial.h" 22 #include "cvodes/cvodes.h" 23 #include "cvodes/cvodes_lapack.h" 50 y_locals = (N_Vector*)malloc(num_threads *
sizeof(N_Vector));
52 integrators = (
void**)malloc(num_threads *
sizeof(
void*));
54 for (
int i = 0; i < num_threads; i++)
60 printf(
"Error creating CVodes Integrator\n");
66 if (flag != CV_SUCCESS) {
67 if (flag == CV_MEM_FAIL) {
68 printf(
"Memory allocation failed.\n");
69 }
else if (flag == CV_ILL_INPUT) {
70 printf(
"Illegal value for CVodeInit input argument.\n");
71 }
else if (flag == CV_MEM_NULL) {
72 printf(
"CVODEs Memory was not initialized with CVodeInit!\n");
79 if (flag != CV_SUCCESS) {
80 if (flag == CV_NO_MALLOC) {
81 printf(
"CVODE memory block not initialized by CVodeCreate.\n");
82 }
else if (flag == CV_ILL_INPUT) {
83 printf(
"Illegal value for CVodeInit input argument.\n");
84 }
else if (flag == CV_MEM_NULL) {
85 printf(
"CVODEs Memory was not initialized with CVodeInit!\n");
92 if (flag != CVDLS_SUCCESS) {
93 if (flag == CVDLS_MEM_FAIL) {
94 printf(
"CVODE memory block not initialized by CVodeCreate.\n");
95 }
else if (flag == CVDLS_ILL_INPUT) {
96 printf(
"Illegal value for CVodeInit input argument.\n");
97 }
else if (flag == CVDLS_MEM_NULL) {
98 printf(
"CVODEs Memory was not initialized with CVodeInit!\n");
103 #ifndef FINITE_DIFFERENCE 105 if (flag != CV_SUCCESS) {
106 printf(
"Error setting analytic jacobian\n");
113 if (flag != CV_SUCCESS) {
114 printf(
"Error setting max order\n");
121 if (flag != CV_SUCCESS) {
122 printf(
"Error setting max steps\n");
129 if (flag != CV_SUCCESS) {
130 printf(
"Error setting max timestep\n");
136 if (flag != CV_SUCCESS) {
137 printf(
"Error setting min timestep\n");
141 #ifdef CV_MAX_ERRTEST_FAILS 143 if (flag != CV_SUCCESS) {
144 printf(
"Error setting max error test fails\n");
150 if (flag != CV_SUCCESS) {
151 printf(
"Error setting max hnil warnings\n");
167 for (
int i = 0; i < num_threads; i++)
182 #ifdef SUNDIALS_ANALYTIC_JACOBIAN 183 const char* name =
"cvodes-analytic-int";
185 const char* name =
"cvodes-int";
Header file for CVODEs interface to RHS of ODEs.
A file generated by Scons that specifies various options to the solvers.
const char * solver_name()
Returns a descriptive solver name.
int dydt_cvodes(realtype t, N_Vector y, N_Vector ydot, void *f)
void initialize_solver(int num_threads)
Initializes the solver.
void cleanup_solver(int num_threads)
Cleans up the created solvers.
int eval_jacob_cvodes(long int N, double t, N_Vector y, N_Vector ydot, DlsMat jac, void *f, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
The CVODEs Jacobian interface for a direct dense Jacobian.
A simple wrapper, allowing for use of the analytical jacobian w/ CVODES.
#define CV_MAX_ERRTEST_FAILS