static void PrintFinalStats(void *cvode_mem) { long int nst, nfe, nsetups, nje, nfeLS, nni, ncfn, netf, nge; int flag; flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); flag = CVDlsGetNumJacEvals(cvode_mem, &nje); check_flag(&flag, "CVDlsGetNumJacEvals", 1); flag = CVDlsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVDlsGetNumRhsEvals", 1); flag = CVodeGetNumGEvals(cvode_mem, &nge); check_flag(&flag, "CVodeGetNumGEvals", 1); printf("\nFinal Statistics:\n"); printf("nst = %-6ld nfe = %-6ld nsetups = %-6ld nfeLS = %-6ld nje = %ld\n", nst, nfe, nsetups, nfeLS, nje); printf("nni = %-6ld ncfn = %-6ld netf = %-6ld nge = %ld\n \n", nni, ncfn, netf, nge); }
/*======================================================================= Print the final statistics returned from the most recent call to CVODE -----------------------------------------------------------------------*/ static void PrintFinalStatistics(void *cvode_mem) { long int nst, nfe, nsetups, nje, nfeLS, nni, ncfn, netf; int flag; flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); flag = CVDlsGetNumJacEvals(cvode_mem, &nje); check_flag(&flag, "CVDlsGetNumJacEvals", 1); flag = CVDlsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVDlsGetNumRhsEvals", 1); #pragma omp critical (statistics) #ifdef OPENMP printf("\nFinal Statistics (thread %d):\n", omp_get_thread_num()); #endif printf("nst = %-6ld nfe = %-6ld nsetups = %-6ld nfeLS = %-6ld\n", nst, nfe, nsetups, nfeLS); printf("nje = %-6ld nni = %-6ld ncfn = %-6ld netf = %-6ld\n", nje, nni, ncfn, netf); }
static void PrintFinalStats(void *cvode_mem) { long int lenrw, leniw ; long int lenrwSPGMR, leniwSPGMR; long int nst, nfe, nsetups, nni, ncfn, netf; long int nli, npe, nps, ncfl, nfeSPGMR; int flag; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); flag = CVodeGetNumSteps(cvode_mem, &nst); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); flag = CVSpilsGetWorkSpace(cvode_mem, &lenrwSPGMR, &leniwSPGMR); flag = CVSpilsGetNumLinIters(cvode_mem, &nli); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); flag = CVSpilsGetNumRhsEvals(cvode_mem, &nfeSPGMR); printf("\nFinal Statistics.. \n\n"); printf("lenrw = %6ld leniw = %6ld\n", lenrw, leniw); printf("llrw = %6ld lliw = %6ld\n", lenrwSPGMR, leniwSPGMR); printf("nst = %6ld\n" , nst); printf("nfe = %6ld nfel = %6ld\n" , nfe, nfeSPGMR); printf("nni = %6ld nli = %6ld\n" , nni, nli); printf("nsetups = %6ld netf = %6ld\n" , nsetups, netf); printf("npe = %6ld nps = %6ld\n" , npe, nps); printf("ncfn = %6ld ncfl = %6ld\n\n", ncfn, ncfl); }
static void PrintFinalStats(void *cvode_mem, booleantype sensi, booleantype err_con, int sensi_meth) { long int nst; long int nfe, nsetups, nni, ncfn, netf; long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS; int retval; retval = CVodeGetNumSteps(cvode_mem, &nst); check_retval(&retval, "CVodeGetNumSteps", 1, 0); retval = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_retval(&retval, "CVodeGetNumRhsEvals", 1, 0); retval = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_retval(&retval, "CVodeGetNumLinSolvSetups", 1, 0); retval = CVodeGetNumErrTestFails(cvode_mem, &netf); check_retval(&retval, "CVodeGetNumErrTestFails", 1, 0); retval = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_retval(&retval, "CVodeGetNumNonlinSolvIters", 1, 0); retval = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_retval(&retval, "CVodeGetNumNonlinSolvConvFails", 1, 0); if (sensi) { retval = CVodeGetSensNumRhsEvals(cvode_mem, &nfSe); check_retval(&retval, "CVodeGetSensNumRhsEvals", 1, 0); retval = CVodeGetNumRhsEvalsSens(cvode_mem, &nfeS); check_retval(&retval, "CVodeGetNumRhsEvalsSens", 1, 0); retval = CVodeGetSensNumLinSolvSetups(cvode_mem, &nsetupsS); check_retval(&retval, "CVodeGetSensNumLinSolvSetups", 1, 0); retval = CVodeGetSensNumErrTestFails(cvode_mem, &netfS); if (err_con) { retval = CVodeGetSensNumErrTestFails(cvode_mem, &netfS); check_retval(&retval, "CVodeGetSensNumErrTestFails", 1, 0); } else { netfS = 0; } if ((sensi_meth == CV_STAGGERED) || (sensi_meth == CV_STAGGERED1)) { retval = CVodeGetSensNumNonlinSolvIters(cvode_mem, &nniS); check_retval(&retval, "CVodeGetSensNumNonlinSolvIters", 1, 0); retval = CVodeGetSensNumNonlinSolvConvFails(cvode_mem, &ncfnS); check_retval(&retval, "CVodeGetSensNumNonlinSolvConvFails", 1, 0); } else { nniS = 0; ncfnS = 0; } } printf("\nFinal Statistics\n\n"); printf("nst = %5ld\n\n", nst); printf("nfe = %5ld\n", nfe); printf("netf = %5ld nsetups = %5ld\n", netf, nsetups); printf("nni = %5ld ncfn = %5ld\n", nni, ncfn); if(sensi) { printf("\n"); printf("nfSe = %5ld nfeS = %5ld\n", nfSe, nfeS); printf("netfs = %5ld nsetupsS = %5ld\n", netfS, nsetupsS); printf("nniS = %5ld ncfnS = %5ld\n", nniS, ncfnS); } }
void ode_solver_print_stats(const ode_solver* solver, FILE* outF){ long int nst; long int nfe, nsetups, nni, ncfn, netf; long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS; long int nje, nfeLS; int flag; void* cvode_mem = solver->cvode_mem; flag = CVodeGetNumSteps(cvode_mem, &nst); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); if (solver->yS != 0) { flag = CVodeGetSensNumRhsEvals(cvode_mem, &nfSe); flag = CVodeGetNumRhsEvalsSens(cvode_mem, &nfeS); flag = CVodeGetSensNumLinSolvSetups(cvode_mem, &nsetupsS); flag = CVodeGetSensNumErrTestFails(cvode_mem, &netfS); flag = CVodeGetSensNumNonlinSolvIters(cvode_mem, &nniS); flag = CVodeGetSensNumNonlinSolvConvFails(cvode_mem, &ncfnS); } flag = CVDlsGetNumJacEvals(cvode_mem, &nje); flag = CVDlsGetNumRhsEvals(cvode_mem, &nfeLS); fprintf(outF,"\n# Solver Statistics\n\n"); fprintf(outF,"# Steps = %5ld\n\n", nst); fprintf(outF,"# RhsEvals = %5ld\n", nfe); fprintf(outF,"# ErrTestFails = %5ld LinSolvSetups = %5ld\n", netf, nsetups); fprintf(outF,"# NonlinSolvIters = %5ld NonlinSolvConvFails = %5ld\n", nni, ncfn); if(solver->yS != 0) { fprintf(outF,"\n# Sensitivities Statistics\n"); fprintf(outF,"# SensRhsEvals = %5ld RhsEvals = %5ld\n", nfSe, nfeS); fprintf(outF,"# ErrTestFails = %5ld LinSolvSetups = %5ld\n", netfS, nsetupsS); fprintf(outF,"# NonlinSolvIters = %5ld NonlinSolvConvFails = %5ld\n", nniS, ncfnS); } fprintf(outF,"\n# Jacobian Statistics\n"); fprintf(outF,"# JacEvals = %5ld RhsEvals = %5ld\n", nje, nfeLS); }
static void PrintFinalStats(void *cvode_mem, booleantype sensi) { long int nst; long int nfe, nsetups, nni, ncfn, netf; long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS; long int njeD, nfeD; int flag; flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); if (sensi) { flag = CVodeGetNumSensRhsEvals(cvode_mem, &nfSe); check_flag(&flag, "CVodeGetNumSensRhsEvals", 1); flag = CVodeGetNumRhsEvalsSens(cvode_mem, &nfeS); check_flag(&flag, "CVodeGetNumRhsEvalsSens", 1); flag = CVodeGetNumSensLinSolvSetups(cvode_mem, &nsetupsS); check_flag(&flag, "CVodeGetNumSensLinSolvSetups", 1); flag = CVodeGetNumSensErrTestFails(cvode_mem, &netfS); check_flag(&flag, "CVodeGetNumSensErrTestFails", 1); flag = CVodeGetNumSensNonlinSolvIters(cvode_mem, &nniS); check_flag(&flag, "CVodeGetNumSensNonlinSolvIters", 1); flag = CVodeGetNumSensNonlinSolvConvFails(cvode_mem, &ncfnS); check_flag(&flag, "CVodeGetNumSensNonlinSolvConvFails", 1); } flag = CVDenseGetNumJacEvals(cvode_mem, &njeD); check_flag(&flag, "CVDenseGetNumJacEvals", 1); flag = CVDenseGetNumRhsEvals(cvode_mem, &nfeD); check_flag(&flag, "CVDenseGetNumRhsEvals", 1); printf("\nFinal Statistics\n\n"); printf("nst = %5ld\n\n", nst); printf("nfe = %5ld\n", nfe); printf("netf = %5ld nsetups = %5ld\n", netf, nsetups); printf("nni = %5ld ncfn = %5ld\n", nni, ncfn); if(sensi) { printf("\n"); printf("nfSe = %5ld nfeS = %5ld\n", nfSe, nfeS); printf("netfs = %5ld nsetupsS = %5ld\n", netfS, nsetupsS); printf("nniS = %5ld ncfnS = %5ld\n", nniS, ncfnS); } printf("\n"); printf("njeD = %5ld nfeD = %5ld\n", njeD, nfeD); }
static void PrintFinalStats(void *cvode_mem, booleantype sensi) { long int nst; long int nfe, nsetups, nni, ncfn, netf; long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS; long int nje, nfeLS; int retval; retval = CVodeGetNumSteps(cvode_mem, &nst); check_retval(&retval, "CVodeGetNumSteps", 1); retval = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_retval(&retval, "CVodeGetNumRhsEvals", 1); retval = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_retval(&retval, "CVodeGetNumLinSolvSetups", 1); retval = CVodeGetNumErrTestFails(cvode_mem, &netf); check_retval(&retval, "CVodeGetNumErrTestFails", 1); retval = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_retval(&retval, "CVodeGetNumNonlinSolvIters", 1); retval = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_retval(&retval, "CVodeGetNumNonlinSolvConvFails", 1); if (sensi) { retval = CVodeGetSensNumRhsEvals(cvode_mem, &nfSe); check_retval(&retval, "CVodeGetSensNumRhsEvals", 1); retval = CVodeGetNumRhsEvalsSens(cvode_mem, &nfeS); check_retval(&retval, "CVodeGetNumRhsEvalsSens", 1); retval = CVodeGetSensNumLinSolvSetups(cvode_mem, &nsetupsS); check_retval(&retval, "CVodeGetSensNumLinSolvSetups", 1); retval = CVodeGetSensNumErrTestFails(cvode_mem, &netfS); check_retval(&retval, "CVodeGetSensNumErrTestFails", 1); retval = CVodeGetSensNumNonlinSolvIters(cvode_mem, &nniS); check_retval(&retval, "CVodeGetSensNumNonlinSolvIters", 1); retval = CVodeGetSensNumNonlinSolvConvFails(cvode_mem, &ncfnS); check_retval(&retval, "CVodeGetSensNumNonlinSolvConvFails", 1); } retval = CVDlsGetNumJacEvals(cvode_mem, &nje); check_retval(&retval, "CVDlsGetNumJacEvals", 1); retval = CVDlsGetNumRhsEvals(cvode_mem, &nfeLS); check_retval(&retval, "CVDlsGetNumRhsEvals", 1); printf("\nFinal Statistics\n\n"); printf("nst = %5ld\n\n", nst); printf("nfe = %5ld\n", nfe); printf("netf = %5ld nsetups = %5ld\n", netf, nsetups); printf("nni = %5ld ncfn = %5ld\n", nni, ncfn); if(sensi) { printf("\n"); printf("nfSe = %5ld nfeS = %5ld\n", nfSe, nfeS); printf("netfs = %5ld nsetupsS = %5ld\n", netfS, nsetupsS); printf("nniS = %5ld ncfnS = %5ld\n", nniS, ncfnS); } printf("\n"); printf("nje = %5ld nfeLS = %5ld\n", nje, nfeLS); }
static void PrintFinalStats(void *cvode_mem) { long int lenrw, leniw ; long int lenrwLS, leniwLS; long int lenrwBP, leniwBP; long int nst, nfe, nsetups, nni, ncfn, netf; long int nli, npe, nps, ncfl, nfeLS; long int nfeBP; int flag; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_flag(&flag, "CVodeGetWorkSpace", 1); flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); flag = CVSpilsGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); check_flag(&flag, "CVSpilsGetWorkSpace", 1); flag = CVSpilsGetNumLinIters(cvode_mem, &nli); check_flag(&flag, "CVSpilsGetNumLinIters", 1); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); check_flag(&flag, "CVSpilsGetNumPrecEvals", 1); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); check_flag(&flag, "CVSpilsGetNumPrecSolves", 1); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); check_flag(&flag, "CVSpilsGetNumConvFails", 1); flag = CVSpilsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVSpilsGetNumRhsEvals", 1); flag = CVBandPrecGetWorkSpace(cvode_mem, &lenrwBP, &leniwBP); check_flag(&flag, "CVBandPrecGetWorkSpace", 1); flag = CVBandPrecGetNumRhsEvals(cvode_mem, &nfeBP); check_flag(&flag, "CVBandPrecGetNumRhsEvals", 1); printf("\nFinal Statistics.. \n\n"); printf("lenrw = %5ld leniw = %5ld\n", lenrw, leniw); printf("lenrwls = %5ld leniwls = %5ld\n", lenrwLS, leniwLS); printf("lenrwbp = %5ld leniwbp = %5ld\n", lenrwBP, leniwBP); printf("nst = %5ld\n" , nst); printf("nfe = %5ld nfetot = %5ld\n" , nfe, nfe+nfeLS+nfeBP); printf("nfeLS = %5ld nfeBP = %5ld\n" , nfeLS, nfeBP); printf("nni = %5ld nli = %5ld\n" , nni, nli); printf("nsetups = %5ld netf = %5ld\n" , nsetups, netf); printf("npe = %5ld nps = %5ld\n" , npe, nps); printf("ncfn = %5ld ncfl = %5ld\n\n", ncfn, ncfl); }
static void PrintFinalStats(void *cvode_mem) { long int lenrw, leniw ; long int lenrwLS, leniwLS; long int lenrwBBDP, leniwBBDP, ngevalsBBDP; long int nst, nfe, nsetups, nni, ncfn, netf; long int nli, npe, nps, ncfl, nfeLS; int flag; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_flag(&flag, "CVodeGetWorkSpace", 1, 0); flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1, 0); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1, 0); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1, 0); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1, 0); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1, 0); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1, 0); flag = CVSpilsGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); check_flag(&flag, "CVSpilsGetWorkSpace", 1, 0); flag = CVSpilsGetNumLinIters(cvode_mem, &nli); check_flag(&flag, "CVSpilsGetNumLinIters", 1, 0); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); check_flag(&flag, "CVSpilsGetNumPrecEvals", 1, 0); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); check_flag(&flag, "CVSpilsGetNumPrecSolves", 1, 0); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); check_flag(&flag, "CVSpilsGetNumConvFails", 1, 0); flag = CVSpilsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVSpilsGetNumRhsEvals", 1, 0); printf("\nFinal Statistics: \n\n"); printf("lenrw = %5ld leniw = %5ld\n", lenrw, leniw); printf("lenrwls = %5ld leniwls = %5ld\n", lenrwLS, leniwLS); printf("nst = %5ld\n" , nst); printf("nfe = %5ld nfels = %5ld\n" , nfe, nfeLS); printf("nni = %5ld nli = %5ld\n" , nni, nli); printf("nsetups = %5ld netf = %5ld\n" , nsetups, netf); printf("npe = %5ld nps = %5ld\n" , npe, nps); printf("ncfn = %5ld ncfl = %5ld\n\n", ncfn, ncfl); flag = CVBBDPrecGetWorkSpace(cvode_mem, &lenrwBBDP, &leniwBBDP); check_flag(&flag, "CVBBDPrecGetWorkSpace", 1, 0); flag = CVBBDPrecGetNumGfnEvals(cvode_mem, &ngevalsBBDP); check_flag(&flag, "CVBBDPrecGetNumGfnEvals", 1, 0); printf("In CVBBDPRE: real/integer local work space sizes = %ld, %ld\n", lenrwBBDP, leniwBBDP); printf(" no. flocal evals. = %ld\n",ngevalsBBDP); }
void OpenSMOKE_CVODE_Sundials<T>::Status() const { int flag; long int nst, nfe, nsetups, netf, nni, ncfn, nje, nfeLS, nge; int qcurrent, qlast; double hcurrent, hlast; flag = CVodeGetNumSteps(cvode_mem_, &nst); check_flag(&flag, std::string("CVodeGetNumSteps"), 1); flag = CVDlsGetNumJacEvals(cvode_mem_, &nje); check_flag(&flag, std::string("CVDlsGetNumJacEvals"), 1); flag = CVodeGetNumRhsEvals(cvode_mem_, &nfe); check_flag(&flag, std::string("CVodeGetNumRhsEvals"), 1); flag = CVodeGetNumLinSolvSetups(cvode_mem_, &nsetups); check_flag(&flag, std::string("CVodeGetNumLinSolvSetups"), 1); flag = CVodeGetNumErrTestFails(cvode_mem_, &netf); check_flag(&flag, std::string("CVodeGetNumErrTestFails"), 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem_, &nni); check_flag(&flag, std::string("CVodeGetNumNonlinSolvIters"), 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem_, &ncfn); check_flag(&flag, std::string("CVodeGetNumNonlinSolvConvFails"), 1); flag = CVodeGetNumGEvals(cvode_mem_, &nge); check_flag(&flag, std::string("CVodeGetNumGEvals"), 1); flag = CVDlsGetNumRhsEvals(cvode_mem_, &nfeLS); check_flag(&flag, std::string("CVDlsGetNumRhsEvals"), 1); flag = CVodeGetLastOrder(cvode_mem_, &qlast); check_flag(&flag, std::string("CVodeGetLastOrder"), 1); flag = CVodeGetCurrentOrder(cvode_mem_, &qcurrent); check_flag(&flag, std::string("CVodeGetCurrentOrder"), 1); flag = CVodeGetLastStep(cvode_mem_, &hlast); check_flag(&flag, std::string("CVodeGetLastStep"), 1); flag = CVodeGetCurrentStep(cvode_mem_, &hcurrent); check_flag(&flag, std::string("CVodeGetCurrentStep"), 1); std::cout << "CVODE Sundials Status" << std::endl; std::cout << " * Absolute tolerance: " << this->absTolerance_[0] << std::endl; // Absolute tolerance std::cout << " * Relative tolerance: " << this->relTolerance_[0] << std::endl; // Relative tolerance std::cout << " * Number of steps: " << nst << std::endl; // Number of steps taken for the problem so far std::cout << " * Number of function evaluations: " << nfe << std::endl; // Number of f evaluations for the problem so far. std::cout << " * Number of Jacobians: " << nje << std::endl; // Number of Jacobian evaluations (and of matrix LU decompositions) for the problem so far. std::cout << " * Last step: " << hlast << std::endl; std::cout << " * Next step: " << hcurrent << std::endl; std::cout << " * Last order: " << qlast << std::endl; std::cout << " * Next order: " << qcurrent << std::endl; }
static void PrintFinalStats(void *cvode_mem, int linsolver) { long int lenrw, leniw ; long int lenrwLS, leniwLS; long int nst, nfe, nsetups, nni, ncfn, netf; long int nli, npe, nps, ncfl, nfeLS; int retval; retval = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_retval(&retval, "CVodeGetWorkSpace", 1); retval = CVodeGetNumSteps(cvode_mem, &nst); check_retval(&retval, "CVodeGetNumSteps", 1); retval = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_retval(&retval, "CVodeGetNumRhsEvals", 1); retval = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_retval(&retval, "CVodeGetNumLinSolvSetups", 1); retval = CVodeGetNumErrTestFails(cvode_mem, &netf); check_retval(&retval, "CVodeGetNumErrTestFails", 1); retval = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_retval(&retval, "CVodeGetNumNonlinSolvIters", 1); retval = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_retval(&retval, "CVodeGetNumNonlinSolvConvFails", 1); retval = CVodeGetLinWorkSpace(cvode_mem, &lenrwLS, &leniwLS); check_retval(&retval, "CVodeGetLinWorkSpace", 1); retval = CVodeGetNumLinIters(cvode_mem, &nli); check_retval(&retval, "CVodeGetNumLinIters", 1); retval = CVodeGetNumPrecEvals(cvode_mem, &npe); check_retval(&retval, "CVodeGetNumPrecEvals", 1); retval = CVodeGetNumPrecSolves(cvode_mem, &nps); check_retval(&retval, "CVodeGetNumPrecSolves", 1); retval = CVodeGetNumLinConvFails(cvode_mem, &ncfl); check_retval(&retval, "CVodeGetNumLinConvFails", 1); retval = CVodeGetNumLinRhsEvals(cvode_mem, &nfeLS); check_retval(&retval, "CVodeGetNumLinRhsEvals", 1); printf("\nFinal Statistics.. \n\n"); printf("lenrw = %5ld leniw = %5ld\n" , lenrw, leniw); printf("lenrwLS = %5ld leniwLS = %5ld\n" , lenrwLS, leniwLS); printf("nst = %5ld\n" , nst); printf("nfe = %5ld nfeLS = %5ld\n" , nfe, nfeLS); printf("nni = %5ld nli = %5ld\n" , nni, nli); printf("nsetups = %5ld netf = %5ld\n" , nsetups, netf); printf("npe = %5ld nps = %5ld\n" , npe, nps); printf("ncfn = %5ld ncfl = %5ld\n\n", ncfn, ncfl); if (linsolver < 2) printf("======================================================================\n\n"); }
static void PrintFinalStats(void *cvode_mem) { long int nst, nfe, nni, ncfn, netf; int retval; retval = CVodeGetNumSteps(cvode_mem, &nst); check_retval(&retval, "CVodeGetNumSteps", 1, 0); retval = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_retval(&retval, "CVodeGetNumRhsEvals", 1, 0); retval = CVodeGetNumErrTestFails(cvode_mem, &netf); check_retval(&retval, "CVodeGetNumErrTestFails", 1, 0); retval = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_retval(&retval, "CVodeGetNumNonlinSolvIters", 1, 0); retval = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_retval(&retval, "CVodeGetNumNonlinSolvConvFails", 1, 0); printf("\nFinal Statistics: \n\n"); printf("nst = %-6ld nfe = %-6ld ", nst, nfe); printf("nni = %-6ld ncfn = %-6ld netf = %ld\n \n", nni, ncfn, netf); }
static void PrintFinalStats(void *cvode_mem) { long int lenrw, leniw ; long int lenrwLS, leniwLS; long int nst, nfe, nsetups, nni, ncfn, netf; long int nli, npe, nps, ncfl, nfeLS; int flag; realtype avdim; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_flag(&flag, "CVodeGetWorkSpace", 1); flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); flag = CVSpilsGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); check_flag(&flag, "CVSpilsGetWorkSpace", 1); flag = CVSpilsGetNumLinIters(cvode_mem, &nli); check_flag(&flag, "CVSpilsGetNumLinIters", 1); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); check_flag(&flag, "CVSpilsGetNumPrecEvals", 1); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); check_flag(&flag, "CVSpilsGetNumPrecSolves", 1); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); check_flag(&flag, "CVSpilsGetNumConvFails", 1); flag = CVSpilsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVSpilsGetNumRhsEvals", 1); printf("\n\n Final statistics for this run:\n\n"); printf(" CVode real workspace length = %4ld \n", lenrw); printf(" CVode integer workspace length = %4ld \n", leniw); printf(" CVSPGMR real workspace length = %4ld \n", lenrwLS); printf(" CVSPGMR integer workspace length = %4ld \n", leniwLS); printf(" Number of steps = %4ld \n", nst); printf(" Number of f-s = %4ld \n", nfe); printf(" Number of f-s (SPGMR) = %4ld \n", nfeLS); printf(" Number of f-s (TOTAL) = %4ld \n", nfe + nfeLS); printf(" Number of setups = %4ld \n", nsetups); printf(" Number of nonlinear iterations = %4ld \n", nni); printf(" Number of linear iterations = %4ld \n", nli); printf(" Number of preconditioner evaluations = %4ld \n", npe); printf(" Number of preconditioner solves = %4ld \n", nps); printf(" Number of error test failures = %4ld \n", netf); printf(" Number of nonlinear conv. failures = %4ld \n", ncfn); printf(" Number of linear convergence failures = %4ld \n", ncfl); avdim = (nni > 0) ? ((realtype)nli)/((realtype)nni) : ZERO; #if defined(SUNDIALS_EXTENDED_PRECISION) printf(" Average Krylov subspace dimension = %.3Lf \n", avdim); #else printf(" Average Krylov subspace dimension = %.3f \n", avdim); #endif printf("\n\n--------------------------------------------------------------"); printf("--------------\n"); printf( "--------------------------------------------------------------"); printf("--------------\n"); }
/* * Get and print some final statistics */ void PrintFinalStats(struct Integrator* integrator) { void* cvode_mem = integrator->cvode_mem; long int lenrw = -1, leniw = -1, nst = -1, nfe = -1, nsetups = -1, nni = -1, ncfn = -1, netf = -1; long int lenrwLS = -1, leniwLS = -1, nje = -1, nfeLS = -1,npe = -1,nps = -1,ncfl = -1,nli = -1; int flag; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_flag(&flag, "CVodeGetWorkSpace", 1); flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); printf("\n Final integrator statistics for this run:\n"); printf(" (MM: %s; IM: %s; LS: %s; max-step: %0.4le)\n", multistepMethodToString( simulationGetMultistepMethod(integrator->simulation)), iterationMethodToString( simulationGetIterationMethod(integrator->simulation)), linearSolverToString(simulationGetLinearSolver(integrator->simulation)), simulationGetBvarMaxStep(integrator->simulation)); printf(" CVode real workspace length = %4ld \n", lenrw); printf(" CVode integer workspace length = %4ld \n", leniw); printf(" Number of steps = %4ld \n", nst); printf(" Number of f-s = %4ld \n", nfe); printf(" Number of setups = %4ld \n", nsetups); printf(" Number of nonlinear iterations = %4ld \n", nni); printf(" Number of nonlinear convergence failures = %4ld \n", ncfn); printf(" Number of error test failures = %4ld \n\n",netf); if (simulationGetIterationMethod(integrator->simulation) == NEWTON) { enum LinearSolver solver = simulationGetLinearSolver(integrator->simulation); switch(solver) { case DENSE: { //flag = CVDenseGetNumJacEvals(cvode_mem, &nje); //check_flag(&flag, "CVDenseGetNumJacEvals", 1); //flag = CVDenseGetNumRhsEvals(cvode_mem, &nfeLS); //check_flag(&flag, "CVDenseGetNumRhsEvals", 1); //flag = CVDenseGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); //check_flag(&flag, "CVDenseGetWorkSpace", 1); } break; case BAND: { //flag = CVBandGetNumJacEvals(cvode_mem, &nje); //check_flag(&flag, "CVBandGetNumJacEvals", 1); //flag = CVBandGetNumRhsEvals(cvode_mem, &nfeLS); //check_flag(&flag, "CVBandGetNumRhsEvals", 1); //flag = CVBandGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); //check_flag(&flag, "CVBandGetWorkSpace", 1); } break; case DIAG: { nje = nsetups; flag = CVDiagGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVDiagGetNumRhsEvals", 1); flag = CVDiagGetWorkSpace(cvode_mem, &lenrwLS, &leniwLS); check_flag(&flag, "CVDiagGetWorkSpace", 1); } break; case SPGMR: case SPBCG: case SPTFQMR: { nje = nsetups; flag = CVSpilsGetWorkSpace(cvode_mem,&lenrwLS,&leniwLS); check_flag(&flag, "CVSpilsGetWorkSpace", 1); flag = CVSpilsGetNumRhsEvals(cvode_mem, &nfeLS); check_flag(&flag, "CVSpilsGetNumRhsEvals", 1); flag = CVSpilsGetNumLinIters(cvode_mem, &nli); check_flag(&flag, "CVSpilsGetNumLinIters", 1); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); check_flag(&flag, "CVSpilsGetNumPrecEvals", 1); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); check_flag(&flag, "CVSpilsGetNumPrecSolves", 1); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); check_flag(&flag, "CVSpilsGetNumConvFails", 1); } break; default: { nje = -1; nfeLS = -1; lenrwLS = -1; leniwLS = -1; } break; } printf(" Linear solver real workspace length = %4ld \n", lenrwLS); printf(" Linear solver integer workspace length = %4ld \n", leniwLS); printf(" Number of Jacobian evaluations = %4ld \n", nje); printf(" Number of f evals. in linear solver = %4ld \n", nfeLS); if ((solver == SPGMR) || (solver == SPBCG) || (solver == SPTFQMR)) { printf(" Number of linear iterations = %4ld \n",nli); printf(" Number of preconditioner evaluations = %4ld \n",npe); printf(" Number of preconditioner solves = %4ld \n",nps); printf(" Number of convergence failures = %4ld \n",ncfl); } printf("\n"); } }
static void PrintFinalStats(void *cvode_mem, int miter, realtype ero) { long int lenrw, leniw, nst, nfe, nsetups, nni, ncfn, netf; long int lenrwL, leniwL, nje, nfeL; int flag; flag = CVodeGetWorkSpace(cvode_mem, &lenrw, &leniw); check_flag(&flag, "CVodeGetWorkSpace", 1); flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); printf("\n Final statistics for this run:\n\n"); printf(" CVode real workspace length = %4ld \n", lenrw); printf(" CVode integer workspace length = %4ld \n", leniw); printf(" Number of steps = %4ld \n", nst); printf(" Number of f-s = %4ld \n", nfe); printf(" Number of setups = %4ld \n", nsetups); printf(" Number of nonlinear iterations = %4ld \n", nni); printf(" Number of nonlinear convergence failures = %4ld \n", ncfn); printf(" Number of error test failures = %4ld \n\n",netf); if (miter != FUNC) { switch(miter) { case DENSE_USER : case DENSE_DQ : flag = CVDenseGetNumJacEvals(cvode_mem, &nje); check_flag(&flag, "CVDenseGetNumJacEvals", 1); flag = CVDenseGetNumRhsEvals(cvode_mem, &nfeL); check_flag(&flag, "CVDenseGetNumRhsEvals", 1); flag = CVDenseGetWorkSpace(cvode_mem, &lenrwL, &leniwL); check_flag(&flag, "CVDenseGetWorkSpace", 1); break; case BAND_USER : case BAND_DQ : flag = CVBandGetNumJacEvals(cvode_mem, &nje); check_flag(&flag, "CVBandGetNumJacEvals", 1); flag = CVBandGetNumRhsEvals(cvode_mem, &nfeL); check_flag(&flag, "CVBandGetNumRhsEvals", 1); flag = CVBandGetWorkSpace(cvode_mem, &lenrwL, &leniwL); check_flag(&flag, "CVBandGetWorkSpace", 1); break; case DIAG : nje = nsetups; flag = CVDiagGetNumRhsEvals(cvode_mem, &nfeL); check_flag(&flag, "CVDiagGetNumRhsEvals", 1); flag = CVDiagGetWorkSpace(cvode_mem, &lenrwL, &leniwL); check_flag(&flag, "CVDiagGetWorkSpace", 1); break; } printf(" Linear solver real workspace length = %4ld \n", lenrwL); printf(" Linear solver integer workspace length = %4ld \n", leniwL); printf(" Number of Jacobian evaluations = %4ld \n", nje); printf(" Number of f-s evaluations = %4ld \n\n", nfeL); } #if defined(SUNDIALS_EXTENDED_PRECISION) printf(" Error overrun = %.3Lf \n", ero); #else printf(" Error overrun = %.3f \n", ero); #endif }
static void PrintFinalStats(void *cvode_mem, booleantype sensi) { long int nst; long int nfe, nsetups, nni, ncfn, netf; long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS; long int nli, ncfl, npe, nps; int flag; flag = CVodeGetNumSteps(cvode_mem, &nst); check_flag(&flag, "CVodeGetNumSteps", 1); flag = CVodeGetNumRhsEvals(cvode_mem, &nfe); check_flag(&flag, "CVodeGetNumRhsEvals", 1); flag = CVodeGetNumLinSolvSetups(cvode_mem, &nsetups); check_flag(&flag, "CVodeGetNumLinSolvSetups", 1); flag = CVodeGetNumErrTestFails(cvode_mem, &netf); check_flag(&flag, "CVodeGetNumErrTestFails", 1); flag = CVodeGetNumNonlinSolvIters(cvode_mem, &nni); check_flag(&flag, "CVodeGetNumNonlinSolvIters", 1); flag = CVodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); check_flag(&flag, "CVodeGetNumNonlinSolvConvFails", 1); if (sensi) { flag = CVodeGetSensNumRhsEvals(cvode_mem, &nfSe); check_flag(&flag, "CVodeGetSensNumRhsEvals", 1); flag = CVodeGetNumRhsEvalsSens(cvode_mem, &nfeS); check_flag(&flag, "CVodeGetNumRhsEvalsSens", 1); flag = CVodeGetSensNumLinSolvSetups(cvode_mem, &nsetupsS); check_flag(&flag, "CVodeGetSensNumLinSolvSetups", 1); flag = CVodeGetSensNumErrTestFails(cvode_mem, &netfS); check_flag(&flag, "CVodeGetSensNumErrTestFails", 1); flag = CVodeGetSensNumNonlinSolvIters(cvode_mem, &nniS); check_flag(&flag, "CVodeGetSensNumNonlinSolvIters", 1); flag = CVodeGetSensNumNonlinSolvConvFails(cvode_mem, &ncfnS); check_flag(&flag, "CVodeGetSensNumNonlinSolvConvFails", 1); } flag = CVSpilsGetNumLinIters(cvode_mem, &nli); check_flag(&flag, "CVSpilsGetNumLinIters", 1); flag = CVSpilsGetNumConvFails(cvode_mem, &ncfl); check_flag(&flag, "CVSpilsGetNumConvFails", 1); flag = CVSpilsGetNumPrecEvals(cvode_mem, &npe); check_flag(&flag, "CVSpilsGetNumPrecEvals", 1); flag = CVSpilsGetNumPrecSolves(cvode_mem, &nps); check_flag(&flag, "CVSpilsGetNumPrecSolves", 1); printf("\nFinal Statistics\n\n"); printf("nst = %5ld\n\n", nst); printf("nfe = %5ld\n", nfe); printf("netf = %5ld nsetups = %5ld\n", netf, nsetups); printf("nni = %5ld ncfn = %5ld\n", nni, ncfn); if(sensi) { printf("\n"); printf("nfSe = %5ld nfeS = %5ld\n", nfSe, nfeS); printf("netfs = %5ld nsetupsS = %5ld\n", netfS, nsetupsS); printf("nniS = %5ld ncfnS = %5ld\n", nniS, ncfnS); } printf("\n"); printf("nli = %5ld ncfl = %5ld\n", nli, ncfl); printf("npe = %5ld nps = %5ld\n", npe, nps); }