summaryrefslogtreecommitdiff
path: root/packages/sundials/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sundials/src/Main.hs')
-rw-r--r--packages/sundials/src/Main.hs41
1 files changed, 40 insertions, 1 deletions
diff --git a/packages/sundials/src/Main.hs b/packages/sundials/src/Main.hs
index 7388b2b..28b813a 100644
--- a/packages/sundials/src/Main.hs
+++ b/packages/sundials/src/Main.hs
@@ -241,6 +241,45 @@ main = do
241 printf(" ---------------------\n"); 241 printf(" ---------------------\n");
242 fclose(UFID); 242 fclose(UFID);
243 243
244 return 0; 244 /* Get/print some final statistics on how the solve progressed */
245 flag = ARKodeGetNumSteps(arkode_mem, &nst);
246 check_flag(&flag, "ARKodeGetNumSteps", 1);
247 flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a);
248 check_flag(&flag, "ARKodeGetNumStepAttempts", 1);
249 flag = ARKodeGetNumRhsEvals(arkode_mem, &nfe, &nfi);
250 check_flag(&flag, "ARKodeGetNumRhsEvals", 1);
251 flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups);
252 check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1);
253 flag = ARKodeGetNumErrTestFails(arkode_mem, &netf);
254 check_flag(&flag, "ARKodeGetNumErrTestFails", 1);
255 flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni);
256 check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1);
257 flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn);
258 check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1);
259 flag = ARKDlsGetNumJacEvals(arkode_mem, &nje);
260 check_flag(&flag, "ARKDlsGetNumJacEvals", 1);
261 flag = ARKDlsGetNumRhsEvals(arkode_mem, &nfeLS);
262 check_flag(&flag, "ARKDlsGetNumRhsEvals", 1);
263
264 printf("\nFinal Solver Statistics:\n");
265 printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a);
266 printf(" Total RHS evals: Fe = %li, Fi = %li\n", nfe, nfi);
267 printf(" Total linear solver setups = %li\n", nsetups);
268 printf(" Total RHS evals for setting up the linear system = %li\n", nfeLS);
269 printf(" Total number of Jacobian evaluations = %li\n", nje);
270 printf(" Total number of Newton iterations = %li\n", nni);
271 printf(" Total number of linear solver convergence failures = %li\n", ncfn);
272 printf(" Total number of error test failures = %li\n\n", netf);
273
274 /* check the solution error */
275 flag = check_ans(y, t, reltol, abstol);
276
277 /* Clean up and return */
278 N_VDestroy(y); /* Free y vector */
279 ARKodeFree(&arkode_mem); /* Free integrator memory */
280 SUNLinSolFree(LS); /* Free linear solver */
281 SUNMatDestroy(A); /* Free A matrix */
282
283 return flag;
245 } |] 284 } |]
246 putStrLn $ show res 285 putStrLn $ show res