diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp index a1f583cbd7..4b98b4de78 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp +++ b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp @@ -246,20 +246,20 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, if (check_retval((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData*", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData*", 1)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Create the (non)linear solver */ if (uopt->global) @@ -269,20 +269,20 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, if (check_retval((void*)NLS, "SUNNonlinSol_Newton", 0)) { return 1; } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return 1; } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return 1; } /* Create linear solver */ LS = SUNLinSol_SPGMR(y, SUN_PREC_LEFT, 0, ctx); if (check_retval((void*)LS, "SUNLinSol_SPGMR", 0)) { return 1; } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, NULL, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1)) { return 1; } + retval = ARKodeSetPreconditioner(arkode_mem, NULL, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1)) { return 1; } } else { @@ -292,8 +292,8 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, if (check_retval((void*)NLS, "TaskLocalNewton", 0)) { return 1; } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return 1; } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return 1; } } /* Output initial condition */ @@ -313,8 +313,8 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* Output state */ WriteOutput(t, y, udata, uopt); @@ -328,24 +328,24 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); if (uopt->global) { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1); } /* Print final statistics */ @@ -366,7 +366,7 @@ int EvolveProblemIMEX(SUNContext ctx, N_Vector y, UserData* udata, } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNNonlinSolFree(NLS); if (LS) { SUNLinSolFree(LS); } @@ -390,20 +390,20 @@ int EvolveProblemExplicit(SUNContext ctx, N_Vector y, UserData* udata, if (check_retval((void*)arkode_mem, "ERKStepCreate", 0)) { return 1; } /* Select the method order */ - retval = ERKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ERKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } /* Attach user data */ - retval = ERKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ERKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Specify tolerances */ - retval = ERKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ERKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ERKStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "ERKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Output initial condition */ if (udata->myid == 0 && uopt->monitor) @@ -422,8 +422,8 @@ int EvolveProblemExplicit(SUNContext ctx, N_Vector y, UserData* udata, do { /* Integrate to output time */ - retval = ERKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* Output state */ WriteOutput(t, y, udata, uopt); @@ -437,14 +437,14 @@ int EvolveProblemExplicit(SUNContext ctx, N_Vector y, UserData* udata, while (iout < uopt->nout); /* Get final statistics */ - retval = ERKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ERKStepGetNumSteps", 1); - retval = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ERKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_retval(&retval, "ERKStepGetNumRhsEvals", 1); - retval = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ERKStepGetNumErrTestFails", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); /* Print final statistics */ if (udata->myid == 0) @@ -456,7 +456,7 @@ int EvolveProblemExplicit(SUNContext ctx, N_Vector y, UserData* udata, } /* Clean up */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* Return success */ return (0); @@ -911,9 +911,9 @@ int TaskLocalNlsResidual(N_Vector ycor, N_Vector F, void* arkode_mem) double tcur, gamma; void* user_data; - retval = ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, + retval = ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, &sdata, &user_data); - if (check_retval((void*)&retval, "ARKStepGetNonlinearSystemData", 1)) + if (check_retval((void*)&retval, "ARKodeGetNonlinearSystemData", 1)) { return (-1); } @@ -956,9 +956,9 @@ int TaskLocalLSolve(N_Vector delta, void* arkode_mem) double tcur, gamma; void* user_data = NULL; - retval = ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, - &gamma, &sdata, &user_data); - if (check_retval((void*)&retval, "ARKStepGetNonlinearSystemData", 1)) + retval = ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, + &gamma, &sdata, &user_data); + if (check_retval((void*)&retval, "ARKodeGetNonlinearSystemData", 1)) { return (-1); } diff --git a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp index d70b4d680c..bdaf48ef3d 100644 --- a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp +++ b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp @@ -611,16 +611,8 @@ int main(int argc, char* argv[]) udata.evolve.start(); // Evolve - if (udata.integrator) - { - flag = MRIStepEvolve(arkode_mem, tout, u, &t, stepmode); - if (check_flag(&flag, "MRIStepEvolve", 1)) { break; } - } - else - { - flag = ARKStepEvolve(arkode_mem, tout, u, &t, stepmode); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } - } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, stepmode); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer udata.evolve.stop(); @@ -678,14 +670,14 @@ int main(int argc, char* argv[]) switch (udata.integrator) { - case (0): ARKStepFree(&arkode_mem); break; + case (0): ARKodeFree(&arkode_mem); break; case (1): { void* inner_arkode_mem = NULL; MRIStepInnerStepper_GetContent(stepper, &inner_arkode_mem); - ARKStepFree(&inner_arkode_mem); + ARKodeFree(&inner_arkode_mem); MRIStepInnerStepper_Free(&stepper); - MRIStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); break; } case (2): @@ -698,7 +690,7 @@ int main(int argc, char* argv[]) delete content; MRIStepInnerStepper_Free(&stepper); SUNNonlinSolFree(NLS); - MRIStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); break; } default: cerr << "Invalid integrator option" << endl; break; @@ -928,51 +920,51 @@ static int SetupARK(SUNContext ctx, UserData* udata, N_Vector u, if (check_flag((void*)*arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(*arkode_mem, udata->rtol_imex, udata->atol_imex); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(*arkode_mem, udata->rtol_imex, udata->atol_imex); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(*arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } if (udata->diffusion) { // Attach linear solver - flag = ARKStepSetLinearSolver(*arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(*arkode_mem, NULL, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(*arkode_mem, NULL, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(*arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(*arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(*arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(*arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } } // Select method order - flag = ARKStepSetOrder(*arkode_mem, udata->order_imex); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(*arkode_mem, udata->order_imex); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } // Set fixed step size or adaptivity method if (udata->h_imex > ZERO) { - flag = ARKStepSetFixedStep(*arkode_mem, udata->h_imex); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, udata->h_imex); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -985,17 +977,17 @@ static int SetupARK(SUNContext ctx, UserData* udata, N_Vector u, case (ARK_ADAPT_IMP_GUS): *Ctrl = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): *Ctrl = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(*arkode_mem, *Ctrl); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(*arkode_mem, *Ctrl); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(*arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(*arkode_mem, udata->tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } return 0; } @@ -1015,23 +1007,23 @@ static int SetupMRI(SUNContext ctx, UserData* udata, N_Vector y, if (check_flag((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(inner_arkode_mem, udata->rtol_fast, - udata->atol_fast); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(inner_arkode_mem, udata->rtol_fast, + udata->atol_fast); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(inner_arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(inner_arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Select method order - flag = ARKStepSetOrder(inner_arkode_mem, udata->order_fast); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(inner_arkode_mem, udata->order_fast); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } // Set fixed step size or adaptivity method if (udata->h_fast > ZERO) { - flag = ARKStepSetFixedStep(inner_arkode_mem, udata->h_fast); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(inner_arkode_mem, udata->h_fast); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -1044,13 +1036,13 @@ static int SetupMRI(SUNContext ctx, UserData* udata, N_Vector y, case (ARK_ADAPT_IMP_GUS): *Ctrl = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): *Ctrl = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(inner_arkode_mem, *Ctrl); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(inner_arkode_mem, *Ctrl); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(inner_arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(inner_arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Wrap ARKODE as an MRIStepInnerStepper flag = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, stepper); @@ -1075,50 +1067,50 @@ static int SetupMRI(SUNContext ctx, UserData* udata, N_Vector y, MRIStepCoupling_Free(C); // Set the slow step size - flag = MRIStepSetFixedStep(*arkode_mem, udata->h_slow); - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, udata->h_slow); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(*arkode_mem, udata->rtol_slow, udata->atol_slow); - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(*arkode_mem, udata->rtol_slow, udata->atol_slow); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = MRIStepSetUserData(*arkode_mem, (void*)udata); - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = MRIStepSetLinearSolver(*arkode_mem, LS, NULL); - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = MRIStepSetPreconditioner(*arkode_mem, NULL, PSolve); - if (check_flag(&flag, "MRIStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(*arkode_mem, NULL, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = MRIStepSetLSetupFrequency(*arkode_mem, udata->msbp); - if (check_flag(&flag, "MRIStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = MRIStepSetEpsLin(*arkode_mem, udata->epslin); - if (check_flag(&flag, "MRIStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(*arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = MRIStepSetLinear(*arkode_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = MRIStepSetMaxNumSteps(*arkode_mem, udata->maxsteps); - if (check_flag(&flag, "MRIStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = MRIStepSetStopTime(*arkode_mem, udata->tf); - if (check_flag(&flag, "MRIStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } return 0; } @@ -1219,50 +1211,50 @@ static int SetupMRICVODE(SUNContext ctx, UserData* udata, N_Vector y, MRIStepCoupling_Free(C); // Set the slow step size - flag = MRIStepSetFixedStep(*arkode_mem, udata->h_slow); - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, udata->h_slow); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(*arkode_mem, udata->rtol_slow, udata->atol_slow); - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(*arkode_mem, udata->rtol_slow, udata->atol_slow); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = MRIStepSetUserData(*arkode_mem, (void*)udata); - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = MRIStepSetLinearSolver(*arkode_mem, LS, NULL); - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = MRIStepSetPreconditioner(*arkode_mem, NULL, PSolve); - if (check_flag(&flag, "MRIStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(*arkode_mem, NULL, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = MRIStepSetLSetupFrequency(*arkode_mem, udata->msbp); - if (check_flag(&flag, "MRIStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = MRIStepSetEpsLin(*arkode_mem, udata->epslin); - if (check_flag(&flag, "MRIStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(*arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = MRIStepSetLinear(*arkode_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = MRIStepSetMaxNumSteps(*arkode_mem, udata->maxsteps); - if (check_flag(&flag, "MRIStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = MRIStepSetStopTime(*arkode_mem, udata->tf); - if (check_flag(&flag, "MRIStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } return 0; } @@ -2603,31 +2595,31 @@ static int OutputStatsIMEX(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } if (udata->diffusion) { - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } } cout << fixed; @@ -2663,10 +2655,10 @@ static int OutputStatsIMEX(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; @@ -2685,24 +2677,24 @@ static int OutputStatsMRI(void* arkode_mem, MRIStepInnerStepper stepper, // Get slow integrator and solver stats long int nsts, nfse, nfsi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = MRIStepGetNumSteps(arkode_mem, &nsts); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nsts); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } flag = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "MRIStepGetNumLinIters", 1)) { return -1; } - flag = MRIStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "MRIStepGetNumLinConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return -1; } - flag = MRIStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "MRIStepGetNumLinRhsEvals", 1)) { return -1; } - flag = MRIStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "MRIStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2731,10 +2723,10 @@ static int OutputStatsMRI(void* arkode_mem, MRIStepInnerStepper stepper, if (udata->prec) { long int npe, nps; - flag = MRIStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "MRIStepGetNumPrecEvals", 1)) { return -1; } - flag = MRIStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "MRIStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; @@ -2747,12 +2739,12 @@ static int OutputStatsMRI(void* arkode_mem, MRIStepInnerStepper stepper, long int nstf, nstf_a, netff, nffe, nffi; - flag = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(inner_arkode_mem, &nstf_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(inner_arkode_mem, &netff); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(inner_arkode_mem, &nstf_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(inner_arkode_mem, &netff); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(inner_arkode_mem, &nffe, &nffi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } @@ -2773,24 +2765,24 @@ static int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper stepper, // Get slow integrator and solver stats long int nsts, nfse, nfsi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = MRIStepGetNumSteps(arkode_mem, &nsts); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nsts); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } flag = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "MRIStepGetNumLinIters", 1)) { return -1; } - flag = MRIStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "MRIStepGetNumLinConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return -1; } - flag = MRIStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "MRIStepGetNumLinRhsEvals", 1)) { return -1; } - flag = MRIStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "MRIStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2819,10 +2811,10 @@ static int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper stepper, if (udata->prec) { long int npe, nps; - flag = MRIStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "MRIStepGetNumPrecEvals", 1)) { return -1; } - flag = MRIStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "MRIStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp index 5c1a264c8f..804ed9c2c7 100644 --- a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp +++ b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp @@ -41,7 +41,7 @@ * problem is advanced in time with a diagonally implicit Runge-Kutta method * using an inexact Newton method paired with the PCG or SPGMR linear solver. * Several command line options are available to change the problem parameters - * and ARKStep settings. Use the flag --help for more information. + * and ARKode settings. Use the flag --help for more information. * ---------------------------------------------------------------------------*/ #include @@ -382,7 +382,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -390,38 +390,38 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -445,8 +445,8 @@ int main(int argc, char* argv[]) // Set fixed step size or adaptivity method if (udata->hfixed > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, udata->hfixed); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata->hfixed); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -459,24 +459,24 @@ int main(int argc, char* argv[]) case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(arkode_mem, udata->tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -499,8 +499,8 @@ int main(int argc, char* argv[]) t1 = MPI_Wtime(); // Evolve in time - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = MPI_Wtime(); @@ -560,7 +560,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -1820,28 +1820,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -1870,10 +1870,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp index 7b2031e540..40d8e81923 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp @@ -41,7 +41,7 @@ * problem is advanced in time with a diagonally implicit Runge-Kutta method * using an inexact Newton method paired with the hypre's PCG or GMRES linear * solver and PFMG preconditioner. Several command line options are available - * to change the problem parameters and ARKStep settings. Use the flag --help + * to change the problem parameters and ARKode settings. Use the flag --help * for more information. * ---------------------------------------------------------------------------*/ @@ -439,7 +439,7 @@ int main(int argc, char* argv[]) if (check_flag((void*)LS, "HypreLS", 0)) { return 1; } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -447,35 +447,35 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } // Specify the Jacobian evaluation function - flag = ARKStepSetJacFn(arkode_mem, Jac); - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } // Set linear solver setup frequency (update linear system matrix) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -499,8 +499,8 @@ int main(int argc, char* argv[]) // Set fixed step size or adaptivity method if (udata->hfixed > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, udata->hfixed); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata->hfixed); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -513,24 +513,24 @@ int main(int argc, char* argv[]) case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(arkode_mem, udata->tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -553,8 +553,8 @@ int main(int argc, char* argv[]) t1 = MPI_Wtime(); // Evolve in time - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = MPI_Wtime(); @@ -614,7 +614,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver SUNMatDestroy(A); // Free matrix N_VDestroy(u); // Free vectors @@ -2120,26 +2120,26 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nJeval; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumJacEvals(arkode_mem, &nJeval); - if (check_flag(&flag, "ARKStepGetNumJacEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumJacEvals(arkode_mem, &nJeval); + if (check_flag(&flag, "ARKodeGetNumJacEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp index eeb61d0af4..aa70f1caa3 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp @@ -41,7 +41,7 @@ * problem is advanced in time with a diagonally implicit Runge-Kutta method * using an inexact Newton method paired with the PCG or SPGMR linear solver * using hypre's PFMG preconditioner. Several command line options are available - * to change the problem parameters and ARKStep settings. Use the flag --help + * to change the problem parameters and ARKode settings. Use the flag --help * for more information. * ---------------------------------------------------------------------------*/ @@ -412,7 +412,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -420,45 +420,45 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->matvec) { // Attach Jacobian-vector product function - flag = ARKStepSetJacTimes(arkode_mem, NULL, JTimes); - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, JTimes); + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -482,8 +482,8 @@ int main(int argc, char* argv[]) // Set fixed step size or adaptivity method if (udata->hfixed > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, udata->hfixed); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata->hfixed); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -496,24 +496,24 @@ int main(int argc, char* argv[]) case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(arkode_mem, udata->tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -536,8 +536,8 @@ int main(int argc, char* argv[]) t1 = MPI_Wtime(); // Evolve in time - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = MPI_Wtime(); @@ -597,7 +597,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -2634,28 +2634,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2684,10 +2684,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp index b36045a68d..dc57e33c2f 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp @@ -41,7 +41,7 @@ * If the requested accuracy is 5th order, the problem is treated implicitly. * This option is included for computing a reference solution. * Several command line options are available to - * change the problem parameters and ARKStep settings. Use the flag --help for + * change the problem parameters and ARKode settings. Use the flag --help for * more information. * ---------------------------------------------------------------------------*/ @@ -391,7 +391,7 @@ int main(int argc, char* argv[]) } // ---------------------------------------------- - // Setup ARKStep integrator and set options + // Setup ARKode integrator and set options // ---------------------------------------------- // Create integrator @@ -407,37 +407,37 @@ int main(int argc, char* argv[]) } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata.rtol, udata.atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata.rtol, udata.atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata.prectype != SUN_PREC_NONE) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set max steps between linear solver (preconditioner) setup calls - flag = ARKStepSetLSetupFrequency(arkode_mem, udata.msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata.msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata.epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata.epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata.order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata.order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } // Set fixed step size or adaptivity method if (udata.hf > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, udata.hf); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata.hf); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -450,28 +450,28 @@ int main(int argc, char* argv[]) case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(sunctx); break; case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(sunctx); break; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Specify linearly implicit non-time-dependent RHS if (udata.linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Attach user data - flag = ARKStepSetUserData(arkode_mem, &udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, &udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(arkode_mem, udata.maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata.maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(arkode_mem, udata.tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata.tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -494,8 +494,8 @@ int main(int argc, char* argv[]) t1 = MPI_Wtime(); // Evolve in time - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = MPI_Wtime(); @@ -539,7 +539,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(&udata); // Free user data @@ -2720,26 +2720,26 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2767,10 +2767,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prectype != SUN_PREC_NONE) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp index 9cd4b0eab9..56118e882d 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp @@ -39,7 +39,7 @@ * an inexact Newton method paired with the PCG linear solver using hypre's PFMG * preconditioner for the slow-implicit nonlinear solve and inexact Newton with * GMRES for the fast nonlinear solve. Several command line options are - * available to change the problem parameters and ARKStep settings. Use the flag + * available to change the problem parameters and ARKode settings. Use the flag * --help for more information. * ---------------------------------------------------------------------------*/ @@ -413,26 +413,26 @@ int main(int argc, char* argv[]) if (check_flag((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(inner_arkode_mem, udata.rtol, udata.atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(inner_arkode_mem, udata.rtol, udata.atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(inner_arkode_mem, LSf, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(inner_arkode_mem, LSf, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(inner_arkode_mem, udata.epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(inner_arkode_mem, udata.epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Use an ARKode provided table - flag = ARKStepSetOrder(inner_arkode_mem, udata.forder); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(inner_arkode_mem, udata.forder); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } // Set fixed step size or adaptivity method if (udata.hf > ZERO) { - flag = ARKStepSetFixedStep(inner_arkode_mem, udata.hf); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(inner_arkode_mem, udata.hf); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -447,17 +447,17 @@ int main(int argc, char* argv[]) Ctrl = SUNAdaptController_ImExGus(sunctx); break; } - flag = ARKStepSetAdaptController(inner_arkode_mem, Ctrl); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(inner_arkode_mem, Ctrl); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Attach user data - flag = ARKStepSetUserData(inner_arkode_mem, &udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(inner_arkode_mem, &udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(inner_arkode_mem, udata.maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(inner_arkode_mem, udata.maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Create inner stepper flag = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -475,27 +475,27 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(arkode_mem, udata.rtol, udata.atol); - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata.rtol, udata.atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach linear solver - flag = MRIStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata.prectype != SUN_PREC_NONE) { // Attach preconditioner - flag = MRIStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "MRIStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set max steps between linear solver (preconditioner) setup calls - flag = MRIStepSetLSetupFrequency(arkode_mem, udata.msbp); - if (check_flag(&flag, "MRIStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata.msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = MRIStepSetEpsLin(arkode_mem, udata.epslin); - if (check_flag(&flag, "MRIStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata.epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } if (udata.sorder == 3) { @@ -513,27 +513,27 @@ int main(int argc, char* argv[]) if (check_flag(&flag, "MRIStepSetCoupling", 1)) { return 1; } // Set fixed step size - flag = MRIStepSetFixedStep(arkode_mem, udata.hs); - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata.hs); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Specify linearly implicit non-time-dependent RHS if (udata.linear) { - flag = MRIStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Attach user data - flag = MRIStepSetUserData(arkode_mem, &udata); - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, &udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Set max steps between outputs - flag = MRIStepSetMaxNumSteps(arkode_mem, udata.maxsteps); - if (check_flag(&flag, "MRIStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata.maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = MRIStepSetStopTime(arkode_mem, udata.tf); - if (check_flag(&flag, "MRIStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata.tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -556,8 +556,8 @@ int main(int argc, char* argv[]) t1 = MPI_Wtime(); // Evolve in time - flag = MRIStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "MRIStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = MPI_Wtime(); @@ -605,15 +605,15 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - MRIStepFree(&arkode_mem); // Free slow integrator memory - ARKStepFree(&inner_arkode_mem); // Free fast integrator memory + ARKodeFree(&arkode_mem); // Free slow integrator memory + ARKodeFree(&inner_arkode_mem); // Free fast integrator memory MRIStepInnerStepper_Free(&inner_stepper); // Free inner stepper MRIStepCoupling_Free(C); // Free coupling coefficients SUNLinSolFree(LS); // Free linear solver SUNLinSolFree(LSf); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(&udata); // Free user data - (void)SUNAdaptController_Destroy(Ctrl); // Free timestep adaptivity controller + (void)SUNAdaptController_Destroy(Ctrl); // Free timestep adaptivity controller } // Finalize MPI @@ -2695,26 +2695,26 @@ static int OutputFastStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2742,10 +2742,10 @@ static int OutputFastStats(void* arkode_mem, UserData* udata) if (udata->prectype != SUN_PREC_NONE) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; @@ -2763,22 +2763,22 @@ static int OutputSlowStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nJv; - flag = MRIStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } flag = MRIStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = MRIStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "MRIStepGetNumLinIters", 1)) { return -1; } - flag = MRIStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "MRIStepGetNumLinConvFails", 1)) { return -1; } - flag = MRIStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return -1; } - flag = MRIStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "MRIStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -2802,10 +2802,10 @@ static int OutputSlowStats(void* arkode_mem, UserData* udata) if (udata->prectype != SUN_PREC_NONE) { long int npe, nps; - flag = MRIStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "MRIStepGetNumPrecEvals", 1)) { return -1; } - flag = MRIStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "MRIStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp b/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp index fc403e7404..bff4c2aba8 100644 --- a/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp +++ b/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp @@ -178,7 +178,7 @@ int main(int argc, char* argv[]) // Setup the integrator // -------------------- - // ERKStep, ARKStep, or MRIStep memory structure + // ARKode memory structure void* arkode_mem = nullptr; // Matrix and linear solver for DIRK, IMEX, or MRI slow integrators @@ -234,55 +234,16 @@ int main(int argc, char* argv[]) for (int iout = 0; iout < uopts.nout; iout++) { // Evolve - switch (uopts.integrator) + if (uopts.output == 3) { - case (0): - if (uopts.output == 3) - { - // Stop at output time (do not interpolate output) - flag = ERKStepSetStopTime(arkode_mem, tout); - if (check_flag(flag, "ARKStepSetStopTime")) { return 1; } - } - - // Advance in time - flag = ERKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - break; - case (1): - if (uopts.output == 3) - { - // Stop at output time (do not interpolate output) - flag = ARKStepSetStopTime(arkode_mem, tout); - if (check_flag(flag, "ARKStepSetStopTime")) { return 1; } - } - - // Advance in time - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - break; - case (2): - if (uopts.output == 3) - { - // Stop at output time (do not interpolate output) - flag = MRIStepSetStopTime(arkode_mem, tout); - if (check_flag(flag, "MRIStepSetStopTime")) { return 1; } - } - - // Advance in time - flag = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - break; - case (3): - if (uopts.output == 3) - { - // Stop at output time (do not interpolate output) - flag = MRIStepSetStopTime(arkode_mem, tout); - if (check_flag(flag, "MRIStepSetStopTime")) { return 1; } - } - - // Advance in time - flag = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - break; - default: flag = -1; + // Stop at output time (do not interpolate output) + flag = ARKodeSetStopTime(arkode_mem, tout); + if (check_flag(flag, "ARKodeSetStopTime")) { return 1; } } - if (check_flag(flag, "Evolve")) { break; } + + // Advance in time + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_flag(flag, "ARKodeEvolve")) { break; } // Output solution flag = WriteOutput(t, y, udata, uopts); @@ -321,15 +282,15 @@ int main(int argc, char* argv[]) switch (uopts.integrator) { - case (0): ERKStepFree(&arkode_mem); break; - case (1): ARKStepFree(&arkode_mem); break; + case (0): ARKodeFree(&arkode_mem); break; + case (1): ARKodeFree(&arkode_mem); break; case (2): { void* inner_arkode_mem = nullptr; MRIStepInnerStepper_GetContent(fast_mem, &inner_arkode_mem); - ARKStepFree(&inner_arkode_mem); + ARKodeFree(&inner_arkode_mem); MRIStepInnerStepper_Free(&fast_mem); - MRIStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); break; } case (3): @@ -340,7 +301,7 @@ int main(int argc, char* argv[]) CVodeFree(&(content->cvode_mem)); delete content; MRIStepInnerStepper_Free(&fast_mem); - MRIStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); break; } } @@ -391,22 +352,22 @@ int SetupERK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(arkode_mem, "ERKStepCreate")) { return 1; } // Specify tolerances - int flag = ERKStepSStolerances(*arkode_mem, uopts.rtol, uopts.atol); - if (check_flag(flag, "ERKStepSStolerances")) { return 1; } + int flag = ARKodeSStolerances(*arkode_mem, uopts.rtol, uopts.atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } // Attach user data - flag = ERKStepSetUserData(*arkode_mem, &udata); - if (check_flag(flag, "ERKStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, &udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // Select method order - flag = ERKStepSetOrder(*arkode_mem, uopts.order); - if (check_flag(flag, "ERKStepSetOrder")) { return 1; } + flag = ARKodeSetOrder(*arkode_mem, uopts.order); + if (check_flag(flag, "ARKodeSetOrder")) { return 1; } // Set fixed step size or adaptivity method if (uopts.fixed_h > ZERO) { - flag = ERKStepSetFixedStep(*arkode_mem, uopts.fixed_h); - if (check_flag(flag, "ERKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, uopts.fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } else if (uopts.controller >= 0) { @@ -419,17 +380,17 @@ int SetupERK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, case (ARK_ADAPT_IMP_GUS): *C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): *C = SUNAdaptController_ImExGus(ctx); break; } - flag = ERKStepSetAdaptController(*arkode_mem, *C); - if (check_flag(flag, "ERKStepSetAdaptController")) { return 1; } + flag = ARKodeSetAdaptController(*arkode_mem, *C); + if (check_flag(flag, "ARKodeSetAdaptController")) { return 1; } } // Set max steps between outputs - flag = ERKStepSetMaxNumSteps(*arkode_mem, uopts.maxsteps); - if (check_flag(flag, "ERKStepSetMaxNumSteps")) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, uopts.maxsteps); + if (check_flag(flag, "ARKodeSetMaxNumSteps")) { return 1; } // Set stopping time - flag = ERKStepSetStopTime(*arkode_mem, udata.tf); - if (check_flag(flag, "ERKStepSetStopTime")) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata.tf); + if (check_flag(flag, "ARKodeSetStopTime")) { return 1; } return 0; } @@ -583,12 +544,12 @@ int SetupARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } // Specify tolerances - int flag = ARKStepSStolerances(*arkode_mem, uopts.rtol, uopts.atol); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + int flag = ARKodeSStolerances(*arkode_mem, uopts.rtol, uopts.atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } // Attach user data - flag = ARKStepSetUserData(*arkode_mem, &udata); - if (check_flag(flag, "ARKStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, &udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // If implicit, setup solvers if (fi_RHS) @@ -602,26 +563,26 @@ int SetupARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(*LS, "SUNLinSol_Band")) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(*arkode_mem, *LS, *A); - if (check_flag(flag, "ARKStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, *LS, *A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } // Attach Jacobian function - flag = ARKStepSetJacFn(*arkode_mem, Ji_RHS); - if (check_flag(flag, "ARKStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(*arkode_mem, Ji_RHS); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } // Set the predictor method - flag = ARKStepSetPredictorMethod(*arkode_mem, uopts.predictor); - if (check_flag(flag, "ARKStepSetPredictorMethod")) { return 1; } + flag = ARKodeSetPredictorMethod(*arkode_mem, uopts.predictor); + if (check_flag(flag, "ARKodeSetPredictorMethod")) { return 1; } // Set linear solver setup frequency - flag = ARKStepSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); - if (check_flag(flag, "ARKStepSetLSetupFrequency")) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); + if (check_flag(flag, "ARKodeSetLSetupFrequency")) { return 1; } if (uopts.linear) { // Specify linearly implicit non-time-dependent RHS - flag = ARKStepSetLinear(*arkode_mem, SUNFALSE); - if (check_flag(flag, "ARKStepSetLinear")) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, SUNFALSE); + if (check_flag(flag, "ARKodeSetLinear")) { return 1; } } } @@ -653,15 +614,15 @@ int SetupARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, else { // Select default method of a given order - flag = ARKStepSetOrder(*arkode_mem, uopts.order); - if (check_flag(flag, "ARKStepSetOrder")) { return 1; } + flag = ARKodeSetOrder(*arkode_mem, uopts.order); + if (check_flag(flag, "ARKodeSetOrder")) { return 1; } } // Set fixed step size or adaptivity method if (uopts.fixed_h > ZERO) { - flag = ARKStepSetFixedStep(*arkode_mem, uopts.fixed_h); - if (check_flag(flag, "ARKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, uopts.fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } else if (uopts.controller >= 0) { @@ -674,17 +635,17 @@ int SetupARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, case (ARK_ADAPT_IMP_GUS): *C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): *C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(*arkode_mem, *C); - if (check_flag(flag, "ARKStepSetAdaptController")) { return 1; } + flag = ARKodeSetAdaptController(*arkode_mem, *C); + if (check_flag(flag, "ARKodeSetAdaptController")) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(*arkode_mem, uopts.maxsteps); - if (check_flag(flag, "ARKStepSetMaxNumSteps")) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, uopts.maxsteps); + if (check_flag(flag, "ARKodeSetMaxNumSteps")) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(*arkode_mem, udata.tf); - if (check_flag(flag, "ARKStepSetStopTime")) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata.tf); + if (check_flag(flag, "ARKodeSetStopTime")) { return 1; } return 0; } @@ -756,13 +717,13 @@ int SetupMRIARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } // Specify tolerances - int flag = ARKStepSStolerances(fast_arkode_mem, uopts.rtol_fast, - uopts.atol_fast); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + int flag = ARKodeSStolerances(fast_arkode_mem, uopts.rtol_fast, + uopts.atol_fast); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } // Attach user data - flag = ARKStepSetUserData(fast_arkode_mem, &udata); - if (check_flag(flag, "ARKStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(fast_arkode_mem, &udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // If implicit, setup solvers if (ffi_RHS) @@ -776,31 +737,31 @@ int SetupMRIARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(*LS_fast, "SUNLinSol_Band")) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(fast_arkode_mem, *LS_fast, *A_fast); - if (check_flag(flag, "ARKStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(fast_arkode_mem, *LS_fast, *A_fast); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } // Attach Jacobian function - flag = ARKStepSetJacFn(fast_arkode_mem, Jfi_RHS); - if (check_flag(flag, "ARKStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(fast_arkode_mem, Jfi_RHS); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } // Set the predictor method - flag = ARKStepSetPredictorMethod(fast_arkode_mem, uopts.predictor_fast); - if (check_flag(flag, "ARKStepSetPredictorMethod")) { return 1; } + flag = ARKodeSetPredictorMethod(fast_arkode_mem, uopts.predictor_fast); + if (check_flag(flag, "ARKodeSetPredictorMethod")) { return 1; } // Set linear solver setup frequency - flag = ARKStepSetLSetupFrequency(fast_arkode_mem, uopts.ls_setup_freq_fast); - if (check_flag(flag, "ARKStepSetLSetupFrequency")) { return 1; } + flag = ARKodeSetLSetupFrequency(fast_arkode_mem, uopts.ls_setup_freq_fast); + if (check_flag(flag, "ARKodeSetLSetupFrequency")) { return 1; } } // Select method order - flag = ARKStepSetOrder(fast_arkode_mem, uopts.order_fast); - if (check_flag(flag, "ARKStepSetOrder")) { return 1; } + flag = ARKodeSetOrder(fast_arkode_mem, uopts.order_fast); + if (check_flag(flag, "ARKodeSetOrder")) { return 1; } // Set fixed step size or adaptivity method if (uopts.fixed_h_fast > ZERO) { - flag = ARKStepSetFixedStep(fast_arkode_mem, uopts.fixed_h_fast); - if (check_flag(flag, "ARKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(fast_arkode_mem, uopts.fixed_h_fast); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } else if (uopts.controller_fast >= 0) { @@ -813,13 +774,13 @@ int SetupMRIARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, case (ARK_ADAPT_IMP_GUS): *C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): *C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(fast_arkode_mem, *C); - if (check_flag(flag, "ARKStepSetAdaptController")) { return 1; } + flag = ARKodeSetAdaptController(fast_arkode_mem, *C); + if (check_flag(flag, "ARKodeSetAdaptController")) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(fast_arkode_mem, uopts.maxsteps); - if (check_flag(flag, "ARKStepSetMaxNumSteps")) { return 1; } + flag = ARKodeSetMaxNumSteps(fast_arkode_mem, uopts.maxsteps); + if (check_flag(flag, "ARKodeSetMaxNumSteps")) { return 1; } // Wrap ARKODE as an MRIStepInnerStepper flag = ARKStepCreateMRIStepInnerStepper(fast_arkode_mem, fast_mem); @@ -834,16 +795,16 @@ int SetupMRIARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(*arkode_mem, "MRIStepCreate")) { return 1; } // Set the slow step size - flag = MRIStepSetFixedStep(*arkode_mem, uopts.fixed_h); - if (check_flag(flag, "MRIStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, uopts.fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(*arkode_mem, uopts.rtol, uopts.atol); - if (check_flag(flag, "MRIStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(*arkode_mem, uopts.rtol, uopts.atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } // Attach user data - flag = MRIStepSetUserData(*arkode_mem, &udata); - if (check_flag(flag, "MRIStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, &udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // If implicit, setup solvers if (fsi_RHS) @@ -857,40 +818,40 @@ int SetupMRIARK(SUNContext ctx, UserData& udata, UserOptions& uopts, N_Vector y, if (check_ptr(*LS, "SUNLinSol_Band")) { return 1; } // Attach linear solver - flag = MRIStepSetLinearSolver(*arkode_mem, *LS, *A); - if (check_flag(flag, "MRIStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, *LS, *A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } // Attach Jacobian function - flag = MRIStepSetJacFn(*arkode_mem, Jsi_RHS); - if (check_flag(flag, "MRIStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(*arkode_mem, Jsi_RHS); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } // Set linear solver setup frequency - flag = MRIStepSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); - if (check_flag(flag, "MRIStepSetLSetupFrequency")) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); + if (check_flag(flag, "ARKodeSetLSetupFrequency")) { return 1; } // Set the predictor method - flag = MRIStepSetPredictorMethod(*arkode_mem, uopts.predictor); - if (check_flag(flag, "MRIStepSetPredictorMethod")) { return 1; } + flag = ARKodeSetPredictorMethod(*arkode_mem, uopts.predictor); + if (check_flag(flag, "ARKodeSetPredictorMethod")) { return 1; } if (uopts.linear) { // Specify linearly implicit non-time-dependent RHS - flag = MRIStepSetLinear(*arkode_mem, SUNFALSE); - if (check_flag(flag, "MRIStepSetLinear")) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, SUNFALSE); + if (check_flag(flag, "ARKodeSetLinear")) { return 1; } } } // Select method order - flag = MRIStepSetOrder(*arkode_mem, uopts.order); - if (check_flag(flag, "MRIStepSetOrder")) { return 1; } + flag = ARKodeSetOrder(*arkode_mem, uopts.order); + if (check_flag(flag, "ARKodeSetOrder")) { return 1; } // Set max steps between outputs - flag = MRIStepSetMaxNumSteps(*arkode_mem, uopts.maxsteps); - if (check_flag(flag, "MRIStepSetMaxNumSteps")) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, uopts.maxsteps); + if (check_flag(flag, "ARKodeSetMaxNumSteps")) { return 1; } // Set stopping time - flag = MRIStepSetStopTime(*arkode_mem, udata.tf); - if (check_flag(flag, "MRIStepSetStopTime")) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata.tf); + if (check_flag(flag, "ARKodeSetStopTime")) { return 1; } return 0; } @@ -1025,16 +986,16 @@ int SetupMRICVODE(SUNContext ctx, UserData& udata, UserOptions& uopts, if (check_ptr(*arkode_mem, "MRIStepCreate")) { return 1; } // Set the slow step size - flag = MRIStepSetFixedStep(*arkode_mem, uopts.fixed_h); - if (check_flag(flag, "MRIStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(*arkode_mem, uopts.fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(*arkode_mem, uopts.rtol, uopts.atol); - if (check_flag(flag, "MRIStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(*arkode_mem, uopts.rtol, uopts.atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } // Attach user data - flag = MRIStepSetUserData(*arkode_mem, &udata); - if (check_flag(flag, "MRIStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(*arkode_mem, &udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // If implicit, setup solvers if (fsi_RHS) @@ -1048,40 +1009,40 @@ int SetupMRICVODE(SUNContext ctx, UserData& udata, UserOptions& uopts, if (check_ptr(*LS, "SUNLinSol_Band")) { return 1; } // Attach linear solver - flag = MRIStepSetLinearSolver(*arkode_mem, *LS, *A); - if (check_flag(flag, "MRIStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(*arkode_mem, *LS, *A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } // Attach Jacobian function - flag = MRIStepSetJacFn(*arkode_mem, Jsi_RHS); - if (check_flag(flag, "MRIStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(*arkode_mem, Jsi_RHS); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } // Set linear solver setup frequency - flag = MRIStepSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); - if (check_flag(flag, "MRIStepSetLSetupFrequency")) { return 1; } + flag = ARKodeSetLSetupFrequency(*arkode_mem, uopts.ls_setup_freq); + if (check_flag(flag, "ARKodeSetLSetupFrequency")) { return 1; } // Set the predictor method - flag = MRIStepSetPredictorMethod(*arkode_mem, uopts.predictor); - if (check_flag(flag, "MRIStepSetPredictorMethod")) { return 1; } + flag = ARKodeSetPredictorMethod(*arkode_mem, uopts.predictor); + if (check_flag(flag, "ARKodeSetPredictorMethod")) { return 1; } if (uopts.linear) { // Specify linearly implicit non-time-dependent RHS - flag = MRIStepSetLinear(*arkode_mem, SUNFALSE); - if (check_flag(flag, "MRIStepSetLinear")) { return 1; } + flag = ARKodeSetLinear(*arkode_mem, SUNFALSE); + if (check_flag(flag, "ARKodeSetLinear")) { return 1; } } } // Select method order - flag = MRIStepSetOrder(*arkode_mem, uopts.order); - if (check_flag(flag, "MRIStepSetOrder")) { return 1; } + flag = ARKodeSetOrder(*arkode_mem, uopts.order); + if (check_flag(flag, "ARKodeSetOrder")) { return 1; } // Set max steps between outputs - flag = MRIStepSetMaxNumSteps(*arkode_mem, uopts.maxsteps); - if (check_flag(flag, "MRIStepSetMaxNumSteps")) { return 1; } + flag = ARKodeSetMaxNumSteps(*arkode_mem, uopts.maxsteps); + if (check_flag(flag, "ARKodeSetMaxNumSteps")) { return 1; } // Set stopping time - flag = MRIStepSetStopTime(*arkode_mem, udata.tf); - if (check_flag(flag, "MRIStepSetStopTime")) { return 1; } + flag = ARKodeSetStopTime(*arkode_mem, udata.tf); + if (check_flag(flag, "ARKodeSetStopTime")) { return 1; } return 0; } diff --git a/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.hpp b/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.hpp index 293cf06d48..6d0bc8a09d 100644 --- a/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.hpp +++ b/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.hpp @@ -291,12 +291,12 @@ int OutputStatsERK(void* arkode_mem, UserData& udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe; - flag = ERKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(flag, "ERKStepGetNumSteps")) { return -1; } - flag = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(flag, "ERKStepGetNumStepAttempts")) { return -1; } - flag = ERKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(flag, "ERKStepGetNumErrTestFails")) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(flag, "ARKodeGetNumSteps")) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(flag, "ARKodeGetNumStepAttempts")) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(flag, "ARKodeGetNumErrTestFails")) { return -1; } flag = ERKStepGetNumRhsEvals(arkode_mem, &nfe); if (check_flag(flag, "ERKStepGetNumRhsEvals")) { return -1; } @@ -315,12 +315,12 @@ int OutputStatsARK(void* arkode_mem, UserData& udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(flag, "ARKStepGetNumSteps")) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(flag, "ARKStepGetNumStepAttempts")) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(flag, "ARKStepGetNumErrTestFails")) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(flag, "ARKodeGetNumSteps")) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(flag, "ARKodeGetNumStepAttempts")) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(flag, "ARKodeGetNumErrTestFails")) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(flag, "ARKStepGetNumRhsEvals")) { return -1; } @@ -334,16 +334,16 @@ int OutputStatsARK(void* arkode_mem, UserData& udata) if (udata.splitting) { long int nni, ncfn; - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(flag, "ARKStepGetNumNonlinSolvIters")) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(flag, "ARKStepGetNumNonlinSolvConvFails")) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(flag, "ARKodeGetNumNonlinSolvIters")) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(flag, "ARKodeGetNumNonlinSolvConvFails")) { return -1; } long int nsetups, nje; - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(flag, "ARKStepGetNumLinSolvSetups")) { return -1; } - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - if (check_flag(flag, "ARKStepGetNumJacEvals")) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(flag, "ARKodeGetNumLinSolvSetups")) { return -1; } + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + if (check_flag(flag, "ARKodeGetNumJacEvals")) { return -1; } cout << " NLS iters = " << nni << endl; cout << " NLS fails = " << ncfn << endl; @@ -369,8 +369,8 @@ int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem, // Get slow integrator and solver stats long int nst, nst_a, netf, nfe, nfi; - flag = MRIStepGetNumSteps(arkode_mem, &nst); - if (check_flag(flag, "MRIStepGetNumSteps")) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(flag, "ARKodeGetNumSteps")) { return -1; } flag = MRIStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(flag, "MRIStepGetNumRhsEvals")) { return -1; } @@ -383,16 +383,16 @@ int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem, if (udata.diffusion) { long int nni, ncfn; - flag = MRIStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(flag, "MRIStepGetNumNonlinSolvIters")) { return -1; } - flag = MRIStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(flag, "MRIStepGetNumNonlinSolvConvFails")) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(flag, "ARKodeGetNumNonlinSolvIters")) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(flag, "ARKodeGetNumNonlinSolvConvFails")) { return -1; } long int nsetups, nje; - flag = MRIStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(flag, "MRIStepGetNumLinSolvSetups")) { return -1; } - flag = MRIStepGetNumJacEvals(arkode_mem, &nje); - if (check_flag(flag, "MRIStepGetNumJacEvals")) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(flag, "ARKodeGetNumLinSolvSetups")) { return -1; } + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + if (check_flag(flag, "ARKodeGetNumJacEvals")) { return -1; } cout << " NLS iters = " << nni << endl; cout << " NLS fails = " << ncfn << endl; @@ -413,12 +413,12 @@ int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem, MRIStepInnerStepper_GetContent(fast_mem, &fast_arkode_mem); // Get fast integrator and solver stats - flag = ARKStepGetNumSteps(fast_arkode_mem, &nst); - if (check_flag(flag, "ARKStepGetNumSteps")) { return -1; } - flag = ARKStepGetNumStepAttempts(fast_arkode_mem, &nst_a); - if (check_flag(flag, "ARKStepGetNumStepAttempts")) { return -1; } - flag = ARKStepGetNumErrTestFails(fast_arkode_mem, &netf); - if (check_flag(flag, "ARKStepGetNumErrTestFails")) { return -1; } + flag = ARKodeGetNumSteps(fast_arkode_mem, &nst); + if (check_flag(flag, "ARKodeGetNumSteps")) { return -1; } + flag = ARKodeGetNumStepAttempts(fast_arkode_mem, &nst_a); + if (check_flag(flag, "ARKodeGetNumStepAttempts")) { return -1; } + flag = ARKodeGetNumErrTestFails(fast_arkode_mem, &netf); + if (check_flag(flag, "ARKodeGetNumErrTestFails")) { return -1; } flag = ARKStepGetNumRhsEvals(fast_arkode_mem, &nfe, &nfi); if (check_flag(flag, "ARKStepGetNumRhsEvals")) { return -1; } @@ -433,16 +433,16 @@ int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem, if (udata.splitting) { long int nni, ncfn; - flag = ARKStepGetNumNonlinSolvIters(fast_arkode_mem, &nni); - if (check_flag(flag, "ARKStepGetNumNonlinSolvIters")) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(fast_arkode_mem, &ncfn); - if (check_flag(flag, "ARKStepGetNumNonlinSolvConvFails")) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(fast_arkode_mem, &nni); + if (check_flag(flag, "ARKodeGetNumNonlinSolvIters")) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(fast_arkode_mem, &ncfn); + if (check_flag(flag, "ARKodeGetNumNonlinSolvConvFails")) { return -1; } long int nsetups, nje; - flag = ARKStepGetNumLinSolvSetups(fast_arkode_mem, &nsetups); - if (check_flag(flag, "ARKStepGetNumLinSolvSetups")) { return -1; } - flag = ARKStepGetNumJacEvals(fast_arkode_mem, &nje); - if (check_flag(flag, "ARKStepGetNumJacEvals")) { return -1; } + flag = ARKodeGetNumLinSolvSetups(fast_arkode_mem, &nsetups); + if (check_flag(flag, "ARKodeGetNumLinSolvSetups")) { return -1; } + flag = ARKodeGetNumJacEvals(fast_arkode_mem, &nje); + if (check_flag(flag, "ARKodeGetNumJacEvals")) { return -1; } cout << " NLS iters = " << nni << endl; cout << " NLS fails = " << ncfn << endl; @@ -505,22 +505,22 @@ int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper fast_mem, // Get slow integrator and solver stats long int nsts, nfse, nfsi; - flag = MRIStepGetNumSteps(arkode_mem, &nsts); - if (check_flag(flag, "MRIStepGetNumSteps")) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nsts); + if (check_flag(flag, "ARKodeGetNumSteps")) { return -1; } flag = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); if (check_flag(flag, "MRIStepGetNumRhsEvals")) { return -1; } long int nni, ncfn; - flag = MRIStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(flag, "MRIStepGetNumNonlinSolvIters")) { return -1; } - flag = MRIStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(flag, "MRIStepGetNumNonlinSolvConvFails")) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(flag, "ARKodeGetNumNonlinSolvIters")) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(flag, "ARKodeGetNumNonlinSolvConvFails")) { return -1; } long int nsetups, nje; - flag = MRIStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(flag, "MRIStepGetNumLinSolvSetups")) { return -1; } - flag = MRIStepGetNumJacEvals(arkode_mem, &nje); - if (check_flag(flag, "MRIStepGetNumJacEvals")) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(flag, "ARKodeGetNumLinSolvSetups")) { return -1; } + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + if (check_flag(flag, "ARKodeGetNumJacEvals")) { return -1; } cout << fixed << setprecision(6); cout << endl << "Slow Integrator:" << endl; diff --git a/examples/arkode/CXX_serial/ark_analytic_sys.cpp b/examples/arkode/CXX_serial/ark_analytic_sys.cpp index ffcad8e516..1dcae7c878 100644 --- a/examples/arkode/CXX_serial/ark_analytic_sys.cpp +++ b/examples/arkode/CXX_serial/ark_analytic_sys.cpp @@ -173,22 +173,22 @@ int main() if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Set routines - flag = ARKStepSetUserData(arkode_mem, - (void*)&lamda); // Pass lamda to user functions - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); // Specify tolerances - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)&lamda); // Pass lamda to user functions + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); // Specify tolerances + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Linear solver interface - flag = ARKStepSetLinearSolver(arkode_mem, LS, + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); // Attach matrix and linear solver - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); // Set Jacobian routine - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); // Set Jacobian routine + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } // Specify linearly implicit RHS, with non-time-dependent Jacobian - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } // Open output stream for results, output comment line FILE* UFID = fopen("solution.txt", "w"); @@ -198,7 +198,7 @@ int main() fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ sunrealtype t = T0; sunrealtype tout = T0 + dTout; @@ -206,8 +206,8 @@ int main() cout << " --------------------------------------\n"; while (Tf - t > 1.0e-15) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); // call integrator - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); // call integrator + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %8.4" FSYM " %8.5" FSYM " %8.5" FSYM " %8.5" FSYM "\n", // access/print solution t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -229,24 +229,24 @@ int main() // Print some final statistics long int nst, nst_a, nfe, nfi, nsetups, nje, nfeLS, nni, ncfn, netf; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); cout << "\nFinal Solver Statistics:\n"; cout << " Internal solver steps = " << nst << " (attempted = " << nst_a @@ -262,7 +262,7 @@ int main() cout << " Total number of error test failures = " << netf << "\n\n"; // Clean up and return with successful completion - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver SUNMatDestroy(A); // Free A matrix N_VDestroy(y); // Free y vector diff --git a/examples/arkode/CXX_serial/ark_heat2D.cpp b/examples/arkode/CXX_serial/ark_heat2D.cpp index 414bbff076..887e59a782 100644 --- a/examples/arkode/CXX_serial/ark_heat2D.cpp +++ b/examples/arkode/CXX_serial/ark_heat2D.cpp @@ -41,7 +41,7 @@ * problem is advanced in time with a diagonally implicit Runge-Kutta method * using an inexact Newton method paired with the PCG or SPGMR linear solver. * Several command line options are available to change the problem parameters - * and ARKStep settings. Use the flag --help for more information. + * and ARKode settings. Use the flag --help for more information. * ---------------------------------------------------------------------------*/ #include @@ -290,7 +290,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -298,38 +298,38 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -353,8 +353,8 @@ int main(int argc, char* argv[]) // Set fixed step size or adaptivity method if (udata->hfixed > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, udata->hfixed); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, udata->hfixed); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -367,24 +367,24 @@ int main(int argc, char* argv[]) case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(ctx); break; case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(ctx); break; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set max steps between outputs - flag = ARKStepSetMaxNumSteps(arkode_mem, udata->maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, udata->maxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Set stopping time - flag = ARKStepSetStopTime(arkode_mem, udata->tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, udata->tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } // ----------------------- // Loop over output times @@ -407,8 +407,8 @@ int main(int argc, char* argv[]) t1 = chrono::steady_clock::now(); // Evolve in time - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } // Stop timer t2 = chrono::steady_clock::now(); @@ -465,7 +465,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -1087,28 +1087,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } cout << fixed; cout << setprecision(6); @@ -1137,10 +1137,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } cout << " Preconditioner setups = " << npe << endl; cout << " Preconditioner solves = " << nps << endl; diff --git a/examples/arkode/CXX_serial/ark_kpr_Mt.cpp b/examples/arkode/CXX_serial/ark_kpr_Mt.cpp index 6a32290cca..431082a467 100644 --- a/examples/arkode/CXX_serial/ark_kpr_Mt.cpp +++ b/examples/arkode/CXX_serial/ark_kpr_Mt.cpp @@ -157,7 +157,7 @@ int main(int argc, char* argv[]) // general problem variables int retval; // reusable error-checking flag N_Vector y = NULL; // empty vector for the computed solution - void* arkode_mem = NULL; // empty ARKStep memory structure + void* arkode_mem = NULL; // empty ARKode memory structure SUNMatrix A = NULL; // empty system matrix SUNMatrix M = NULL; // empty mass matrix SUNLinearSolver LS = NULL; // empty system linear solver object @@ -269,34 +269,34 @@ int main(int argc, char* argv[]) NLS = SUNNonlinSol_Newton(y, ctx); if (check_retval((void*)NLS, "SUNNonlinSol_Newton", 0)) { return 1; } - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return (1); } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return (1); } A = SUNDenseMatrix(NEQ, NEQ, ctx); if (check_retval((void*)A, "SUNDenseMatrix", 0)) { return 1; } LS = SUNLinSol_Dense(y, A, ctx); if (check_retval((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } - retval = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return (1); } - if (rk_type == 0) { retval = ARKStepSetJacFn(arkode_mem, Ji); } - else { retval = ARKStepSetJacFn(arkode_mem, Jn); } - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return (1); } + if (rk_type == 0) { retval = ARKodeSetJacFn(arkode_mem, Ji); } + else { retval = ARKodeSetJacFn(arkode_mem, Jn); } + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } } else { // Fixed-point NLS = SUNNonlinSol_FixedPoint(y, 4, ctx); if (check_retval((void*)NLS, "SUNNonlinSol_FixedPoint", 0)) { return 1; } - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return (1); } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return (1); } } } // Set maximum stepsize for ERK run if (rk_type == 2) { - retval = ARKStepSetMaxStep(arkode_mem, ONE / SUNRabs(udata.G)); - if (check_retval(&retval, "ARKStepSetMaxStep", 1)) { return (1); } + retval = ARKodeSetMaxStep(arkode_mem, ONE / SUNRabs(udata.G)); + if (check_retval(&retval, "ARKodeSetMaxStep", 1)) { return (1); } } // Initialize/attach mass matrix solver @@ -304,21 +304,21 @@ int main(int argc, char* argv[]) if (check_retval((void*)M, "SUNDenseMatrix", 0)) { return 1; } MLS = SUNLinSol_Dense(y, M, ctx); if (check_retval((void*)MLS, "SUNLinSol_Dense", 0)) { return 1; } - retval = ARKStepSetMassLinearSolver(arkode_mem, MLS, M, SUNTRUE); - if (check_retval(&retval, "ARKStepSetMassLinearSolver", 1)) { return (1); } - retval = ARKStepSetMassFn(arkode_mem, MassMatrix); - if (check_retval(&retval, "ARKStepSetMassFn", 1)) { return (1); } + retval = ARKodeSetMassLinearSolver(arkode_mem, MLS, M, SUNTRUE); + if (check_retval(&retval, "ARKodeSetMassLinearSolver", 1)) { return (1); } + retval = ARKodeSetMassFn(arkode_mem, MassMatrix); + if (check_retval(&retval, "ARKodeSetMassFn", 1)) { return (1); } // Set desired solver order - retval = ARKStepSetOrder(arkode_mem, order); - if (check_retval(&retval, "ARKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } - retval = ARKStepSetDeduceImplicitRhs(arkode_mem, deduce); - if (check_retval(&retval, "ARKStepSetDeduceImplicitRhs", 1)) { return 1; } + retval = ARKodeSetDeduceImplicitRhs(arkode_mem, deduce); + if (check_retval(&retval, "ARKodeSetDeduceImplicitRhs", 1)) { return 1; } // Set the user data pointer - retval = ARKStepSetUserData(arkode_mem, (void*)&udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)&udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } // Integrate ODE, based on run type if (adaptive) @@ -334,7 +334,7 @@ int main(int argc, char* argv[]) } // Clean up and return - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // free system linear solver SUNLinSolFree(MLS); // free mass linear solver SUNNonlinSolFree(NLS); // free nonlinear solver @@ -509,10 +509,10 @@ static int adaptive_run(void* arkode_mem, N_Vector y, sunrealtype T0, int retval; // Set tolerances - retval = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } - retval = ARKStepResStolerance(arkode_mem, abstol); - if (check_retval(&retval, "ARKStepResStolerance", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } + retval = ARKodeResStolerance(arkode_mem, abstol); + if (check_retval(&retval, "ARKodeResStolerance", 1)) { return 1; } // Open output stream for results, output comment line FILE* UFID = fopen("ark_kpr_Mt_solution.txt", "w"); @@ -524,7 +524,7 @@ static int adaptive_run(void* arkode_mem, N_Vector y, sunrealtype T0, T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), SUNRabs(NV_Ith_S(y, 0) - utrue(T0)), SUNRabs(NV_Ith_S(y, 1) - vtrue(T0))); - // Main time-stepping loop: calls ARKStepEvolve to perform integration, + // Main time-stepping loop: calls ARKodeEvolve to perform integration, // then prints results. Stops when the final time has been reached int Nt = (int)ceil((Tf - T0) / dTout); sunrealtype t = T0; @@ -543,8 +543,8 @@ static int adaptive_run(void* arkode_mem, N_Vector y, sunrealtype T0, for (int iout = 0; iout < Nt; iout++) { // call integrator - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } // access/print solution and error uerr = SUNRabs(NV_Ith_S(y, 0) - utrue(t)); @@ -571,30 +571,30 @@ static int adaptive_run(void* arkode_mem, N_Vector y, sunrealtype T0, // Get integrator statistics long int nst, nst_a, nfe, nfi, nni, nnc, nje, nsetups, netf, nmset, nms, nMv; - retval = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_retval(&retval, "ARKStepGetNumSteps", 1)) { return 1; } - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_retval(&retval, "ARKStepGetNumStepAttempts", 1)) { return 1; } + retval = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_retval(&retval, "ARKodeGetNumSteps", 1)) { return 1; } + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_retval(&retval, "ARKodeGetNumStepAttempts", 1)) { return 1; } retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_retval(&retval, "ARKStepGetNumRhsEvals", 1)) { return 1; } - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_retval(&retval, "ARKStepGetNumErrTestFails", 1)) { return 1; } - retval = ARKStepGetNumMassSetups(arkode_mem, &nmset); - if (check_retval(&retval, "ARKStepGetNumMassSetups", 1)) { return 1; } - retval = ARKStepGetNumMassSolves(arkode_mem, &nms); - if (check_retval(&retval, "ARKStepGetNumMassSolves", 1)) { return 1; } - retval = ARKStepGetNumMassMult(arkode_mem, &nMv); - if (check_retval(&retval, "ARKStepGetNumMassMult", 1)) { return 1; } + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_retval(&retval, "ARKodeGetNumErrTestFails", 1)) { return 1; } + retval = ARKodeGetNumMassSetups(arkode_mem, &nmset); + if (check_retval(&retval, "ARKodeGetNumMassSetups", 1)) { return 1; } + retval = ARKodeGetNumMassSolves(arkode_mem, &nms); + if (check_retval(&retval, "ARKodeGetNumMassSolves", 1)) { return 1; } + retval = ARKodeGetNumMassMult(arkode_mem, &nMv); + if (check_retval(&retval, "ARKodeGetNumMassMult", 1)) { return 1; } if (rk_type < 2) { - retval = ARKStepGetNonlinSolvStats(arkode_mem, &nni, &nnc); - if (check_retval(&retval, "ARKStepGetNonlinSolvStats", 1)) { return 1; } - retval = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_retval(&retval, "ARKStepGetNumLinSolvSetups", 1)) { return 1; } + retval = ARKodeGetNonlinSolvStats(arkode_mem, &nni, &nnc); + if (check_retval(&retval, "ARKodeGetNonlinSolvStats", 1)) { return 1; } + retval = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_retval(&retval, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } if (nls_type == 0) { - retval = ARKStepGetNumJacEvals(arkode_mem, &nje); - if (check_retval(&retval, "ARKStepGetNumJacEvals", 1)) { return 1; } + retval = ARKodeGetNumJacEvals(arkode_mem, &nje); + if (check_retval(&retval, "ARKodeGetNumJacEvals", 1)) { return 1; } } else { nje = 0; } } @@ -632,22 +632,22 @@ static int check_order(void* arkode_mem, N_Vector y, sunrealtype T0, a11 = a12 = a21 = a22 = b1 = b2 = ZERO; // Tighten implicit solver to accommodate fixed step sizes - retval = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } - retval = ARKStepResStolerance(arkode_mem, abstol); - if (check_retval(&retval, "ARKStepResStolerance", 1)) { return (1); } - retval = ARKStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1)) { return (1); } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } + retval = ARKodeResStolerance(arkode_mem, abstol); + if (check_retval(&retval, "ARKodeResStolerance", 1)) { return (1); } + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return (1); } if (rk_type < 2) { - retval = ARKStepSetJacEvalFrequency(arkode_mem, 1); - if (check_retval(&retval, "ARKStepSetJacEvalFrequency", 1)) { return 1; } - retval = ARKStepSetLSetupFrequency(arkode_mem, 1); - if (check_retval(&retval, "ARKStepSetLSetupFrequency", 1)) { return 1; } - retval = ARKStepSetMaxNonlinIters(arkode_mem, 20); - if (check_retval(&retval, "ARKStepSetMaxNonlinIters", 1)) { return 1; } - retval = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_retval(&retval, "ARKStepSetNonlinConvCoef", 1)) { return 1; } + retval = ARKodeSetJacEvalFrequency(arkode_mem, 1); + if (check_retval(&retval, "ARKodeSetJacEvalFrequency", 1)) { return 1; } + retval = ARKodeSetLSetupFrequency(arkode_mem, 1); + if (check_retval(&retval, "ARKodeSetLSetupFrequency", 1)) { return 1; } + retval = ARKodeSetMaxNonlinIters(arkode_mem, 20); + if (check_retval(&retval, "ARKodeSetMaxNonlinIters", 1)) { return 1; } + retval = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_retval(&retval, "ARKodeSetNonlinConvCoef", 1)) { return 1; } } // Set array of fixed step sizes to use, storage for corresponding errors/orders @@ -667,13 +667,13 @@ static int check_order(void* arkode_mem, N_Vector y, sunrealtype T0, cout << " -----------------------------------------------------\n"; for (size_t ih = 0; ih < hvals.size(); ih++) { - // Reset ARKStep for this run + // Reset ARKode for this run retval = Ytrue(T0, y); if (check_retval(&retval, "Ytrue", 1)) { return 1; } - retval = ARKStepReset(arkode_mem, T0, y); - if (check_retval(&retval, "ARKStepReset", 1)) { return 1; } - retval = ARKStepSetFixedStep(arkode_mem, hvals[ih]); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, T0, y); + if (check_retval(&retval, "ARKodeReset", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hvals[ih]); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } // Main time-stepping loop: run for Nout periods, accumulating overall error sunrealtype t = T0; @@ -685,8 +685,8 @@ static int check_order(void* arkode_mem, N_Vector y, sunrealtype T0, for (size_t iout = 0; iout < Nout; iout++) { // call integrator and update output time - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } tout += dTout; tout = (tout > Tf) ? Tf : tout; diff --git a/examples/arkode/CXX_serial/ark_pendulum.cpp b/examples/arkode/CXX_serial/ark_pendulum.cpp index 776dc831d8..d351f38239 100644 --- a/examples/arkode/CXX_serial/ark_pendulum.cpp +++ b/examples/arkode/CXX_serial/ark_pendulum.cpp @@ -139,14 +139,14 @@ int main(int argc, char* argv[]) if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } if (relax) { // Enable relaxation methods - flag = ARKStepSetRelaxFn(arkode_mem, Eng, JacEng); - if (check_flag(flag, "ARKStepSetRelaxFn")) { return 1; } + flag = ARKodeSetRelaxFn(arkode_mem, Eng, JacEng); + if (check_flag(flag, "ARKodeSetRelaxFn")) { return 1; } } SUNMatrix A = nullptr; @@ -162,12 +162,12 @@ int main(int argc, char* argv[]) if (check_ptr(LS, "SUNLinSol_Dense")) { return 1; } // Attach the matrix and linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_flag(flag, "ARKStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } // Set Jacobian routine - flag = ARKStepSetJacFn(arkode_mem, Jac); - if (check_flag(flag, "ARKStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } if (fixed_h > SUN_RCONST(0.0)) { @@ -206,12 +206,12 @@ int main(int argc, char* argv[]) if (fixed_h > SUN_RCONST(0.0)) { - flag = ARKStepSetFixedStep(arkode_mem, fixed_h); - if (check_flag(flag, "ARKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } - flag = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_flag(flag, "ARKStepSetNonlinConvCoef")) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_flag(flag, "ARKodeSetNonlinConvCoef")) { return 1; } /* --------------- * * Advance in Time * @@ -248,8 +248,8 @@ int main(int argc, char* argv[]) while (t < tf) { // Evolve in time - flag = ARKStepEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); - if (check_flag(flag, "ARKStepEvolve")) { break; } + flag = ARKodeEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); + if (check_flag(flag, "ARKodeEvolve")) { break; } // Output solution and errors sunrealtype eng; @@ -260,8 +260,8 @@ int main(int argc, char* argv[]) /* Output to the screen periodically */ long int nst; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); if (nst % 1000 == 0) { @@ -288,14 +288,14 @@ int main(int argc, char* argv[]) long int nst, nst_a, netf, nfe, nfi; // Get final statistics on how the solve progressed - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(flag, "ARKStepGetNumStepAttempts"); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(flag, "ARKodeGetNumStepAttempts"); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(flag, "ARKStepGetNumErrTestFails"); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(flag, "ARKodeGetNumErrTestFails"); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(flag, "ARKStepGetNumRhsEvals"); @@ -311,20 +311,20 @@ int main(int argc, char* argv[]) { long int nsetups, nje, nfeLS, nni, ncfn; - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(flag, "ARKStepGetNumNonlinSolvIters"); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(flag, "ARKodeGetNumNonlinSolvIters"); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(flag, "ARKStepGetNumNonlinSolvConvFails"); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(flag, "ARKodeGetNumNonlinSolvConvFails"); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(flag, "ARKStepGetNumLinSolvSetups"); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(flag, "ARKodeGetNumLinSolvSetups"); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(flag, "ARKStepGetNumJacEvals"); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(flag, "ARKodeGetNumJacEvals"); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(flag, "ARKStepGetNumLinRhsEvals"); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(flag, "ARKodeGetNumLinRhsEvals"); std::cout << " Total number of Newton iterations = " << nni << "\n"; std::cout << " Total number of linear solver convergence failures = " << ncfn @@ -339,23 +339,23 @@ int main(int argc, char* argv[]) { long int nre, nrje, nrf, nrbf, nrnlsi, nrnlsf; - flag = ARKStepGetNumRelaxFnEvals(arkode_mem, &nre); - check_flag(flag, "ARKStepGetNumRelaxFnEvals"); + flag = ARKodeGetNumRelaxFnEvals(arkode_mem, &nre); + check_flag(flag, "ARKodeGetNumRelaxFnEvals"); - flag = ARKStepGetNumRelaxJacEvals(arkode_mem, &nrje); - check_flag(flag, "ARKStepGetNumRelaxJacEvals"); + flag = ARKodeGetNumRelaxJacEvals(arkode_mem, &nrje); + check_flag(flag, "ARKodeGetNumRelaxJacEvals"); - flag = ARKStepGetNumRelaxFails(arkode_mem, &nrf); - check_flag(flag, "ARKStepGetNumRelaxFails"); + flag = ARKodeGetNumRelaxFails(arkode_mem, &nrf); + check_flag(flag, "ARKodeGetNumRelaxFails"); - flag = ARKStepGetNumRelaxBoundFails(arkode_mem, &nrbf); - check_flag(flag, "ARKStepGetNumRelaxBoundFails"); + flag = ARKodeGetNumRelaxBoundFails(arkode_mem, &nrbf); + check_flag(flag, "ARKodeGetNumRelaxBoundFails"); - flag = ARKStepGetNumRelaxSolveFails(arkode_mem, &nrnlsf); - check_flag(flag, "ARKStepGetNumRelaxSolveFails"); + flag = ARKodeGetNumRelaxSolveFails(arkode_mem, &nrnlsf); + check_flag(flag, "ARKodeGetNumRelaxSolveFails"); - flag = ARKStepGetNumRelaxSolveIters(arkode_mem, &nrnlsi); - check_flag(flag, "ARKStepGetNumRelaxSolveIters"); + flag = ARKodeGetNumRelaxSolveIters(arkode_mem, &nrnlsi); + check_flag(flag, "ARKodeGetNumRelaxSolveIters"); std::cout << " Total Relaxation Fn evals = " << nre << "\n"; std::cout << " Total Relaxation Jac evals = " << nrje << "\n"; @@ -370,8 +370,8 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - // Free ARKStep integrator and SUNDIALS objects - ARKStepFree(&arkode_mem); + // Free ARKode integrator and SUNDIALS objects + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNMatDestroy(A); N_VDestroy(y); diff --git a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp index 67d2b9db30..72cfefb4a1 100644 --- a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp +++ b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp @@ -342,22 +342,22 @@ int main(int argc, char* argv[]) /* Set routines */ /* Pass udata to user functions */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { MPI_Abort(grid.comm, 1); } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { MPI_Abort(grid.comm, 1); } /* Specify residual tolerance */ - retval = ARKStepResStolerance(arkode_mem, abstol); - if (check_retval(&retval, "ARKStepResStolerance", 1)) + retval = ARKodeResStolerance(arkode_mem, abstol); + if (check_retval(&retval, "ARKodeResStolerance", 1)) { MPI_Abort(grid.comm, 1); } @@ -481,28 +481,28 @@ int main(int argc, char* argv[]) MPI_Abort(grid.comm, 1); } - /* Attach the matrix, linear solver, and Jacobian construction routine to ARKStep */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) + /* Attach the matrix, linear solver, and Jacobian construction routine to ARKode */ + retval = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { MPI_Abort(grid.comm, 1); } /* Supply Jac routine */ - retval = ARKStepSetJacFn(arkode_mem, Jac); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { MPI_Abort(grid.comm, 1); } + retval = ARKodeSetJacFn(arkode_mem, Jac); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { MPI_Abort(grid.comm, 1); } - /* Attach the mass matrix, linear solver and construction routines to ARKStep; - notify ARKStep that the mass matrix is not time-dependent */ - retval = ARKStepSetMassLinearSolver(arkode_mem, MLS, M, SUNFALSE); - if (check_retval(&retval, "ARKStepSetMassLinearSolver", 1)) + /* Attach the mass matrix, linear solver and construction routines to ARKode; + notify ARKode that the mass matrix is not time-dependent */ + retval = ARKodeSetMassLinearSolver(arkode_mem, MLS, M, SUNFALSE); + if (check_retval(&retval, "ARKodeSetMassLinearSolver", 1)) { MPI_Abort(grid.comm, 1); } /* Supply M routine */ - retval = ARKStepSetMassFn(arkode_mem, MassMatrix); - if (check_retval(&retval, "ARKStepSetMassFn", 1)) { MPI_Abort(grid.comm, 1); } + retval = ARKodeSetMassFn(arkode_mem, MassMatrix); + if (check_retval(&retval, "ARKodeSetMassFn", 1)) { MPI_Abort(grid.comm, 1); } /* output mesh to disk */ FID = fopen("bruss_FEM_mesh.txt", "w"); @@ -527,7 +527,7 @@ int main(int argc, char* argv[]) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = Tf / Nt; @@ -536,9 +536,9 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - retval = ARKStepEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, + ARK_NORMAL); /* call integrator */ + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } u = N_VWL2Norm(y, umask); /* access/print solution statistics */ u = sqrt(u * u / N); v = N_VWL2Norm(y, vmask); @@ -572,28 +572,28 @@ int main(int argc, char* argv[]) fclose(WFID); /* Print some final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_retval(&retval, "ARKStepGetNumLinSolvSetups", 1); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); - retval = ARKStepGetNumMassSetups(arkode_mem, &nmset); - check_retval(&retval, "ARKStepGetNumMassSetups", 1); - retval = ARKStepGetNumMassSolves(arkode_mem, &nms); - check_retval(&retval, "ARKStepGetNumMassSolves", 1); - retval = ARKStepGetNumMassMult(arkode_mem, &nMv); - check_retval(&retval, "ARKStepGetNumMassMult", 1); - retval = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); + retval = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_retval(&retval, "ARKodeGetNumLinSolvSetups", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumMassSetups(arkode_mem, &nmset); + check_retval(&retval, "ARKodeGetNumMassSetups", 1); + retval = ARKodeGetNumMassSolves(arkode_mem, &nms); + check_retval(&retval, "ARKodeGetNumMassSolves", 1); + retval = ARKodeGetNumMassMult(arkode_mem, &nMv); + check_retval(&retval, "ARKodeGetNumMassMult", 1); + retval = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -613,7 +613,7 @@ int main(int argc, char* argv[]) N_VDestroy(umask); N_VDestroy(vmask); N_VDestroy(wmask); - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solvers */ SUNLinSolFree(MLS); SUNMatDestroy(A); /* Free matrices */ diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp index e1a02fed2f..d883a73ed8 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp @@ -448,7 +448,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -456,45 +456,45 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->matvec) { // Attach Jacobian-vector product function - flag = ARKStepSetJacTimes(arkode_mem, NULL, JTimes); - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, JTimes); + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -518,8 +518,8 @@ int main(int argc, char* argv[]) // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set adaptive stepping (XBraid with temporal refinement) options @@ -528,16 +528,16 @@ int main(int argc, char* argv[]) // Use I controller with default parameters C = SUNAdaptController_I(ctx); if (check_flag((void*)C, "SUNAdaptController_I", 0)) { return 1; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } // Set the step size reduction factor limit (1 / refinement factor limit) - flag = ARKStepSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); - if (check_flag(&flag, "ARKStepSetMinReduction", 1)) { return 1; } + flag = ARKodeSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); + if (check_flag(&flag, "ARKodeSetMinReduction", 1)) { return 1; } // Set the failed solve step size reduction factor (1 / refinement factor) - flag = ARKStepSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); - if (check_flag(&flag, "ARKStepSetMaxCFailGrowth", 1)) { return 1; } + flag = ARKodeSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); + if (check_flag(&flag, "ARKodeSetMaxCFailGrowth", 1)) { return 1; } } // ------------------------ @@ -701,7 +701,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -2889,28 +2889,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } // Reduce stats across time MPI_Allreduce(MPI_IN_PLACE, &nst, 1, MPI_LONG, MPI_MAX, udata->comm_w); @@ -2955,10 +2955,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } MPI_Allreduce(MPI_IN_PLACE, &npe, 1, MPI_LONG, MPI_MAX, udata->comm_w); MPI_Allreduce(MPI_IN_PLACE, &nps, 1, MPI_LONG, MPI_MAX, udata->comm_w); diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp index 0fb944fdfa..55253433fb 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp @@ -402,7 +402,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -410,38 +410,38 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -465,8 +465,8 @@ int main(int argc, char* argv[]) // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set adaptive stepping (XBraid with temporal refinement) options @@ -475,16 +475,16 @@ int main(int argc, char* argv[]) // Use I controller with default parameters C = SUNAdaptController_I(ctx); if (check_flag((void*)C, "SUNAdaptController_I", 0)) { return 1; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } // Set the step size reduction factor limit (1 / refinement factor limit) - flag = ARKStepSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); - if (check_flag(&flag, "ARKStepSetMinReduction", 1)) { return 1; } + flag = ARKodeSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); + if (check_flag(&flag, "ARKodeSetMinReduction", 1)) { return 1; } // Set the failed solve step size reduction factor (1 / refinement factor) - flag = ARKStepSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); - if (check_flag(&flag, "ARKStepSetMaxCFailGrowth", 1)) { return 1; } + flag = ARKodeSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); + if (check_flag(&flag, "ARKodeSetMaxCFailGrowth", 1)) { return 1; } } // ------------------------ @@ -648,7 +648,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -2053,28 +2053,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } // Reduce stats across time MPI_Allreduce(MPI_IN_PLACE, &nst, 1, MPI_LONG, MPI_MAX, udata->comm_w); @@ -2119,10 +2119,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } MPI_Allreduce(MPI_IN_PLACE, &npe, 1, MPI_LONG, MPI_MAX, udata->comm_w); MPI_Allreduce(MPI_IN_PLACE, &nps, 1, MPI_LONG, MPI_MAX, udata->comm_w); diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp index cfddfbbdd7..7f450e8217 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp @@ -41,7 +41,7 @@ * with a diagonally implicit Runge-Kutta method from the ARKODE ARKStep module * using an inexact Newton method paired with the PCG or SPGMR linear solver. * Several command line options are available to change the problem parameters - * and ARKStep settings. Use the flag --help for more information. + * and ARKode settings. Use the flag --help for more information. * ---------------------------------------------------------------------------*/ #include @@ -340,7 +340,7 @@ int main(int argc, char* argv[]) } // -------------- - // Setup ARKStep + // Setup ARKode // -------------- // Create integrator @@ -348,38 +348,38 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, udata->rtol, udata->atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, udata->rtol, udata->atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data - flag = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } if (udata->prec) { // Attach preconditioner - flag = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Set linear solver setup frequency (update preconditioner) - flag = ARKStepSetLSetupFrequency(arkode_mem, udata->msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, udata->msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, udata->epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, udata->epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order if (udata->order > 1) { // Use an ARKode provided table - flag = ARKStepSetOrder(arkode_mem, udata->order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, udata->order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } } else { @@ -403,8 +403,8 @@ int main(int argc, char* argv[]) // Specify linearly implicit non-time-dependent RHS if (udata->linear) { - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // Set adaptive stepping (XBraid with temporal refinement) options @@ -413,16 +413,16 @@ int main(int argc, char* argv[]) // Use I controller with default parameters C = SUNAdaptController_I(ctx); if (check_flag((void*)C, "SUNAdaptController_I", 0)) { return 1; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } // Set the step size reduction factor limit (1 / refinement factor limit) - flag = ARKStepSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); - if (check_flag(&flag, "ARKStepSetMinReduction", 1)) { return 1; } + flag = ARKodeSetMinReduction(arkode_mem, ONE / udata->x_rfactor_limit); + if (check_flag(&flag, "ARKodeSetMinReduction", 1)) { return 1; } // Set the failed solve step size reduction factor (1 / refinement factor) - flag = ARKStepSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); - if (check_flag(&flag, "ARKStepSetMaxCFailGrowth", 1)) { return 1; } + flag = ARKodeSetMaxCFailGrowth(arkode_mem, ONE / udata->x_rfactor_fail); + if (check_flag(&flag, "ARKodeSetMaxCFailGrowth", 1)) { return 1; } } // ------------------------ @@ -586,7 +586,7 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKStepFree(&arkode_mem); // Free integrator memory + ARKodeFree(&arkode_mem); // Free integrator memory SUNLinSolFree(LS); // Free linear solver N_VDestroy(u); // Free vectors FreeUserData(udata); // Free user data @@ -1352,28 +1352,28 @@ static int OutputStats(void* arkode_mem, UserData* udata) // Get integrator and solver stats long int nst, nst_a, netf, nfe, nfi, nni, ncfn, nli, nlcf, nsetups, nfi_ls, nJv; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return -1; } - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - if (check_flag(&flag, "ARKStepGetNumStepAttempts", 1)) { return -1; } - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - if (check_flag(&flag, "ARKStepGetNumErrTestFails", 1)) { return -1; } + flag = ARKodeGetNumSteps(arkode_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return -1; } + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + if (check_flag(&flag, "ARKodeGetNumStepAttempts", 1)) { return -1; } + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + if (check_flag(&flag, "ARKodeGetNumErrTestFails", 1)) { return -1; } flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return -1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return -1; } - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return -1; } - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return -1; } - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfi_ls); - if (check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1)) { return -1; } - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return -1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return -1; } + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return -1; } + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return -1; } + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfi_ls); + if (check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1)) { return -1; } + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return -1; } // Reduce stats across time MPI_Allreduce(MPI_IN_PLACE, &nst, 1, MPI_LONG, MPI_MAX, udata->comm_w); @@ -1418,10 +1418,10 @@ static int OutputStats(void* arkode_mem, UserData* udata) if (udata->prec) { long int npe, nps; - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return -1; } - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return -1; } + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return -1; } + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return -1; } MPI_Allreduce(MPI_IN_PLACE, &npe, 1, MPI_LONG, MPI_MAX, udata->comm_w); MPI_Allreduce(MPI_IN_PLACE, &nps, 1, MPI_LONG, MPI_MAX, udata->comm_w); diff --git a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c index ff80e737d2..8ea29e8369 100644 --- a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c +++ b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c @@ -201,22 +201,22 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)userdata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)userdata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize spgmr solver */ LS = SUNLinSol_SPGMR(y, SUN_PREC_NONE, 10, ctx); if (check_flag((void*)LS, "SUNLinSol_SPGMR", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); /* Attach linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, - JacVI); /* Set the Jacobian-vector product */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); /* Attach linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, + JacVI); /* Set the Jacobian-vector product */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } /* output spatial mesh to disk */ FID = fopen("bruss_mesh.txt", "w"); @@ -239,7 +239,7 @@ int main(void) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -249,8 +249,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } /* print solution statistics */ unorm = N_VDotProd(u, u); @@ -288,28 +288,28 @@ int main(void) fclose(WFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1); - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1); - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - check_flag(&flag, "ARKStepGetNumJtimesEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1); + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1); + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + check_flag(&flag, "ARKodeGetNumJtimesEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -330,7 +330,7 @@ int main(void) N_VDestroy(v); N_VDestroy(w); free(userdata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_openmp/ark_brusselator1D_omp.c b/examples/arkode/C_openmp/ark_brusselator1D_omp.c index 8a57f87c5f..d68067127b 100644 --- a/examples/arkode/C_openmp/ark_brusselator1D_omp.c +++ b/examples/arkode/C_openmp/ark_brusselator1D_omp.c @@ -236,18 +236,18 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Linear solver specification */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* output spatial mesh to disk */ FID = fopen("bruss_mesh.txt", "w"); @@ -269,7 +269,7 @@ int main(int argc, char* argv[]) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -278,8 +278,8 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } u = N_VWL2Norm(y, umask); /* access/print solution statistics */ u = sqrt(u * u / N); v = N_VWL2Norm(y, vmask); @@ -313,24 +313,24 @@ int main(int argc, char* argv[]) fclose(WFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -345,7 +345,7 @@ int main(int argc, char* argv[]) /* Clean up and return with successful completion */ free(udata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free matrix */ N_VDestroy(y); /* Free vectors */ diff --git a/examples/arkode/C_openmp/ark_heat1D_omp.c b/examples/arkode/C_openmp/ark_heat1D_omp.c index e59b1f03d0..feb208ac43 100644 --- a/examples/arkode/C_openmp/ark_heat1D_omp.c +++ b/examples/arkode/C_openmp/ark_heat1D_omp.c @@ -97,7 +97,7 @@ int main(int argc, char* argv[]) int flag; /* reusable error-checking flag */ N_Vector y = NULL; /* empty vector for storing solution */ SUNLinearSolver LS = NULL; /* empty linear solver object */ - void* arkode_mem = NULL; /* empty ARKStep memory structure */ + void* arkode_mem = NULL; /* empty ARKode memory structure */ FILE *FID, *UFID; sunrealtype t, dTout, tout; int iout, num_threads; @@ -139,31 +139,31 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, - 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, + 1); /* Specify maximum-order predictor */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize PCG solver -- no preconditioning, with up to N iterations */ LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKStep */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + NULL); /* Attach linear solver to ARKode */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } /* Specify linearly implicit RHS, with non-time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* output mesh to disk */ FID = fopen("heat_mesh.txt", "w"); @@ -178,7 +178,7 @@ int main(int argc, char* argv[]) for (i = 0; i < N; i++) { fprintf(UFID, " %.16" ESYM "", data[i]); } fprintf(UFID, "\n"); - /* Main time-stepping loop: calls ARKStep to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -188,8 +188,8 @@ int main(int argc, char* argv[]) printf(" %10.6" FSYM " %10.6f\n", t, sqrt(N_VDotProd(y, y) / N)); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6f\n", t, sqrt(N_VDotProd(y, y) / N)); /* print solution stats */ if (flag >= 0) @@ -211,26 +211,26 @@ int main(int argc, char* argv[]) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1); - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - check_flag(&flag, "ARKStepGetNumJtimesEvals", 1); - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1); + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + check_flag(&flag, "ARKodeGetNumJtimesEvals", 1); + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -247,7 +247,7 @@ int main(int argc, char* argv[]) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free vectors */ free(udata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c index 83d89bfc0f..123d984175 100644 --- a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c @@ -96,8 +96,8 @@ int main(void) if (check_flag((void*)arkode_mem, "ERKStepCreate", 0)) { return 1; } /* Specify tolerances */ - flag = ERKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ERKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -107,7 +107,7 @@ int main(void) N_VCopyFromDevice_OpenMPDEV(y); fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, y_data[0]); - /* Main time-stepping loop: calls ERKStep to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -115,8 +115,8 @@ int main(void) printf(" ---------------------\n"); while (Tf - t > 1.0e-15) { - flag = ERKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ERKStep", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKode", 1)) { break; } N_VCopyFromDevice_OpenMPDEV(y); printf(" %10.6" FSYM " %10.6" FSYM "\n", t, y_data[0]); /* access/print solution */ @@ -136,14 +136,14 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ERKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ERKStepGetNumSteps", 1); - flag = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ERKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_flag(&flag, "ERKStepGetNumRhsEvals", 1); - flag = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ERKStepGetNumErrTestFails", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -152,7 +152,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ - ERKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c index ec98fbcd5a..02669d9e5e 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c @@ -184,41 +184,41 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetAdaptivityMethod(arkode_mem, 2, 1, 0, - NULL); /* Set adaptivity method */ - if (check_flag(&flag, "ARKStepSetAdaptivityMethod", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, 0); /* Set predictor method */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetAdaptivityMethod(arkode_mem, 2, 1, 0, + NULL); /* Set adaptivity method */ + if (check_flag(&flag, "ARKodeSetAdaptivityMethod", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, 0); /* Set predictor method */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } /* Specify I-controller with default parameters */ C = SUNAdaptController_I(ctx); if (check_flag((void*)C, "SUNAdaptController_I", 0)) { return 1; } - flag = ARKStepSetAdaptController(arkode_mem, C); - if (check_flag(&flag, "ARKStepSetAdaptController", 1)) { return 1; } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } /* Specify linearly implicit RHS, with time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 1); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 1); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* Initialize PCG solver -- no preconditioning, with up to N iterations */ LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKStep */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + NULL); /* Attach linear solver to ARKode */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; olddt = ZERO; @@ -234,24 +234,24 @@ int main(void) while (t < Tf) { /* "set" routines */ - flag = ARKStepSetStopTime(arkode_mem, Tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } - flag = ARKStepSetInitStep(arkode_mem, newdt); - if (check_flag(&flag, "ARKStepSetInitStep", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, Tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } + flag = ARKodeSetInitStep(arkode_mem, newdt); + if (check_flag(&flag, "ARKodeSetInitStep", 1)) { return 1; } /* call integrator */ - flag = ARKStepEvolve(arkode_mem, Tf, y, &t, ARK_ONE_STEP); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(arkode_mem, Tf, y, &t, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } /* "get" routines */ - flag = ARKStepGetLastStep(arkode_mem, &olddt); - if (check_flag(&flag, "ARKStepGetLastStep", 1)) { return 1; } - flag = ARKStepGetCurrentStep(arkode_mem, &newdt); - if (check_flag(&flag, "ARKStepGetCurrentStep", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return 1; } + flag = ARKodeGetLastStep(arkode_mem, &olddt); + if (check_flag(&flag, "ARKodeGetLastStep", 1)) { return 1; } + flag = ARKodeGetCurrentStep(arkode_mem, &newdt); + if (check_flag(&flag, "ARKodeGetCurrentStep", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return 1; } /* print current solution stats */ iout++; @@ -307,18 +307,18 @@ int main(void) y = y2; y2 = yt; - /* call ARKStepResize to notify integrator of change in mesh */ - flag = ARKStepResize(arkode_mem, y, hscale, t, NULL, NULL); - if (check_flag(&flag, "ARKStepResize", 1)) { return 1; } + /* call ARKodeResize to notify integrator of change in mesh */ + flag = ARKodeResize(arkode_mem, y, hscale, t, NULL, NULL); + if (check_flag(&flag, "ARKodeResize", 1)) { return 1; } - /* destroy and re-allocate linear solver memory; reattach to ARKStep interface */ + /* destroy and re-allocate linear solver memory; reattach to ARKode interface */ SUNLinSolFree(LS); LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } } printf(" --------------------------------------------------------------------" "--------------------\n"); @@ -336,7 +336,7 @@ int main(void) free(udata->x_host); /* Free user data */ omp_target_free(udata->x_dev, dev); free(udata); - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ (void)SUNAdaptController_Destroy(C); /* Free time adaptivity controller */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c index f85ec24efb..5d5c8d9ce9 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c @@ -97,7 +97,7 @@ int main(void) int flag; /* reusable error-checking flag */ N_Vector y = NULL; /* empty vector for storing solution */ SUNLinearSolver LS = NULL; /* empty linear solver object */ - void* arkode_mem = NULL; /* empty ARKStep memory structure */ + void* arkode_mem = NULL; /* empty ARKode memory structure */ FILE *FID, *UFID; sunrealtype t, dTout, tout; int iout; @@ -132,31 +132,31 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize PCG solver -- no preconditioning, with up to N iterations */ LS = SUNLinSol_PCG(y, 0, N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKStep */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + NULL); /* Attach linear solver to ARKStep */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } /* Specify linearly implicit RHS, with non-time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* output mesh to disk */ FID = fopen("heat_mesh.txt", "w"); @@ -172,7 +172,7 @@ int main(void) for (i = 0; i < N; i++) { fprintf(UFID, " %.16" ESYM "", data[i]); } fprintf(UFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -182,8 +182,8 @@ int main(void) printf(" %10.6" FSYM " %10.6" FSYM "\n", t, SUNRsqrt(N_VDotProd(y, y) / N)); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStep", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM "\n", t, SUNRsqrt(N_VDotProd(y, y) / N)); /* print solution stats */ if (flag >= 0) @@ -207,26 +207,26 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1); - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - check_flag(&flag, "ARKStepGetNumJtimesEvals", 1); - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1); + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + check_flag(&flag, "ARKodeGetNumJtimesEvals", 1); + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -243,7 +243,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free vectors */ free(udata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c index ab26d152eb..73825d1221 100644 --- a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c +++ b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c @@ -371,20 +371,20 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c if (check_retval((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Create the (non)linear solver */ if (uopt->global) @@ -394,20 +394,20 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c if (check_retval((void*)NLS, "SUNNonlinSol_Newton", 0)) { return 1; } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return 1; } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return 1; } /* Create linear solver */ LS = SUNLinSol_SPGMR(y, SUN_PREC_LEFT, 0, ctx); if (check_retval((void*)LS, "SUNLinSol_SPGMR", 0)) { return 1; } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1)) { return 1; } + retval = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1)) { return 1; } } else { @@ -417,8 +417,8 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c if (check_retval((void*)NLS, "TaskLocalNewton", 0)) { return 1; } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1)) { return 1; } + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1)) { return 1; } } /* Output initial condition */ @@ -438,8 +438,8 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* Output state */ WriteOutput(t, y, udata, uopt); @@ -453,26 +453,26 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); if (uopt->global) { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1); - retval = ARKStepGetNumPrecEvals(arkode_mem, &npre); - check_retval(&retval, "ARKStepGetNumPrecEvals", 1); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1); + retval = ARKodeGetNumPrecEvals(arkode_mem, &npre); + check_retval(&retval, "ARKodeGetNumPrecEvals", 1); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1); } /* Print final statistics */ @@ -494,7 +494,7 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, SUNContext c } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNNonlinSolFree(NLS); if (LS) { SUNLinSolFree(LS); } @@ -518,20 +518,20 @@ int EvolveProblemExplicit(N_Vector y, UserData udata, UserOptions uopt, if (check_retval((void*)arkode_mem, "ERKStepCreate", 0)) { return 1; } /* Select the method order */ - retval = ERKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ERKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } /* Attach user data */ - retval = ERKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ERKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Specify tolerances */ - retval = ERKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ERKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ERKStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "ERKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Output initial condition */ if (udata->myid == 0 && uopt->monitor) @@ -550,8 +550,8 @@ int EvolveProblemExplicit(N_Vector y, UserData udata, UserOptions uopt, do { /* Integrate to output time */ - retval = ERKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* Output state */ WriteOutput(t, y, udata, uopt); @@ -565,14 +565,14 @@ int EvolveProblemExplicit(N_Vector y, UserData udata, UserOptions uopt, while (iout < uopt->nout); /* Get final statistics */ - retval = ERKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ERKStepGetNumSteps", 1); - retval = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ERKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_retval(&retval, "ERKStepGetNumRhsEvals", 1); - retval = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ERKStepGetNumErrTestFails", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); /* Print final statistics */ if (udata->myid == 0) @@ -584,7 +584,7 @@ int EvolveProblemExplicit(N_Vector y, UserData udata, UserOptions uopt, } /* Clean up */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* Return success */ return 0; @@ -892,9 +892,9 @@ int TaskLocalNlsResidual(N_Vector ycor, N_Vector F, void* arkode_mem) double tcur, gamma; void* user_data; - retval = ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, - &gamma, &sdata, &user_data); - if (check_retval((void*)&retval, "ARKStepGetNonlinearSystemData", 1)) + retval = ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, + &gamma, &sdata, &user_data); + if (check_retval((void*)&retval, "ARKodeGetNonlinearSystemData", 1)) { return (-1); } @@ -948,9 +948,9 @@ int TaskLocalLSolve(N_Vector delta, void* arkode_mem) double tcur, gamma; void* user_data = NULL; - retval = ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, - &gamma, &sdata, &user_data); - if (check_retval((void*)&retval, "ARKStepGetNonlinearSystemData", 1)) + retval = ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, + &gamma, &sdata, &user_data); + if (check_retval((void*)&retval, "ARKodeGetNonlinearSystemData", 1)) { return (-1); } diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c index 46eeb4b865..2769ced1b8 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c @@ -229,21 +229,21 @@ int main(int argc, char* argv[]) } /* Set the pointer to user-defined data */ - flag = ARKStepSetUserData(arkode_mem, data); - if (check_flag(&flag, "ARKStepSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } + flag = ARKodeSetUserData(arkode_mem, data); + if (check_flag(&flag, "ARKodeSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } - /* Call ARKStepSetMaxNumSteps to increase default */ - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1, my_pe)) { return (1); } + /* Call ARKodeSetMaxNumSteps to increase default */ + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1, my_pe)) { return (1); } - /* Call ARKStepSStolerances to specify the scalar relative tolerance + /* Call ARKodeSStolerances to specify the scalar relative tolerance and scalar absolute tolerances */ - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1, my_pe)) { return (1); } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKStep interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1, my_pe)) + /* Attach SPGMR solver structure to ARKode interface */ + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { MPI_Abort(comm, 1); } @@ -256,8 +256,8 @@ int main(int argc, char* argv[]) if (check_flag(&flag, "ARKBBDPrecInit", 1, my_pe)) { MPI_Abort(comm, 1); } /* Tighten nonlinear solver tolerance */ - flag = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1, my_pe)) + flag = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1, my_pe)) { MPI_Abort(comm, 1); } @@ -302,11 +302,11 @@ int main(int argc, char* argv[]) (jpre == SUN_PREC_LEFT) ? "SUN_PREC_LEFT" : "SUN_PREC_RIGHT"); } - /* In loop over output points, call ARKStepEvolve, print results, test for error */ + /* In loop over output points, call ARKodeEvolve, print results, test for error */ for (iout = 1, tout = TWOHR; iout <= NOUT; iout++, tout += TWOHR) { - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1, my_pe)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1, my_pe)) { break; } PrintOutput(arkode_mem, my_pe, comm, u, t); } @@ -318,7 +318,7 @@ int main(int argc, char* argv[]) /* Free memory */ N_VDestroy(u); free(data); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNContext_Free(&ctx); MPI_Finalize(); @@ -447,10 +447,10 @@ static void PrintOutput(void* arkode_mem, int my_pe, MPI_Comm comm, N_Vector u, { MPI_Recv(&tempu[0], 2, MPI_SUNREALTYPE, npelast, 0, comm, &status); } - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, my_pe); - flag = ARKStepGetLastStep(arkode_mem, &hu); - check_flag(&flag, "ARKStepGetLastStep", 1, my_pe); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, my_pe); + flag = ARKodeGetLastStep(arkode_mem, &hu); + check_flag(&flag, "ARKodeGetLastStep", 1, my_pe); #if defined(SUNDIALS_EXTENDED_PRECISION) printf("t = %.2Le no. steps = %ld stepsize = %.2Le\n", t, nst, hu); printf("At bottom left: c1, c2 = %12.3Le %12.3Le \n", uarray[0], uarray[1]); @@ -477,33 +477,33 @@ static void PrintFinalStats(void* arkode_mem) long int nli, npe, nps, ncfl, nfeLS, ngevalsBBDP; int flag; - flag = ARKStepGetWorkSpace(arkode_mem, &lenrw, &leniw); - check_flag(&flag, "ARKStepGetWorkSpace", 1, 0); - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, 0); + flag = ARKodeGetWorkSpace(arkode_mem, &lenrw, &leniw); + check_flag(&flag, "ARKodeGetWorkSpace", 1, 0); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, 0); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1, 0); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1, 0); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1, 0); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1, 0); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1, 0); - - flag = ARKStepGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); - check_flag(&flag, "ARKStepGetLinWorkSpace", 1, 0); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1, 0); - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - check_flag(&flag, "ARKStepGetNumPrecEvals", 1, 0); - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - check_flag(&flag, "ARKStepGetNumPrecSolves", 1, 0); - flag = ARKStepGetNumLinConvFails(arkode_mem, &ncfl); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1, 0); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1, 0); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1, 0); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1, 0); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1, 0); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1, 0); + + flag = ARKodeGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); + check_flag(&flag, "ARKodeGetLinWorkSpace", 1, 0); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1, 0); + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + check_flag(&flag, "ARKodeGetNumPrecEvals", 1, 0); + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + check_flag(&flag, "ARKodeGetNumPrecSolves", 1, 0); + flag = ARKodeGetNumLinConvFails(arkode_mem, &ncfl); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1, 0); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1, 0); printf("\nFinal Statistics: \n\n"); printf("lenrw = %5ld leniw = %5ld\n", lenrw, leniw); diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_p.c index 3fc249d26b..ade42769dc 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.c @@ -243,36 +243,36 @@ int main(int argc, char* argv[]) } /* Set the pointer to user-defined data */ - flag = ARKStepSetUserData(arkode_mem, data); - if (check_flag(&flag, "ARKStepSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } + flag = ARKodeSetUserData(arkode_mem, data); + if (check_flag(&flag, "ARKodeSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } - /* Call ARKStepSetMaxNumSteps to increase default */ - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1, my_pe)) { return (1); } + /* Call ARKodeSetMaxNumSteps to increase default */ + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1, my_pe)) { return (1); } - /* Call ARKStepSStolerances to specify the scalar relative tolerance + /* Call ARKodeSStolerances to specify the scalar relative tolerance and scalar absolute tolerances */ - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1, my_pe)) { return (1); } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKStep interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1, my_pe)) + /* Attach SPGMR solver structure to ARKode interface */ + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { MPI_Abort(comm, 1); } /* Set preconditioner setup and solve routines Precond and PSolve, and the pointer to the user-defined block data */ - flag = ARKStepSetPreconditioner(arkode_mem, Precond, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1, my_pe)) + flag = ARKodeSetPreconditioner(arkode_mem, Precond, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1, my_pe)) { MPI_Abort(comm, 1); } /* Tighten nonlinear solver tolerance */ - flag = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1, my_pe)) + flag = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1, my_pe)) { MPI_Abort(comm, 1); } @@ -283,11 +283,11 @@ int main(int argc, char* argv[]) printf("\n2-species diurnal advection-diffusion problem\n\n"); } - /* In loop over output points, call ARKStepEvolve, print results, test for error */ + /* In loop over output points, call ARKodeEvolve, print results, test for error */ for (iout = 1, tout = TWOHR; iout <= NOUT; iout++, tout += TWOHR) { - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1, my_pe)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1, my_pe)) { break; } PrintOutput(arkode_mem, my_pe, comm, u, t); } @@ -296,7 +296,7 @@ int main(int argc, char* argv[]) /* Free memory */ FreeUserData(data); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); N_VDestroy(u); SUNContext_Free(&ctx); @@ -440,10 +440,10 @@ static void PrintOutput(void* arkode_mem, int my_pe, MPI_Comm comm, N_Vector u, { MPI_Recv(&tempu[0], 2, MPI_SUNREALTYPE, npelast, 0, comm, &status); } - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, my_pe); - flag = ARKStepGetLastStep(arkode_mem, &hu); - check_flag(&flag, "ARKStepGetLastStep", 1, my_pe); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, my_pe); + flag = ARKodeGetLastStep(arkode_mem, &hu); + check_flag(&flag, "ARKodeGetLastStep", 1, my_pe); #if defined(SUNDIALS_EXTENDED_PRECISION) printf("t = %.2Le no. steps = %ld stepsize = %.2Le\n", t, nst, hu); @@ -470,33 +470,33 @@ static void PrintFinalStats(void* arkode_mem) long int nli, npe, nps, ncfl, nfeLS; int flag; - flag = ARKStepGetWorkSpace(arkode_mem, &lenrw, &leniw); - check_flag(&flag, "ARKStepGetWorkSpace", 1, 0); - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, 0); + flag = ARKodeGetWorkSpace(arkode_mem, &lenrw, &leniw); + check_flag(&flag, "ARKodeGetWorkSpace", 1, 0); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, 0); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1, 0); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1, 0); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1, 0); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1, 0); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1, 0); - - flag = ARKStepGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); - check_flag(&flag, "ARKStepGetLinWorkSpace", 1, 0); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1, 0); - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - check_flag(&flag, "ARKStepGetNumPrecEvals", 1, 0); - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - check_flag(&flag, "ARKStepGetNumPrecSolves", 1, 0); - flag = ARKStepGetNumLinConvFails(arkode_mem, &ncfl); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1, 0); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1, 0); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1, 0); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1, 0); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1, 0); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1, 0); + + flag = ARKodeGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); + check_flag(&flag, "ARKodeGetLinWorkSpace", 1, 0); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1, 0); + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + check_flag(&flag, "ARKodeGetNumPrecEvals", 1, 0); + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + check_flag(&flag, "ARKodeGetNumPrecSolves", 1, 0); + flag = ARKodeGetNumLinConvFails(arkode_mem, &ncfl); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1, 0); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1, 0); printf("\nFinal Statistics: \n\n"); printf("lenrw = %5ld leniw = %5ld\n", lenrw, leniw); diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index 0f1585c26b..5c90a93281 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -251,29 +251,29 @@ int main(int argc, char* argv[]) } /* Set the pointer to user-defined data */ - flag = ARKStepSetUserData(arkode_mem, data); - if (check_flag(&flag, "ARKStepSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } + flag = ARKodeSetUserData(arkode_mem, data); + if (check_flag(&flag, "ARKodeSetUserData", 1, my_pe)) { MPI_Abort(comm, 1); } - /* Call ARKStepSetMaxNumSteps to increase default */ - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1, my_pe)) { return (1); } + /* Call ARKodeSetMaxNumSteps to increase default */ + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1, my_pe)) { return (1); } - /* Call ARKStepSStolerances to specify the scalar relative tolerance + /* Call ARKodeSStolerances to specify the scalar relative tolerance and scalar absolute tolerances */ - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1, my_pe)) { return (1); } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKStep interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1, my_pe)) + /* Attach SPGMR solver structure to ARKode interface */ + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { MPI_Abort(comm, 1); } /* Set preconditioner setup and solve routines Precond and PSolve, and the pointer to the user-defined block data */ - flag = ARKStepSetPreconditioner(arkode_mem, Precond, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1, my_pe)) + flag = ARKodeSetPreconditioner(arkode_mem, Precond, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1, my_pe)) { MPI_Abort(comm, 1); } @@ -284,11 +284,11 @@ int main(int argc, char* argv[]) printf("\n2-species diurnal advection-diffusion problem\n\n"); } - /* In loop over output points, call ARKStepEvolve, print results, test for error */ + /* In loop over output points, call ARKodeEvolve, print results, test for error */ for (iout = 1, tout = TWOHR; iout <= NOUT; iout++, tout += TWOHR) { - flag = ARKStepEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1, my_pe)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, u, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1, my_pe)) { break; } PrintOutput(arkode_mem, my_pe, comm, u, t); } @@ -299,7 +299,7 @@ int main(int argc, char* argv[]) N_VDestroy(u); /* Free hypre vector wrapper */ HYPRE_IJVectorDestroy(Uij); /* Free the underlying hypre vector */ FreeUserData(data); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNContext_Free(&sunctx); /* Free context */ MPI_Finalize(); @@ -452,10 +452,10 @@ static void PrintOutput(void* arkode_mem, int my_pe, MPI_Comm comm, N_Vector u, { MPI_Recv(&tempu[0], 2, MPI_SUNREALTYPE, npelast, 0, comm, &status); } - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, my_pe); - flag = ARKStepGetLastStep(arkode_mem, &hu); - check_flag(&flag, "ARKStepGetLastStep", 1, my_pe); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, my_pe); + flag = ARKodeGetLastStep(arkode_mem, &hu); + check_flag(&flag, "ARKodeGetLastStep", 1, my_pe); #if defined(SUNDIALS_EXTENDED_PRECISION) printf("t = %.2Le no. steps = %ld stepsize = %.2Le\n", t, nst, hu); @@ -482,33 +482,33 @@ static void PrintFinalStats(void* arkode_mem) long int nli, npe, nps, ncfl, nfeLS; int flag; - flag = ARKStepGetWorkSpace(arkode_mem, &lenrw, &leniw); - check_flag(&flag, "ARKStepGetWorkSpace", 1, 0); - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1, 0); + flag = ARKodeGetWorkSpace(arkode_mem, &lenrw, &leniw); + check_flag(&flag, "ARKodeGetWorkSpace", 1, 0); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1, 0); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1, 0); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1, 0); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1, 0); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1, 0); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1, 0); - - flag = ARKStepGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); - check_flag(&flag, "ARKStepGetLinWorkSpace", 1, 0); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1, 0); - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - check_flag(&flag, "ARKStepGetNumPrecEvals", 1, 0); - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - check_flag(&flag, "ARKStepGetNumPrecSolves", 1, 0); - flag = ARKStepGetNumLinConvFails(arkode_mem, &ncfl); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1, 0); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1, 0); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1, 0); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1, 0); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1, 0); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1, 0); + + flag = ARKodeGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); + check_flag(&flag, "ARKodeGetLinWorkSpace", 1, 0); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1, 0); + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + check_flag(&flag, "ARKodeGetNumPrecEvals", 1, 0); + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + check_flag(&flag, "ARKodeGetNumPrecSolves", 1, 0); + flag = ARKodeGetNumLinConvFails(arkode_mem, &ncfl); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1, 0); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1, 0); printf("\nFinal Statistics: \n\n"); printf("lenrw = %5ld leniw = %5ld\n", lenrw, leniw); diff --git a/examples/arkode/C_petsc/ark_petsc_ex25.c b/examples/arkode/C_petsc/ark_petsc_ex25.c index 47373cb11f..180be37843 100644 --- a/examples/arkode/C_petsc/ark_petsc_ex25.c +++ b/examples/arkode/C_petsc/ark_petsc_ex25.c @@ -60,7 +60,7 @@ static PetscErrorCode FormIFunction(PetscReal, Vec, Vec, Vec, void*); static PetscErrorCode FormIJacobian(SNES, Vec, Mat, Mat, void*); static PetscErrorCode FormInitialSolution(Vec, void*); -/* User-supplied Functions called by ARKStep */ +/* User-supplied Functions called by ARKode */ static int f_I(PetscReal, N_Vector, N_Vector, void*); static int f_E(PetscReal, N_Vector, N_Vector, void*); @@ -188,7 +188,7 @@ int main(int argc, char** argv) dt = 0.4 * PetscSqr(hx) / user.alpha; /* Diffusive stability limit */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create ARKStep time stepper + Create ARKode time stepper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Call ARKStepCreate to initialize the ARK timestepper module and @@ -225,28 +225,28 @@ int main(int argc, char** argv) CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set ARKStep options + Set ARKode options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - ierr = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_retval(&ierr, "ARKStepSStolerances", 1)) { return 1; } + ierr = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_retval(&ierr, "ARKodeSStolerances", 1)) { return 1; } - ierr = ARKStepSetOrder(arkode_mem, 3); - if (check_retval(&ierr, "ARKStepSetOrder", 1)) { return 1; } + ierr = ARKodeSetOrder(arkode_mem, 3); + if (check_retval(&ierr, "ARKodeSetOrder", 1)) { return 1; } - ierr = ARKStepSetUserData(arkode_mem, (void*)&user); - if (check_retval(&ierr, "ARKStepSetUserData", 1)) { return 1; } + ierr = ARKodeSetUserData(arkode_mem, (void*)&user); + if (check_retval(&ierr, "ARKodeSetUserData", 1)) { return 1; } - ierr = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&ierr, "ARKStepSetNonlinearSolver", 1)) { return 1; } + ierr = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&ierr, "ARKodeSetNonlinearSolver", 1)) { return 1; } C = SUNAdaptController_I(ctx); if (check_retval((void*)C, "SUNAdaptController_I", 0)) { return 1; } - ierr = ARKStepSetAdaptController(arkode_mem, C); - if (check_retval(&ierr, "ARKStepSetAdaptController", 1)) { return 1; } + ierr = ARKodeSetAdaptController(arkode_mem, C); + if (check_retval(&ierr, "ARKodeSetAdaptController", 1)) { return 1; } - ierr = ARKStepSetInitStep(arkode_mem, dt); - if (check_retval(&ierr, "ARKStepSetInitStep", 1)) { return 1; } + ierr = ARKodeSetInitStep(arkode_mem, dt); + if (check_retval(&ierr, "ARKodeSetInitStep", 1)) { return 1; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Perform the integration @@ -265,18 +265,18 @@ int main(int argc, char** argv) /* Advance time */ tstop += dtout; - ierr = ARKStepSetStopTime(arkode_mem, tstop); - if (check_retval(&ierr, "ARKStepSetStopTime", 1)) { return 1; } + ierr = ARKodeSetStopTime(arkode_mem, tstop); + if (check_retval(&ierr, "ARKodeSetStopTime", 1)) { return 1; } /* Evolve solution in time */ - ierr = ARKStepEvolve(arkode_mem, ftime, nvecx, &t, ARK_NORMAL); - if (check_retval(&ierr, "ARKStepEvolve", 1)) { return 1; } + ierr = ARKodeEvolve(arkode_mem, ftime, nvecx, &t, ARK_NORMAL); + if (check_retval(&ierr, "ARKodeEvolve", 1)) { return 1; } /* Get statistics */ - ierr = ARKStepGetCurrentStep(arkode_mem, &dt); - if (check_retval(&ierr, "ARKStepGetCurrntStep", 1)) { return 1; } - ierr = ARKStepGetNumSteps(arkode_mem, &steps); - if (check_retval(&ierr, "ARKStepGetNumSteps", 1)) { return 1; } + ierr = ARKodeGetCurrentStep(arkode_mem, &dt); + if (check_retval(&ierr, "ARKodeGetCurrntStep", 1)) { return 1; } + ierr = ARKodeGetNumSteps(arkode_mem, &steps); + if (check_retval(&ierr, "ARKodeGetNumSteps", 1)) { return 1; } } printf("Converged at time %g after %ld steps.\n", t, steps); @@ -288,7 +288,7 @@ int main(int argc, char** argv) /* Free SUNDIALS data structures */ N_VDestroy(nvecx); /* Free x nvector */ SUNNonlinSolFree(NLS); /* Free nonlinear solver */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ (void)SUNAdaptController_Destroy(C); /* Free time adaptivity controller */ /* Free petsc data structures */ @@ -305,7 +305,7 @@ int main(int argc, char** argv) } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - User provided functions in ARKStep format + User provided functions in ARKode format - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Implicit component of RHS */ @@ -459,7 +459,7 @@ PetscErrorCode FormIJacobian(SNES snes, Vec X, Mat J, Mat Jpre, void* ptr) hx = 1.0 / (PetscReal)(info.mx - 1); /* Get current gamma value from ARKode */ - ierr = ARKStepGetCurrentGamma(user->arkode_mem, &gamma); + ierr = ARKodeGetCurrentGamma(user->arkode_mem, &gamma); /* Get pointers to vector data */ ierr = DMDAVecGetArrayRead(user->da, X, &x); diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec.c b/examples/arkode/C_serial/ark_KrylovDemo_prec.c index 7bbbd42a6d..26774ead15 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec.c +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec.c @@ -68,7 +68,7 @@ * preconditoner is applied on the left and on the right. In each * case, both the modified and classical Gram-Schmidt options are * tested. In the series of runs, ARKStepCreate, SUNLinSol_SPGMR and - * ARKStepSetLinearSolver are called only for the first run, whereas + * ARKodeSetLinearSolver are called only for the first run, whereas * ARKStepReInit, SUNLinSol_SPGMRSetPrecType, and * SUNLinSol_SPGMRSetGSType are called for each of the remaining * three runs. @@ -294,32 +294,32 @@ int main(int argc, char* argv[]) wdata->arkode_mem = arkode_mem; - flag = ARKStepSetUserData(arkode_mem, wdata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return (1); } + flag = ARKodeSetUserData(arkode_mem, wdata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return (1); } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return (1); } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return (1); } - flag = ARKStepSetMaxNumSteps(arkode_mem, 1000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return (1); } + flag = ARKodeSetMaxNumSteps(arkode_mem, 1000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return (1); } - flag = ARKStepSetNonlinConvCoef(arkode_mem, 1.e-3); - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1)) { return (1); } + flag = ARKodeSetNonlinConvCoef(arkode_mem, 1.e-3); + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return (1); } LS = SUNLinSol_SPGMR(c, jpre, MAXL, ctx); if (check_flag((void*)LS, "SUNLinSol_SPGMR", 0)) { return (1); } - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } flag = SUNLinSol_SPGMRSetGSType(LS, gstype); if (check_flag(&flag, "SUNLinSol_SPGMRSetGSType", 1)) { return (1); } - flag = ARKStepSetEpsLin(arkode_mem, DELT); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return (1); } + flag = ARKodeSetEpsLin(arkode_mem, DELT); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return (1); } - flag = ARKStepSetPreconditioner(arkode_mem, Precond, PSolve); - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return (1); } + flag = ARKodeSetPreconditioner(arkode_mem, Precond, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return (1); } /* Set the linear solver tolerance conversion factor */ switch (nrmfactor) @@ -338,8 +338,8 @@ int main(int argc, char* argv[]) break; } - flag = ARKStepSetLSNormFactor(arkode_mem, nrmfac); - if (check_flag(&flag, "ARKStepSetLSNormFactor", 1)) { return (1); } + flag = ARKodeSetLSNormFactor(arkode_mem, nrmfac); + if (check_flag(&flag, "ARKodeSetLSNormFactor", 1)) { return (1); } } else { @@ -356,14 +356,14 @@ int main(int argc, char* argv[]) /* Print initial values */ if (firstrun) { PrintAllSpecies(c, ns, mxns, T0); } - /* Loop over output points, call ARKStepEvolve, print sample solution values. */ + /* Loop over output points, call ARKodeEvolve, print sample solution values. */ tout = T1; for (iout = 1; iout <= NOUT; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, c, &t, ARK_NORMAL); + flag = ARKodeEvolve(arkode_mem, tout, c, &t, ARK_NORMAL); PrintOutput(arkode_mem, t); if (firstrun && (iout % 3 == 0)) { PrintAllSpecies(c, ns, mxns, t); } - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } if (tout > SUN_RCONST(0.9)) { tout += DTOUT; } else { tout *= TOUT_MULT; } } @@ -374,7 +374,7 @@ int main(int argc, char* argv[]) } /* Free all memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); N_VDestroy(c); SUNLinSolFree(LS); FreeUserData(wdata); @@ -624,14 +624,14 @@ static void PrintOutput(void* arkode_mem, sunrealtype t) int flag; sunrealtype hu; - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetLastStep(arkode_mem, &hu); - check_flag(&flag, "ARKStepGetLastStep", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetLastStep(arkode_mem, &hu); + check_flag(&flag, "ARKodeGetLastStep", 1); #if defined(SUNDIALS_EXTENDED_PRECISION) printf("t = %10.2Le nst = %ld nfe = %ld nfi = %ld nni = %ld", t, nst, nfe, @@ -657,33 +657,33 @@ static void PrintFinalStats(void* arkode_mem) int flag; sunrealtype avdim; - flag = ARKStepGetWorkSpace(arkode_mem, &lenrw, &leniw); - check_flag(&flag, "ARKStepGetWorkSpace", 1); - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); + flag = ARKodeGetWorkSpace(arkode_mem, &lenrw, &leniw); + check_flag(&flag, "ARKodeGetWorkSpace", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - - flag = ARKStepGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); - check_flag(&flag, "ARKStepGetLinWorkSpace", 1); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1); - flag = ARKStepGetNumPrecEvals(arkode_mem, &npe); - check_flag(&flag, "ARKStepGetNumPrecEvals", 1); - flag = ARKStepGetNumPrecSolves(arkode_mem, &nps); - check_flag(&flag, "ARKStepGetNumPrecSolves", 1); - flag = ARKStepGetNumLinConvFails(arkode_mem, &ncfl); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + + flag = ARKodeGetLinWorkSpace(arkode_mem, &lenrwLS, &leniwLS); + check_flag(&flag, "ARKodeGetLinWorkSpace", 1); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1); + flag = ARKodeGetNumPrecEvals(arkode_mem, &npe); + check_flag(&flag, "ARKodeGetNumPrecEvals", 1); + flag = ARKodeGetNumPrecSolves(arkode_mem, &nps); + check_flag(&flag, "ARKodeGetNumPrecSolves", 1); + flag = ARKodeGetNumLinConvFails(arkode_mem, &ncfl); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\n\n Final statistics for this run:\n\n"); printf(" ARKStep real workspace length = %4ld \n", lenrw); @@ -846,8 +846,8 @@ static int Precond(sunrealtype t, N_Vector c, N_Vector fc, sunbooleantype jok, arkode_mem = wdata->arkode_mem; cdata = N_VGetArrayPointer(c); rewt = wdata->rewt; - flag = ARKStepGetErrWeights(arkode_mem, rewt); - if (check_flag(&flag, "ARKStepGetErrWeights", 1)) { return (1); } + flag = ARKodeGetErrWeights(arkode_mem, rewt); + if (check_flag(&flag, "ARKodeGetErrWeights", 1)) { return (1); } rewtdata = N_VGetArrayPointer(rewt); uround = SUN_UNIT_ROUNDOFF; diff --git a/examples/arkode/C_serial/ark_analytic.c b/examples/arkode/C_serial/ark_analytic.c index eb1a7cd934..4544f6f0ad 100644 --- a/examples/arkode/C_serial/ark_analytic.c +++ b/examples/arkode/C_serial/ark_analytic.c @@ -107,11 +107,11 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)&lamda); /* Pass lamda to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)&lamda); /* Pass lamda to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize dense matrix data structure and solver */ A = SUNDenseMatrix(NEQ, NEQ, ctx); @@ -120,15 +120,15 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* Specify linearly implicit RHS, with non-time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -137,7 +137,7 @@ int main(void) /* output initial condition to disk */ fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -145,8 +145,8 @@ int main(void) printf(" ---------------------\n"); while (Tf - t > 1.0e-15) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM "\n", t, NV_Ith_S(y, 0)); /* access/print solution */ fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, NV_Ith_S(y, 0)); @@ -165,24 +165,24 @@ int main(void) fclose(UFID); /* Get/print some final statistics on how the solve progressed */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -199,7 +199,7 @@ int main(void) /* Clean up and return */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_analytic_mels.c b/examples/arkode/C_serial/ark_analytic_mels.c index e1dd476909..4373a7aa3d 100644 --- a/examples/arkode/C_serial/ark_analytic_mels.c +++ b/examples/arkode/C_serial/ark_analytic_mels.c @@ -46,7 +46,7 @@ #define FSYM "f" #endif -/* User-supplied functions called by ARKStep */ +/* User-supplied functions called by ARKode */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); /* Custom linear solver data structure, accessor macros, and routines */ @@ -107,23 +107,23 @@ int main(void) if (check_retval((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - retval = ARKStepSetUserData(arkode_mem, - (void*)&lamda); /* Pass lamda to user functions */ - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } - retval = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, + (void*)&lamda); /* Pass lamda to user functions */ + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Initialize custom matrix-embedded linear solver */ LS = MatrixEmbeddedLS(arkode_mem, ctx); if (check_retval((void*)LS, "MatrixEmbeddedLS", 0)) { return 1; } - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); /* Attach linear solver */ - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); /* Attach linear solver */ + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Specify linearly implicit RHS, with non-time-dependent Jacobian */ - retval = ARKStepSetLinear(arkode_mem, 0); - if (check_retval(&retval, "ARKStepSetLinear", 1)) { return 1; } + retval = ARKodeSetLinear(arkode_mem, 0); + if (check_retval(&retval, "ARKodeSetLinear", 1)) { return 1; } - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached. */ t = T0; tout = T0 + dTout; @@ -131,9 +131,9 @@ int main(void) printf(" ---------------------\n"); while (Tf - t > 1.0e-15) { - retval = ARKStepEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, + ARK_NORMAL); /* call integrator */ + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM "\n", t, NV_Ith_S(y, 0)); /* access/print solution */ if (retval >= 0) @@ -150,24 +150,24 @@ int main(void) printf(" ---------------------\n"); /* Get/print some final statistics on how the solve progressed */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_retval(&retval, "ARKStepGetNumLinSolvSetups", 1); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); - retval = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); - retval = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_retval(&retval, "ARKStepGetNumLinRhsEvals", 1); + retval = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_retval(&retval, "ARKodeGetNumLinSolvSetups", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); + retval = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_retval(&retval, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -184,7 +184,7 @@ int main(void) /* Clean up and return */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free the SUNContext */ @@ -250,10 +250,10 @@ static int MatrixEmbeddedLSSolve(SUNLinearSolver LS, SUNMatrix A, N_Vector x, sunrealtype* rdata; sunrealtype lamda; - /* retrieve implicit system data from ARKStep */ - retval = ARKStepGetNonlinearSystemData(LS->content, &tcur, &zpred, &z, &Fi, - &gamma, &sdata, &user_data); - if (check_retval((void*)&retval, "ARKStepGetNonlinearSystemData", 1)) + /* retrieve implicit system data from ARKode */ + retval = ARKodeGetNonlinearSystemData(LS->content, &tcur, &zpred, &z, &Fi, + &gamma, &sdata, &user_data); + if (check_retval((void*)&retval, "ARKodeGetNonlinearSystemData", 1)) { return (-1); } diff --git a/examples/arkode/C_serial/ark_analytic_nonlin.c b/examples/arkode/C_serial/ark_analytic_nonlin.c index f8a4565c55..e56600d3fc 100644 --- a/examples/arkode/C_serial/ark_analytic_nonlin.c +++ b/examples/arkode/C_serial/ark_analytic_nonlin.c @@ -89,8 +89,8 @@ int main(void) if (check_flag((void*)arkode_mem, "ERKStepCreate", 0)) { return 1; } /* Specify tolerances */ - flag = ERKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(&flag, "ERKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -99,7 +99,7 @@ int main(void) /* output initial condition to disk */ fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0)); - /* Main time-stepping loop: calls ERKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -107,8 +107,8 @@ int main(void) printf(" ---------------------\n"); while (Tf - t > 1.0e-15) { - flag = ERKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ERKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM "\n", t, NV_Ith_S(y, 0)); /* access/print solution */ fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, NV_Ith_S(y, 0)); @@ -128,16 +128,16 @@ int main(void) /* Print final statistics */ printf("\nFinal Statistics:\n"); - flag = ERKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + flag = ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); /* Print final statistics to a file in CSV format */ FID = fopen("ark_analytic_nonlin_stats.csv", "w"); - flag = ERKStepPrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); + flag = ARKodePrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); fclose(FID); /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ - ERKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/C_serial/ark_brusselator.c b/examples/arkode/C_serial/ark_brusselator.c index 9dc799d308..8702a2189e 100644 --- a/examples/arkode/C_serial/ark_brusselator.c +++ b/examples/arkode/C_serial/ark_brusselator.c @@ -168,17 +168,17 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)rdata); /* Pass rdata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetInterpolantType(arkode_mem, - ARK_INTERP_LAGRANGE); /* Specify stiff interpolant */ - if (check_flag(&flag, "ARKStepSetInterpolantType", 1)) { return 1; } - flag = ARKStepSetDeduceImplicitRhs(arkode_mem, - 1); /* Avoid eval of f after stage */ - if (check_flag(&flag, "ARKStepSetDeduceImplicitRhs", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)rdata); /* Pass rdata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetInterpolantType(arkode_mem, + ARK_INTERP_LAGRANGE); /* Specify stiff interpolant */ + if (check_flag(&flag, "ARKodeSetInterpolantType", 1)) { return 1; } + flag = ARKodeSetDeduceImplicitRhs(arkode_mem, + 1); /* Avoid eval of f after stage */ + if (check_flag(&flag, "ARKodeSetDeduceImplicitRhs", 1)) { return 1; } /* Initialize dense matrix data structure and solver */ A = SUNDenseMatrix(NEQ, NEQ, ctx); @@ -187,11 +187,11 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -201,7 +201,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -212,8 +212,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", /* access/print solution */ t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -234,26 +234,26 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumStepSolveFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumStepSolveFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &nnf); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumStepSolveFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumStepSolveFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &nnf); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -268,7 +268,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_brusselator1D.c b/examples/arkode/C_serial/ark_brusselator1D.c index abd7399099..f8b647cde1 100644 --- a/examples/arkode/C_serial/ark_brusselator1D.c +++ b/examples/arkode/C_serial/ark_brusselator1D.c @@ -207,11 +207,11 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize band matrix data structure and solver -- A will be factored, so set smu to ml+mu */ A = SUNBandMatrix(NEQ, 4, 4, ctx); @@ -220,11 +220,11 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Band", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* output spatial mesh to disk */ FID = fopen("bruss_mesh.txt", "w"); @@ -246,7 +246,7 @@ int main(void) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -255,8 +255,8 @@ int main(void) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } u = N_VWL2Norm(y, umask); /* access/print solution statistics */ u = sqrt(u * u / N); v = N_VWL2Norm(y, vmask); @@ -290,24 +290,24 @@ int main(void) fclose(WFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -326,7 +326,7 @@ int main(void) N_VDestroy(vmask); N_VDestroy(wmask); free(udata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c index 11d9dbab40..327a4c66e7 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c @@ -285,16 +285,16 @@ int main(int argc, char* argv[]) /* Set routines */ /* Pass udata to user functions */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return (1); } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return (1); } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return (1); } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return (1); } /* Specify residual tolerance */ - retval = ARKStepResStolerance(arkode_mem, abstol); - if (check_retval(&retval, "ARKStepResStolerance", 1)) { return (1); } + retval = ARKodeResStolerance(arkode_mem, abstol); + if (check_retval(&retval, "ARKodeResStolerance", 1)) { return (1); } /* Initialize sparse matrix data structure and linear solvers (system and mass) */ NNZ = 15 * NEQ; @@ -311,26 +311,26 @@ int main(int argc, char* argv[]) MLS = SUNLinSol_SuperLUMT(y, M, num_threads, ctx); if (check_retval((void*)MLS, "SUNLinSol_SuperLUMT", 0)) { return (1); } - /* Attach the matrix, linear solver, and Jacobian construction routine to ARKStep */ + /* Attach the matrix, linear solver, and Jacobian construction routine to ARKode */ /* Attach matrix and LS */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return (1); } + retval = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return (1); } /* Supply Jac routine */ - retval = ARKStepSetJacFn(arkode_mem, Jac); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return (1); } + retval = ARKodeSetJacFn(arkode_mem, Jac); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return (1); } - /* Attach the mass matrix, linear solver and construction routines to ARKStep; - notify ARKStep that the mass matrix is not time-dependent */ + /* Attach the mass matrix, linear solver and construction routines to ARKode; + notify ARKode that the mass matrix is not time-dependent */ /* Attach matrix and LS */ - retval = ARKStepSetMassLinearSolver(arkode_mem, MLS, M, SUNFALSE); - if (check_retval(&retval, "ARKStepSetMassLinearSolver", 1)) { return (1); } + retval = ARKodeSetMassLinearSolver(arkode_mem, MLS, M, SUNFALSE); + if (check_retval(&retval, "ARKodeSetMassLinearSolver", 1)) { return (1); } /* Supply M routine */ - retval = ARKStepSetMassFn(arkode_mem, MassMatrix); - if (check_retval(&retval, "ARKStepSetMassFn", 1)) { return (1); } + retval = ARKodeSetMassFn(arkode_mem, MassMatrix); + if (check_retval(&retval, "ARKodeSetMassFn", 1)) { return (1); } /* output mesh to disk */ FID = fopen("bruss_FEM_mesh.txt", "w"); @@ -352,7 +352,7 @@ int main(int argc, char* argv[]) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = Tf / Nt; @@ -361,9 +361,9 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - retval = ARKStepEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ - if (check_retval(&retval, "ARKStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, + ARK_NORMAL); /* call integrator */ + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } u = N_VWL2Norm(y, umask); /* access/print solution statistics */ u = sqrt(u * u / N); v = N_VWL2Norm(y, vmask); @@ -397,28 +397,28 @@ int main(int argc, char* argv[]) fclose(WFID); /* Print some final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_retval(&retval, "ARKStepGetNumLinSolvSetups", 1); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); - retval = ARKStepGetNumMassSetups(arkode_mem, &nmset); - check_retval(&retval, "ARKStepGetNumMassSetups", 1); - retval = ARKStepGetNumMassSolves(arkode_mem, &nms); - check_retval(&retval, "ARKStepGetNumMassSolves", 1); - retval = ARKStepGetNumMassMult(arkode_mem, &nMv); - check_retval(&retval, "ARKStepGetNumMassMult", 1); - retval = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); + retval = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_retval(&retval, "ARKodeGetNumLinSolvSetups", 1); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumMassSetups(arkode_mem, &nmset); + check_retval(&retval, "ARKodeGetNumMassSetups", 1); + retval = ARKodeGetNumMassSolves(arkode_mem, &nms); + check_retval(&retval, "ARKodeGetNumMassSolves", 1); + retval = ARKodeGetNumMassMult(arkode_mem, &nMv); + check_retval(&retval, "ARKodeGetNumMassMult", 1); + retval = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -442,7 +442,7 @@ int main(int argc, char* argv[]) N_VDestroy(udata->tmp); free(udata->x); free(udata); - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solvers */ SUNLinSolFree(MLS); SUNMatDestroy(A); /* Free matrices */ diff --git a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c index 7a557fa22a..c1245a4f4e 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c +++ b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c @@ -400,28 +400,28 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSf, "SUNLinSol_Band", 0)) { return 1; } /* Specify fast tolerances */ - retval = ARKStepSStolerances(inner_arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(inner_arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = ARKStepSetLinearSolver(inner_arkode_mem, LSf, Af); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(inner_arkode_mem, LSf, Af); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set max number of nonlinear iters */ - retval = ARKStepSetMaxNonlinIters(inner_arkode_mem, 10); - if (check_retval(&retval, "ARKStepSetMaxNonlinIters", 1)) { return 1; } + retval = ARKodeSetMaxNonlinIters(inner_arkode_mem, 10); + if (check_retval(&retval, "ARKodeSetMaxNonlinIters", 1)) { return 1; } /* Set the Jacobian routine */ - retval = ARKStepSetJacFn(inner_arkode_mem, Jf); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(inner_arkode_mem, Jf); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; case (1): /*dirk 5th order fast solver (full problem) */ inner_arkode_mem = ARKStepCreate(NULL, f, T0, y, ctx); if (check_retval((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set method order to use */ - retval = ARKStepSetOrder(inner_arkode_mem, 5); - if (check_retval(&retval, "ARKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(inner_arkode_mem, 5); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } /* Initialize matrix and linear solver data structures */ Af = SUNBandMatrix(NEQ, 4, 4, ctx); @@ -431,16 +431,16 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSf, "SUNLinSol_Band", 0)) { return 1; } /* Specify fast tolerances */ - retval = ARKStepSStolerances(inner_arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(inner_arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = ARKStepSetLinearSolver(inner_arkode_mem, LSf, Af); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(inner_arkode_mem, LSf, Af); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set the Jacobian routine */ - retval = ARKStepSetJacFn(inner_arkode_mem, Jac); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(inner_arkode_mem, Jac); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; case (2): /* erk-3-3 fast solver */ case (4): @@ -497,30 +497,30 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSf, "SUNLinSol_Band", 0)) { return 1; } /* Specify fast tolerances */ - retval = ARKStepSStolerances(inner_arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(inner_arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = ARKStepSetLinearSolver(inner_arkode_mem, LSf, Af); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(inner_arkode_mem, LSf, Af); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set max number of nonlinear iters */ - retval = ARKStepSetMaxNonlinIters(inner_arkode_mem, 10); - if (check_retval(&retval, "ARKStepSetMaxNonlinIters", 1)) { return 1; } + retval = ARKodeSetMaxNonlinIters(inner_arkode_mem, 10); + if (check_retval(&retval, "ARKodeSetMaxNonlinIters", 1)) { return 1; } /* Set the Jacobian routine */ - retval = ARKStepSetJacFn(inner_arkode_mem, Jf); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(inner_arkode_mem, Jf); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; } /* Attach user data to fast integrator */ - retval = ARKStepSetUserData(inner_arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(inner_arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -576,16 +576,16 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSs, "SUNLinSol_Band", 0)) { return 1; } /* Specify tolerances */ - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set the Jacobian routine */ - retval = MRIStepSetJacFn(arkode_mem, Js); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Js); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; case (4): case (5): /* IMEX-MRI-GARK3b, solve-decoupled slow solver */ @@ -606,16 +606,16 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSs, "SUNLinSol_Band", 0)) { return 1; } /* Specify tolerances */ - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set the Jacobian routine */ - retval = MRIStepSetJacFn(arkode_mem, Jsi); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jsi); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; case (6): case (7): /* IMEX-MRI-GARK4, solve-decoupled slow solver */ @@ -636,30 +636,30 @@ int main(int argc, char* argv[]) if (check_retval((void*)LSs, "SUNLinSol_Band", 0)) { return 1; } /* Specify tolerances */ - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set the Jacobian routine */ - retval = MRIStepSetJacFn(arkode_mem, Jsi); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jsi); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } break; } /* Pass udata to user functions */ - retval = MRIStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Set maximum number of steps taken by solver */ - retval = MRIStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "MRIStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* * Integrate ODE @@ -706,7 +706,7 @@ int main(int argc, char* argv[]) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls MRIStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -715,8 +715,8 @@ int main(int argc, char* argv[]) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* access/print solution statistics */ u = N_VWL2Norm(y, umask); @@ -750,14 +750,14 @@ int main(int argc, char* argv[]) */ /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nffe, &nffi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); @@ -801,10 +801,10 @@ int main(int argc, char* argv[]) /* Get/print slow integrator decoupled implicit solver statistics */ if (solve_type > 1) { - retval = MRIStepGetNonlinSolvStats(arkode_mem, &nnis, &nncs); - check_retval(&retval, "MRIStepGetNonlinSolvStats", 1); - retval = MRIStepGetNumJacEvals(arkode_mem, &njes); - check_retval(&retval, "MRIStepGetNumJacEvals", 1); + retval = ARKodeGetNonlinSolvStats(arkode_mem, &nnis, &nncs); + check_retval(&retval, "ARKodeGetNonlinSolvStats", 1); + retval = ARKodeGetNumJacEvals(arkode_mem, &njes); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf(" Slow Newton iters = %li\n", nnis); printf(" Slow Newton conv fails = %li\n", nncs); printf(" Slow Jacobian evals = %li\n", njes); @@ -814,10 +814,10 @@ int main(int argc, char* argv[]) if ((solve_type == 0) || (solve_type == 1) || (solve_type == 3) || (solve_type == 5) || (solve_type == 7)) { - retval = ARKStepGetNonlinSolvStats(inner_arkode_mem, &nnif, &nncf); - check_retval(&retval, "ARKStepGetNonlinSolvStats", 1); - retval = ARKStepGetNumJacEvals(inner_arkode_mem, &njef); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); + retval = ARKodeGetNonlinSolvStats(inner_arkode_mem, &nnif, &nncf); + check_retval(&retval, "ARKodeGetNonlinSolvStats", 1); + retval = ARKodeGetNumJacEvals(inner_arkode_mem, &njef); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf(" Fast Newton iters = %li\n", nnif); printf(" Fast Newton conv fails = %li\n", nncf); printf(" Fast Jacobian evals = %li\n", njef); @@ -825,9 +825,9 @@ int main(int argc, char* argv[]) /* Clean up and return with successful completion */ free(udata); /* Free user data */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ ARKodeButcherTable_Free(B); /* Free Butcher table */ MRIStepCoupling_Free(C); /* Free coupling coefficients */ SUNMatDestroy(Af); /* Free fast matrix */ diff --git a/examples/arkode/C_serial/ark_brusselator1D_klu.c b/examples/arkode/C_serial/ark_brusselator1D_klu.c index 1c34e56c3c..98dc04533d 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_klu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_klu.c @@ -223,11 +223,11 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize sparse matrix data structure and KLU solver */ NNZ = 5 * NEQ; @@ -236,11 +236,11 @@ int main(void) LS = SUNLinSol_KLU(y, A, ctx); if (check_flag((void*)LS, "SUNLinSol_KLU", 0)) { return 1; } - /* Attach the matrix, linear solver, and Jacobian construction routine to ARKStep */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); /* Attach matrix and LS */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Supply Jac routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + /* Attach the matrix, linear solver, and Jacobian construction routine to ARKode */ + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); /* Attach matrix and LS */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Supply Jac routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* output spatial mesh to disk */ FID = fopen("bruss_mesh.txt", "w"); @@ -262,7 +262,7 @@ int main(void) fprintf(VFID, "\n"); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = Tf / Nt; @@ -271,7 +271,7 @@ int main(void) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ u = N_VWL2Norm(y, umask); u = SUNRsqrt(u * u / N); v = N_VWL2Norm(y, vmask); @@ -305,22 +305,22 @@ int main(void) fclose(WFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -337,9 +337,9 @@ int main(void) N_VDestroy(umask); N_VDestroy(vmask); N_VDestroy(wmask); - SUNMatDestroy(udata->R); /* Free user data */ + SUNMatDestroy(udata->R); /* Free user data */ free(udata); - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_brusselator_1D_mri.c b/examples/arkode/C_serial/ark_brusselator_1D_mri.c index 57171864e9..ba858f7a0e 100644 --- a/examples/arkode/C_serial/ark_brusselator_1D_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_1D_mri.c @@ -228,24 +228,24 @@ int main(int argc, char* argv[]) if (check_retval((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Attach user data to fast integrator */ - retval = ARKStepSetUserData(inner_arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(inner_arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the fast method */ retval = ARKStepSetTableNum(inner_arkode_mem, ARKODE_ARK324L2SA_DIRK_4_2_3, -1); if (check_retval(&retval, "ARKStepSetTableNum", 1)) { return 1; } /* Specify fast tolerances */ - retval = ARKStepSStolerances(inner_arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(inner_arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } /* Attach matrix and linear solver */ - retval = ARKStepSetLinearSolver(inner_arkode_mem, LS, A); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetLinearSolver(inner_arkode_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } /* Set the Jacobian routine */ - retval = ARKStepSetJacFn(inner_arkode_mem, Jf); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } + retval = ARKodeSetJacFn(inner_arkode_mem, Jf); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -265,12 +265,12 @@ int main(int argc, char* argv[]) if (check_retval((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } /* Pass udata to user functions */ - retval = MRIStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* output spatial mesh to disk (add extra point for periodic BC) */ FID = fopen("mesh.txt", "w"); @@ -301,7 +301,7 @@ int main(int argc, char* argv[]) fprintf(WFID, " %.16" ESYM, data[IDX(0, 2)]); fprintf(WFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -311,8 +311,8 @@ int main(int argc, char* argv[]) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* access/print solution statistics */ u = N_VWL2Norm(y, umask); @@ -347,30 +347,30 @@ int main(int argc, char* argv[]) fclose(WFID); /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); - retval = ARKStepGetNumStepAttempts(inner_arkode_mem, &nstf_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); + retval = ARKodeGetNumStepAttempts(inner_arkode_mem, &nstf_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nffe, &nffi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); - retval = ARKStepGetNumLinSolvSetups(inner_arkode_mem, &nsetups); - check_retval(&retval, "ARKStepGetNumLinSolvSetups", 1); - retval = ARKStepGetNumErrTestFails(inner_arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1); - retval = ARKStepGetNumNonlinSolvIters(inner_arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1); - retval = ARKStepGetNumNonlinSolvConvFails(inner_arkode_mem, &ncfn); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1); - retval = ARKStepGetNumJacEvals(inner_arkode_mem, &nje); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); - retval = ARKStepGetNumLinRhsEvals(inner_arkode_mem, &nfeLS); - check_retval(&retval, "ARKStepGetNumLinRhsEvals", 1); + retval = ARKodeGetNumLinSolvSetups(inner_arkode_mem, &nsetups); + check_retval(&retval, "ARKodeGetNumLinSolvSetups", 1); + retval = ARKodeGetNumErrTestFails(inner_arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1); + retval = ARKodeGetNumNonlinSolvIters(inner_arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1); + retval = ARKodeGetNumNonlinSolvConvFails(inner_arkode_mem, &ncfn); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1); + retval = ARKodeGetNumJacEvals(inner_arkode_mem, &nje); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); + retval = ARKodeGetNumLinRhsEvals(inner_arkode_mem, &nfeLS); + check_retval(&retval, "ARKodeGetNumLinRhsEvals", 1); /* Print some final statistics */ printf("\nFinal Solver Statistics:\n"); @@ -387,9 +387,9 @@ int main(int argc, char* argv[]) /* Clean up and return with successful completion */ free(udata); /* Free user data */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free matrix */ N_VDestroy(y); /* Free vectors */ diff --git a/examples/arkode/C_serial/ark_brusselator_fp.c b/examples/arkode/C_serial/ark_brusselator_fp.c index 012acd329e..f3e2664f07 100644 --- a/examples/arkode/C_serial/ark_brusselator_fp.c +++ b/examples/arkode/C_serial/ark_brusselator_fp.c @@ -185,22 +185,22 @@ int main(int argc, char* argv[]) arkode_mem = ARKStepCreate(fe, fi, T0, y, ctx); if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } - /* Initialize fixed-point nonlinear solver and attach to ARKStep */ + /* Initialize fixed-point nonlinear solver and attach to ARKode */ NLS = SUNNonlinSol_FixedPoint(y, fp_m, ctx); if (check_flag((void*)NLS, "SUNNonlinSol_FixedPoint", 0)) { return 1; } - flag = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_flag(&flag, "ARKStepSetNonlinearSolver", 1)) { return 1; } + flag = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_flag(&flag, "ARKodeSetNonlinearSolver", 1)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)rdata); /* Pass rdata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetMaxNonlinIters(arkode_mem, - maxcor); /* Increase default iterations */ - if (check_flag(&flag, "ARKStepSetMaxNonlinIters", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)rdata); /* Pass rdata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetMaxNonlinIters(arkode_mem, + maxcor); /* Increase default iterations */ + if (check_flag(&flag, "ARKodeSetMaxNonlinIters", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -210,7 +210,7 @@ int main(int argc, char* argv[]) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -218,8 +218,8 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", /* access/print solution */ t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -240,18 +240,18 @@ int main(int argc, char* argv[]) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -263,7 +263,7 @@ int main(int argc, char* argv[]) /* Clean up and return with successful completion */ N_VDestroy(y); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNNonlinSolFree(NLS); SUNLogger_Destroy(&logger); SUNContext_Free(&ctx); diff --git a/examples/arkode/C_serial/ark_brusselator_mri.c b/examples/arkode/C_serial/ark_brusselator_mri.c index 0fbca635e7..0b636fd3a7 100644 --- a/examples/arkode/C_serial/ark_brusselator_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_mri.c @@ -135,16 +135,16 @@ int main(void) if (check_retval((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Attach user data to fast integrator */ - retval = ARKStepSetUserData(inner_arkode_mem, (void*)rdata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(inner_arkode_mem, (void*)rdata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the fast method */ retval = ARKStepSetTableNum(inner_arkode_mem, -1, ARKODE_KNOTH_WOLKE_3_3); if (check_retval(&retval, "ARKStepSetTableNum", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -164,12 +164,12 @@ int main(void) if (check_retval((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } /* Pass rdata to user functions */ - retval = MRIStepSetUserData(arkode_mem, (void*)rdata); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)rdata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* * Integrate ODE @@ -183,7 +183,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls MRIStepEvolve to perform the + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; @@ -196,8 +196,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* access/print solution */ printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", t, @@ -217,14 +217,14 @@ int main(void) */ /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nff, &tmp); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); @@ -235,9 +235,9 @@ int main(void) /* Clean up and return */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c b/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c index 4ef129b9d3..c9570e8bec 100644 --- a/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c +++ b/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c @@ -215,14 +215,14 @@ int main(int argc, char* argv[]) if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } /* Specify tolerances */ - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } if (relax) { /* Enable relaxation methods */ - flag = ARKStepSetRelaxFn(arkode_mem, Ent, JacEnt); - if (check_flag(flag, "ARKStepSetRelaxFn")) { return 1; } + flag = ARKodeSetRelaxFn(arkode_mem, Ent, JacEnt); + if (check_flag(flag, "ARKodeSetRelaxFn")) { return 1; } } if (implicit) @@ -235,12 +235,12 @@ int main(int argc, char* argv[]) if (check_ptr(LS, "SUNLinSol_Dense")) { return 1; } /* Attach the matrix and linear solver */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_flag(flag, "ARKStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } /* Set Jacobian routine */ - flag = ARKStepSetJacFn(arkode_mem, Jac); - if (check_flag(flag, "ARKStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } /* Select a Butcher table with non-negative b values */ flag = ARKStepSetTableName(arkode_mem, "ARKODE_ARK2_DIRK_3_1_2", @@ -248,14 +248,14 @@ int main(int argc, char* argv[]) if (check_flag(flag, "ARKStepSetTableName")) { return 1; } /* Tighten nonlinear solver tolerance */ - flag = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_flag(flag, "ARKStepSetNonlinConvCoef")) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_flag(flag, "ARKodeSetNonlinConvCoef")) { return 1; } } if (fixed_h > SUN_RCONST(0.0)) { - flag = ARKStepSetFixedStep(arkode_mem, fixed_h); - if (check_flag(flag, "ARKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } /* Open output stream for results, output comment line */ @@ -290,8 +290,8 @@ int main(int argc, char* argv[]) while (t < tf) { /* Evolve in time */ - flag = ARKStepEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); - if (check_flag(flag, "ARKStepEvolve")) { break; } + flag = ARKodeEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); + if (check_flag(flag, "ARKodeEvolve")) { break; } /* Output solution and errors */ flag = Ent(y, &ent, NULL); @@ -305,8 +305,8 @@ int main(int argc, char* argv[]) v_err = ydata[1] - ytdata[1]; /* Output to the screen periodically */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); if (nst % 40 == 0) { @@ -331,14 +331,14 @@ int main(int argc, char* argv[]) * ------------ */ /* Get final statistics on how the solve progressed */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(flag, "ARKStepGetNumStepAttempts"); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(flag, "ARKodeGetNumStepAttempts"); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(flag, "ARKStepGetNumErrTestFails"); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(flag, "ARKodeGetNumErrTestFails"); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(flag, "ARKStepGetNumRhsEvals"); @@ -350,20 +350,20 @@ int main(int argc, char* argv[]) if (implicit) { - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(flag, "ARKStepGetNumNonlinSolvIters"); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(flag, "ARKodeGetNumNonlinSolvIters"); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(flag, "ARKStepGetNumNonlinSolvConvFails"); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(flag, "ARKodeGetNumNonlinSolvConvFails"); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(flag, "ARKStepGetNumLinSolvSetups"); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(flag, "ARKodeGetNumLinSolvSetups"); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(flag, "ARKStepGetNumJacEvals"); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(flag, "ARKodeGetNumJacEvals"); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(flag, "ARKStepGetNumLinRhsEvals"); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(flag, "ARKodeGetNumLinRhsEvals"); printf(" Total number of Newton iterations = %li\n", nni); printf(" Total number of linear solver convergence failures = %li\n", ncfn); @@ -374,23 +374,23 @@ int main(int argc, char* argv[]) if (relax) { - flag = ARKStepGetNumRelaxFnEvals(arkode_mem, &nre); - check_flag(flag, "ARKStepGetNumRelaxFnEvals"); + flag = ARKodeGetNumRelaxFnEvals(arkode_mem, &nre); + check_flag(flag, "ARKodeGetNumRelaxFnEvals"); - flag = ARKStepGetNumRelaxJacEvals(arkode_mem, &nrje); - check_flag(flag, "ARKStepGetNumRelaxJacEvals"); + flag = ARKodeGetNumRelaxJacEvals(arkode_mem, &nrje); + check_flag(flag, "ARKodeGetNumRelaxJacEvals"); - flag = ARKStepGetNumRelaxFails(arkode_mem, &nrf); - check_flag(flag, "ARKStepGetNumRelaxFails"); + flag = ARKodeGetNumRelaxFails(arkode_mem, &nrf); + check_flag(flag, "ARKodeGetNumRelaxFails"); - flag = ARKStepGetNumRelaxBoundFails(arkode_mem, &nrbf); - check_flag(flag, "ARKStepGetNumRelaxBoundFails"); + flag = ARKodeGetNumRelaxBoundFails(arkode_mem, &nrbf); + check_flag(flag, "ARKodeGetNumRelaxBoundFails"); - flag = ARKStepGetNumRelaxSolveFails(arkode_mem, &nrnlsf); - check_flag(flag, "ARKStepGetNumRelaxSolveFails"); + flag = ARKodeGetNumRelaxSolveFails(arkode_mem, &nrnlsf); + check_flag(flag, "ARKodeGetNumRelaxSolveFails"); - flag = ARKStepGetNumRelaxSolveIters(arkode_mem, &nrnlsi); - check_flag(flag, "ARKStepGetNumRelaxSolveIters"); + flag = ARKodeGetNumRelaxSolveIters(arkode_mem, &nrnlsi); + check_flag(flag, "ARKodeGetNumRelaxSolveIters"); printf(" Total Relaxation Fn evals = %li\n", nre); printf(" Total Relaxation Jac evals = %li\n", nrje); @@ -405,8 +405,8 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - /* Free ARKStep integrator and SUNDIALS objects */ - ARKStepFree(&arkode_mem); + /* Free ARKode integrator and SUNDIALS objects */ + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNMatDestroy(A); N_VDestroy(y); diff --git a/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c b/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c index e78a50e9bc..6b73b0d999 100644 --- a/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c +++ b/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c @@ -202,20 +202,20 @@ int main(int argc, char* argv[]) if (check_ptr(arkode_mem, "ERKStepCreate")) { return 1; } /* Specify tolerances */ - flag = ERKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(flag, "ERKStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } if (relax) { /* Enable relaxation methods */ - flag = ERKStepSetRelaxFn(arkode_mem, Ent, JacEnt); - if (check_flag(flag, "ERKStepSetRelaxFn")) { return 1; } + flag = ARKodeSetRelaxFn(arkode_mem, Ent, JacEnt); + if (check_flag(flag, "ARKodeSetRelaxFn")) { return 1; } } if (fixed_h > SUN_RCONST(0.0)) { - flag = ERKStepSetFixedStep(arkode_mem, fixed_h); - if (check_flag(flag, "ERKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } /* Open output stream for results, output comment line */ @@ -250,8 +250,8 @@ int main(int argc, char* argv[]) while (t < tf) { /* Evolve in time */ - flag = ERKStepEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); - if (check_flag(flag, "ERKStepEvolve")) { break; } + flag = ARKodeEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); + if (check_flag(flag, "ARKodeEvolve")) { break; } /* Output solution and errors */ flag = Ent(y, &ent, NULL); @@ -265,8 +265,8 @@ int main(int argc, char* argv[]) v_err = ydata[1] - ytdata[1]; /* Output to the screen periodically */ - flag = ERKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ERKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); if (nst % 40 == 0) { @@ -291,14 +291,14 @@ int main(int argc, char* argv[]) * ------------ */ /* Get final statistics on how the solve progressed */ - flag = ERKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ERKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); - flag = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(flag, "ERKStepGetNumStepAttempts"); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(flag, "ARKodeGetNumStepAttempts"); - flag = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(flag, "ERKStepGetNumErrTestFails"); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(flag, "ARKodeGetNumErrTestFails"); flag = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_flag(flag, "ERKStepGetNumRhsEvals"); @@ -310,23 +310,23 @@ int main(int argc, char* argv[]) if (relax) { - flag = ERKStepGetNumRelaxFnEvals(arkode_mem, &nre); - check_flag(flag, "ERKStepGetNumRelaxFnEvals"); + flag = ARKodeGetNumRelaxFnEvals(arkode_mem, &nre); + check_flag(flag, "ARKodeGetNumRelaxFnEvals"); - flag = ERKStepGetNumRelaxJacEvals(arkode_mem, &nrje); - check_flag(flag, "ERKStepGetNumRelaxJacEvals"); + flag = ARKodeGetNumRelaxJacEvals(arkode_mem, &nrje); + check_flag(flag, "ARKodeGetNumRelaxJacEvals"); - flag = ERKStepGetNumRelaxFails(arkode_mem, &nrf); - check_flag(flag, "ERKStepGetNumRelaxFails"); + flag = ARKodeGetNumRelaxFails(arkode_mem, &nrf); + check_flag(flag, "ARKodeGetNumRelaxFails"); - flag = ERKStepGetNumRelaxBoundFails(arkode_mem, &nrbf); - check_flag(flag, "ERKStepGetNumRelaxBoundFails"); + flag = ARKodeGetNumRelaxBoundFails(arkode_mem, &nrbf); + check_flag(flag, "ARKodeGetNumRelaxBoundFails"); - flag = ERKStepGetNumRelaxSolveFails(arkode_mem, &nrnlsf); - check_flag(flag, "ERKStepGetNumRelaxSolveFails"); + flag = ARKodeGetNumRelaxSolveFails(arkode_mem, &nrnlsf); + check_flag(flag, "ARKodeGetNumRelaxSolveFails"); - flag = ERKStepGetNumRelaxSolveIters(arkode_mem, &nrnlsi); - check_flag(flag, "ERKStepGetNumRelaxSolveIters"); + flag = ARKodeGetNumRelaxSolveIters(arkode_mem, &nrnlsi); + check_flag(flag, "ARKodeGetNumRelaxSolveIters"); printf(" Total Relaxation Fn evals = %li\n", nre); printf(" Total Relaxation Jac evals = %li\n", nrje); @@ -341,8 +341,8 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - /* Free ERKStep integrator and SUNDIALS objects */ - ERKStepFree(&arkode_mem); + /* Free ARKode integrator and SUNDIALS objects */ + ARKodeFree(&arkode_mem); N_VDestroy(y); N_VDestroy(ytrue); SUNContext_Free(&ctx); diff --git a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c index 79e6310538..bcb05f830b 100644 --- a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c @@ -106,17 +106,17 @@ int main(int argc, char* argv[]) /* Create SPRKStep integrator */ arkode_mem = SPRKStepCreate(qdot, pdot, T0, y, sunctx); - retval = SPRKStepSetOrder(arkode_mem, order); - if (check_retval(&retval, "SPRKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } - retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } + retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } - retval = SPRKStepSetFixedStep(arkode_mem, dt); - if (check_retval(&retval, "SPRKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, dt); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } - retval = SPRKStepSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 2); - if (check_retval(&retval, "SPRKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 2); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Print out starting Hamiltonian before integrating */ tret = T0; @@ -128,8 +128,8 @@ int main(int argc, char* argv[]) /* Do integration */ for (iout = 0; iout < num_output_times; iout++) { - if (args.use_tstop) { SPRKStepSetStopTime(arkode_mem, tout); } - retval = SPRKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + if (args.use_tstop) { ARKodeSetStopTime(arkode_mem, tout); } + retval = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); /* Output current integration status */ fprintf(stdout, "t = %.6Lf, q(t) = %.6Lf, H = %.6Lf\n", (long double)tret, @@ -149,9 +149,9 @@ int main(int argc, char* argv[]) } fprintf(stdout, "\n"); - SPRKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); N_VDestroy(y); - SPRKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNContext_Free(&sunctx); return 0; diff --git a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c index 7f6db669c1..1b4bd469a5 100644 --- a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c +++ b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c @@ -195,14 +195,14 @@ int main(int argc, char* argv[]) if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } /* Specify tolerances */ - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } if (relax) { /* Enable relaxation methods */ - flag = ARKStepSetRelaxFn(arkode_mem, Ent, JacEnt); - if (check_flag(flag, "ARKStepSetRelaxFn")) { return 1; } + flag = ARKodeSetRelaxFn(arkode_mem, Ent, JacEnt); + if (check_flag(flag, "ARKodeSetRelaxFn")) { return 1; } } if (implicit) @@ -215,12 +215,12 @@ int main(int argc, char* argv[]) if (check_ptr(LS, "SUNLinSol_Dense")) { return 1; } /* Attach the matrix and linear solver */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_flag(flag, "ARKStepSetLinearSolver")) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_flag(flag, "ARKodeSetLinearSolver")) { return 1; } /* Set Jacobian routine */ - flag = ARKStepSetJacFn(arkode_mem, Jac); - if (check_flag(flag, "ARKStepSetJacFn")) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); + if (check_flag(flag, "ARKodeSetJacFn")) { return 1; } /* Select a Butcher table with non-negative b values */ flag = ARKStepSetTableName(arkode_mem, "ARKODE_ARK2_DIRK_3_1_2", @@ -228,14 +228,14 @@ int main(int argc, char* argv[]) if (check_flag(flag, "ARKStepSetTableName")) { return 1; } /* Tighten nonlinear solver tolerance */ - flag = ARKStepSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); - if (check_flag(flag, "ARKStepSetNonlinConvCoef")) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, SUN_RCONST(0.01)); + if (check_flag(flag, "ARKodeSetNonlinConvCoef")) { return 1; } } if (fixed_h > SUN_RCONST(0.0)) { - flag = ARKStepSetFixedStep(arkode_mem, fixed_h); - if (check_flag(flag, "ARKStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, fixed_h); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } } /* Open output stream for results, output comment line */ @@ -269,8 +269,8 @@ int main(int argc, char* argv[]) while (t < tf) { /* Evolve in time */ - flag = ARKStepEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); - if (check_flag(flag, "ARKStepEvolve")) { break; } + flag = ARKodeEvolve(arkode_mem, tf, y, &t, ARK_ONE_STEP); + if (check_flag(flag, "ARKodeEvolve")) { break; } /* Output solution and errors */ flag = Ent(y, &ent, NULL); @@ -283,8 +283,8 @@ int main(int argc, char* argv[]) u_err = ydata[0] - ytdata[0]; /* Output to the screen periodically */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); if (nst % 40 == 0) { @@ -309,14 +309,14 @@ int main(int argc, char* argv[]) * ------------ */ /* Get final statistics on how the solve progressed */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(flag, "ARKStepGetNumSteps"); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(flag, "ARKodeGetNumSteps"); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(flag, "ARKStepGetNumStepAttempts"); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(flag, "ARKodeGetNumStepAttempts"); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(flag, "ARKStepGetNumErrTestFails"); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(flag, "ARKodeGetNumErrTestFails"); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(flag, "ARKStepGetNumRhsEvals"); @@ -328,20 +328,20 @@ int main(int argc, char* argv[]) if (implicit) { - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(flag, "ARKStepGetNumNonlinSolvIters"); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(flag, "ARKodeGetNumNonlinSolvIters"); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(flag, "ARKStepGetNumNonlinSolvConvFails"); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(flag, "ARKodeGetNumNonlinSolvConvFails"); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(flag, "ARKStepGetNumLinSolvSetups"); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(flag, "ARKodeGetNumLinSolvSetups"); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(flag, "ARKStepGetNumJacEvals"); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(flag, "ARKodeGetNumJacEvals"); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(flag, "ARKStepGetNumLinRhsEvals"); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(flag, "ARKodeGetNumLinRhsEvals"); printf(" Total number of Newton iterations = %li\n", nni); printf(" Total number of linear solver convergence failures = %li\n", ncfn); @@ -352,23 +352,23 @@ int main(int argc, char* argv[]) if (relax) { - flag = ARKStepGetNumRelaxFnEvals(arkode_mem, &nre); - check_flag(flag, "ARKStepGetNumRelaxFnEvals"); + flag = ARKodeGetNumRelaxFnEvals(arkode_mem, &nre); + check_flag(flag, "ARKodeGetNumRelaxFnEvals"); - flag = ARKStepGetNumRelaxJacEvals(arkode_mem, &nrje); - check_flag(flag, "ARKStepGetNumRelaxJacEvals"); + flag = ARKodeGetNumRelaxJacEvals(arkode_mem, &nrje); + check_flag(flag, "ARKodeGetNumRelaxJacEvals"); - flag = ARKStepGetNumRelaxFails(arkode_mem, &nrf); - check_flag(flag, "ARKStepGetNumRelaxFails"); + flag = ARKodeGetNumRelaxFails(arkode_mem, &nrf); + check_flag(flag, "ARKodeGetNumRelaxFails"); - flag = ARKStepGetNumRelaxBoundFails(arkode_mem, &nrbf); - check_flag(flag, "ARKStepGetNumRelaxBoundFails"); + flag = ARKodeGetNumRelaxBoundFails(arkode_mem, &nrbf); + check_flag(flag, "ARKodeGetNumRelaxBoundFails"); - flag = ARKStepGetNumRelaxSolveFails(arkode_mem, &nrnlsf); - check_flag(flag, "ARKStepGetNumRelaxSolveFails"); + flag = ARKodeGetNumRelaxSolveFails(arkode_mem, &nrnlsf); + check_flag(flag, "ARKodeGetNumRelaxSolveFails"); - flag = ARKStepGetNumRelaxSolveIters(arkode_mem, &nrnlsi); - check_flag(flag, "ARKStepGetNumRelaxSolveIters"); + flag = ARKodeGetNumRelaxSolveIters(arkode_mem, &nrnlsi); + check_flag(flag, "ARKodeGetNumRelaxSolveIters"); printf(" Total Relaxation Fn evals = %li\n", nre); printf(" Total Relaxation Jac evals = %li\n", nrje); @@ -383,8 +383,8 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - /* Free ARKStep integrator and SUNDIALS objects */ - ARKStepFree(&arkode_mem); + /* Free ARKode integrator and SUNDIALS objects */ + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNMatDestroy(A); N_VDestroy(y); diff --git a/examples/arkode/C_serial/ark_harmonic_symplectic.c b/examples/arkode/C_serial/ark_harmonic_symplectic.c index 411c49ea63..60a9d41d33 100644 --- a/examples/arkode/C_serial/ark_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_harmonic_symplectic.c @@ -125,20 +125,20 @@ int main(int argc, char* argv[]) /* Create SPRKStep integrator */ arkode_mem = SPRKStepCreate(xdot, vdot, T0, y, sunctx); - retval = SPRKStepSetOrder(arkode_mem, order); - if (check_retval(&retval, "SPRKStepSetOrder", 1)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, order); + if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } - retval = SPRKStepSetUserData(arkode_mem, &udata); - if (check_retval(&retval, "SPRKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, &udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } - retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } + retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } - retval = SPRKStepSetFixedStep(arkode_mem, dt); - if (check_retval(&retval, "SPRKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, dt); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } - retval = SPRKStepSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 2); - if (check_retval(&retval, "SPRKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 2); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Print out starting energy, momentum before integrating */ tret = T0; @@ -150,8 +150,8 @@ int main(int argc, char* argv[]) /* Do integration */ for (iout = 0; iout < num_output_times; iout++) { - if (args.use_tstop) { SPRKStepSetStopTime(arkode_mem, tout); } - retval = SPRKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + if (args.use_tstop) { ARKodeSetStopTime(arkode_mem, tout); } + retval = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); /* Compute the anaytical solution */ Solution(tret, y, solution, &udata); @@ -188,8 +188,8 @@ int main(int argc, char* argv[]) fprintf(stdout, "\n"); N_VDestroy(y); N_VDestroy(solution); - SPRKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); - SPRKStepFree(&arkode_mem); + ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + ARKodeFree(&arkode_mem); SUNContext_Free(&sunctx); return 0; diff --git a/examples/arkode/C_serial/ark_heat1D.c b/examples/arkode/C_serial/ark_heat1D.c index eb6609029d..ef0458f113 100644 --- a/examples/arkode/C_serial/ark_heat1D.c +++ b/examples/arkode/C_serial/ark_heat1D.c @@ -124,31 +124,31 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, - 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, + 1); /* Specify maximum-order predictor */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize PCG solver -- no preconditioning, with up to N iterations */ LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKStep */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + NULL); /* Attach linear solver to ARKode */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } /* Specify linearly implicit RHS, with non-time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* output mesh to disk */ FID = fopen("heat_mesh.txt", "w"); @@ -163,7 +163,7 @@ int main(void) for (i = 0; i < N; i++) { fprintf(UFID, " %.16" ESYM "", data[i]); } fprintf(UFID, "\n"); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -173,8 +173,8 @@ int main(void) printf(" %10.6" FSYM " %10.6f\n", t, sqrt(N_VDotProd(y, y) / N)); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.6" FSYM " %10.6f\n", t, sqrt(N_VDotProd(y, y) / N)); /* print solution stats */ if (flag >= 0) @@ -196,26 +196,26 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - check_flag(&flag, "ARKStepGetNumLinIters", 1); - flag = ARKStepGetNumJtimesEvals(arkode_mem, &nJv); - check_flag(&flag, "ARKStepGetNumJtimesEvals", 1); - flag = ARKStepGetNumLinConvFails(arkode_mem, &nlcf); - check_flag(&flag, "ARKStepGetNumLinConvFails", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + check_flag(&flag, "ARKodeGetNumLinIters", 1); + flag = ARKodeGetNumJtimesEvals(arkode_mem, &nJv); + check_flag(&flag, "ARKodeGetNumJtimesEvals", 1); + flag = ARKodeGetNumLinConvFails(arkode_mem, &nlcf); + check_flag(&flag, "ARKodeGetNumLinConvFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -232,7 +232,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free vectors */ free(udata); /* Free user data */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_heat1D_adapt.c b/examples/arkode/C_serial/ark_heat1D_adapt.c index 2852bffc4a..45a8ff63fb 100644 --- a/examples/arkode/C_serial/ark_heat1D_adapt.c +++ b/examples/arkode/C_serial/ark_heat1D_adapt.c @@ -161,35 +161,35 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetUserData(arkode_mem, - (void*)udata); /* Pass udata to user functions */ - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, + (void*)udata); /* Pass udata to user functions */ + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 10000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } flag = ARKStepSetAdaptivityMethod(arkode_mem, 2, 1, 0, NULL); /* Set adaptivity method */ - if (check_flag(&flag, "ARKStepSetAdaptivityMethod", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, 0); /* Set predictor method */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } + if (check_flag(&flag, "ARKodeSetAdaptivityMethod", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, 0); /* Set predictor method */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } /* Specify linearly implicit RHS, with time-dependent Jacobian */ - flag = ARKStepSetLinear(arkode_mem, 1); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkode_mem, 1); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } /* Initialize PCG solver -- no preconditioning, with up to N iterations */ LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKStep */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + NULL); /* Attach linear solver to ARKode */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; olddt = ZERO; @@ -204,22 +204,22 @@ int main(void) while (t < Tf) { /* "set" routines */ - flag = ARKStepSetStopTime(arkode_mem, Tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, Tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } /* call integrator */ - flag = ARKStepEvolve(arkode_mem, Tf, y, &t, ARK_ONE_STEP); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(arkode_mem, Tf, y, &t, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } /* "get" routines */ - flag = ARKStepGetLastStep(arkode_mem, &olddt); - if (check_flag(&flag, "ARKStepGetLastStep", 1)) { return 1; } - flag = ARKStepGetCurrentStep(arkode_mem, &newdt); - if (check_flag(&flag, "ARKStepGetCurrentStep", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = ARKStepGetNumLinIters(arkode_mem, &nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return 1; } + flag = ARKodeGetLastStep(arkode_mem, &olddt); + if (check_flag(&flag, "ARKodeGetLastStep", 1)) { return 1; } + flag = ARKodeGetCurrentStep(arkode_mem, &newdt); + if (check_flag(&flag, "ARKodeGetCurrentStep", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumLinIters(arkode_mem, &nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return 1; } /* print current solution stats */ iout++; @@ -262,18 +262,18 @@ int main(void) y = y2; y2 = yt; - /* call ARKStepResize to notify integrator of change in mesh */ - flag = ARKStepResize(arkode_mem, y, hscale, t, NULL, NULL); - if (check_flag(&flag, "ARKStepResize", 1)) { return 1; } + /* call ARKodeResize to notify integrator of change in mesh */ + flag = ARKodeResize(arkode_mem, y, hscale, t, NULL, NULL); + if (check_flag(&flag, "ARKodeResize", 1)) { return 1; } - /* destroy and re-allocate linear solver memory; reattach to ARKStep interface */ + /* destroy and re-allocate linear solver memory; reattach to ARKode interface */ SUNLinSolFree(LS); LS = SUNLinSol_PCG(y, 0, (int)N, ctx); if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } - flag = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacTimes(arkode_mem, NULL, Jac); - if (check_flag(&flag, "ARKStepSetJacTimes", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacTimes(arkode_mem, NULL, Jac); + if (check_flag(&flag, "ARKodeSetJacTimes", 1)) { return 1; } } printf(" --------------------------------------------------------------------" "--------------------\n"); @@ -290,7 +290,7 @@ int main(void) N_VDestroy(y); /* Free vectors */ free(udata->x); /* Free user data */ free(udata); - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_kepler.c b/examples/arkode/C_serial/ark_kepler.c index f6fd9982d5..f298389049 100644 --- a/examples/arkode/C_serial/ark_kepler.c +++ b/examples/arkode/C_serial/ark_kepler.c @@ -161,23 +161,23 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) /* Optional: enable temporal root-finding */ if (count_orbits) { - SPRKStepRootInit(arkode_mem, 1, rootfn); - if (check_retval(&retval, "SPRKStepRootInit", 1)) { return 1; } + ARKodeRootInit(arkode_mem, 1, rootfn); + if (check_retval(&retval, "ARKodeRootInit", 1)) { return 1; } } retval = SPRKStepSetMethodName(arkode_mem, method_name); if (check_retval(&retval, "SPRKStepSetMethodName", 1)) { return 1; } - retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } + retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } if (step_mode == 0) { - retval = SPRKStepSetFixedStep(arkode_mem, dt); - if (check_retval(&retval, "SPRKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, dt); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } - retval = SPRKStepSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 1); - if (check_retval(&retval, "SPRKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 1); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } } else { @@ -186,8 +186,8 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) return 1; } - retval = SPRKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "SPRKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } } else if (stepper == 1) { @@ -198,21 +198,21 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) if (count_orbits) { - ARKStepRootInit(arkode_mem, 1, rootfn); - if (check_retval(&retval, "ARKStepRootInit", 1)) { return 1; } + ARKodeRootInit(arkode_mem, 1, rootfn); + if (check_retval(&retval, "ARKodeRootInit", 1)) { return 1; } } - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } - retval = ARKStepSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 1); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, ((long int)ceil(Tf / dt)) + 1); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } - if (step_mode == 0) { retval = ARKStepSetFixedStep(arkode_mem, dt); } + if (step_mode == 0) { retval = ARKodeSetFixedStep(arkode_mem, dt); } else { - retval = ARKStepSStolerances(arkode_mem, dt, dt); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, dt, dt); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } } } @@ -264,15 +264,15 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) exact requested output time will not be hit (even with a fixed time-step due to roundoff error accumulation) and interpolation will be used to get the solution at the output time. */ - if (args->use_tstop) { SPRKStepSetStopTime(arkode_mem, tout); } - retval = SPRKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + if (args->use_tstop) { ARKodeSetStopTime(arkode_mem, tout); } + retval = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); if (retval == ARK_ROOT_RETURN) { num_orbits += SUN_RCONST(0.5); fprintf(stdout, "ROOT RETURN:\t"); - SPRKStepGetRootInfo(arkode_mem, &rootsfound); + ARKodeGetRootInfo(arkode_mem, &rootsfound); fprintf(stdout, " g[0] = %3d, y[0] = %3Lg, y[1] = %3Lg, num. orbits is now %.2Lf\n", rootsfound, (long double)ydata[0], (long double)ydata[1], (long double)num_orbits); @@ -311,15 +311,15 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) exact requested output time will not be hit (even with a fixed time-step due to roundoff error accumulation) and interpolation will be used to get the solution at the output time. */ - if (args->use_tstop) { ARKStepSetStopTime(arkode_mem, tout); } - retval = ARKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + if (args->use_tstop) { ARKodeSetStopTime(arkode_mem, tout); } + retval = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); if (retval == ARK_ROOT_RETURN) { num_orbits += SUN_RCONST(0.5); fprintf(stdout, "ROOT RETURN:\t"); - ARKStepGetRootInfo(arkode_mem, &rootsfound); + ARKodeGetRootInfo(arkode_mem, &rootsfound); fprintf(stdout, " g[0] = %3d, y[0] = %3Lg, y[1] = %3Lg, num. orbits is now %.2Lf\n", rootsfound, (long double)ydata[0], (long double)ydata[1], (long double)num_orbits); @@ -361,17 +361,8 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) fclose(solution_fp); if (NLS) { SUNNonlinSolFree(NLS); } N_VDestroy(y); - if (stepper == 0) - { - SPRKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); - SPRKStepFree(&arkode_mem); - } - else - { - ARKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); - ARKStepFree(&arkode_mem); - } - + ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + ARKodeFree(&arkode_mem); return 0; } diff --git a/examples/arkode/C_serial/ark_kpr_mri.c b/examples/arkode/C_serial/ark_kpr_mri.c index af9fad93a0..6ba73c89ae 100644 --- a/examples/arkode/C_serial/ark_kpr_mri.c +++ b/examples/arkode/C_serial/ark_kpr_mri.c @@ -378,12 +378,12 @@ int main(int argc, char* argv[]) if (check_retval((void*)Af, "SUNDenseMatrix", 0)) { return 1; } LSf = SUNLinSol_Dense(y, Af, ctx); if (check_retval((void*)LSf, "SUNLinSol_Dense", 0)) { return 1; } - retval = ARKStepSetLinearSolver(inner_arkode_mem, LSf, Af); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } - retval = ARKStepSetJacFn(inner_arkode_mem, Jn); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } - retval = ARKStepSStolerances(inner_arkode_mem, reltol, abstol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(inner_arkode_mem, LSf, Af); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(inner_arkode_mem, Jn); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSStolerances(inner_arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } ARKodeButcherTable_Free(B); break; case (3): /* no fast dynamics ('evolve' explicitly w/ erk-3-3) */ @@ -409,12 +409,12 @@ int main(int argc, char* argv[]) } /* Set the user data pointer */ - retval = ARKStepSetUserData(inner_arkode_mem, (void*)rpar); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(inner_arkode_mem, (void*)rpar); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -485,12 +485,12 @@ int main(int argc, char* argv[]) if (check_retval((void*)As, "SUNDenseMatrix", 0)) { return 1; } LSs = SUNLinSol_Dense(y, As, ctx); if (check_retval((void*)LSs, "SUNLinSol_Dense", 0)) { return 1; } - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } - retval = MRIStepSetJacFn(arkode_mem, Jn); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jn); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } break; case (7): /* MRI-GARK-ESDIRK34a, solve-decoupled slow solver */ arkode_mem = MRIStepCreate(NULL, fs, T0, y, inner_stepper, ctx); @@ -503,12 +503,12 @@ int main(int argc, char* argv[]) if (check_retval((void*)As, "SUNDenseMatrix", 0)) { return 1; } LSs = SUNLinSol_Dense(y, As, ctx); if (check_retval((void*)LSs, "SUNLinSol_Dense", 0)) { return 1; } - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } - retval = MRIStepSetJacFn(arkode_mem, Js); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Js); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } break; case (8): /* IMEX-MRI-GARK3b, solve-decoupled slow solver */ arkode_mem = MRIStepCreate(fse, fsi, T0, y, inner_stepper, ctx); @@ -521,12 +521,12 @@ int main(int argc, char* argv[]) if (check_retval((void*)As, "SUNDenseMatrix", 0)) { return 1; } LSs = SUNLinSol_Dense(y, As, ctx); if (check_retval((void*)LSs, "SUNLinSol_Dense", 0)) { return 1; } - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } - retval = MRIStepSetJacFn(arkode_mem, Jsi); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jsi); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } break; case (9): /* IMEX-MRI-GARK4, solve-decoupled slow solver */ arkode_mem = MRIStepCreate(fse, fsi, T0, y, inner_stepper, ctx); @@ -539,25 +539,25 @@ int main(int argc, char* argv[]) if (check_retval((void*)As, "SUNDenseMatrix", 0)) { return 1; } LSs = SUNLinSol_Dense(y, As, ctx); if (check_retval((void*)LSs, "SUNLinSol_Dense", 0)) { return 1; } - retval = MRIStepSetLinearSolver(arkode_mem, LSs, As); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } - retval = MRIStepSetJacFn(arkode_mem, Jsi); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } - retval = MRIStepSStolerances(arkode_mem, reltol, abstol); - if (check_retval(&retval, "MRIStepSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LSs, As); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jsi); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, reltol, abstol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } break; } /* Set the user data pointer */ - retval = MRIStepSetUserData(arkode_mem, (void*)rpar); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)rpar); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } - retval = MRIStepSetDeduceImplicitRhs(arkode_mem, deduce); - if (check_retval(&retval, "MRIStepSetDeduceImplicitRhs", 1)) { return 1; } + retval = ARKodeSetDeduceImplicitRhs(arkode_mem, deduce); + if (check_retval(&retval, "ARKodeSetDeduceImplicitRhs", 1)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* * Integrate ODE @@ -574,7 +574,7 @@ int main(int argc, char* argv[]) SUNRabs(NV_Ith_S(y, 0) - utrue(T0, rpar)), SUNRabs(NV_Ith_S(y, 1) - vtrue(T0, rpar))); - /* Main time-stepping loop: calls MRIStepEvolve to perform the + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; @@ -593,8 +593,8 @@ int main(int argc, char* argv[]) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* access/print solution and error */ uerr = SUNRabs(NV_Ith_S(y, 0) - utrue(t, rpar)); @@ -624,14 +624,14 @@ int main(int argc, char* argv[]) */ /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nff, &tmp); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); @@ -656,10 +656,10 @@ int main(int argc, char* argv[]) if ((solve_type == 4) || (solve_type == 7) || (solve_type == 8) || (solve_type == 9)) { - retval = MRIStepGetNonlinSolvStats(arkode_mem, &nnis, &nncs); - check_retval(&retval, "MRIStepGetNonlinSolvStats", 1); - retval = MRIStepGetNumJacEvals(arkode_mem, &njes); - check_retval(&retval, "MRIStepGetNumJacEvals", 1); + retval = ARKodeGetNonlinSolvStats(arkode_mem, &nnis, &nncs); + check_retval(&retval, "ARKodeGetNonlinSolvStats", 1); + retval = ARKodeGetNumJacEvals(arkode_mem, &njes); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf(" Slow Newton iters = %li\n", nnis); printf(" Slow Newton conv fails = %li\n", nncs); printf(" Slow Jacobian evals = %li\n", njes); @@ -668,10 +668,10 @@ int main(int argc, char* argv[]) /* Get/print fast integrator implicit solver statistics */ if (solve_type == 2) { - retval = ARKStepGetNonlinSolvStats(inner_arkode_mem, &nnif, &nncf); - check_retval(&retval, "ARKStepGetNonlinSolvStats", 1); - retval = ARKStepGetNumJacEvals(inner_arkode_mem, &njef); - check_retval(&retval, "ARKStepGetNumJacEvals", 1); + retval = ARKodeGetNonlinSolvStats(inner_arkode_mem, &nnif, &nncf); + check_retval(&retval, "ARKodeGetNonlinSolvStats", 1); + retval = ARKodeGetNumJacEvals(inner_arkode_mem, &njef); + check_retval(&retval, "ARKodeGetNumJacEvals", 1); printf(" Fast Newton iters = %li\n", nnif); printf(" Fast Newton conv fails = %li\n", nncf); printf(" Fast Jacobian evals = %li\n", njef); @@ -684,9 +684,9 @@ int main(int argc, char* argv[]) SUNLinSolFree(LSf); /* free fast linear solver */ SUNMatDestroy(As); /* free fast matrix */ SUNLinSolFree(LSs); /* free fast linear solver */ - ARKStepFree(&inner_arkode_mem); /* Free fast integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free fast integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free slow integrator memory */ + ARKodeFree(&arkode_mem); /* Free slow integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/C_serial/ark_onewaycouple_mri.c b/examples/arkode/C_serial/ark_onewaycouple_mri.c index a0842f2736..d6993383fe 100644 --- a/examples/arkode/C_serial/ark_onewaycouple_mri.c +++ b/examples/arkode/C_serial/ark_onewaycouple_mri.c @@ -144,8 +144,8 @@ int main(void) if (check_retval(&retval, "ARKStepSetTableNum", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -165,8 +165,8 @@ int main(void) if (check_retval((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* * Integrate ODE @@ -181,7 +181,7 @@ int main(void) " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2), error); - /* Main time-stepping loop: calls MRIStepEvolve to perform the + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; @@ -195,8 +195,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* compute the analytic solution */ retval = ans(t, ytrue, NULL); @@ -226,14 +226,14 @@ int main(void) */ /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nff, &tmp); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); @@ -245,9 +245,9 @@ int main(void) /* Clean up and return */ N_VDestroy(y); /* Free y vector */ N_VDestroy(ytrue); /* Free ytrue vector */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c index b11cc23b61..65a4ca73bf 100644 --- a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c +++ b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c @@ -145,16 +145,16 @@ int main(void) if (check_retval((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Attach user data to fast integrator */ - retval = ARKStepSetUserData(inner_arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(inner_arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the fast method */ retval = ARKStepSetTableNum(inner_arkode_mem, -1, ARKODE_KNOTH_WOLKE_3_3); if (check_retval(&retval, "ARKStepSetTableNum", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -174,16 +174,16 @@ int main(void) if (check_retval((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } /* Pass udata to user functions */ - retval = MRIStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Increase max num steps */ - retval = MRIStepSetMaxNumSteps(arkode_mem, 10000); - if (check_retval(&retval, "MRIStepSetMaxNumSteps", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 10000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* * Integrate ODE @@ -202,7 +202,7 @@ int main(void) for (i = 0; i < N; i++) { fprintf(UFID, " %.16" ESYM "", data[i]); } fprintf(UFID, "\n"); - /* Main time-stepping loop: calls MRIStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; dTout = (Tf - T0) / Nt; @@ -213,8 +213,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* print solution stats and output results to disk */ printf(" %10.6" FSYM " %10.6f\n", t, sqrt(N_VDotProd(y, y) / N)); @@ -230,23 +230,23 @@ int main(void) /* Print final statistics to the screen */ printf("\nFinal Slow Statistics:\n"); - retval = MRIStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + retval = ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); printf("\nFinal Fast Statistics:\n"); - retval = ARKStepPrintAllStats(inner_arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + retval = ARKodePrintAllStats(inner_arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); /* Print final statistics to a file in CSV format */ FID = fopen("ark_reaction_diffusion_mri_slow_stats.csv", "w"); - retval = MRIStepPrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); + retval = ARKodePrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); fclose(FID); FID = fopen("ark_reaction_diffusion_mri_fast_stats.csv", "w"); - retval = ARKStepPrintAllStats(inner_arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); + retval = ARKodePrintAllStats(inner_arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); fclose(FID); /* Clean up and return */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ free(udata); /* Free user data */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_robertson.c b/examples/arkode/C_serial/ark_robertson.c index b4e47e214d..2456ef7da8 100644 --- a/examples/arkode/C_serial/ark_robertson.c +++ b/examples/arkode/C_serial/ark_robertson.c @@ -117,23 +117,23 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetInitStep(arkode_mem, h0); /* Set custom initial step */ - if (check_flag(&flag, "ARKStepSetInitStep", 1)) { return 1; } - flag = ARKStepSetMaxErrTestFails(arkode_mem, - 20); /* Increase max error test fails */ - if (check_flag(&flag, "ARKStepSetMaxErrTestFails", 1)) { return 1; } - flag = ARKStepSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ - if (check_flag(&flag, "ARKStepSetMaxNonlinIters", 1)) { return 1; } - flag = ARKStepSetNonlinConvCoef(arkode_mem, - SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, - 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetInitStep(arkode_mem, h0); /* Set custom initial step */ + if (check_flag(&flag, "ARKodeSetInitStep", 1)) { return 1; } + flag = ARKodeSetMaxErrTestFails(arkode_mem, + 20); /* Increase max error test fails */ + if (check_flag(&flag, "ARKodeSetMaxErrTestFails", 1)) { return 1; } + flag = ARKodeSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ + if (check_flag(&flag, "ARKodeSetMaxNonlinIters", 1)) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, + SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, + 1); /* Specify maximum-order predictor */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Initialize dense matrix data structure and solver */ A = SUNDenseMatrix(NEQ, NEQ, ctx); @@ -142,11 +142,11 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -156,7 +156,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -166,8 +166,8 @@ int main(void) NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.3" ESYM " %12.5" ESYM " %12.5" ESYM " %12.5" ESYM "\n", /* access/print solution */ t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -189,11 +189,11 @@ int main(void) /* Print final statistics to the screen */ printf("\nFinal Statistics:\n"); - flag = ARKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + flag = ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); /* Print final statistics to a file in CSV format */ FID = fopen("ark_robertson_stats.csv", "w"); - flag = ARKStepPrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); + flag = ARKodePrintAllStats(arkode_mem, FID, SUN_OUTPUTFORMAT_CSV); fclose(FID); /* check the solution error */ @@ -201,7 +201,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_robertson_constraints.c b/examples/arkode/C_serial/ark_robertson_constraints.c index 43b4718ebc..bc4f2d9345 100644 --- a/examples/arkode/C_serial/ark_robertson_constraints.c +++ b/examples/arkode/C_serial/ark_robertson_constraints.c @@ -127,25 +127,25 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetInitStep(arkode_mem, h0); /* Set custom initial step */ - if (check_flag(&flag, "ARKStepSetInitStep", 1)) { return 1; } - flag = ARKStepSetMaxErrTestFails(arkode_mem, - 20); /* Increase max error test fails */ - if (check_flag(&flag, "ARKStepSetMaxErrTestFails", 1)) { return 1; } - flag = ARKStepSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ - if (check_flag(&flag, "ARKStepSetMaxNonlinIters", 1)) { return 1; } - flag = ARKStepSetNonlinConvCoef(arkode_mem, - SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, - 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetConstraints(arkode_mem, constraints); /* Set constraints */ - if (check_flag(&flag, "ARKStepSetConstraints", 1)) { return 1; } + flag = ARKodeSetInitStep(arkode_mem, h0); /* Set custom initial step */ + if (check_flag(&flag, "ARKodeSetInitStep", 1)) { return 1; } + flag = ARKodeSetMaxErrTestFails(arkode_mem, + 20); /* Increase max error test fails */ + if (check_flag(&flag, "ARKodeSetMaxErrTestFails", 1)) { return 1; } + flag = ARKodeSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ + if (check_flag(&flag, "ARKodeSetMaxNonlinIters", 1)) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, + SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, + 1); /* Specify maximum-order predictor */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, reltol, abstol); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetConstraints(arkode_mem, constraints); /* Set constraints */ + if (check_flag(&flag, "ARKodeSetConstraints", 1)) { return 1; } /* Initialize dense matrix data structure and solver */ A = SUNDenseMatrix(NEQ, NEQ, ctx); @@ -154,11 +154,11 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -168,7 +168,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; tout = T0 + dTout; @@ -178,8 +178,8 @@ int main(void) NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); for (iout = 0; iout < Nt; iout++) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %10.3" ESYM " %12.5" ESYM " %12.5" ESYM " %12.5" ESYM "\n", /* access/print solution */ t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -200,28 +200,28 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumStepSolveFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumStepSolveFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &nnf); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); - flag = ARKStepGetNumConstrFails(arkode_mem, &nctf); - check_flag(&flag, "ARKStepGetNumConstrFails", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumStepSolveFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumStepSolveFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &nnf); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); + flag = ARKodeGetNumConstrFails(arkode_mem, &nctf); + check_flag(&flag, "ARKodeGetNumConstrFails", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -241,7 +241,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ N_VDestroy(constraints); /* Free constraints vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_robertson_root.c b/examples/arkode/C_serial/ark_robertson_root.c index be0782279c..1b2c7864aa 100644 --- a/examples/arkode/C_serial/ark_robertson_root.c +++ b/examples/arkode/C_serial/ark_robertson_root.c @@ -129,25 +129,24 @@ int main(void) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Set routines */ - flag = ARKStepSetMaxErrTestFails(arkode_mem, - 20); /* Increase max error test fails */ - if (check_flag(&flag, "ARKStepSetMaxErrTestFails", 1)) { return 1; } - flag = ARKStepSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ - if (check_flag(&flag, "ARKStepSetMaxNonlinIters", 1)) { return 1; } - flag = ARKStepSetNonlinConvCoef(arkode_mem, - SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - flag = ARKStepSetPredictorMethod(arkode_mem, - 1); /* Specify maximum-order predictor */ - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } - flag = ARKStepSVtolerances(arkode_mem, reltol, atols); /* Specify tolerances */ - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSetMaxErrTestFails(arkode_mem, + 20); /* Increase max error test fails */ + if (check_flag(&flag, "ARKodeSetMaxErrTestFails", 1)) { return 1; } + flag = ARKodeSetMaxNonlinIters(arkode_mem, 8); /* Increase max nonlin iters */ + if (check_flag(&flag, "ARKodeSetMaxNonlinIters", 1)) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkode_mem, + SUN_RCONST(1.e-7)); /* Set nonlinear convergence coeff. */ + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 100000); /* Increase max num steps */ + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkode_mem, 1); /* Specify maximum-order predictor */ + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSVtolerances(arkode_mem, reltol, atols); /* Specify tolerances */ + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* Specify the root-finding function, having 2 equations */ - flag = ARKStepRootInit(arkode_mem, 2, g); - if (check_flag(&flag, "ARKStepRootInit", 1)) { return 1; } + flag = ARKodeRootInit(arkode_mem, 2, g); + if (check_flag(&flag, "ARKodeRootInit", 1)) { return 1; } /* Initialize dense matrix data structure and solver */ A = SUNDenseMatrix(NEQ, NEQ, ctx); @@ -156,11 +155,11 @@ int main(void) if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /* Linear solver interface */ - flag = ARKStepSetLinearSolver(arkode_mem, LS, - A); /* Attach matrix and linear solver */ - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkode_mem, LS, + A); /* Attach matrix and linear solver */ + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkode_mem, Jac); /* Set the Jacobian routine */ + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } /* Open output stream for results, output comment line */ UFID = fopen("solution.txt", "w"); @@ -170,7 +169,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls ARKStepEvolve to perform the integration, then + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; printf(" t u v w\n"); @@ -181,8 +180,8 @@ int main(void) iout = 0; while (1) { - flag = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKStepEvolve", 1)) { break; } + flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } printf(" %12.5" ESYM " %12.5" ESYM " %12.5" ESYM " %12.5" ESYM "\n", /* access/print solution */ t, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); @@ -190,8 +189,8 @@ int main(void) NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); if (flag == ARK_ROOT_RETURN) { /* check if a root was found */ - rtflag = ARKStepGetRootInfo(arkode_mem, rootsfound); - if (check_flag(&rtflag, "ARKStepGetRootInfo", 1)) { return 1; } + rtflag = ARKodeGetRootInfo(arkode_mem, rootsfound); + if (check_flag(&rtflag, "ARKodeGetRootInfo", 1)) { return 1; } printf(" rootsfound[] = %3d %3d\n", rootsfound[0], rootsfound[1]); } if (flag >= 0) @@ -210,28 +209,28 @@ int main(void) fclose(UFID); /* Print some final statistics */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); flag = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_flag(&flag, "ARKStepGetNumRhsEvals", 1); - flag = ARKStepGetNumLinSolvSetups(arkode_mem, &nsetups); - check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1); - flag = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_flag(&flag, "ARKStepGetNumErrTestFails", 1); - flag = ARKStepGetNumStepSolveFails(arkode_mem, &ncfn); - check_flag(&flag, "ARKStepGetNumStepSolveFails", 1); - flag = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1); - flag = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &nnf); - check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1); - flag = ARKStepGetNumJacEvals(arkode_mem, &nje); - check_flag(&flag, "ARKStepGetNumJacEvals", 1); - flag = ARKStepGetNumLinRhsEvals(arkode_mem, &nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); - flag = ARKStepGetNumGEvals(arkode_mem, &nge); - check_flag(&flag, "ARKStepGetNumGEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkode_mem, &nsetups); + check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1); + flag = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_flag(&flag, "ARKodeGetNumErrTestFails", 1); + flag = ARKodeGetNumStepSolveFails(arkode_mem, &ncfn); + check_flag(&flag, "ARKodeGetNumStepSolveFails", 1); + flag = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1); + flag = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &nnf); + check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1); + flag = ARKodeGetNumJacEvals(arkode_mem, &nje); + check_flag(&flag, "ARKodeGetNumJacEvals", 1); + flag = ARKodeGetNumLinRhsEvals(arkode_mem, &nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); + flag = ARKodeGetNumGEvals(arkode_mem, &nge); + check_flag(&flag, "ARKodeGetNumGEvals", 1); printf("\nFinal Solver Statistics:\n"); printf(" Internal solver steps = %li (attempted = %li)\n", nst, nst_a); @@ -248,7 +247,7 @@ int main(void) /* Clean up and return with successful completion */ N_VDestroy(y); /* Free y vector */ N_VDestroy(atols); /* Free atols vector */ - ARKStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNLinSolFree(LS); /* Free linear solver */ SUNMatDestroy(A); /* Free A matrix */ SUNContext_Free(&ctx); /* Free context */ diff --git a/examples/arkode/C_serial/ark_twowaycouple_mri.c b/examples/arkode/C_serial/ark_twowaycouple_mri.c index ec05170aec..d44204d38f 100644 --- a/examples/arkode/C_serial/ark_twowaycouple_mri.c +++ b/examples/arkode/C_serial/ark_twowaycouple_mri.c @@ -123,8 +123,8 @@ int main(void) if (check_retval(&retval, "ARKStepSetTableNum", 1)) { return 1; } /* Set the fast step size */ - retval = ARKStepSetFixedStep(inner_arkode_mem, hf); - if (check_retval(&retval, "ARKStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(inner_arkode_mem, hf); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* Create inner stepper */ retval = ARKStepCreateMRIStepInnerStepper(inner_arkode_mem, &inner_stepper); @@ -144,8 +144,8 @@ int main(void) if (check_retval((void*)arkode_mem, "MRIStepCreate", 0)) { return 1; } /* Set the slow step size */ - retval = MRIStepSetFixedStep(arkode_mem, hs); - if (check_retval(&retval, "MRIStepSetFixedStep", 1)) { return 1; } + retval = ARKodeSetFixedStep(arkode_mem, hs); + if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } /* * Integrate ODE @@ -159,7 +159,7 @@ int main(void) fprintf(UFID, " %.16" ESYM " %.16" ESYM " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0), NV_Ith_S(y, 1), NV_Ith_S(y, 2)); - /* Main time-stepping loop: calls MRIStepEvolve to perform the + /* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then prints results. Stops when the final time has been reached */ t = T0; @@ -172,8 +172,8 @@ int main(void) for (iout = 0; iout < Nt; iout++) { /* call integrator */ - retval = MRIStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { break; } /* access/print solution and error */ printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", t, @@ -193,14 +193,14 @@ int main(void) */ /* Get some slow integrator statistics */ - retval = MRIStepGetNumSteps(arkode_mem, &nsts); - check_retval(&retval, "MRIStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(arkode_mem, &nsts); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = MRIStepGetNumRhsEvals(arkode_mem, &nfse, &nfsi); check_retval(&retval, "MRIStepGetNumRhsEvals", 1); /* Get some fast integrator statistics */ - retval = ARKStepGetNumSteps(inner_arkode_mem, &nstf); - check_retval(&retval, "ARKStepGetNumSteps", 1); + retval = ARKodeGetNumSteps(inner_arkode_mem, &nstf); + check_retval(&retval, "ARKodeGetNumSteps", 1); retval = ARKStepGetNumRhsEvals(inner_arkode_mem, &nff, &tmp); check_retval(&retval, "ARKStepGetNumRhsEvals", 1); @@ -211,9 +211,9 @@ int main(void) /* Clean up and return */ N_VDestroy(y); /* Free y vector */ - ARKStepFree(&inner_arkode_mem); /* Free integrator memory */ + ARKodeFree(&inner_arkode_mem); /* Free integrator memory */ MRIStepInnerStepper_Free(&inner_stepper); /* Free inner stepper */ - MRIStepFree(&arkode_mem); /* Free integrator memory */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ SUNContext_Free(&ctx); /* Free context */ return 0; diff --git a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 index fc1e3c3c5d..4a0a8a5911 100644 --- a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 @@ -167,7 +167,7 @@ program main stop 1 end if - ! main time-stepping loop: calls FARKStepEvolve to perform the integration, then + ! main time-stepping loop: calls FARKodeEvolve to perform the integration, then ! prints results. Stops when the final time has been reached tcur(1) = T0 dTout = (Tf-T0)/Nt @@ -181,9 +181,9 @@ program main do iout = 1,Nt ! call integrator - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) if (ierr /= 0) then - write(*,*) 'Error in FARKStepEvolve, ierr = ', ierr, '; halting' + write(*,*) 'Error in FARKodeEvolve, ierr = ', ierr, '; halting' stop 1 endif @@ -208,7 +208,7 @@ program main print *, ' ' ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_y) ierr = FSUNContext_Free(sunctx) @@ -241,10 +241,10 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) ierr = FARKStepGetNumRhsEvals(arkode_mem, nfe, nfi) - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) print *, ' ' print *, 'Final Solver Statistics:' diff --git a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 index 86a7d97447..ad0e815ae0 100644 --- a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 @@ -328,13 +328,13 @@ program main end if ! set routines - ierr = FARKStepSStolerances(arkode_mem, reltol, abstol) + ierr = FARKodeSStolerances(arkode_mem, reltol, abstol) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSStolerances' + write(*,*) 'Error in FARKodeSStolerances' stop 1 end if - ! initialize custom matrix data structure and solver; attach to ARKStep + ! initialize custom matrix data structure and solver; attach to ARKode sunmat_A => FSUNMatNew_Fortran(Nvar, N, sunctx) if (.not. associated(sunmat_A)) then print *,'ERROR: sunmat = NULL' @@ -348,19 +348,19 @@ program main end if ! Attach matrix, linear solver, and Jacobian routine to linear solver interface - ierr = FARKStepSetLinearSolver(arkode_mem, sunls, sunmat_A) + ierr = FARKodeSetLinearSolver(arkode_mem, sunls, sunmat_A) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSetLinearSolver' + write(*,*) 'Error in FARKodeSetLinearSolver' stop 1 end if - ierr = FARKStepSetJacFn(arkode_mem, c_funloc(JacFn)) + ierr = FARKodeSetJacFn(arkode_mem, c_funloc(JacFn)) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSetJacFn' + write(*,*) 'Error in FARKodeSetJacFn' stop 1 end if - ! main time-stepping loop: calls FARKStepEvolve to perform the integration, then + ! main time-stepping loop: calls FARKodeEvolve to perform the integration, then ! prints results. Stops when the final time has been reached tcur(1) = T0 dTout = (Tf-T0)/Nt @@ -370,9 +370,9 @@ program main do iout = 1,Nt ! call integrator - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) if (ierr /= 0) then - write(*,*) 'Error in FARKStepEvolve, ierr = ', ierr, '; halting' + write(*,*) 'Error in FARKodeEvolve, ierr = ', ierr, '; halting' stop 1 endif @@ -390,7 +390,7 @@ program main call ARKStepStats(arkode_mem) ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_y) call FSUNMatDestroy(sunmat_A) ierr = FSUNLinSolFree(sunls) @@ -432,16 +432,16 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) ierr = FARKStepGetNumRhsEvals(arkode_mem, nfe, nfi) - ierr = FARKStepGetNumLinRhsEvals(arkode_mem, nfeLS) - ierr = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) - ierr = FARKStepGetNumJacEvals(arkode_mem, nje) - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) - ierr = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) - ierr = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) - ierr = FARKStepGetNumJacEvals(arkode_mem, njacevals) + ierr = FARKodeGetNumLinRhsEvals(arkode_mem, nfeLS) + ierr = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) + ierr = FARKodeGetNumJacEvals(arkode_mem, nje) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) + ierr = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) + ierr = FARKodeGetNumJacEvals(arkode_mem, njacevals) print *, ' ' print *, 'Final Solver Statistics:' diff --git a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 index 5e83ff44c7..cc1e51b503 100644 --- a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 @@ -545,9 +545,9 @@ integer(c_int) function TaskLocalNlsResidual(sunvec_zcor, sunvec_F, arkode_mem) !======= Inclusions =========== use, intrinsic :: iso_c_binding + use farkode_mod use farkode_arkstep_mod - use ode_mod, only : Neq, Reaction !======= Declarations ========= @@ -585,10 +585,10 @@ integer(c_int) function TaskLocalNlsResidual(sunvec_zcor, sunvec_F, arkode_mem) !======= Internals ============ ! get nonlinear residual data - ierr = FARKStepGetNonlinearSystemData(arkmem, tcur, zpred_ptr, z_ptr, & + ierr = FARKodeGetNonlinearSystemData(arkmem, tcur, zpred_ptr, z_ptr, & Fi_ptr, gam, sdata_ptr, user_data) if (ierr /= 0) then - print *, "Error: FARKStepGetNonlinearSystemData returned ",ierr + print *, "Error: FARKodeGetNonlinearSystemData returned ",ierr return end if @@ -639,12 +639,10 @@ integer(c_int) function TaskLocalLSolve(sunvec_delta, arkode_mem) & !======= Inclusions =========== use, intrinsic :: iso_c_binding + use farkode_mod use farkode_arkstep_mod - - use fsunmatrix_dense_mod - use ode_mod, only : Nvar, Npts, k2, k3, k4, k6 !======= Declarations ========= @@ -674,10 +672,10 @@ integer(c_int) function TaskLocalLSolve(sunvec_delta, arkode_mem) & !======= Internals ============ ! get nonlinear residual data - ierr = FARKStepGetNonlinearSystemData(arkmem, tcur, zpred_ptr, z_ptr, & + ierr = FARKodeGetNonlinearSystemData(arkmem, tcur, zpred_ptr, z_ptr, & Fi_ptr, gam, sdata_ptr, user_data) if (ierr /= 0) then - print *, "Error: FARKStepGetNonlinearSystemData returned ",ierr + print *, "Error: FARKodeGetNonlinearSystemData returned ",ierr return end if @@ -1239,23 +1237,23 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Select the method order - retval = FARKStepSetOrder(arkode_mem, order) + retval = FARKodeSetOrder(arkode_mem, order) if (retval /= 0) then - print *, "Error: FARKStepSetOrder returned ",retval + print *, "Error: FARKodeSetOrder returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify tolerances - retval = FARKStepSStolerances(arkode_mem, rtol, atol) + retval = FARKodeSStolerances(arkode_mem, rtol, atol) if (retval /= 0) then - print *, "Error: FARKStepSStolerances returned ",retval + print *, "Error: FARKodeSStolerances returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Increase the max number of steps allowed between outputs - retval = FARKStepSetMaxNumSteps(arkode_mem, int(100000, c_long)) + retval = FARKodeSetMaxNumSteps(arkode_mem, int(100000, c_long)) if (retval /= 0) then - print *, "Error: FARKStepMaxNumSteps returned ",retval + print *, "Error: FARKodeMaxNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1270,9 +1268,9 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Attach nonlinear solver - retval = FARKStepSetNonlinearSolver(arkode_mem, sun_NLS) + retval = FARKodeSetNonlinearSolver(arkode_mem, sun_NLS) if (retval /= 0) then - print *, "Error: FARKStepSetNonlinearSolver returned ",retval + print *, "Error: FARKodeSetNonlinearSolver returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1285,17 +1283,17 @@ subroutine EvolveProblemIMEX(sunvec_y) ! Attach linear solver sunmat_A => null() - retval = FARKStepSetLinearSolver(arkode_mem, sun_LS, sunmat_A) + retval = FARKodeSetLinearSolver(arkode_mem, sun_LS, sunmat_A) if (retval /= 0) then - print *, "Error: FARKStepSetLinearSolver returned ",retval + print *, "Error: FARKodeSetLinearSolver returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Attach preconditioner - retval = FARKStepSetPreconditioner(arkode_mem, c_funloc(PSetup), & + retval = FARKodeSetPreconditioner(arkode_mem, c_funloc(PSetup), & c_funloc(PSolve)) if (retval /= 0) then - print *, "Error: FARKStepSetPreconditioner returned ",retval + print *, "Error: FARKodeSetPreconditioner returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1314,9 +1312,9 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Attach nonlinear solver - retval = FARKStepSetNonlinearSolver(arkode_mem, sun_NLS) + retval = FARKodeSetNonlinearSolver(arkode_mem, sun_NLS) if (retval /= 0) then - print *, "Error: FARKStepSetNonlinearSolver returned ",retval + print *, "Error: FARKodeSetNonlinearSolver returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1343,9 +1341,9 @@ subroutine EvolveProblemIMEX(sunvec_y) do while (iout < max(nout,1)) ! Integrate to output time - retval = FARKStepEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) if (retval /= 0) then - print *, "Error: FARKStepEvolve returned ",retval + print *, "Error: FARKodeEvolve returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1369,15 +1367,15 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Get final statistics - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FARKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FARKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1387,41 +1385,41 @@ subroutine EvolveProblemIMEX(sunvec_y) call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumErrTestFails(arkode_mem, netf) + retval = FARKodeGetNumErrTestFails(arkode_mem, netf) if (retval /= 0) then - print *, "Error: FARKStepGetNumErrTestFails returned ",retval + print *, "Error: FARKodeGetNumErrTestFails returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumNonlinSolvIters(arkode_mem, nni) + retval = FARKodeGetNumNonlinSolvIters(arkode_mem, nni) if (retval /= 0) then - print *, "Error: FARKStepGetNumNonlinSolvIters returned ",retval + print *, "Error: FARKodeGetNumNonlinSolvIters returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumNonlinSolvConvFails(arkode_mem, ncfn) + retval = FARKodeGetNumNonlinSolvConvFails(arkode_mem, ncfn) if (retval /= 0) then - print *, "Error: FARKStepGetNumNonlinSolvConvFails returned ",retval + print *, "Error: FARKodeGetNumNonlinSolvConvFails returned ",retval call MPI_Abort(comm, 1, ierr) end if if (global) then - retval = FARKStepGetNumLinIters(arkode_mem, nli) + retval = FARKodeGetNumLinIters(arkode_mem, nli) if (retval /= 0) then - print *, "Error: FARKStepGetNumLinIters returned ",retval + print *, "Error: FARKodeGetNumLinIters returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecEvals(arkode_mem, npre) + retval = FARKodeGetNumPrecEvals(arkode_mem, npre) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecEvals returned ",retval + print *, "Error: FARKodeGetNumPrecEvals returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecSolves(arkode_mem, npsol) + retval = FARKodeGetNumPrecSolves(arkode_mem, npsol) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecSolves returned ",retval + print *, "Error: FARKodeGetNumPrecSolves returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1455,7 +1453,7 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) ! Free nonlinear solver retval = FSUNNonlinSolFree(sun_NLS) @@ -1527,23 +1525,23 @@ subroutine EvolveProblemExplicit(sunvec_y) end if ! Select the method order - retval = FERKStepSetOrder(arkode_mem, order) + retval = FARKodeSetOrder(arkode_mem, order) if (retval /= 0) then - print *, "Error: FERKStepSetOrder returned ",retval + print *, "Error: FARKodeSetOrder returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify tolerances - retval = FERKStepSStolerances(arkode_mem, rtol, atol) + retval = FARKodeSStolerances(arkode_mem, rtol, atol) if (retval /= 0) then - print *, "Error: FERKStepSStolerances returned ",retval + print *, "Error: FARKodeSStolerances returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Increase the max number of steps allowed between outputs - retval = FERKStepSetMaxNumSteps(arkode_mem, int(100000, c_long)) + retval = FARKodeSetMaxNumSteps(arkode_mem, int(100000, c_long)) if (retval /= 0) then - print *, "Error: FERKStepMaxNumSteps returned ",retval + print *, "Error: FARKodeMaxNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1568,9 +1566,9 @@ subroutine EvolveProblemExplicit(sunvec_y) do while (iout < nout) ! Integrate to output time - retval = FERKStepEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) if (retval /= 0) then - print *, "Error: FERKStepEvolve returned ",retval + print *, "Error: FARKodeEvolve returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1594,15 +1592,15 @@ subroutine EvolveProblemExplicit(sunvec_y) end if ! Get final statistics - retval = FERKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FERKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FERKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1612,9 +1610,9 @@ subroutine EvolveProblemExplicit(sunvec_y) call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumErrTestFails(arkode_mem, netf) + retval = FARKodeGetNumErrTestFails(arkode_mem, netf) if (retval /= 0) then - print *, "Error: FERKStepGetNumErrTestFails returned ",retval + print *, "Error: FARKodeGetNumErrTestFails returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -1628,7 +1626,7 @@ subroutine EvolveProblemExplicit(sunvec_y) end if ! Clean up - call FERKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) end subroutine EvolveProblemExplicit @@ -1640,8 +1638,6 @@ subroutine WriteOutput(t, sunvec_y) use, intrinsic :: iso_c_binding use fsundials_core_mod use farkode_mod ! Access ARKode - use farkode_erkstep_mod ! Access ERKStep - use ode_mod, only : Nvar, nprocs, myid, Erecv, Nx, Npts, monitor, nout, & umask, vmask, wmask diff --git a/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.f90 b/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.f90 index 7e849b7830..7cf6efd0f9 100644 --- a/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.f90 @@ -268,9 +268,9 @@ program driver ! Attach the linear solver (with NULL SUNMatrix object) sunmat_A => null() - retval = FARKStepSetLinearSolver(arkode_mem, sunls, sunmat_A) + retval = FARKodeSetLinearSolver(arkode_mem, sunls, sunmat_A) if (retval /= 0) then - print *, 'Error in FARKStepSetLinearSolver, retval = ', retval + print *, 'Error in FARKodeSetLinearSolver, retval = ', retval call MPI_Abort(comm, 1, ierr) end if @@ -281,9 +281,9 @@ program driver end if ! Specify tolerances - retval = FARKStepSStolerances(arkode_mem, rtol, atol) + retval = FARKodeSStolerances(arkode_mem, rtol, atol) if (retval /= 0) then - print *, "Error: FARKStepSStolerances returned ",retval + print *, "Error: FARKodeSStolerances returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -330,7 +330,7 @@ program driver if (iPretype == 1 .and. outproc) write(6,*) " Preconditioning on left:" - ! Main time-stepping loop: calls FARKStepEvolve to perform the integration, + ! Main time-stepping loop: calls FARKodeEvolve to perform the integration, ! then prints results. Stops when the final time has been reached t(1) = T0 dTout = 0.1d0 @@ -342,22 +342,22 @@ program driver do ioutput=1,Nt ! Integrate to output time - retval = FARKStepEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) if (retval /= 0) then - print *, "Error: FARKStepEvolve returned ",retval + print *, "Error: FARKodeEvolve returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Retrieve solver statistics - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FARKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FARKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -395,15 +395,15 @@ program driver if (outproc) print '(a,es10.2)', "Max. absolute error is ", gerrmax ! Get final statistics - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FARKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FARKStepGetNumStepAttempts returned ", retval + print *, "Error: FARKodeGetNumStepAttempts returned ", retval call MPI_Abort(comm, 1, ierr) end if @@ -413,59 +413,59 @@ program driver call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecEvals(arkode_mem, npre) + retval = FARKodeGetNumPrecEvals(arkode_mem, npre) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecEvals returned ", retval + print *, "Error: FARKodeGetNumPrecEvals returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecSolves(arkode_mem, npsol) + retval = FARKodeGetNumPrecSolves(arkode_mem, npsol) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecSolves returned ", retval + print *, "Error: FARKodeGetNumPrecSolves returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumNonlinSolvIters(arkode_mem, nni) + retval = FARKodeGetNumNonlinSolvIters(arkode_mem, nni) if (retval /= 0) then - print *, "Error: FARKStepGetNumNonlinSolvIters returned ", retval + print *, "Error: FARKodeGetNumNonlinSolvIters returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumLinIters(arkode_mem, nli) + retval = FARKodeGetNumLinIters(arkode_mem, nli) if (retval /= 0) then - print *, "Error: FARKStepGetNumLinIters returned ", retval + print *, "Error: FARKodeGetNumLinIters returned ", retval call MPI_Abort(comm, 1, ierr) end if avdim = dble(nli) / dble(nni) - retval = FARKStepGetNumNonlinSolvConvFails(arkode_mem, ncfn) + retval = FARKodeGetNumNonlinSolvConvFails(arkode_mem, ncfn) if (retval /= 0) then - print *, "Error: FARKStepGetNumNonlinSolvConvFails returned ", retval + print *, "Error: FARKodeGetNumNonlinSolvConvFails returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumLinConvFails(arkode_mem, ncfl) + retval = FARKodeGetNumLinConvFails(arkode_mem, ncfl) if (retval /= 0) then - print *, "Error: FARKStepGetNumLinSolvConvFails returned ", retval + print *, "Error: FARKodeGetNumLinSolvConvFails returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumErrTestFails(arkode_mem, netf) + retval = FARKodeGetNumErrTestFails(arkode_mem, netf) if (retval /= 0) then - print *, "Error: FARKStepGetNumErrTestFails returned ",retval + print *, "Error: FARKodeGetNumErrTestFails returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetWorkSpace(arkode_mem, lenrw, leniw) + retval = FARKodeGetWorkSpace(arkode_mem, lenrw, leniw) if (retval /= 0) then - print *, "Error: FARKStepGetWorkSpace returned ", retval + print *, "Error: FARKodeGetWorkSpace returned ", retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetLinWorkSpace(arkode_mem, lenrwls, leniwls) + retval = FARKodeGetLinWorkSpace(arkode_mem, lenrwls, leniwls) if (retval /= 0) then - print *, "Error: FARKStepGetLinWorkSpace returned ", retval + print *, "Error: FARKodeGetLinWorkSpace returned ", retval call MPI_Abort(comm, 1, ierr) end if @@ -508,7 +508,7 @@ program driver end do ! Clean up and return with successful completion - call FARKStepFree(arkode_mem) ! free integrator memory + call FARKodeFree(arkode_mem) ! free integrator memory call FN_VDestroy(sunvec_y) ! free vector memory call MPI_Barrier(comm, ierr) call MPI_Finalize(ierr) ! Finalize MPI diff --git a/examples/arkode/F2003_parallel/ark_diag_non_f2003.f90 b/examples/arkode/F2003_parallel/ark_diag_non_f2003.f90 index 0ddb06d0d1..edfcf0d3b5 100644 --- a/examples/arkode/F2003_parallel/ark_diag_non_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_diag_non_f2003.f90 @@ -202,13 +202,13 @@ program driver end if ! Specify tolerances - retval = FERKStepSStolerances(arkode_mem, rtol, atol) + retval = FARKodeSStolerances(arkode_mem, rtol, atol) if (retval /= 0) then - print *, "Error: FERKStepSStolerances returned ",retval + print *, "Error: FARKodeSStolerances returned ",retval call MPI_Abort(comm, 1, ierr) end if - ! Main time-stepping loop: calls FERKStepEvolve to perform the + ! Main time-stepping loop: calls FARKodeEvolve to perform the ! integration, then prints results. Stops when the final time ! has been reached. t(1) = T0 @@ -221,21 +221,21 @@ program driver do ioutput=1,Nt ! Integrate to output time - retval = FERKStepEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) if (retval /= 0) then - print *, "Error: FERKStepEvolve returned ",retval + print *, "Error: FARKodeEvolve returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FERKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FERKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -273,15 +273,15 @@ program driver if (outproc) print '(a,es10.2)', "Max. absolute error is ", gerrmax ! Get final statistics - retval = FERKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FERKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FERKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -291,9 +291,9 @@ program driver call MPI_Abort(comm, 1, ierr) end if - retval = FERKStepGetNumErrTestFails(arkode_mem, netf) + retval = FARKodeGetNumErrTestFails(arkode_mem, netf) if (retval /= 0) then - print *, "Error: FERKStepGetNumErrTestFails returned ",retval + print *, "Error: FARKodeGetNumErrTestFails returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -308,7 +308,7 @@ program driver endif ! Clean up and return with successful completion - call FERKStepFree(arkode_mem) ! free integrator memory + call FARKodeFree(arkode_mem) ! free integrator memory call FN_VDestroy(sunvec_y) ! free vector memory call MPI_Barrier(comm, ierr) call MPI_Finalize(ierr) ! Finalize MPI diff --git a/examples/arkode/F2003_parallel/ark_heat2D_f2003.f90 b/examples/arkode/F2003_parallel/ark_heat2D_f2003.f90 index 50c54e0211..a58e0ad2d8 100644 --- a/examples/arkode/F2003_parallel/ark_heat2D_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_heat2D_f2003.f90 @@ -766,45 +766,45 @@ program driver ! Attach linear solver sunmat_A => null() - retval = FARKStepSetLinearSolver(arkode_mem, sun_LS, sunmat_A) + retval = FARKodeSetLinearSolver(arkode_mem, sun_LS, sunmat_A) if (retval /= 0) then - print *, "Error: FARKStepSetLinearSolver returned ",retval + print *, "Error: FARKodeSetLinearSolver returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Attach preconditioner - retval = FARKStepSetPreconditioner(arkode_mem, c_funloc(PSetup), & + retval = FARKodeSetPreconditioner(arkode_mem, c_funloc(PSetup), & c_funloc(PSolve)) if (retval /= 0) then - print *, "Error: FARKStepSetPreconditioner returned ",retval + print *, "Error: FARKodeSetPreconditioner returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify tolerances - retval = FARKStepSStolerances(arkode_mem, rtol, atol) + retval = FARKodeSStolerances(arkode_mem, rtol, atol) if (retval /= 0) then - print *, "Error: FARKStepSStolerances returned ",retval + print *, "Error: FARKodeSStolerances returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify nonlinear solver convergence coefficient - retval = FARKStepSetNonlinConvCoef(arkode_mem, nlscoef) + retval = FARKodeSetNonlinConvCoef(arkode_mem, nlscoef) if (retval /= 0) then - print *, "Error: FARKStepSetNonlinConvCoef returned ",retval + print *, "Error: FARKodeSetNonlinConvCoef returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify nonlinear solver predictor method - retval = FARKStepSetPredictorMethod(arkode_mem, int(1, c_int)) + retval = FARKodeSetPredictorMethod(arkode_mem, int(1, c_int)) if (retval /= 0) then - print *, "Error: FARKStepSetNonlinConvCoef returned ",retval + print *, "Error: FARKodeSetNonlinConvCoef returned ",retval call MPI_Abort(comm, 1, ierr) end if ! Specify that problem is linearly implicit - retval = FARKStepSetLinear(arkode_mem, int(0, c_int)) + retval = FARKodeSetLinear(arkode_mem, int(0, c_int)) if (retval /= 0) then - print *, "Error: FARKStepSetNonlinConvCoef returned ",retval + print *, "Error: FARKodeSetNonlinConvCoef returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -852,9 +852,9 @@ program driver do ioutput=1,Nt ! Integrate to output time - retval = FARKStepEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, t, ARK_NORMAL) if (retval /= 0) then - print *, "Error: FARKStepEvolve returned ",retval + print *, "Error: FARKodeEvolve returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -878,15 +878,15 @@ program driver close(101) ! Get final statistics - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, "Error: FARKStepGetNumSteps returned ",retval + print *, "Error: FARKodeGetNumSteps returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, "Error: FARKStepGetNumStepAttempts returned ",retval + print *, "Error: FARKodeGetNumStepAttempts returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -896,39 +896,39 @@ program driver call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumErrTestFails(arkode_mem, netf) + retval = FARKodeGetNumErrTestFails(arkode_mem, netf) if (retval /= 0) then - print *, "Error: FARKStepGetNumErrTestFails returned ",retval + print *, "Error: FARKodeGetNumErrTestFails returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumNonlinSolvIters(arkode_mem, nni) + retval = FARKodeGetNumNonlinSolvIters(arkode_mem, nni) if (retval /= 0) then - print *, "Error: FARKStepGetNumNonlinSolvIters returned ",retval + print *, "Error: FARKodeGetNumNonlinSolvIters returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumLinConvFails(arkode_mem, ncfn) + retval = FARKodeGetNumLinConvFails(arkode_mem, ncfn) if (retval /= 0) then - print *, "Error: FARKStepGetNumLinConvFails returned ",retval + print *, "Error: FARKodeGetNumLinConvFails returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumLinIters(arkode_mem, nli) + retval = FARKodeGetNumLinIters(arkode_mem, nli) if (retval /= 0) then - print *, "Error: FARKStepGetNumLinIters returned ",retval + print *, "Error: FARKodeGetNumLinIters returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecEvals(arkode_mem, npre) + retval = FARKodeGetNumPrecEvals(arkode_mem, npre) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecEvals returned ",retval + print *, "Error: FARKodeGetNumPrecEvals returned ",retval call MPI_Abort(comm, 1, ierr) end if - retval = FARKStepGetNumPrecSolves(arkode_mem, npsol) + retval = FARKodeGetNumPrecSolves(arkode_mem, npsol) if (retval /= 0) then - print *, "Error: FARKStepGetNumPrecSolves returned ",retval + print *, "Error: FARKodeGetNumPrecSolves returned ",retval call MPI_Abort(comm, 1, ierr) end if @@ -949,7 +949,7 @@ program driver endif ! Clean up and return with successful completion - call FARKStepFree(arkode_mem) ! free integrator memory + call FARKodeFree(arkode_mem) ! free integrator memory call FN_VDestroy(sunvec_y) ! free vector memory call FN_VDestroy(sunvec_ones) retval = FSUNLinSolFree(sun_LS) ! free linear solver diff --git a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 index 877d76062b..d7378eabd0 100644 --- a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 @@ -169,9 +169,9 @@ program main stop 1 end if - ierr = FARKStepSetLinearSolver(arkode_mem, sunls, sunmat_A) + ierr = FARKodeSetLinearSolver(arkode_mem, sunls, sunmat_A) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSetLinearSolver' + write(*,*) 'Error in FARKodeSetLinearSolver' stop 1 end if @@ -179,9 +179,9 @@ program main rtol = 1.0d-6 atol = 1.0d-10 - ierr = FARKStepSStolerances(arkode_mem, rtol, atol) + ierr = FARKodeSStolerances(arkode_mem, rtol, atol) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSStolerances, ierr = ', ierr, '; halting' + write(*,*) 'Error in FARKodeSStolerances, ierr = ', ierr, '; halting' stop 1 end if @@ -190,15 +190,15 @@ program main print *, 'ERROR: sunCtrl = NULL' stop 1 end if - ierr = FARKStepSetAdaptController(arkode_mem, sunCtrl) + ierr = FARKodeSetAdaptController(arkode_mem, sunCtrl) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSetAdaptController, ierr = ', ierr, '; halting' + write(*,*) 'Error in FARKodeSetAdaptController, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepSetNonlinConvCoef(arkode_mem, 0.01d0) + ierr = FARKodeSetNonlinConvCoef(arkode_mem, 0.01d0) if (ierr /= 0) then - write(*,*) 'Error in FARKStepSetNonlinConvCoef, ierr = ', ierr, '; halting' + write(*,*) 'Error in FARKodeSetNonlinConvCoef, ierr = ', ierr, '; halting' stop 1 end if @@ -211,9 +211,9 @@ program main print '(2x,2(es12.5,1x))', tcur, yvec(1) do outstep = 1,nout - ! call ARKStep + ! call ARKodeEvolve tout = min(tout + dtout, tend) - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) if (ierr /= 0) then write(*,*) 'Error in FARKODE, ierr = ', ierr, '; halting' stop 1 @@ -228,7 +228,7 @@ program main call ARKStepStats(arkode_mem) ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_y) call FSUNMatDestroy(sunmat_A) ierr = FSUNLinSolFree(sunls) @@ -277,15 +277,15 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, retval = ', ierr, '; halting' stop 1 end if @@ -296,57 +296,57 @@ subroutine ARKStepStats(arkode_mem) end if nfevals=nfe+nfi - ierr = FARKStepGetActualInitStep(arkode_mem, hinused) + ierr = FARKodeGetActualInitStep(arkode_mem, hinused) if (ierr /= 0) then - print *, 'Error in FARKStepGetActualInitStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetActualInitStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetLastStep(arkode_mem, hlast) + ierr = FARKodeGetLastStep(arkode_mem, hlast) if (ierr /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentStep(arkode_mem, hcur) + ierr = FARKodeGetCurrentStep(arkode_mem, hcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentTime(arkode_mem, tcur) + ierr = FARKodeGetCurrentTime(arkode_mem, tcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentTime, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentTime, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) + ierr = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumLinSolvSetups, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumLinSolvSetups, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + ierr = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) + ierr = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumJacEvals(arkode_mem, njacevals) + ierr = FARKodeGetNumJacEvals(arkode_mem, njacevals) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumJacEvals, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumJacEvals, retval = ', ierr, '; halting' stop 1 end if diff --git a/examples/arkode/F2003_serial/ark_bruss1D_FEM_klu_f2003.f90 b/examples/arkode/F2003_serial/ark_bruss1D_FEM_klu_f2003.f90 index 6389a9e7de..f272a56644 100644 --- a/examples/arkode/F2003_serial/ark_bruss1D_FEM_klu_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_bruss1D_FEM_klu_f2003.f90 @@ -1166,15 +1166,15 @@ program main stop 1 end if - ierr = FARKStepSetLinearSolver(arkode_mem, sunls_A, sunmat_A) + ierr = FARKodeSetLinearSolver(arkode_mem, sunls_A, sunmat_A) if (ierr /= 0) then - print *, 'Error in FARKStepSetLinearSolver' + print *, 'Error in FARKodeSetLinearSolver' stop 1 end if - ierr = FARKStepSetJacFn(arkode_mem, c_funloc(Jac)) + ierr = FARKodeSetJacFn(arkode_mem, c_funloc(Jac)) if (ierr /= 0) then - print *, 'Error in FARKStepSetJacFn' + print *, 'Error in FARKodeSetJacFn' stop 1 end if @@ -1185,15 +1185,15 @@ program main end if time_dep = 0 - ierr = FARKStepSetMassLinearSolver(arkode_mem, sunls_M, sunmat_M, time_dep) + ierr = FARKodeSetMassLinearSolver(arkode_mem, sunls_M, sunmat_M, time_dep) if (ierr /= 0) then - print *, 'Error in FARKStepSetMassLinearSolver' + print *, 'Error in FARKodeSetMassLinearSolver' stop 1 end if - ierr = FARKStepSetMassFn(arkode_mem, c_funloc(Mass)) + ierr = FARKodeSetMassFn(arkode_mem, c_funloc(Mass)) if (ierr /= 0) then - print *, 'Error in FARKStepSetMassFn' + print *, 'Error in FARKodeSetMassFn' stop 1 end if @@ -1201,24 +1201,24 @@ program main rtol = 1.0d-6 atol = 1.0d-11 - ierr = FARKStepSStolerances(arkode_mem, rtol, atol) + ierr = FARKodeSStolerances(arkode_mem, rtol, atol) if (ierr /= 0) then - print *, 'Error in FARKStepSStolerances, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeSStolerances, ierr = ', ierr, '; halting' stop 1 end if ! set residual tolerance with the same atol as above - ierr = FARKStepResStolerance(arkode_mem, atol) + ierr = FARKodeResStolerance(arkode_mem, atol) if (ierr /= 0) then - print *, 'Error in FARKStepResStolerance, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeResStolerance, ierr = ', ierr, '; halting' stop 1 end if ! Set maximum number of internal time steps mxsteps = 1000 - ierr = FARKStepSetMaxNumSteps(arkode_mem, mxsteps) + ierr = FARKodeSetMaxNumSteps(arkode_mem, mxsteps) if (ierr /= 0) then - print *, 'Error in FARKStepSetNonlinConvCoef' + print *, 'Error in FARKodeSetNonlinConvCoef' stop 1 end if @@ -1238,9 +1238,9 @@ program main print *, 'Error in FSUNDIALSFileOpen' stop 1 end if - ierr = FARKStepWriteParameters(arkode_mem, outstr) + ierr = FARKodeWriteParameters(arkode_mem, outstr) if (ierr /= 0) then - print *, 'Error in FARKStepWriteParameters' + print *, 'Error in FARKodeWriteParameters' stop 1 end if ierr = FSUNDIALSFileClose(outstr) @@ -1262,16 +1262,16 @@ program main ! set the next output time tout = min(tout + dtout, tend) - ierr = FARKStepSetStopTime(arkode_mem, tout) + ierr = FARKodeSetStopTime(arkode_mem, tout) if (ierr /= 0) then - print *, 'Error in FARKStepSetStopTime, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeSetStopTime, ierr = ', ierr, '; halting' stop 1 end if - ! call ARKStep - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) + ! call ARKodeEvolve + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) if (ierr < 0) then - print *, 'Error in FARKStepEvolve, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeEvolve, ierr = ', ierr, '; halting' stop 1 end if @@ -1292,7 +1292,7 @@ program main call ARKStepStats(arkode_mem) ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_y) call FN_VDestroy(sunvec_u) call FN_VDestroy(sunvec_v) @@ -1344,15 +1344,15 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, retval = ', ierr, '; halting' stop 1 end if @@ -1362,57 +1362,57 @@ subroutine ARKStepStats(arkode_mem) stop 1 end if - ierr = FARKStepGetLastStep(arkode_mem, hlast) + ierr = FARKodeGetLastStep(arkode_mem, hlast) if (ierr /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentStep(arkode_mem, hcur) + ierr = FARKodeGetCurrentStep(arkode_mem, hcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentTime(arkode_mem, tcur) + ierr = FARKodeGetCurrentTime(arkode_mem, tcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentTime, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentTime, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) + ierr = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumLinSolvSetups, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumLinSolvSetups, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + ierr = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) + ierr = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumJacEvals(arkode_mem, njacevals) + ierr = FARKodeGetNumJacEvals(arkode_mem, njacevals) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumJacEvals, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumJacEvals, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumMassSetups(arkode_mem, nmassevals) + ierr = FARKodeGetNumMassSetups(arkode_mem, nmassevals) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumMassSetups, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumMassSetups, retval = ', ierr, '; halting' stop 1 end if diff --git a/examples/arkode/F2003_serial/ark_bruss_f2003.f90 b/examples/arkode/F2003_serial/ark_bruss_f2003.f90 index cdf1ebdb0b..52a7121a88 100644 --- a/examples/arkode/F2003_serial/ark_bruss_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_bruss_f2003.f90 @@ -303,15 +303,15 @@ program main stop 1 end if - ierr = FARKStepSetLinearSolver(arkode_mem, sunls, sunmat_A) + ierr = FARKodeSetLinearSolver(arkode_mem, sunls, sunmat_A) if (ierr /= 0) then - print *, 'Error in FARKStepSetLinearSolver' + print *, 'Error in FARKodeSetLinearSolver' stop 1 end if - ierr = FARKStepSetJacFn(arkode_mem, c_funloc(Jac)) + ierr = FARKodeSetJacFn(arkode_mem, c_funloc(Jac)) if (ierr /= 0) then - print *, 'Error in FARKStepSetJacFn' + print *, 'Error in FARKodeSetJacFn' stop 1 end if @@ -319,22 +319,22 @@ program main rtol = 1.0d-6 atol = 1.0d-10 - ierr = FARKStepSStolerances(arkode_mem, rtol, atol) + ierr = FARKodeSStolerances(arkode_mem, rtol, atol) if (ierr /= 0) then - print *, 'Error in FARKStepSStolerances, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeSStolerances, ierr = ', ierr, '; halting' stop 1 end if ! Set additional method parameters - ierr = FARKStepSetOrder(arkode_mem, order) + ierr = FARKodeSetOrder(arkode_mem, order) if (ierr /= 0) then - print *, 'Error in FARKStepSetOrder' + print *, 'Error in FARKodeSetOrder' stop 1 end if - ierr = FARKStepSetNonlinConvCoef(arkode_mem, nlscoef) + ierr = FARKodeSetNonlinConvCoef(arkode_mem, nlscoef) if (ierr /= 0) then - print *, 'Error in FARKStepSetNonlinConvCoef' + print *, 'Error in FARKodeSetNonlinConvCoef' stop 1 end if @@ -364,11 +364,11 @@ program main print '(2x,4(es12.5,1x))', tcur, yvec(1), yvec(2), yvec(3) do outstep = 1,nout - ! call ARKStepEvolve + ! call ARKodeEvolve tout = min(tout + dtout, tend) - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_y, tcur, ARK_NORMAL) if (ierr /= 0) then - print *, 'Error in FARKStepEvolve, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeEvolve, ierr = ', ierr, '; halting' stop 1 endif @@ -384,7 +384,7 @@ program main call ARKStepStats(arkode_mem) ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_y) call FSUNMatDestroy(sunmat_A) ierr = FSUNLinSolFree(sunls) @@ -431,15 +431,15 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, retval = ', ierr, '; halting' stop 1 end if @@ -449,57 +449,57 @@ subroutine ARKStepStats(arkode_mem) stop 1 end if - ierr = FARKStepGetActualInitStep(arkode_mem, hinused) + ierr = FARKodeGetActualInitStep(arkode_mem, hinused) if (ierr /= 0) then - print *, 'Error in FARKStepGetActualInitStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetActualInitStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetLastStep(arkode_mem, hlast) + ierr = FARKodeGetLastStep(arkode_mem, hlast) if (ierr /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentStep(arkode_mem, hcur) + ierr = FARKodeGetCurrentStep(arkode_mem, hcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentStep, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentStep, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentTime(arkode_mem, tcur) + ierr = FARKodeGetCurrentTime(arkode_mem, tcur) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentTime, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentTime, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) + ierr = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumLinSolvSetups, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumLinSolvSetups, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + ierr = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) + ierr = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, retval = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumJacEvals(arkode_mem, njacevals) + ierr = FARKodeGetNumJacEvals(arkode_mem, njacevals) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumJacEvals, retval = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumJacEvals, retval = ', ierr, '; halting' stop 1 end if diff --git a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.f90 b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.f90 index 372cbf1642..c87583eb23 100644 --- a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.f90 @@ -295,9 +295,9 @@ program main ! Attach the linear solver (with NULL SUNMatrix object) sunmat_A => null() - ierr = FARKStepSetLinearSolver(arkode_mem, sunls, sunmat_A) + ierr = FARKodeSetLinearSolver(arkode_mem, sunls, sunmat_A) if (ierr /= 0) then - print *, 'Error in FARKStepSetLinearSolver, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeSetLinearSolver, ierr = ', ierr, '; halting' stop 1 end if @@ -316,15 +316,15 @@ program main end if ! Set additional method parameters - ierr = FARKStepSStolerances(arkode_mem, rtol, atol) + ierr = FARKodeSStolerances(arkode_mem, rtol, atol) if (ierr /= 0) then - print *, 'Error in FARKStepSStolerances, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeSStolerances, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepSetMaxNumSteps(arkode_mem, mxsteps) + ierr = FARKodeSetMaxNumSteps(arkode_mem, mxsteps) if (ierr /= 0) then - print *, 'Error in FARKStepSetMaxNumSteps' + print *, 'Error in FARKodeSetMaxNumSteps' stop 1 end if @@ -338,29 +338,29 @@ program main tout = twohr do outstep = 1,12 - ! call ARKStep - ierr = FARKStepEvolve(arkode_mem, tout, sunvec_u, tcur, ARK_NORMAL) + ! call ARKodeEvolve + ierr = FARKodeEvolve(arkode_mem, tout, sunvec_u, tcur, ARK_NORMAL) if (ierr /= 0) then - print *, 'Error in FARKStepEvolve, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeEvolve, ierr = ', ierr, '; halting' stop 1 end if ! get some solver statistics - ierr = FARKStepGetNumSteps(arkode_mem, lnst) + ierr = FARKodeGetNumSteps(arkode_mem, lnst) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumSteps, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumSteps, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumStepAttempts(arkode_mem, lnst_att) + ierr = FARKodeGetNumStepAttempts(arkode_mem, lnst_att) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetCurrentStep(arkode_mem, lh) + ierr = FARKodeGetCurrentStep(arkode_mem, lh) if (ierr /= 0) then - print *, 'Error in FARKStepGetCurrentStep, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetCurrentStep, ierr = ', ierr, '; halting' stop 1 end if @@ -378,7 +378,7 @@ program main call ARKStepStats(arkode_mem) ! clean up - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) call FN_VDestroy(sunvec_u) call FN_VDestroy(sunvec_f) ierr = FSUNLinSolFree(sunls) @@ -429,15 +429,15 @@ subroutine ARKStepStats(arkode_mem) !======= Internals ============ - ierr = FARKStepGetNumSteps(arkode_mem, nsteps) + ierr = FARKodeGetNumSteps(arkode_mem, nsteps) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumSteps, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumSteps, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + ierr = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, ierr = ', ierr, '; halting' stop 1 end if @@ -447,59 +447,59 @@ subroutine ARKStepStats(arkode_mem) stop 1 end if - ierr = FARKStepGetNumErrTestFails(arkode_mem, netfails) + ierr = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumPrecEvals(arkode_mem, npe) + ierr = FARKodeGetNumPrecEvals(arkode_mem, npe) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumPrecEvals, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumPrecEvals, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumPrecSolves(arkode_mem, nps) + ierr = FARKodeGetNumPrecSolves(arkode_mem, nps) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumPrecSolves, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumPrecSolves, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + ierr = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumLinIters(arkode_mem, nliters) + ierr = FARKodeGetNumLinIters(arkode_mem, nliters) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumLinIters, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumLinIters, ierr = ', ierr, '; halting' stop 1 end if avdim = dble(nliters)/dble(nniters) - ierr = FARKStepGetNumLinConvFails(arkode_mem, ncfl) + ierr = FARKodeGetNumLinConvFails(arkode_mem, ncfl) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumLinConvFails, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumLinConvFails, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetNumNonlinSolvConvFails(arkode_mem, ncf) + ierr = FARKodeGetNumNonlinSolvConvFails(arkode_mem, ncf) if (ierr /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetWorkSpace(arkode_mem, lenrw, leniw) + ierr = FARKodeGetWorkSpace(arkode_mem, lenrw, leniw) if (ierr /= 0) then - print *, 'Error in FARKStepGetWorkSpace, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetWorkSpace, ierr = ', ierr, '; halting' stop 1 end if - ierr = FARKStepGetLinWorkSpace(arkode_mem, lenrwls, leniwls) + ierr = FARKodeGetLinWorkSpace(arkode_mem, lenrwls, leniwls) if (ierr /= 0) then - print *, 'Error in FARKStepGetLinWorkSpace, ierr = ', ierr, '; halting' + print *, 'Error in FARKodeGetLinWorkSpace, ierr = ', ierr, '; halting' stop 1 end if diff --git a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 index b925a5ab76..929844e792 100644 --- a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 @@ -842,12 +842,12 @@ program main call check_retval(retval, "FARKStepSetTables") MATf => FSUNDenseMatrix(NEQ, NEQ, sunctx) LSf => FSUNLinSol_Dense(y, MATf, sunctx) - retval = FARKStepSetLinearSolver(inner_arkode_mem, LSf, MATf) - call check_retval(retval, "FARKStepSetLinearSolver") - retval = FARKStepSetJacFn(inner_arkode_mem, c_funloc(Jn)) - call check_retval(retval, "FARKStepSetJacFn") - retval = FARKStepSStolerances(inner_arkode_mem, reltol, abstol) - call check_retval(retval, "FARKStepSStolerances") + retval = FARKodeSetLinearSolver(inner_arkode_mem, LSf, MATf) + call check_retval(retval, "FARKodeSetLinearSolver") + retval = FARKodeSetJacFn(inner_arkode_mem, c_funloc(Jn)) + call check_retval(retval, "FARKodeSetJacFn") + retval = FARKodeSStolerances(inner_arkode_mem, reltol, abstol) + call check_retval(retval, "FARKodeSStolerances") call FARKodeButcherTable_Free(BTf) else if (solve_type == 3 .or. solve_type == 4) then ! no fast dynamics ('evolve' explicitly w/ erk-3-3) @@ -881,9 +881,9 @@ program main end if ! Set the fast step size */ - retval = FARKStepSetFixedStep(inner_arkode_mem, hf) + retval = FARKodeSetFixedStep(inner_arkode_mem, hf) if (retval /= 0) then - print *, 'ERROR: FARKStepSetFixedStep failed' + print *, 'ERROR: FARKodeSetFixedStep failed' stop 1 end if @@ -951,12 +951,12 @@ program main call check_retval(retval, "FMRIStepSetCoupling") MATs => FSUNDenseMatrix(NEQ, NEQ, sunctx) LSs => FSUNLinSol_Dense(y, MATs, sunctx) - retval = FMRIStepSetLinearSolver(arkode_mem, LSs, MATs) - call check_retval(retval, "FMRIStepSetLinearSolver") - retval = FMRIStepSetJacFn(arkode_mem, c_funloc(Jn)) - call check_retval(retval, "FMRIStepSetJacFn") - retval = FMRIStepSStolerances(arkode_mem, reltol, abstol) - call check_retval(retval, "FMRIStepSStolerances") + retval = FARKodeSetLinearSolver(arkode_mem, LSs, MATs) + call check_retval(retval, "FARKodeSetLinearSolver") + retval = FARKodeSetJacFn(arkode_mem, c_funloc(Jn)) + call check_retval(retval, "FARKodeSetJacFn") + retval = FARKodeSStolerances(arkode_mem, reltol, abstol) + call check_retval(retval, "FARKodeSStolerances") else if (solve_type == 7) then ! MRI-GARK-ESDIRK34a, solve-decoupled slow solver arkode_mem = FMRIStepCreate(c_null_funptr, c_funloc(fs), T0, y, inner_stepper, sunctx) @@ -965,12 +965,12 @@ program main call check_retval(retval, "FMRIStepSetCoupling") MATs => FSUNDenseMatrix(NEQ, NEQ, sunctx) LSs => FSUNLinSol_Dense(y, MATs, sunctx) - retval = FMRIStepSetLinearSolver(arkode_mem, LSs, MATs) - call check_retval(retval, "FMRIStepSetLinearSolver") - retval = FMRIStepSetJacFn(arkode_mem, c_funloc(Js)) - call check_retval(retval, "FMRIStepSetJacFn") - retval = FMRIStepSStolerances(arkode_mem, reltol, abstol) - call check_retval(retval, "FMRIStepSStolerances") + retval = FARKodeSetLinearSolver(arkode_mem, LSs, MATs) + call check_retval(retval, "FARKodeSetLinearSolver") + retval = FARKodeSetJacFn(arkode_mem, c_funloc(Js)) + call check_retval(retval, "FARKodeSetJacFn") + retval = FARKodeSStolerances(arkode_mem, reltol, abstol) + call check_retval(retval, "FARKodeSStolerances") else if (solve_type == 8) then ! IMEX-MRI-GARK3b, solve-decoupled slow solver arkode_mem = FMRIStepCreate(c_funloc(fse), c_funloc(fsi), T0, y, inner_stepper, sunctx) @@ -979,12 +979,12 @@ program main call check_retval(retval, "FMRIStepSetCoupling") MATs => FSUNDenseMatrix(NEQ, NEQ, sunctx) LSs => FSUNLinSol_Dense(y, MATs, sunctx) - retval = FMRIStepSetLinearSolver(arkode_mem, LSs, MATs) - call check_retval(retval, "FMRIStepSetLinearSolver") - retval = FMRIStepSetJacFn(arkode_mem, c_funloc(Jsi)) - call check_retval(retval, "FMRIStepSetJacFn") - retval = FMRIStepSStolerances(arkode_mem, reltol, abstol) - call check_retval(retval, "FMRIStepSStolerances") + retval = FARKodeSetLinearSolver(arkode_mem, LSs, MATs) + call check_retval(retval, "FARKodeSetLinearSolver") + retval = FARKodeSetJacFn(arkode_mem, c_funloc(Jsi)) + call check_retval(retval, "FARKodeSetJacFn") + retval = FARKodeSStolerances(arkode_mem, reltol, abstol) + call check_retval(retval, "FARKodeSStolerances") else if (solve_type == 9) then ! IMEX-MRI-GARK4, solve-decoupled slow solver arkode_mem = FMRIStepCreate(c_funloc(fse), c_funloc(fsi), T0, y, inner_stepper, sunctx) @@ -992,12 +992,12 @@ program main retval = FMRIStepSetCoupling(arkode_mem, SC) MATs => FSUNDenseMatrix(NEQ, NEQ, sunctx) LSs => FSUNLinSol_Dense(y, MATs, sunctx) - retval = FMRIStepSetLinearSolver(arkode_mem, LSs, MATs) - call check_retval(retval, "FMRIStepSetLinearSolver") - retval = FMRIStepSetJacFn(arkode_mem, c_funloc(Jsi)) - call check_retval(retval, "FMRIStepSetJacFn") - retval = FMRIStepSStolerances(arkode_mem, reltol, abstol) - call check_retval(retval, "FMRIStepSStolerances") + retval = FARKodeSetLinearSolver(arkode_mem, LSs, MATs) + call check_retval(retval, "FARKodeSetLinearSolver") + retval = FARKodeSetJacFn(arkode_mem, c_funloc(Jsi)) + call check_retval(retval, "FARKodeSetJacFn") + retval = FARKodeSStolerances(arkode_mem, reltol, abstol) + call check_retval(retval, "FARKodeSStolerances") end if if (.not. c_associated(arkode_mem)) then @@ -1006,14 +1006,14 @@ program main end if ! Set the slow step size - retval = FMRIStepSetFixedStep(arkode_mem, hs) - call check_retval(retval, "FMRIStepSetFixedStep") + retval = FARKodeSetFixedStep(arkode_mem, hs) + call check_retval(retval, "FARKodeSetFixedStep") ! ! Integrate ODE ! - ! Main time-stepping loop: calls MRIStepEvolve to perform the + ! Main time-stepping loop: calls ARKodeEvolve to perform the ! integration, then prints results. Stops when the final time ! has been reached t = T0 @@ -1030,8 +1030,8 @@ program main do iout = 1, Nt ! call integrator - retval = FMRIStepEvolve(arkode_mem, tout, y, tret, ARK_NORMAL) - call check_retval(retval, "FMRIStepEvolve") + retval = FARKodeEvolve(arkode_mem, tout, y, tret, ARK_NORMAL) + call check_retval(retval, "FARKodeEvolve") ! access/print solution and error uerr = abs(yarr(1)-utrue(tret(1))) @@ -1058,11 +1058,11 @@ program main ! ! Get some slow integrator statistics - retval = FMRIStepGetNumSteps(arkode_mem, nsts) + retval = FARKodeGetNumSteps(arkode_mem, nsts) retval = FMRIStepGetNumRhsEvals(arkode_mem, nfse, nfsi) ! Get some fast integrator statistics - retval = FARKStepGetNumSteps(inner_arkode_mem, nstf) + retval = FARKodeGetNumSteps(inner_arkode_mem, nstf) retval = FARKStepGetNumRhsEvals(inner_arkode_mem, nff, tmp) ! Print some final statistics @@ -1080,10 +1080,10 @@ program main ! Get/print slow integrator decoupled implicit solver statistics if ((solve_type == 4) .or. (solve_type == 7) .or. & (solve_type == 8) .or. (solve_type == 9)) then - retval = FMRIStepGetNonlinSolvStats(arkode_mem, nnis, nncs) - call check_retval(retval, "MRIStepGetNonlinSolvStats") - retval = FMRIStepGetNumJacEvals(arkode_mem, njes) - call check_retval(retval, "MRIStepGetNumJacEvals") + retval = FARKodeGetNonlinSolvStats(arkode_mem, nnis, nncs) + call check_retval(retval, "ARKodeGetNonlinSolvStats") + retval = FARKodeGetNumJacEvals(arkode_mem, njes) + call check_retval(retval, "ARKodeGetNumJacEvals") print '(A, I7)', " Slow Newton iters = ", nnis print '(A, I7)', " Slow Newton conv fails = ", nncs print '(A, I7)', " Slow Jacobian evals = ", njes @@ -1091,10 +1091,10 @@ program main ! Get/print fast integrator implicit solver statistics if (solve_type == 2) then - retval = FARKStepGetNonlinSolvStats(inner_arkode_mem, nnif, nncf) - call check_retval(retval, "ARKStepGetNonlinSolvStats") - retval = FARKStepGetNumJacEvals(inner_arkode_mem, njef) - call check_retval(retval, "ARKStepGetNumJacEvals") + retval = FARKodeGetNonlinSolvStats(inner_arkode_mem, nnif, nncf) + call check_retval(retval, "ARKodeGetNonlinSolvStats") + retval = FARKodeGetNumJacEvals(inner_arkode_mem, njef) + call check_retval(retval, "ARKodeGetNumJacEvals") print '(A, I7)', " Fast Newton iters = ", nnif print '(A, I7)', " Fast Newton conv fails = ", nncf print '(A, I7)', " Fast Jacobian evals = ", njef @@ -1116,9 +1116,9 @@ program main if (associated(LSf)) retval = FSUNLinSolFree(LSf) ! Free fast linear solver if (associated(MATs)) call FSUNMatDestroy(MATs) ! Free slow matrix if (associated(LSs)) retval = FSUNLinSolFree(LSs) ! Free slow linear solver - call FARKStepFree(inner_arkode_mem) ! Free fast integrator memory + call FARKodeFree(inner_arkode_mem) ! Free fast integrator memory retval = FMRIStepInnerStepper_Free(inner_stepper) ! Free inner stepper - call FMRIStepFree(arkode_mem) ! Free slow integrator memory + call FARKodeFree(arkode_mem) ! Free slow integrator memory retval = FSUNContext_Free(sunctx) ! Free context end program main diff --git a/examples/arkode/F2003_serial/ark_roberts_dnsL_f2003.f90 b/examples/arkode/F2003_serial/ark_roberts_dnsL_f2003.f90 index a57dd5f9c6..fb58aee07f 100644 --- a/examples/arkode/F2003_serial/ark_roberts_dnsL_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_roberts_dnsL_f2003.f90 @@ -275,18 +275,18 @@ program main arkode_mem = FARKStepCreate(c_null_funptr, c_funloc(fcnirob), t0, sunvec_y, sunctx) if (.not. c_associated(arkode_mem)) print *, 'ERROR: arkode_mem = NULL' - ! Call FARKStepSVtolerances to set tolerances - retval = FARKStepSVtolerances(arkode_mem, rtol, sunvec_av) + ! Call FARKodeSVtolerances to set tolerances + retval = FARKodeSVtolerances(arkode_mem, rtol, sunvec_av) if (retval /= 0) then - print *, 'Error in FARKStepSVtolerances, retval = ', retval, '; halting' + print *, 'Error in FARKodeSVtolerances, retval = ', retval, '; halting' stop 1 end if - ! Call FARKStepRootInit to specify the root function grob with 2 components + ! Call FARKodeRootInit to specify the root function grob with 2 components nrtfn = 2 - retval = FARKStepRootInit(arkode_mem, nrtfn, c_funloc(grob)) + retval = FARKodeRootInit(arkode_mem, nrtfn, c_funloc(grob)) if (retval /= 0) then - print *, 'Error in FARKStepRootInit, retval = ', retval, '; halting' + print *, 'Error in FARKodeRootInit, retval = ', retval, '; halting' stop 1 end if @@ -305,59 +305,59 @@ program main end if ! Attach the matrix and linear solver - retval = FARKStepSetLinearSolver(arkode_mem, sunlinsol_LS, sunmat_A); + retval = FARKodeSetLinearSolver(arkode_mem, sunlinsol_LS, sunmat_A); if (retval /= 0) then - print *, 'Error in FARKStepSetLinearSolver, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetLinearSolver, retval = ', retval, '; halting' stop 1 end if ! Set the user-supplied Jacobian routine - retval = FARKStepSetJacFn(arkode_mem, c_funloc(jacrob)) + retval = FARKodeSetJacFn(arkode_mem, c_funloc(jacrob)) if (retval /= 0) then - print *, 'Error in FARKStepSetJacFn, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetJacFn, retval = ', retval, '; halting' stop 1 end if ! Set additional method parameters mxsteps = 10000 - retval = FARKStepSetMaxNumSteps(arkode_mem, mxsteps) + retval = FARKodeSetMaxNumSteps(arkode_mem, mxsteps) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxNumSteps' + print *, 'Error in FARKodeSetMaxNumSteps' stop 1 end if initsize = 1.d-4 * rtol - retval = FARKStepSetInitStep(arkode_mem, initsize) + retval = FARKodeSetInitStep(arkode_mem, initsize) if (retval /= 0) then - print *, 'Error in FARKStepSetInitStep' + print *, 'Error in FARKodeSetInitStep' stop 1 end if nlscoef = 1.d-7 - retval = FARKStepSetNonlinConvCoef(arkode_mem, nlscoef) + retval = FARKodeSetNonlinConvCoef(arkode_mem, nlscoef) if (retval /= 0) then - print *, 'Error in FARKStepSetNonlinConvCoef' + print *, 'Error in FARKodeSetNonlinConvCoef' stop 1 end if nliters = 8 - retval = FARKStepSetMaxNonlinIters(arkode_mem, nliters) + retval = FARKodeSetMaxNonlinIters(arkode_mem, nliters) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxNonlinIters' + print *, 'Error in FARKodeSetMaxNonlinIters' stop 1 end if pmethod = 1 - retval = FARKStepSetPredictorMethod(arkode_mem, pmethod) + retval = FARKodeSetPredictorMethod(arkode_mem, pmethod) if (retval /= 0) then - print *, 'Error in FARKStepSetPredictorMethod' + print *, 'Error in FARKodeSetPredictorMethod' stop 1 end if maxetf = 20 - retval = FARKStepSetMaxErrTestFails(arkode_mem, maxetf) + retval = FARKodeSetMaxErrTestFails(arkode_mem, maxetf) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxErrTestFails' + print *, 'Error in FARKodeSetMaxErrTestFails' stop 1 end if @@ -372,29 +372,29 @@ program main end if ! Attach the nonlinear solver - retval = FARKStepSetNonlinearSolver(arkode_mem, sunnonlin_NLS) + retval = FARKodeSetNonlinearSolver(arkode_mem, sunnonlin_NLS) if (retval /= 0) then - print *, 'Error in FARKStepSetNonlinearSolver, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetNonlinearSolver, retval = ', retval, '; halting' stop 1 end if - ! In loop, call ARKStepEvolve, print results, and test for error. + ! In loop, call ARKodeEvolve, print results, and test for error. iout = 0 tout = tout1 do while(iout < nout) - retval = FARKStepEvolve(arkode_mem, tout, sunvec_y, tret(1), ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, tret(1), ARK_NORMAL) if (retval < 0) then - print *, 'Error in FARKStepEvolve, retval = ', retval, '; halting' + print *, 'Error in FARKodeEvolve, retval = ', retval, '; halting' stop 1 endif call PrintOutput(arkode_mem, tret(1), yval) if (retval .eq. ARK_ROOT_RETURN) then - retvalr = FARKStepGetRootInfo(arkode_mem, rootsfound) + retvalr = FARKodeGetRootInfo(arkode_mem, rootsfound) if (retvalr < 0) then - print *, 'Error in FARKStepGetRootInfo, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetRootInfo, retval = ', retval, '; halting' stop 1 endif print '(a,2(i2,2x))', " rootsfound[] = ", rootsfound(1), rootsfound(2) @@ -413,9 +413,9 @@ program main stop 1 end if - retval = FARKStepGetDky(arkode_mem, tret(1), 1, sunvec_dky) + retval = FARKodeGetDky(arkode_mem, tret(1), 1, sunvec_dky) if (retval /= 0) then - print *, 'Error in ARKStepGetDky' + print *, 'Error in ARKodeGetDky' stop 1 end if print *, " " @@ -428,7 +428,7 @@ program main call PrintFinalStats(arkode_mem) ! free memory - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) retval = FSUNNonlinSolFree(sunnonlin_NLS) retval = FSUNLinSolFree(sunlinsol_LS) call FSUNMatDestroy(sunmat_A) @@ -503,15 +503,15 @@ subroutine PrintOutput(arkode_mem, t, y) !======= Internals ============ - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetLastStep(arkode_mem, hused) + retval = FARKodeGetLastStep(arkode_mem, hused) if (retval /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', retval, '; halting' stop 1 end if @@ -559,15 +559,15 @@ subroutine PrintFinalStats(arkode_mem) !======= Internals ============ - retval = FARKStepGetNumSteps(arkode_mem, nsteps) + retval = FARKodeGetNumSteps(arkode_mem, nsteps) if (retval /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, retval = ', retval, '; halting' stop 1 end if @@ -577,57 +577,57 @@ subroutine PrintFinalStats(arkode_mem) stop 1 end if - retval = FARKStepGetActualInitStep(arkode_mem, hinused) + retval = FARKodeGetActualInitStep(arkode_mem, hinused) if (retval /= 0) then - print *, 'Error in FARKStepGetActualInitStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetActualInitStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetLastStep(arkode_mem, hlast) + retval = FARKodeGetLastStep(arkode_mem, hlast) if (retval /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetCurrentStep(arkode_mem, hcur) + retval = FARKodeGetCurrentStep(arkode_mem, hcur) if (retval /= 0) then - print *, 'Error in FARKStepGetCurrentStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetCurrentStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetCurrentTime(arkode_mem, tcur) + retval = FARKodeGetCurrentTime(arkode_mem, tcur) if (retval /= 0) then - print *, 'Error in FARKStepGetCurrentTime, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetCurrentTime, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) + retval = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) if (retval /= 0) then - print *, 'Error in FARKStepGetNumLinSolvSetups, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumLinSolvSetups, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumErrTestFails(arkode_mem, netfails) + retval = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (retval /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + retval = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (retval /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) + retval = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) if (retval /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumJacEvals(arkode_mem, njacevals) + retval = FARKodeGetNumJacEvals(arkode_mem, njacevals) if (retval /= 0) then - print *, 'Error in FARKStepGetNumJacEvals, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumJacEvals, retval = ', retval, '; halting' stop 1 end if diff --git a/examples/arkode/F2003_serial/ark_roberts_dns_f2003.f90 b/examples/arkode/F2003_serial/ark_roberts_dns_f2003.f90 index 30b41329ee..379f7a23ea 100644 --- a/examples/arkode/F2003_serial/ark_roberts_dns_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_roberts_dns_f2003.f90 @@ -278,18 +278,18 @@ program main arkode_mem = FARKStepCreate(c_null_funptr, c_funloc(fcnirob), t0, sunvec_y, sunctx) if (.not. c_associated(arkode_mem)) print *, 'ERROR: arkode_mem = NULL' - ! Call FARKStepSVtolerances to set tolerances - retval = FARKStepSVtolerances(arkode_mem, rtol, sunvec_av) + ! Call FARKodeSVtolerances to set tolerances + retval = FARKodeSVtolerances(arkode_mem, rtol, sunvec_av) if (retval /= 0) then - print *, 'Error in FARKStepSVtolerances, retval = ', retval, '; halting' + print *, 'Error in FARKodeSVtolerances, retval = ', retval, '; halting' stop 1 end if - ! Call FARKStepRootInit to specify the root function grob with 2 components + ! Call FARKodeRootInit to specify the root function grob with 2 components nrtfn = 2 - retval = FARKStepRootInit(arkode_mem, nrtfn, c_funloc(grob)) + retval = FARKodeRootInit(arkode_mem, nrtfn, c_funloc(grob)) if (retval /= 0) then - print *, 'Error in FARKStepRootInit, retval = ', retval, '; halting' + print *, 'Error in FARKodeRootInit, retval = ', retval, '; halting' stop 1 end if @@ -308,59 +308,59 @@ program main end if ! Attach the matrix and linear solver - retval = FARKStepSetLinearSolver(arkode_mem, sunlinsol_LS, sunmat_A); + retval = FARKodeSetLinearSolver(arkode_mem, sunlinsol_LS, sunmat_A); if (retval /= 0) then - print *, 'Error in FARKStepSetLinearSolver, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetLinearSolver, retval = ', retval, '; halting' stop 1 end if ! Set the user-supplied Jacobian routine - retval = FARKStepSetJacFn(arkode_mem, c_funloc(jacrob)) + retval = FARKodeSetJacFn(arkode_mem, c_funloc(jacrob)) if (retval /= 0) then - print *, 'Error in FARKStepSetJacFn, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetJacFn, retval = ', retval, '; halting' stop 1 end if ! Set additional method parameters mxsteps = 10000 - retval = FARKStepSetMaxNumSteps(arkode_mem, mxsteps) + retval = FARKodeSetMaxNumSteps(arkode_mem, mxsteps) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxNumSteps' + print *, 'Error in FARKodeSetMaxNumSteps' stop 1 end if initsize = 1.d-4 * rtol - retval = FARKStepSetInitStep(arkode_mem, initsize) + retval = FARKodeSetInitStep(arkode_mem, initsize) if (retval /= 0) then - print *, 'Error in FARKStepSetInitStep' + print *, 'Error in FARKodeSetInitStep' stop 1 end if nlscoef = 1.d-7 - retval = FARKStepSetNonlinConvCoef(arkode_mem, nlscoef) + retval = FARKodeSetNonlinConvCoef(arkode_mem, nlscoef) if (retval /= 0) then - print *, 'Error in FARKStepSetNonlinConvCoef' + print *, 'Error in FARKodeSetNonlinConvCoef' stop 1 end if nliters = 8 - retval = FARKStepSetMaxNonlinIters(arkode_mem, nliters) + retval = FARKodeSetMaxNonlinIters(arkode_mem, nliters) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxNonlinIters' + print *, 'Error in FARKodeSetMaxNonlinIters' stop 1 end if pmethod = 1 - retval = FARKStepSetPredictorMethod(arkode_mem, pmethod) + retval = FARKodeSetPredictorMethod(arkode_mem, pmethod) if (retval /= 0) then - print *, 'Error in FARKStepSetPredictorMethod' + print *, 'Error in FARKodeSetPredictorMethod' stop 1 end if maxetf = 20 - retval = FARKStepSetMaxErrTestFails(arkode_mem, maxetf) + retval = FARKodeSetMaxErrTestFails(arkode_mem, maxetf) if (retval /= 0) then - print *, 'Error in FARKStepSetMaxErrTestFails' + print *, 'Error in FARKodeSetMaxErrTestFails' stop 1 end if @@ -375,29 +375,29 @@ program main end if ! Attach the nonlinear solver - retval = FARKStepSetNonlinearSolver(arkode_mem, sunnonlin_NLS) + retval = FARKodeSetNonlinearSolver(arkode_mem, sunnonlin_NLS) if (retval /= 0) then - print *, 'Error in FARKStepSetNonlinearSolver, retval = ', retval, '; halting' + print *, 'Error in FARKodeSetNonlinearSolver, retval = ', retval, '; halting' stop 1 end if - ! In loop, call ARKStepEvolve, print results, and test for error. + ! In loop, call ARKodeEvolve, print results, and test for error. iout = 0 tout = tout1 do while(iout < nout) - retval = FARKStepEvolve(arkode_mem, tout, sunvec_y, tret(1), ARK_NORMAL) + retval = FARKodeEvolve(arkode_mem, tout, sunvec_y, tret(1), ARK_NORMAL) if (retval < 0) then - print *, 'Error in FARKStepEvolve, retval = ', retval, '; halting' + print *, 'Error in FARKodeEvolve, retval = ', retval, '; halting' stop 1 endif call PrintOutput(arkode_mem, tret(1), yval) if (retval .eq. ARK_ROOT_RETURN) then - retvalr = FARKStepGetRootInfo(arkode_mem, rootsfound) + retvalr = FARKodeGetRootInfo(arkode_mem, rootsfound) if (retvalr < 0) then - print *, 'Error in FARKStepGetRootInfo, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetRootInfo, retval = ', retval, '; halting' stop 1 endif print '(a,2(i2,2x))', " rootsfound[] = ", rootsfound(1), rootsfound(2) @@ -416,9 +416,9 @@ program main stop 1 end if - retval = FARKStepGetDky(arkode_mem, tret(1), 1, sunvec_dky) + retval = FARKodeGetDky(arkode_mem, tret(1), 1, sunvec_dky) if (retval /= 0) then - print *, 'Error in ARKStepGetDky' + print *, 'Error in ARKodeGetDky' stop 1 end if print *, " " @@ -431,7 +431,7 @@ program main call PrintFinalStats(arkode_mem) ! free memory - call FARKStepFree(arkode_mem) + call FARKodeFree(arkode_mem) retval = FSUNNonlinSolFree(sunnonlin_NLS) retval = FSUNLinSolFree(sunlinsol_LS) call FSUNMatDestroy(sunmat_A) @@ -506,15 +506,15 @@ subroutine PrintOutput(arkode_mem, t, y) !======= Internals ============ - retval = FARKStepGetNumSteps(arkode_mem, nst) + retval = FARKodeGetNumSteps(arkode_mem, nst) if (retval /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetLastStep(arkode_mem, hused) + retval = FARKodeGetLastStep(arkode_mem, hused) if (retval /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', retval, '; halting' stop 1 end if @@ -562,15 +562,15 @@ subroutine PrintFinalStats(arkode_mem) !======= Internals ============ - retval = FARKStepGetNumSteps(arkode_mem, nsteps) + retval = FARKodeGetNumSteps(arkode_mem, nsteps) if (retval /= 0) then - print *, 'Error in FARKStepGetNumSteps, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumSteps, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumStepAttempts(arkode_mem, nst_a) + retval = FARKodeGetNumStepAttempts(arkode_mem, nst_a) if (retval /= 0) then - print *, 'Error in FARKStepGetNumStepAttempts, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumStepAttempts, retval = ', retval, '; halting' stop 1 end if @@ -580,57 +580,57 @@ subroutine PrintFinalStats(arkode_mem) stop 1 end if - retval = FARKStepGetActualInitStep(arkode_mem, hinused) + retval = FARKodeGetActualInitStep(arkode_mem, hinused) if (retval /= 0) then - print *, 'Error in FARKStepGetActualInitStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetActualInitStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetLastStep(arkode_mem, hlast) + retval = FARKodeGetLastStep(arkode_mem, hlast) if (retval /= 0) then - print *, 'Error in FARKStepGetLastStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetLastStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetCurrentStep(arkode_mem, hcur) + retval = FARKodeGetCurrentStep(arkode_mem, hcur) if (retval /= 0) then - print *, 'Error in FARKStepGetCurrentStep, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetCurrentStep, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetCurrentTime(arkode_mem, tcur) + retval = FARKodeGetCurrentTime(arkode_mem, tcur) if (retval /= 0) then - print *, 'Error in FARKStepGetCurrentTime, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetCurrentTime, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumLinSolvSetups(arkode_mem, nlinsetups) + retval = FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) if (retval /= 0) then - print *, 'Error in FARKStepGetNumLinSolvSetups, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumLinSolvSetups, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumErrTestFails(arkode_mem, netfails) + retval = FARKodeGetNumErrTestFails(arkode_mem, netfails) if (retval /= 0) then - print *, 'Error in FARKStepGetNumErrTestFails, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumErrTestFails, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumNonlinSolvIters(arkode_mem, nniters) + retval = FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) if (retval /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvIters, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvIters, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumNonlinSolvConvFails(arkode_mem, nncfails) + retval = FARKodeGetNumNonlinSolvConvFails(arkode_mem, nncfails) if (retval /= 0) then - print *, 'Error in FARKStepGetNumNonlinSolvConvFails, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumNonlinSolvConvFails, retval = ', retval, '; halting' stop 1 end if - retval = FARKStepGetNumJacEvals(arkode_mem, njacevals) + retval = FARKodeGetNumJacEvals(arkode_mem, njacevals) if (retval /= 0) then - print *, 'Error in FARKStepGetNumJacEvals, retval = ', retval, '; halting' + print *, 'Error in FARKodeGetNumJacEvals, retval = ', retval, '; halting' stop 1 end if diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index 2842f490d3..ee7464a525 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -173,10 +173,9 @@ SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetNumARKodes instead") int ERKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetARKodeAttempts instead") int ERKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") -int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") int ERKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); +SUNDIALS_EXPORT int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); SUNDIALS_EXPORT int ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable* B); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") diff --git a/src/arkode/fmod/farkode_erkstep_mod.c b/src/arkode/fmod/farkode_erkstep_mod.c index c401460048..fab7db1d84 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.c +++ b/src/arkode/fmod/farkode_erkstep_mod.c @@ -1001,7 +1001,7 @@ SWIGEXPORT int _wrap_FERKStepGetNumStepAttempts(void *farg1, long *farg2) { } -SWIGEXPORT int _wrap_FERKStepGetNumRhsEvals(void *farg1, long *farg2) { +SWIGEXPORT int _wrap_FERKStepGetNumErrTestFails(void *farg1, long *farg2) { int fresult ; void *arg1 = (void *) 0 ; long *arg2 = (long *) 0 ; @@ -1009,13 +1009,13 @@ SWIGEXPORT int _wrap_FERKStepGetNumRhsEvals(void *farg1, long *farg2) { arg1 = (void *)(farg1); arg2 = (long *)(farg2); - result = (int)ERKStepGetNumRhsEvals(arg1,arg2); + result = (int)ERKStepGetNumErrTestFails(arg1,arg2); fresult = (int)(result); return fresult; } -SWIGEXPORT int _wrap_FERKStepGetNumErrTestFails(void *farg1, long *farg2) { +SWIGEXPORT int _wrap_FERKStepGetNumRhsEvals(void *farg1, long *farg2) { int fresult ; void *arg1 = (void *) 0 ; long *arg2 = (long *) 0 ; @@ -1023,7 +1023,7 @@ SWIGEXPORT int _wrap_FERKStepGetNumErrTestFails(void *farg1, long *farg2) { arg1 = (void *)(farg1); arg2 = (long *)(farg2); - result = (int)ERKStepGetNumErrTestFails(arg1,arg2); + result = (int)ERKStepGetNumRhsEvals(arg1,arg2); fresult = (int)(result); return fresult; } diff --git a/src/arkode/fmod/farkode_erkstep_mod.f90 b/src/arkode/fmod/farkode_erkstep_mod.f90 index 98a6a5f817..e75d960ae4 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.f90 +++ b/src/arkode/fmod/farkode_erkstep_mod.f90 @@ -90,8 +90,8 @@ module farkode_erkstep_mod public :: FERKStepGetNumExpSteps public :: FERKStepGetNumAccSteps public :: FERKStepGetNumStepAttempts - public :: FERKStepGetNumRhsEvals public :: FERKStepGetNumErrTestFails + public :: FERKStepGetNumRhsEvals public :: FERKStepGetCurrentButcherTable public :: FERKStepGetEstLocalErrors public :: FERKStepGetWorkSpace @@ -621,8 +621,8 @@ function swigc_FERKStepGetNumStepAttempts(farg1, farg2) & integer(C_INT) :: fresult end function -function swigc_FERKStepGetNumRhsEvals(farg1, farg2) & -bind(C, name="_wrap_FERKStepGetNumRhsEvals") & +function swigc_FERKStepGetNumErrTestFails(farg1, farg2) & +bind(C, name="_wrap_FERKStepGetNumErrTestFails") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 @@ -630,8 +630,8 @@ function swigc_FERKStepGetNumRhsEvals(farg1, farg2) & integer(C_INT) :: fresult end function -function swigc_FERKStepGetNumErrTestFails(farg1, farg2) & -bind(C, name="_wrap_FERKStepGetNumErrTestFails") & +function swigc_FERKStepGetNumRhsEvals(farg1, farg2) & +bind(C, name="_wrap_FERKStepGetNumRhsEvals") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 @@ -1900,35 +1900,35 @@ function FERKStepGetNumStepAttempts(arkode_mem, step_attempts) & swig_result = fresult end function -function FERKStepGetNumRhsEvals(arkode_mem, nfevals) & +function FERKStepGetNumErrTestFails(arkode_mem, netfails) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result type(C_PTR) :: arkode_mem -integer(C_LONG), dimension(*), target, intent(inout) :: nfevals +integer(C_LONG), dimension(*), target, intent(inout) :: netfails integer(C_INT) :: fresult type(C_PTR) :: farg1 type(C_PTR) :: farg2 farg1 = arkode_mem -farg2 = c_loc(nfevals(1)) -fresult = swigc_FERKStepGetNumRhsEvals(farg1, farg2) +farg2 = c_loc(netfails(1)) +fresult = swigc_FERKStepGetNumErrTestFails(farg1, farg2) swig_result = fresult end function -function FERKStepGetNumErrTestFails(arkode_mem, netfails) & +function FERKStepGetNumRhsEvals(arkode_mem, nfevals) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result type(C_PTR) :: arkode_mem -integer(C_LONG), dimension(*), target, intent(inout) :: netfails +integer(C_LONG), dimension(*), target, intent(inout) :: nfevals integer(C_INT) :: fresult type(C_PTR) :: farg1 type(C_PTR) :: farg2 farg1 = arkode_mem -farg2 = c_loc(netfails(1)) -fresult = swigc_FERKStepGetNumErrTestFails(farg1, farg2) +farg2 = c_loc(nfevals(1)) +fresult = swigc_FERKStepGetNumRhsEvals(farg1, farg2) swig_result = fresult end function