From 14d817bfef2a9a5a480dc75aa4491d6dcec4ca44 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 15 Apr 2024 09:38:01 -0500 Subject: [PATCH 01/39] Updated ARKODE header files in alignment with this proposal -- need to start on .c files. --- include/arkode/arkode.h | 267 +++++++++++++++ include/arkode/arkode_arkstep.h | 555 ++++++++++++++++++------------- include/arkode/arkode_erkstep.h | 291 +++++++++------- include/arkode/arkode_mristep.h | 298 ++++++++++------- include/arkode/arkode_sprkstep.h | 94 ++++-- src/arkode/arkode_erkstep_io.c | 2 +- 6 files changed, 1005 insertions(+), 502 deletions(-) diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index f0265db008..1f04db996c 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -187,6 +187,273 @@ typedef enum ARK_RELAX_NEWTON } ARKRelaxSolver; +/* -------------------------- + * Shared API routines + * -------------------------- */ + +/* Resize and Reset functions */ +SUNDIALS_EXPORT int ARKodeResize(void* arkode_mem, N_Vector ynew, + sunrealtype hscale, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); +SUNDIALS_EXPORT int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR); + +/* Tolerance input functions */ +SUNDIALS_EXPORT int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, + sunrealtype abstol); +SUNDIALS_EXPORT int ARKodeSVtolerances(void* arkode_mem, sunrealtype reltol, + N_Vector abstol); +SUNDIALS_EXPORT int ARKodeWFtolerances(void* arkode_mem, ARKEwtFn efun); + +/* Residual tolerance input functions */ +SUNDIALS_EXPORT int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol); +SUNDIALS_EXPORT int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol); +SUNDIALS_EXPORT int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun); + +/* Linear solver set functions */ +SUNDIALS_EXPORT int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, + SUNMatrix A); +SUNDIALS_EXPORT int ARKodeSetMassLinearSolver(void* arkode_mem, + SUNLinearSolver LS, SUNMatrix M, + sunbooleantype time_dep); + +/* Rootfinding initialization */ +SUNDIALS_EXPORT int ARKodeRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); + +/* Optional input functions */ +SUNDIALS_EXPORT int ARKodeSetDefaults(void* arkode_mem); +SUNDIALS_EXPORT int ARKodeSetOrder(void* arkode_mem, int maxord); +SUNDIALS_EXPORT int ARKodeSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_EXPORT int ARKodeSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_EXPORT int ARKodeSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_EXPORT int ARKodeSetNonlinearSolver(void* arkode_mem, + SUNNonlinearSolver NLS); +SUNDIALS_EXPORT int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); +SUNDIALS_EXPORT int ARKodeSetLinear(void* arkode_mem, int timedepend); +SUNDIALS_EXPORT int ARKodeSetNonlinear(void* arkode_mem); +SUNDIALS_EXPORT int ARKodeSetDeduceImplicitRhs(void* arkode_mem, + sunbooleantype deduce); +SUNDIALS_EXPORT int ARKodeSetAdaptController(void* arkode_mem, + SUNAdaptController C); +SUNDIALS_EXPORT int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust); +SUNDIALS_EXPORT int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_EXPORT int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety); +SUNDIALS_EXPORT int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); +SUNDIALS_EXPORT int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min); +SUNDIALS_EXPORT int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, + sunrealtype ub); +SUNDIALS_EXPORT int ARKodeSetMaxFirstGrowth(void* arkode_mem, + sunrealtype etamx1); +SUNDIALS_EXPORT int ARKodeSetMaxEFailGrowth(void* arkode_mem, + sunrealtype etamxf); +SUNDIALS_EXPORT int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef); +SUNDIALS_EXPORT int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); +SUNDIALS_EXPORT int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +SUNDIALS_EXPORT int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +SUNDIALS_EXPORT int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +SUNDIALS_EXPORT int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp); +SUNDIALS_EXPORT int ARKodeSetPredictorMethod(void* arkode_mem, int method); +SUNDIALS_EXPORT int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, + void* estab_data); +SUNDIALS_EXPORT int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef); +SUNDIALS_EXPORT int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor); +SUNDIALS_EXPORT int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf); +SUNDIALS_EXPORT int ARKodeSetNonlinConvCoef(void* arkode_mem, + sunrealtype nlscoef); +SUNDIALS_EXPORT int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints); +SUNDIALS_EXPORT int ARKodeSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_EXPORT int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_EXPORT int ARKodeSetInitStep(void* arkode_mem, sunrealtype hin); +SUNDIALS_EXPORT int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin); +SUNDIALS_EXPORT int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax); +SUNDIALS_EXPORT int ARKodeSetInterpolateStopTime(void* arkode_mem, + sunbooleantype interp); +SUNDIALS_EXPORT int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_EXPORT int ARKodeClearStopTime(void* arkode_mem); +SUNDIALS_EXPORT int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_EXPORT int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails); + +SUNDIALS_EXPORT int ARKodeSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_EXPORT int ARKodeSetNoInactiveRootWarn(void* arkode_mem); + +SUNDIALS_EXPORT int ARKodeSetUserData(void* arkode_mem, void* user_data); + +SUNDIALS_EXPORT int ARKodeSetPostprocessStepFn(void* arkode_mem, + ARKPostProcessFn ProcessStep); +SUNDIALS_EXPORT int ARKodeSetPostprocessStageFn(void* arkode_mem, + ARKPostProcessFn ProcessStage); +SUNDIALS_EXPORT int ARKodeSetStagePredictFn(void* arkode_mem, + ARKStagePredictFn PredictStage); + +/* Linear solver interface optional input functions -- must be called + AFTER ARKodeSetLinearSolver and/or ARKodeSetMassLinearSolver */ +SUNDIALS_EXPORT int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_EXPORT int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass); +SUNDIALS_EXPORT int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_EXPORT int ARKodeSetLinearSolutionScaling(void* arkode_mem, + sunbooleantype onoff); +SUNDIALS_EXPORT int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_EXPORT int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_EXPORT int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_EXPORT int ARKodeSetMassLSNormFactor(void* arkode_mem, + sunrealtype nrmfac); +SUNDIALS_EXPORT int ARKodeSetPreconditioner(void* arkode_mem, + ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_EXPORT int ARKodeSetMassPreconditioner(void* arkode_mem, + ARKLsMassPrecSetupFn psetup, + ARKLsMassPrecSolveFn psolve); +SUNDIALS_EXPORT int ARKodeSetJacTimes(void* arkode_mem, + ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_EXPORT int ARKodeSetJacTimesRhsFn(void* arkode_mem, + ARKRhsFn jtimesRhsFn); +SUNDIALS_EXPORT int ARKodeSetMassTimes(void* arkode_mem, + ARKLsMassTimesSetupFn msetup, + ARKLsMassTimesVecFn mtimes, + void* mtimes_data); +SUNDIALS_EXPORT int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); + +/* Integrate the ODE over an interval in t */ +SUNDIALS_EXPORT int ARKodeEvolve(void* arkode_mem, sunrealtype tout, + N_Vector yout, sunrealtype* tret, int itask); + +/* Computes the kth derivative of the y function at time t */ +SUNDIALS_EXPORT int ARKodeGetDky(void* arkode_mem, sunrealtype t, int k, + N_Vector dky); + +/* Utility function to update/compute y based on zcor */ +SUNDIALS_EXPORT int ARKodeComputeState(void* arkode_mem, N_Vector zcor, + N_Vector z); + +/* Optional output functions */ +SUNDIALS_EXPORT int ARKodeGetNumExpSteps(void* arkode_mem, long int* expsteps); +SUNDIALS_EXPORT int ARKodeGetNumAccSteps(void* arkode_mem, long int* accsteps); +SUNDIALS_EXPORT int ARKodeGetNumStepAttempts(void* arkode_mem, + long int* step_attempts); +SUNDIALS_EXPORT int ARKodeGetNumLinSolvSetups(void* arkode_mem, + long int* nlinsetups); +SUNDIALS_EXPORT int ARKodeGetNumErrTestFails(void* arkode_mem, + long int* netfails); +SUNDIALS_EXPORT int ARKodeGetEstLocalErrors(void* arkode_mem, N_Vector ele); +SUNDIALS_EXPORT int ARKodeGetWorkSpace(void* arkode_mem, long int* lenrw, + long int* leniw); +SUNDIALS_EXPORT int ARKodeGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_EXPORT int ARKodeGetActualInitStep(void* arkode_mem, + sunrealtype* hinused); +SUNDIALS_EXPORT int ARKodeGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_EXPORT int ARKodeGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_EXPORT int ARKodeGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_EXPORT int ARKodeGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_EXPORT int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +SUNDIALS_EXPORT int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); +SUNDIALS_EXPORT int ARKodeGetTolScaleFactor(void* arkode_mem, + sunrealtype* tolsfac); +SUNDIALS_EXPORT int ARKodeGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_EXPORT int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight); +SUNDIALS_EXPORT int ARKodeGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_EXPORT int ARKodeGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_EXPORT int ARKodeGetNumConstrFails(void* arkode_mem, + long int* nconstrfails); +SUNDIALS_EXPORT int ARKodeGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_EXPORT int ARKodePrintAllStats(void* arkode_mem, FILE* outfile, + SUNOutputFormat fmt); +SUNDIALS_EXPORT char* ARKodeGetReturnFlagName(long int flag); + +SUNDIALS_EXPORT int ARKodeWriteParameters(void* arkode_mem, FILE* fp); + +/* Grouped optional output functions */ +SUNDIALS_EXPORT int ARKodeGetStepStats(void* arkode_mem, long int* nsteps, + sunrealtype* hinused, sunrealtype* hlast, + sunrealtype* hcur, sunrealtype* tcur); + +/* Nonlinear solver optional output functions */ +SUNDIALS_EXPORT int ARKodeGetNonlinearSystemData( + void* arkode_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, + N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); + +SUNDIALS_EXPORT int ARKodeGetNumNonlinSolvIters(void* arkode_mem, + long int* nniters); +SUNDIALS_EXPORT int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, + long int* nnfails); +SUNDIALS_EXPORT int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +SUNDIALS_EXPORT int ARKodeGetNumStepSolveFails(void* arkode_mem, + long int* nncfails); + +/* Linear solver optional output functions */ +SUNDIALS_EXPORT int ARKodeGetJac(void* arkode_mem, SUNMatrix* J); +SUNDIALS_EXPORT int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J); +SUNDIALS_EXPORT int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J); +SUNDIALS_EXPORT int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, + long int* leniwLS); +SUNDIALS_EXPORT int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals); +SUNDIALS_EXPORT int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals); +SUNDIALS_EXPORT int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves); +SUNDIALS_EXPORT int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters); +SUNDIALS_EXPORT int ARKodeGetNumLinConvFails(void* arkode_mem, + long int* nlcfails); +SUNDIALS_EXPORT int ARKodeGetNumJTSetupEvals(void* arkode_mem, + long int* njtsetups); +SUNDIALS_EXPORT int ARKodeGetNumJtimesEvals(void* arkode_mem, + long int* njvevals); +SUNDIALS_EXPORT int ARKodeGetNumLinRhsEvals(void* arkode_mem, + long int* nfevalsLS); +SUNDIALS_EXPORT int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag); + +SUNDIALS_EXPORT int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, + long int* leniwMLS); +SUNDIALS_EXPORT int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups); +SUNDIALS_EXPORT int ARKodeGetNumMassMultSetups(void* arkode_mem, + long int* nmvsetups); +SUNDIALS_EXPORT int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals); +SUNDIALS_EXPORT int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves); +SUNDIALS_EXPORT int ARKodeGetNumMassPrecEvals(void* arkode_mem, + long int* nmpevals); +SUNDIALS_EXPORT int ARKodeGetNumMassPrecSolves(void* arkode_mem, + long int* nmpsolves); +SUNDIALS_EXPORT int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters); +SUNDIALS_EXPORT int ARKodeGetNumMassConvFails(void* arkode_mem, + long int* nmcfails); +SUNDIALS_EXPORT int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups); +SUNDIALS_EXPORT int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag); + +SUNDIALS_EXPORT char* ARKodeGetLinReturnFlagName(long int flag); + +/* Free function */ +SUNDIALS_EXPORT void ARKodeFree(void** arkode_mem); + +/* Output the ARKode memory structure (useful when debugging) */ +SUNDIALS_EXPORT void ARKodePrintMem(void* arkode_mem, FILE* outfile); + +/* Relaxation functions */ +SUNDIALS_EXPORT int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, + ARKRelaxJacFn rjac); +SUNDIALS_EXPORT int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); +SUNDIALS_EXPORT int ARKodeSetRelaxLowerBound(void* arkode_mem, + sunrealtype lower); +SUNDIALS_EXPORT int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails); +SUNDIALS_EXPORT int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters); +SUNDIALS_EXPORT int ARKodeSetRelaxSolver(void* arkode_mem, + ARKRelaxSolver solver); +SUNDIALS_EXPORT int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); +SUNDIALS_EXPORT int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, + sunrealtype abs_tol); +SUNDIALS_EXPORT int ARKodeSetRelaxUpperBound(void* arkode_mem, + sunrealtype upper); +SUNDIALS_EXPORT int ARKodeGetNumRelaxFnEvals(void* arkode_mem, + long int* r_evals); +SUNDIALS_EXPORT int ARKodeGetNumRelaxJacEvals(void* arkode_mem, + long int* J_evals); +SUNDIALS_EXPORT int ARKodeGetNumRelaxFails(void* arkode_mem, + long int* relax_fails); +SUNDIALS_EXPORT int ARKodeGetNumRelaxBoundFails(void* arkode_mem, + long int* fails); +SUNDIALS_EXPORT int ARKodeGetNumRelaxSolveFails(void* arkode_mem, + long int* fails); +SUNDIALS_EXPORT int ARKodeGetNumRelaxSolveIters(void* arkode_mem, + long int* iters); + + #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index c4eb064935..75b5dbbbca 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -68,54 +68,72 @@ static const int ARKSTEP_DEFAULT_ARK_ITABLE_5 = ARKODE_ARK548L2SA_DIRK_8_4_5; SUNDIALS_EXPORT void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, SUNContext sunctx); -SUNDIALS_EXPORT int ARKStepResize(void* arkode_mem, N_Vector ynew, - sunrealtype hscale, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int ARKStepResize(void* arkode_mem, N_Vector ynew, + sunrealtype hscale, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); SUNDIALS_EXPORT int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ -SUNDIALS_EXPORT int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, - sunrealtype abstol); -SUNDIALS_EXPORT int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, - N_Vector abstol); -SUNDIALS_EXPORT int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, + sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); /* Residual tolerance input functions */ -SUNDIALS_EXPORT int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol); -SUNDIALS_EXPORT int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol); -SUNDIALS_EXPORT int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResStolerance instead") +int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResVtolerance instead") +int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResFtolerance instead") +int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun); /* Linear solver set functions */ -SUNDIALS_EXPORT int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, - SUNMatrix A); -SUNDIALS_EXPORT int ARKStepSetMassLinearSolver(void* arkode_mem, - SUNLinearSolver LS, SUNMatrix M, - sunbooleantype time_dep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") +int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, + SUNMatrix A); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLinearSolver instead") +int ARKStepSetMassLinearSolver(void* arkode_mem, + SUNLinearSolver LS, SUNMatrix M, + sunbooleantype time_dep); /* Rootfinding initialization */ -SUNDIALS_EXPORT int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER ARKStepCreate */ -SUNDIALS_EXPORT int ARKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int ARKStepSetDefaults(void* arkode_mem); SUNDIALS_EXPORT int ARKStepSetOptimalParams(void* arkode_mem); -SUNDIALS_EXPORT int ARKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_EXPORT int ARKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_EXPORT int ARKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_EXPORT int ARKStepSetDenseOrder(void* arkode_mem, int dord); -SUNDIALS_EXPORT int ARKStepSetNonlinearSolver(void* arkode_mem, - SUNNonlinearSolver NLS); -SUNDIALS_EXPORT int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); -SUNDIALS_EXPORT int ARKStepSetLinear(void* arkode_mem, int timedepend); -SUNDIALS_EXPORT int ARKStepSetNonlinear(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int ARKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int ARKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ARKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +int ARKStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") +int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") +int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") +int ARKStepSetLinear(void* arkode_mem, int timedepend); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") +int ARKStepSetNonlinear(void* arkode_mem); SUNDIALS_EXPORT int ARKStepSetExplicit(void* arkode_mem); SUNDIALS_EXPORT int ARKStepSetImplicit(void* arkode_mem); SUNDIALS_EXPORT int ARKStepSetImEx(void* arkode_mem); -SUNDIALS_EXPORT int ARKStepSetDeduceImplicitRhs(void* arkode_mem, - sunbooleantype deduce); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") +int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); SUNDIALS_EXPORT int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, ARKodeButcherTable Be); @@ -124,146 +142,201 @@ SUNDIALS_EXPORT int ARKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable); SUNDIALS_EXPORT int ARKStepSetTableName(void* arkode_mem, const char* itable, const char* etable); -SUNDIALS_EXPORT int ARKStepSetAdaptController(void* arkode_mem, - SUNAdaptController C); -SUNDIALS_EXPORT int ARKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); -SUNDIALS_EXPORT int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); -SUNDIALS_EXPORT int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") +int ARKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") +int ARKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") +int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") +int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias); -SUNDIALS_EXPORT int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); -SUNDIALS_EXPORT int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); -SUNDIALS_EXPORT int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, - sunrealtype ub); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") +int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") +int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") +int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, + sunrealtype ub); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ARKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, sunrealtype adapt_params[3]); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ARKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); -SUNDIALS_EXPORT int ARKStepSetMaxFirstGrowth(void* arkode_mem, - sunrealtype etamx1); -SUNDIALS_EXPORT int ARKStepSetMaxEFailGrowth(void* arkode_mem, - sunrealtype etamxf); -SUNDIALS_EXPORT int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef); -SUNDIALS_EXPORT int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); -SUNDIALS_EXPORT int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -SUNDIALS_EXPORT int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -SUNDIALS_EXPORT int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -SUNDIALS_EXPORT int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp); -SUNDIALS_EXPORT int ARKStepSetPredictorMethod(void* arkode_mem, int method); -SUNDIALS_EXPORT int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, - void* estab_data); -SUNDIALS_EXPORT int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); -SUNDIALS_EXPORT int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor); -SUNDIALS_EXPORT int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf); -SUNDIALS_EXPORT int ARKStepSetNonlinConvCoef(void* arkode_mem, - sunrealtype nlscoef); -SUNDIALS_EXPORT int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints); -SUNDIALS_EXPORT int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_EXPORT int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_EXPORT int ARKStepSetInitStep(void* arkode_mem, sunrealtype hin); -SUNDIALS_EXPORT int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin); -SUNDIALS_EXPORT int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); -SUNDIALS_EXPORT int ARKStepSetInterpolateStopTime(void* arkode_mem, - sunbooleantype interp); -SUNDIALS_EXPORT int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_EXPORT int ARKStepClearStopTime(void* arkode_mem); -SUNDIALS_EXPORT int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_EXPORT int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); - -SUNDIALS_EXPORT int ARKStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_EXPORT int ARKStepSetNoInactiveRootWarn(void* arkode_mem); - -SUNDIALS_EXPORT int ARKStepSetUserData(void* arkode_mem, void* user_data); - -SUNDIALS_EXPORT int ARKStepSetPostprocessStepFn(void* arkode_mem, - ARKPostProcessFn ProcessStep); -SUNDIALS_EXPORT int ARKStepSetPostprocessStageFn(void* arkode_mem, - ARKPostProcessFn ProcessStage); -SUNDIALS_EXPORT int ARKStepSetStagePredictFn(void* arkode_mem, - ARKStagePredictFn PredictStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") +int ARKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") +int ARKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") +int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxCFailGrowth instead") +int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") +int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") +int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") +int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") +int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") +int ARKStepSetPredictorMethod(void* arkode_mem, int method); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") +int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, + void* estab_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") +int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") +int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxConvFails instead") +int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") +int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") +int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInitStep instead") +int ARKStepSetInitStep(void* arkode_mem, sunrealtype hin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinStep instead") +int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxStep instead") +int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int ARKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int ARKStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") +int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int ARKStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int ARKStepSetNoInactiveRootWarn(void* arkode_mem); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int ARKStepSetUserData(void* arkode_mem, void* user_data); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int ARKStepSetPostprocessStepFn(void* arkode_mem,ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int ARKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") +int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); /* Linear solver interface optional input functions -- must be called AFTER ARKStepSetLinearSolver and/or ARKStepSetMassLinearSolver */ -SUNDIALS_EXPORT int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); -SUNDIALS_EXPORT int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass); -SUNDIALS_EXPORT int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj); -SUNDIALS_EXPORT int ARKStepSetLinearSolutionScaling(void* arkode_mem, - sunbooleantype onoff); -SUNDIALS_EXPORT int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_EXPORT int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_EXPORT int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_EXPORT int ARKStepSetMassLSNormFactor(void* arkode_mem, - sunrealtype nrmfac); -SUNDIALS_EXPORT int ARKStepSetPreconditioner(void* arkode_mem, - ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -SUNDIALS_EXPORT int ARKStepSetMassPreconditioner(void* arkode_mem, - ARKLsMassPrecSetupFn psetup, - ARKLsMassPrecSolveFn psolve); -SUNDIALS_EXPORT int ARKStepSetJacTimes(void* arkode_mem, - ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -SUNDIALS_EXPORT int ARKStepSetJacTimesRhsFn(void* arkode_mem, - ARKRhsFn jtimesRhsFn); -SUNDIALS_EXPORT int ARKStepSetMassTimes(void* arkode_mem, - ARKLsMassTimesSetupFn msetup, - ARKLsMassTimesVecFn mtimes, - void* mtimes_data); -SUNDIALS_EXPORT int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") +int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassFn instead") +int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") +int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") +int ARKStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") +int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassEpsLin instead") +int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") +int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLSNormFactor instead") +int ARKStepSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") +int ARKStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassPreconditioner instead") +int ARKStepSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, + ARKLsMassPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") +int ARKStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") +int ARKStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassTimes instead") +int ARKStepSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn msetup, + ARKLsMassTimesVecFn mtimes, void* mtimes_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") +int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); /* Integrate the ODE over an interval in t */ -SUNDIALS_EXPORT int ARKStepEvolve(void* arkode_mem, sunrealtype tout, - N_Vector yout, sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); /* Computes the kth derivative of the y function at time t */ -SUNDIALS_EXPORT int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, - N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); /* Utility function to update/compute y based on zcor */ -SUNDIALS_EXPORT int ARKStepComputeState(void* arkode_mem, N_Vector zcor, - N_Vector z); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") +int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); /* Optional output functions */ -SUNDIALS_EXPORT int ARKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); -SUNDIALS_EXPORT int ARKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); -SUNDIALS_EXPORT int ARKStepGetNumStepAttempts(void* arkode_mem, - long int* step_attempts); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumExpSteps instead") +int ARKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumAccSteps instead") +int ARKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") +int ARKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); SUNDIALS_EXPORT int ARKStepGetNumRhsEvals(void* arkode_mem, long int* nfe_evals, long int* nfi_evals); -SUNDIALS_EXPORT int ARKStepGetNumLinSolvSetups(void* arkode_mem, - long int* nlinsetups); -SUNDIALS_EXPORT int ARKStepGetNumErrTestFails(void* arkode_mem, - long int* netfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") +int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") +int ARKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); SUNDIALS_EXPORT int ARKStepGetCurrentButcherTables(void* arkode_mem, ARKodeButcherTable* Bi, ARKodeButcherTable* Be); -SUNDIALS_EXPORT int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); -SUNDIALS_EXPORT int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, - long int* leniw); -SUNDIALS_EXPORT int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_EXPORT int ARKStepGetActualInitStep(void* arkode_mem, - sunrealtype* hinused); -SUNDIALS_EXPORT int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_EXPORT int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_EXPORT int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_EXPORT int ARKStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_EXPORT int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -SUNDIALS_EXPORT int ARKStepGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); -SUNDIALS_EXPORT int ARKStepGetTolScaleFactor(void* arkode_mem, - sunrealtype* tolsfac); -SUNDIALS_EXPORT int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_EXPORT int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight); -SUNDIALS_EXPORT int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_EXPORT int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_EXPORT int ARKStepGetNumConstrFails(void* arkode_mem, - long int* nconstrfails); -SUNDIALS_EXPORT int ARKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_EXPORT int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, - SUNOutputFormat fmt); -SUNDIALS_EXPORT char* ARKStepGetReturnFlagName(long int flag); - -SUNDIALS_EXPORT int ARKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") +int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetWorkSpace instead") +int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetActualInitStep instead") +int ARKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") +int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int ARKStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") +int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentMassMatrix instead") +int ARKStepGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int ARKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetResWeights instead") +int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") +int ARKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int ARKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, + SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* ARKStepGetReturnFlagName(long int flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int ARKStepWriteParameters(void* arkode_mem, FILE* fp); SUNDIALS_EXPORT int ARKStepWriteButcher(void* arkode_mem, FILE* fp); @@ -272,100 +345,128 @@ SUNDIALS_EXPORT int ARKStepGetTimestepperStats( void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nfe_evals, long int* nfi_evals, long int* nlinsetups, long int* netfails); -SUNDIALS_EXPORT int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") +int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, + sunrealtype* hinused, sunrealtype* hlast, + sunrealtype* hcur, sunrealtype* tcur); /* Nonlinear solver optional output functions */ -SUNDIALS_EXPORT int ARKStepGetNonlinearSystemData( - void* arkode_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, - N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); - -SUNDIALS_EXPORT int ARKStepGetNumNonlinSolvIters(void* arkode_mem, - long int* nniters); -SUNDIALS_EXPORT int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, - long int* nnfails); -SUNDIALS_EXPORT int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails); -SUNDIALS_EXPORT int ARKStepGetNumStepSolveFails(void* arkode_mem, - long int* nncfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") +int ARKStepGetNonlinearSystemData( void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, + N_Vector* Fi, sunrealtype* gamma, + N_Vector* sdata, void** user_data); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") +int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") +int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") +int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepSolveFails instead") +int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); /* Linear solver optional output functions */ -SUNDIALS_EXPORT int ARKStepGetJac(void* arkode_mem, SUNMatrix* J); -SUNDIALS_EXPORT int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J); -SUNDIALS_EXPORT int ARKStepGetJacNumSteps(void* arkode_mem, long int* nst_J); -SUNDIALS_EXPORT int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, - long int* leniwLS); -SUNDIALS_EXPORT int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals); -SUNDIALS_EXPORT int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals); -SUNDIALS_EXPORT int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); -SUNDIALS_EXPORT int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters); -SUNDIALS_EXPORT int ARKStepGetNumLinConvFails(void* arkode_mem, - long int* nlcfails); -SUNDIALS_EXPORT int ARKStepGetNumJTSetupEvals(void* arkode_mem, - long int* njtsetups); -SUNDIALS_EXPORT int ARKStepGetNumJtimesEvals(void* arkode_mem, - long int* njvevals); -SUNDIALS_EXPORT int ARKStepGetNumLinRhsEvals(void* arkode_mem, - long int* nfevalsLS); -SUNDIALS_EXPORT int ARKStepGetLastLinFlag(void* arkode_mem, long int* flag); - -SUNDIALS_EXPORT int ARKStepGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, - long int* leniwMLS); -SUNDIALS_EXPORT int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups); -SUNDIALS_EXPORT int ARKStepGetNumMassMultSetups(void* arkode_mem, - long int* nmvsetups); -SUNDIALS_EXPORT int ARKStepGetNumMassMult(void* arkode_mem, long int* nmvevals); -SUNDIALS_EXPORT int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves); -SUNDIALS_EXPORT int ARKStepGetNumMassPrecEvals(void* arkode_mem, - long int* nmpevals); -SUNDIALS_EXPORT int ARKStepGetNumMassPrecSolves(void* arkode_mem, - long int* nmpsolves); -SUNDIALS_EXPORT int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters); -SUNDIALS_EXPORT int ARKStepGetNumMassConvFails(void* arkode_mem, - long int* nmcfails); -SUNDIALS_EXPORT int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetups); -SUNDIALS_EXPORT int ARKStepGetLastMassFlag(void* arkode_mem, long int* flag); - -SUNDIALS_EXPORT char* ARKStepGetLinReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") +int ARKStepGetJac(void* arkode_mem, SUNMatrix* J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") +int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacNumSteps instead") +int ARKStepGetJacNumSteps(void* arkode_mem, long int* nst_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinWorkSpace instead") +int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, + long int* leniwLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") +int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") +int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") +int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") +int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") +int ARKStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") +int ARKStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") +int ARKStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") +int ARKStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") +int ARKStepGetLastLinFlag(void* arkode_mem, long int* flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetMassWorkSpace instead") +int ARKStepGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, + long int* leniwMLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSetups instead") +int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMultSetups instead") +int ARKStepGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMult instead") +int ARKStepGetNumMassMult(void* arkode_mem, long int* nmvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSolves instead") +int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecEvals instead") +int ARKStepGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecSolves instead") +int ARKStepGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassIters instead") +int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassConvFails instead") +int ARKStepGetNumMassConvFails(void* arkode_mem, long int* nmcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMTSetups instead") +int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastMassFlag instead") +int ARKStepGetLastMassFlag(void* arkode_mem, long int* flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") +char* ARKStepGetLinReturnFlagName(long int flag); /* Free function */ -SUNDIALS_EXPORT void ARKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void ARKStepFree(void** arkode_mem); /* Output the ARKStep memory structure (useful when debugging) */ -SUNDIALS_EXPORT void ARKStepPrintMem(void* arkode_mem, FILE* outfile); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void ARKStepPrintMem(void* arkode_mem, FILE* outfile); /* MRIStep interface functions */ SUNDIALS_EXPORT int ARKStepCreateMRIStepInnerStepper(void* arkode_mem, MRIStepInnerStepper* stepper); /* Relaxation functions */ -SUNDIALS_EXPORT int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, - ARKRelaxJacFn rjac); -SUNDIALS_EXPORT int ARKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); -SUNDIALS_EXPORT int ARKStepSetRelaxLowerBound(void* arkode_mem, - sunrealtype lower); -SUNDIALS_EXPORT int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); -SUNDIALS_EXPORT int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); -SUNDIALS_EXPORT int ARKStepSetRelaxSolver(void* arkode_mem, - ARKRelaxSolver solver); -SUNDIALS_EXPORT int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); -SUNDIALS_EXPORT int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, - sunrealtype abs_tol); -SUNDIALS_EXPORT int ARKStepSetRelaxUpperBound(void* arkode_mem, - sunrealtype upper); -SUNDIALS_EXPORT int ARKStepGetNumRelaxFnEvals(void* arkode_mem, - long int* r_evals); -SUNDIALS_EXPORT int ARKStepGetNumRelaxJacEvals(void* arkode_mem, - long int* J_evals); -SUNDIALS_EXPORT int ARKStepGetNumRelaxFails(void* arkode_mem, - long int* relax_fails); -SUNDIALS_EXPORT int ARKStepGetNumRelaxBoundFails(void* arkode_mem, - long int* fails); -SUNDIALS_EXPORT int ARKStepGetNumRelaxSolveFails(void* arkode_mem, - long int* fails); -SUNDIALS_EXPORT int ARKStepGetNumRelaxSolveIters(void* arkode_mem, - long int* iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") +int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") +int ARKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") +int ARKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") +int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") +int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") +int ARKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") +int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") +int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, + sunrealtype abs_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") +int ARKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") +int ARKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") +int ARKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") +int ARKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") +int ARKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") +int ARKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") +int ARKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); #ifdef __cplusplus } diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index 6fc507c4f2..2842f490d3 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -49,122 +49,169 @@ static const int ERKSTEP_DEFAULT_9 = ARKODE_VERNER_16_8_9; SUNDIALS_EXPORT void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx); -SUNDIALS_EXPORT int ERKStepResize(void* arkode_mem, N_Vector ynew, - sunrealtype hscale, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int ERKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); SUNDIALS_EXPORT int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ -SUNDIALS_EXPORT int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, - sunrealtype abstol); -SUNDIALS_EXPORT int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, - N_Vector abstol); -SUNDIALS_EXPORT int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, + sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, + N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); /* Rootfinding initialization */ -SUNDIALS_EXPORT int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER ERKStepCreate */ -SUNDIALS_EXPORT int ERKStepSetDefaults(void* arkode_mem); -SUNDIALS_EXPORT int ERKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_EXPORT int ERKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_EXPORT int ERKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_EXPORT int ERKStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int ERKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int ERKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int ERKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ERKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +int ERKStepSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_EXPORT int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B); SUNDIALS_EXPORT int ERKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable); SUNDIALS_EXPORT int ERKStepSetTableName(void* arkode_mem, const char* etable); -SUNDIALS_EXPORT int ERKStepSetAdaptController(void* arkode_mem, - SUNAdaptController C); -SUNDIALS_EXPORT int ERKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); -SUNDIALS_EXPORT int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); -SUNDIALS_EXPORT int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") +int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") +int ERKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") +int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") +int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias); -SUNDIALS_EXPORT int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); -SUNDIALS_EXPORT int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); -SUNDIALS_EXPORT int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, - sunrealtype ub); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") +int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") +int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetFiARKodeBounds instead") +int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, + sunrealtype ub); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ERKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, sunrealtype adapt_params[3]); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ERKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); -SUNDIALS_EXPORT int ERKStepSetMaxFirstGrowth(void* arkode_mem, - sunrealtype etamx1); -SUNDIALS_EXPORT int ERKStepSetMaxEFailGrowth(void* arkode_mem, - sunrealtype etamxf); -SUNDIALS_EXPORT int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef); -SUNDIALS_EXPORT int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, - void* estab_data); -SUNDIALS_EXPORT int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); -SUNDIALS_EXPORT int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints); -SUNDIALS_EXPORT int ERKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_EXPORT int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_EXPORT int ERKStepSetInitStep(void* arkode_mem, sunrealtype hin); -SUNDIALS_EXPORT int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin); -SUNDIALS_EXPORT int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); -SUNDIALS_EXPORT int ERKStepSetInterpolateStopTime(void* arkode_mem, - sunbooleantype interp); -SUNDIALS_EXPORT int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_EXPORT int ERKStepClearStopTime(void* arkode_mem); -SUNDIALS_EXPORT int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_EXPORT int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); - -SUNDIALS_EXPORT int ERKStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_EXPORT int ERKStepSetNoInactiveRootWarn(void* arkode_mem); - -SUNDIALS_EXPORT int ERKStepSetUserData(void* arkode_mem, void* user_data); - -SUNDIALS_EXPORT int ERKStepSetPostprocessStepFn(void* arkode_mem, - ARKPostProcessFn ProcessStep); -SUNDIALS_EXPORT int ERKStepSetPostprocessStageFn(void* arkode_mem, - ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") +int ERKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") +int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") +int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") +int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, + void* estab_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") +int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") +int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetMaxARKodes instead") +int ERKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetIARKode instead") +int ERKStepSetInitStep(void* arkode_mem, sunrealtype hin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetARKode instead") +int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetARKode instead") +int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int ERKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int ERKStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetFiARKode instead") +int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") +int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int ERKStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int ERKStepSetNoInactiveRootWarn(void* arkode_mem); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int ERKStepSetUserData(void* arkode_mem, void* user_data); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetPostprocARKodeFn instead") +int ERKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int ERKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); /* Integrate the ODE over an interval in t */ -SUNDIALS_EXPORT int ERKStepEvolve(void* arkode_mem, sunrealtype tout, - N_Vector yout, sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); /* Computes the kth derivative of the y function at time t */ -SUNDIALS_EXPORT int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, - N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); /* Optional output functions */ -SUNDIALS_EXPORT int ERKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); -SUNDIALS_EXPORT int ERKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); -SUNDIALS_EXPORT int ERKStepGetNumStepAttempts(void* arkode_mem, - long int* step_attempts); -SUNDIALS_EXPORT int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); -SUNDIALS_EXPORT int ERKStepGetNumErrTestFails(void* arkode_mem, - long int* netfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetNumARKodes instead") +int ERKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); +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 ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable* B); -SUNDIALS_EXPORT int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); -SUNDIALS_EXPORT int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, - long int* leniw); -SUNDIALS_EXPORT int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_EXPORT int ERKStepGetActualInitStep(void* arkode_mem, - sunrealtype* hinused); -SUNDIALS_EXPORT int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_EXPORT int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_EXPORT int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_EXPORT int ERKStepGetTolScaleFactor(void* arkode_mem, - sunrealtype* tolsfac); -SUNDIALS_EXPORT int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_EXPORT int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_EXPORT int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_EXPORT int ERKStepGetNumConstrFails(void* arkode_mem, - long int* nconstrfails); -SUNDIALS_EXPORT int ERKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_EXPORT int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, - SUNOutputFormat fmt); -SUNDIALS_EXPORT char* ERKStepGetReturnFlagName(long int flag); - -SUNDIALS_EXPORT int ERKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") +int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetWorkSpace instead") +int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetARKodes instead") +int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetActualIARKode instead") +int ERKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetLARKode instead") +int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepGetCurrARKode instead") +int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int ERKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") +int ERKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int ERKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* ERKStepGetReturnFlagName(long int flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int ERKStepWriteParameters(void* arkode_mem, FILE* fp); SUNDIALS_EXPORT int ERKStepWriteButcher(void* arkode_mem, FILE* fp); @@ -172,43 +219,51 @@ SUNDIALS_EXPORT int ERKStepWriteButcher(void* arkode_mem, FILE* fp); SUNDIALS_EXPORT int ERKStepGetTimestepperStats( void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nfevals, long int* netfails); -SUNDIALS_EXPORT int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepARKodeStats instead") +int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, + sunrealtype* hinused, sunrealtype* hlast, + sunrealtype* hcur, sunrealtype* tcur); /* Free function */ -SUNDIALS_EXPORT void ERKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void ERKStepFree(void** arkode_mem); /* Output the ERKStep memory structure (useful when debugging) */ -SUNDIALS_EXPORT void ERKStepPrintMem(void* arkode_mem, FILE* outfile); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void ERKStepPrintMem(void* arkode_mem, FILE* outfile); /* Relaxation functions */ -SUNDIALS_EXPORT int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, - ARKRelaxJacFn rjac); -SUNDIALS_EXPORT int ERKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); -SUNDIALS_EXPORT int ERKStepSetRelaxLowerBound(void* arkode_mem, - sunrealtype lower); -SUNDIALS_EXPORT int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); -SUNDIALS_EXPORT int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); -SUNDIALS_EXPORT int ERKStepSetRelaxSolver(void* arkode_mem, - ARKRelaxSolver solver); -SUNDIALS_EXPORT int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); -SUNDIALS_EXPORT int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, - sunrealtype abs_tol); -SUNDIALS_EXPORT int ERKStepSetRelaxUpperBound(void* arkode_mem, - sunrealtype upper); -SUNDIALS_EXPORT int ERKStepGetNumRelaxFnEvals(void* arkode_mem, - long int* r_evals); -SUNDIALS_EXPORT int ERKStepGetNumRelaxJacEvals(void* arkode_mem, - long int* J_evals); -SUNDIALS_EXPORT int ERKStepGetNumRelaxFails(void* arkode_mem, - long int* relax_fails); -SUNDIALS_EXPORT int ERKStepGetNumRelaxBoundFails(void* arkode_mem, - long int* fails); -SUNDIALS_EXPORT int ERKStepGetNumRelaxSolveFails(void* arkode_mem, - long int* fails); -SUNDIALS_EXPORT int ERKStepGetNumRelaxSolveIters(void* arkode_mem, - long int* iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") +int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") +int ERKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") +int ERKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") +int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") +int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") +int ERKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") +int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") +int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, + sunrealtype abs_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") +int ERKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") +int ERKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") +int ERKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") +int ERKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") +int ERKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") +int ERKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") +int ERKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); #ifdef __cplusplus } diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index d4451e64c2..b1cfdff60a 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -135,170 +135,228 @@ SUNDIALS_EXPORT void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, MRIStepInnerStepper stepper, SUNContext sunctx); -SUNDIALS_EXPORT int MRIStepResize(void* arkode_mem, N_Vector ynew, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int MRIStepResize(void* arkode_mem, N_Vector ynew, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); SUNDIALS_EXPORT int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ -SUNDIALS_EXPORT int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, - sunrealtype abstol); -SUNDIALS_EXPORT int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, - N_Vector abstol); -SUNDIALS_EXPORT int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun); /* Linear solver set function */ -SUNDIALS_EXPORT int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, - SUNMatrix A); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") +int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); /* Rootfinding initialization */ -SUNDIALS_EXPORT int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER MRIStepCreate */ -SUNDIALS_EXPORT int MRIStepSetDefaults(void* arkode_mem); -SUNDIALS_EXPORT int MRIStepSetOrder(void* arkode_mem, int ord); -SUNDIALS_EXPORT int MRIStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_EXPORT int MRIStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_EXPORT int MRIStepSetDenseOrder(void* arkode_mem, int dord); -SUNDIALS_EXPORT int MRIStepSetNonlinearSolver(void* arkode_mem, - SUNNonlinearSolver NLS); -SUNDIALS_EXPORT int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fs); -SUNDIALS_EXPORT int MRIStepSetLinear(void* arkode_mem, int timedepend); -SUNDIALS_EXPORT int MRIStepSetNonlinear(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int MRIStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int MRIStepSetOrder(void* arkode_mem, int ord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int MRIStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int MRIStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +int MRIStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") +int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") +int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fs); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") +int MRIStepSetLinear(void* arkode_mem, int timedepend); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") +int MRIStepSetNonlinear(void* arkode_mem); SUNDIALS_EXPORT int MRIStepSetCoupling(void* arkode_mem, MRIStepCoupling MRIC); -SUNDIALS_EXPORT int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_EXPORT int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -SUNDIALS_EXPORT int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -SUNDIALS_EXPORT int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -SUNDIALS_EXPORT int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp); -SUNDIALS_EXPORT int MRIStepSetPredictorMethod(void* arkode_mem, int method); -SUNDIALS_EXPORT int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor); -SUNDIALS_EXPORT int MRIStepSetNonlinConvCoef(void* arkode_mem, - sunrealtype nlscoef); -SUNDIALS_EXPORT int MRIStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_EXPORT int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_EXPORT int MRIStepSetInterpolateStopTime(void* arkode_mem, - sunbooleantype interp); -SUNDIALS_EXPORT int MRIStepClearStopTime(void* arkode_mem); -SUNDIALS_EXPORT int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed); -SUNDIALS_EXPORT int MRIStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_EXPORT int MRIStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_EXPORT int MRIStepSetUserData(void* arkode_mem, void* user_data); -SUNDIALS_EXPORT int MRIStepSetPostprocessStepFn(void* arkode_mem, - ARKPostProcessFn ProcessStep); -SUNDIALS_EXPORT int MRIStepSetPostprocessStageFn(void* arkode_mem, - ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepSetMaxARKodes instead") +int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") +int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") +int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") +int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") +int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") +int MRIStepSetPredictorMethod(void* arkode_mem, int method); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") +int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") +int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int MRIStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int MRIStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int MRIStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepSetFiARKode instead") +int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int MRIStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int MRIStepSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int MRIStepSetUserData(void* arkode_mem, void* user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepSetPostprocARKodeFn instead") +int MRIStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int MRIStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); SUNDIALS_EXPORT int MRIStepSetPreInnerFn(void* arkode_mem, MRIStepPreInnerFn prefn); SUNDIALS_EXPORT int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn); -SUNDIALS_EXPORT int MRIStepSetStagePredictFn(void* arkode_mem, - ARKStagePredictFn PredictStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") +int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); SUNDIALS_EXPORT int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); /* Linear solver interface optional input functions -- must be called AFTER MRIStepSetLinearSolver */ -SUNDIALS_EXPORT int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); -SUNDIALS_EXPORT int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj); -SUNDIALS_EXPORT int MRIStepSetLinearSolutionScaling(void* arkode_mem, - sunbooleantype onoff); -SUNDIALS_EXPORT int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_EXPORT int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_EXPORT int MRIStepSetPreconditioner(void* arkode_mem, - ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -SUNDIALS_EXPORT int MRIStepSetJacTimes(void* arkode_mem, - ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -SUNDIALS_EXPORT int MRIStepSetJacTimesRhsFn(void* arkode_mem, - ARKRhsFn jtimesRhsFn); -SUNDIALS_EXPORT int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") +int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") +int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") +int MRIStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") +int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") +int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") +int MRIStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") +int MRIStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") +int MRIStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") +int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); /* Integrate the ODE over an interval in t */ -SUNDIALS_EXPORT int MRIStepEvolve(void* arkode_mem, sunrealtype tout, - N_Vector yout, sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); /* Computes the kth derivative of the y function at time t */ -SUNDIALS_EXPORT int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, - N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); /* Utility function to update/compute y based on zcor */ -SUNDIALS_EXPORT int MRIStepComputeState(void* arkode_mem, N_Vector zcor, - N_Vector z); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") +int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); /* Optional output functions */ SUNDIALS_EXPORT int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, long int* nfsi_evals); -SUNDIALS_EXPORT int MRIStepGetNumLinSolvSetups(void* arkode_mem, - long int* nlinsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") +int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); SUNDIALS_EXPORT int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling* MRIC); -SUNDIALS_EXPORT int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, - long int* leniw); -SUNDIALS_EXPORT int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps); -SUNDIALS_EXPORT int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_EXPORT int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_EXPORT int MRIStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_EXPORT int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -SUNDIALS_EXPORT int MRIStepGetTolScaleFactor(void* arkode_mem, - sunrealtype* tolsfac); -SUNDIALS_EXPORT int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_EXPORT int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_EXPORT int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_EXPORT int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag); -SUNDIALS_EXPORT int MRIStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_EXPORT int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, - SUNOutputFormat fmt); -SUNDIALS_EXPORT char* MRIStepGetReturnFlagName(long int flag); - -SUNDIALS_EXPORT int MRIStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetWorkSpace instead") +int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetARKodes instead") +int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetLARKode instead") +int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int MRIStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") +int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int MRIStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetLastInARKodeFlag instead") +int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int MRIStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* MRIStepGetReturnFlagName(long int flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int MRIStepWriteParameters(void* arkode_mem, FILE* fp); SUNDIALS_EXPORT int MRIStepWriteCoupling(void* arkode_mem, FILE* fp); /* Nonlinear solver optional output functions */ -SUNDIALS_EXPORT int MRIStepGetNonlinearSystemData( - void* arkode_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, - N_Vector* F, sunrealtype* gamma, N_Vector* sdata, void** user_data); -SUNDIALS_EXPORT int MRIStepGetNumNonlinSolvIters(void* arkode_mem, - long int* nniters); -SUNDIALS_EXPORT int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, - long int* nnfails); -SUNDIALS_EXPORT int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails); -SUNDIALS_EXPORT int MRIStepGetNumStepSolveFails(void* arkode_mem, - long int* nncfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") +int MRIStepGetNonlinearSystemData( void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, + N_Vector* F, sunrealtype* gamma, + N_Vector* sdata, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") +int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") +int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") +int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetARKodeSolveFails instead") +int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); /* Linear solver optional output functions */ -SUNDIALS_EXPORT int MRIStepGetJac(void* arkode_mem, SUNMatrix* J); -SUNDIALS_EXPORT int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J); -SUNDIALS_EXPORT int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J); -SUNDIALS_EXPORT int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, - long int* leniwLS); -SUNDIALS_EXPORT int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals); -SUNDIALS_EXPORT int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals); -SUNDIALS_EXPORT int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); -SUNDIALS_EXPORT int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters); -SUNDIALS_EXPORT int MRIStepGetNumLinConvFails(void* arkode_mem, - long int* nlcfails); -SUNDIALS_EXPORT int MRIStepGetNumJTSetupEvals(void* arkode_mem, - long int* njtsetups); -SUNDIALS_EXPORT int MRIStepGetNumJtimesEvals(void* arkode_mem, - long int* njvevals); -SUNDIALS_EXPORT int MRIStepGetNumLinRhsEvals(void* arkode_mem, - long int* nfevalsLS); -SUNDIALS_EXPORT int MRIStepGetLastLinFlag(void* arkode_mem, long int* flag); - -SUNDIALS_EXPORT char* MRIStepGetLinReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") +int MRIStepGetJac(void* arkode_mem, SUNMatrix* J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") +int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetJacARKodes instead") +int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinWorkSpace instead") +int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") +int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") +int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") +int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") +int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") +int MRIStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") +int MRIStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") +int MRIStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") +int MRIStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") +int MRIStepGetLastLinFlag(void* arkode_mem, long int* flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") +char* MRIStepGetLinReturnFlagName(long int flag); /* Free function */ -SUNDIALS_EXPORT void MRIStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void MRIStepFree(void** arkode_mem); /* Output the MRIStep memory structure (useful when debugging) */ -SUNDIALS_EXPORT void MRIStepPrintMem(void* arkode_mem, FILE* outfile); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void MRIStepPrintMem(void* arkode_mem, FILE* outfile); /* Custom inner stepper functions */ SUNDIALS_EXPORT int MRIStepInnerStepper_Create(SUNContext sunctx, diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index a8f6c3a4df..602579d921 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -48,67 +48,89 @@ SUNDIALS_EXPORT void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, SUNDIALS_EXPORT int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Rootfinding functions */ /* Rootfinding initialization */ -SUNDIALS_EXPORT int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER SPRKStepCreate */ -SUNDIALS_EXPORT int SPRKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int SPRKStepSetDefaults(void* arkode_mem); SUNDIALS_EXPORT int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); SUNDIALS_EXPORT int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage); SUNDIALS_EXPORT int SPRKStepSetMethodName(void* arkode_mem, const char* method); -SUNDIALS_EXPORT int SPRKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_EXPORT int SPRKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_EXPORT int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_EXPORT int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_EXPORT int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_EXPORT int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_EXPORT int SPRKStepSetUserData(void* arkode_mem, void* user_data); - -SUNDIALS_EXPORT int SPRKStepSetPostprocessStepFn(void* arkode_mem, - ARKPostProcessFn ProcessStep); -SUNDIALS_EXPORT int SPRKStepSetPostprocessStageFn(void* arkode_mem, - ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int SPRKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int SPRKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int SPRKStepSetUserData(void* arkode_mem, void* user_data); + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int SPRKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int SPRKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); /* Integrate the ODE over an interval in t */ -SUNDIALS_EXPORT int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, - N_Vector yout, sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); /* Computes the kth derivative of the y function at time t */ -SUNDIALS_EXPORT int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, - N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); /* Optional output functions */ -SUNDIALS_EXPORT char* SPRKStepGetReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* SPRKStepGetReturnFlagName(long int flag); SUNDIALS_EXPORT int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage); -SUNDIALS_EXPORT int SPRKStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_EXPORT int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_EXPORT int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_EXPORT int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int SPRKStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") +int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); SUNDIALS_EXPORT int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2); -SUNDIALS_EXPORT int SPRKStepGetNumStepAttempts(void* arkode_mem, - long int* step_attempts); -SUNDIALS_EXPORT int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_EXPORT int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_EXPORT int SPRKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_EXPORT int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, - SUNOutputFormat fmt); -SUNDIALS_EXPORT int SPRKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") +int SPRKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int SPRKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int SPRKStepWriteParameters(void* arkode_mem, FILE* fp); /* Grouped optional output functions */ -SUNDIALS_EXPORT int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") +int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, + sunrealtype* hinused, sunrealtype* hlast, + sunrealtype* hcur, sunrealtype* tcur); /* Free function */ -SUNDIALS_EXPORT void SPRKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void SPRKStepFree(void** arkode_mem); #ifdef __cplusplus } diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 15904203a0..de0d743497 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -648,7 +648,7 @@ int ERKStepSetTableName(void* arkode_mem, const char* etable) /*--------------------------------------------------------------- ERKStepGetNumRhsEvals: - Returns the current number of calls to fe and fi + Returns the current number of calls to f ---------------------------------------------------------------*/ int ERKStepGetNumRhsEvals(void* arkode_mem, long int* fevals) { From cedc12775e058fea652f7afd42296d50c0ff99eb Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Thu, 18 Apr 2024 12:14:56 -0500 Subject: [PATCH 02/39] Added shared set of ARKODE UI routines, and set existing stepper-specific UI routines to wrap those. --- include/arkode/arkode.h | 49 +- include/arkode/arkode_ls.h | 37 + src/arkode/arkode.c | 313 +- src/arkode/arkode_adapt.c | 2 +- src/arkode/arkode_arkstep.c | 328 +- src/arkode/arkode_arkstep_impl.h | 35 + src/arkode/arkode_arkstep_io.c | 599 ++-- src/arkode/arkode_arkstep_nls.c | 116 +- src/arkode/arkode_bandpre.c | 2 +- src/arkode/arkode_bbdpre.c | 2 +- src/arkode/arkode_erkstep.c | 196 +- src/arkode/arkode_erkstep_impl.h | 11 + src/arkode/arkode_erkstep_io.c | 277 +- src/arkode/arkode_impl.h | 147 +- src/arkode/arkode_io.c | 1185 ++++++- src/arkode/arkode_ls.c | 610 +++- src/arkode/arkode_ls_impl.h | 47 +- src/arkode/arkode_mristep.c | 259 +- src/arkode/arkode_mristep_impl.h | 34 + src/arkode/arkode_mristep_io.c | 480 ++- src/arkode/arkode_mristep_nls.c | 18 +- src/arkode/arkode_relaxation.c | 164 +- src/arkode/arkode_relaxation_impl.h | 16 - src/arkode/arkode_root.c | 28 +- src/arkode/arkode_sprkstep.c | 163 +- src/arkode/arkode_sprkstep_impl.h | 10 + src/arkode/arkode_sprkstep_io.c | 167 +- src/arkode/fmod/farkode_mod.c | 2276 ++++++++++++- src/arkode/fmod/farkode_mod.f90 | 4654 +++++++++++++++++++++++++-- 29 files changed, 10015 insertions(+), 2210 deletions(-) diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index 1f04db996c..8ee70255f2 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -137,6 +137,8 @@ extern "C" { #define ARK_CONTROLLER_ERR -47 +#define ARK_STEPPER_UNSUPPORTED -48 + #define ARK_UNRECOGNIZED_ERROR -99 /* ------------------------------ @@ -209,15 +211,10 @@ SUNDIALS_EXPORT int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol); SUNDIALS_EXPORT int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol); SUNDIALS_EXPORT int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun); -/* Linear solver set functions */ -SUNDIALS_EXPORT int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, - SUNMatrix A); -SUNDIALS_EXPORT int ARKodeSetMassLinearSolver(void* arkode_mem, - SUNLinearSolver LS, SUNMatrix M, - sunbooleantype time_dep); - -/* Rootfinding initialization */ +/* Rootfinding */ SUNDIALS_EXPORT int ARKodeRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_EXPORT int ARKodeSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_EXPORT int ARKodeSetNoInactiveRootWarn(void* arkode_mem); /* Optional input functions */ SUNDIALS_EXPORT int ARKodeSetDefaults(void* arkode_mem); @@ -227,15 +224,16 @@ SUNDIALS_EXPORT int ARKodeSetInterpolantDegree(void* arkode_mem, int degree); SUNDIALS_EXPORT int ARKodeSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_EXPORT int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); -SUNDIALS_EXPORT int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); SUNDIALS_EXPORT int ARKodeSetLinear(void* arkode_mem, int timedepend); SUNDIALS_EXPORT int ARKodeSetNonlinear(void* arkode_mem); +SUNDIALS_EXPORT int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); SUNDIALS_EXPORT int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); SUNDIALS_EXPORT int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C); SUNDIALS_EXPORT int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust); SUNDIALS_EXPORT int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_EXPORT int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias); SUNDIALS_EXPORT int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety); SUNDIALS_EXPORT int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); SUNDIALS_EXPORT int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min); @@ -271,9 +269,7 @@ SUNDIALS_EXPORT int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop); SUNDIALS_EXPORT int ARKodeClearStopTime(void* arkode_mem); SUNDIALS_EXPORT int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed); SUNDIALS_EXPORT int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails); - -SUNDIALS_EXPORT int ARKodeSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_EXPORT int ARKodeSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_EXPORT int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); SUNDIALS_EXPORT int ARKodeSetUserData(void* arkode_mem, void* user_data); @@ -284,35 +280,6 @@ SUNDIALS_EXPORT int ARKodeSetPostprocessStageFn(void* arkode_mem, SUNDIALS_EXPORT int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -/* Linear solver interface optional input functions -- must be called - AFTER ARKodeSetLinearSolver and/or ARKodeSetMassLinearSolver */ -SUNDIALS_EXPORT int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac); -SUNDIALS_EXPORT int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass); -SUNDIALS_EXPORT int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj); -SUNDIALS_EXPORT int ARKodeSetLinearSolutionScaling(void* arkode_mem, - sunbooleantype onoff); -SUNDIALS_EXPORT int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_EXPORT int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_EXPORT int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_EXPORT int ARKodeSetMassLSNormFactor(void* arkode_mem, - sunrealtype nrmfac); -SUNDIALS_EXPORT int ARKodeSetPreconditioner(void* arkode_mem, - ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -SUNDIALS_EXPORT int ARKodeSetMassPreconditioner(void* arkode_mem, - ARKLsMassPrecSetupFn psetup, - ARKLsMassPrecSolveFn psolve); -SUNDIALS_EXPORT int ARKodeSetJacTimes(void* arkode_mem, - ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -SUNDIALS_EXPORT int ARKodeSetJacTimesRhsFn(void* arkode_mem, - ARKRhsFn jtimesRhsFn); -SUNDIALS_EXPORT int ARKodeSetMassTimes(void* arkode_mem, - ARKLsMassTimesSetupFn msetup, - ARKLsMassTimesVecFn mtimes, - void* mtimes_data); -SUNDIALS_EXPORT int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); - /* Integrate the ODE over an interval in t */ SUNDIALS_EXPORT int ARKodeEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype* tret, int itask); diff --git a/include/arkode/arkode_ls.h b/include/arkode/arkode_ls.h index 8973e53ea5..3afa02f6b2 100644 --- a/include/arkode/arkode_ls.h +++ b/include/arkode/arkode_ls.h @@ -87,6 +87,43 @@ typedef int (*ARKLsMassPrecSetupFn)(sunrealtype t, void* user_data); typedef int (*ARKLsMassPrecSolveFn)(sunrealtype t, N_Vector r, N_Vector z, sunrealtype delta, int lr, void* user_data); +/* Linear solver set functions */ +SUNDIALS_EXPORT int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, + SUNMatrix A); +SUNDIALS_EXPORT int ARKodeSetMassLinearSolver(void* arkode_mem, + SUNLinearSolver LS, SUNMatrix M, + sunbooleantype time_dep); + +/* Linear solver interface optional input functions -- must be called + AFTER ARKodeSetLinearSolver and/or ARKodeSetMassLinearSolver */ +SUNDIALS_EXPORT int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_EXPORT int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass); +SUNDIALS_EXPORT int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_EXPORT int ARKodeSetLinearSolutionScaling(void* arkode_mem, + sunbooleantype onoff); +SUNDIALS_EXPORT int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_EXPORT int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_EXPORT int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_EXPORT int ARKodeSetMassLSNormFactor(void* arkode_mem, + sunrealtype nrmfac); +SUNDIALS_EXPORT int ARKodeSetPreconditioner(void* arkode_mem, + ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_EXPORT int ARKodeSetMassPreconditioner(void* arkode_mem, + ARKLsMassPrecSetupFn psetup, + ARKLsMassPrecSolveFn psolve); +SUNDIALS_EXPORT int ARKodeSetJacTimes(void* arkode_mem, + ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_EXPORT int ARKodeSetJacTimesRhsFn(void* arkode_mem, + ARKRhsFn jtimesRhsFn); +SUNDIALS_EXPORT int ARKodeSetMassTimes(void* arkode_mem, + ARKLsMassTimesSetupFn msetup, + ARKLsMassTimesVecFn mtimes, + void* mtimes_data); +SUNDIALS_EXPORT int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); + + #ifdef __cplusplus } #endif diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index eac2af4222..b445a809d8 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -83,19 +83,53 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->uround = SUN_UNIT_ROUNDOFF; /* Initialize time step module to NULL */ - ark_mem->step_attachlinsol = NULL; - ark_mem->step_attachmasssol = NULL; - ark_mem->step_disablelsetup = NULL; - ark_mem->step_disablemsetup = NULL; - ark_mem->step_getlinmem = NULL; - ark_mem->step_getmassmem = NULL; - ark_mem->step_getimplicitrhs = NULL; - ark_mem->step_mmult = NULL; - ark_mem->step_getgammas = NULL; - ark_mem->step_init = NULL; - ark_mem->step_fullrhs = NULL; - ark_mem->step = NULL; - ark_mem->step_mem = NULL; + ark_mem->step_attachlinsol = NULL; + ark_mem->step_attachmasssol = NULL; + ark_mem->step_disablelsetup = NULL; + ark_mem->step_disablemsetup = NULL; + ark_mem->step_getlinmem = NULL; + ark_mem->step_getmassmem = NULL; + ark_mem->step_getimplicitrhs = NULL; + ark_mem->step_mmult = NULL; + ark_mem->step_getgammas = NULL; + ark_mem->step_init = NULL; + ark_mem->step_fullrhs = NULL; + ark_mem->step = NULL; + ark_mem->step_setuserdata = NULL; + ark_mem->step_printallstats = NULL; + ark_mem->step_writeparameters = NULL; + ark_mem->step_resize = NULL; + ark_mem->step_reset = NULL; + ark_mem->step_free = NULL; + ark_mem->step_printmem = NULL; + ark_mem->step_setdefaults = NULL; + ark_mem->step_computestate = NULL; + ark_mem->step_setrelaxfn = NULL; + ark_mem->step_setorder = NULL; + ark_mem->step_setnonlinearsolver = NULL; + ark_mem->step_setlinear = NULL; + ark_mem->step_setnonlinear = NULL; + ark_mem->step_setnlsrhsfn = NULL; + ark_mem->step_setdeduceimplicitrhs = NULL; + ark_mem->step_setnonlincrdown = NULL; + ark_mem->step_setnonlinrdiv = NULL; + ark_mem->step_setdeltagammamax = NULL; + ark_mem->step_setlsetupfrequency = NULL; + ark_mem->step_setpredictormethod = NULL; + ark_mem->step_setmaxnonliniters = NULL; + ark_mem->step_setnonlinconvcoef = NULL; + ark_mem->step_setstagepredictfn = NULL; + ark_mem->step_getnumlinsolvsetups = NULL; + ark_mem->step_getcurrentgamma = NULL; + ark_mem->step_getnonlinearsystemdata = NULL; + ark_mem->step_getnumnonlinsolviters = NULL; + ark_mem->step_getnumnonlinsolvconvfails = NULL; + ark_mem->step_getnonlinsolvstats = NULL; + ark_mem->step_mem = NULL; + ark_mem->step_supports_adaptive = SUNFALSE; + ark_mem->step_supports_algebraic = SUNFALSE; + ark_mem->step_supports_massmatrix = SUNFALSE; + ark_mem->step_supports_relaxation = SUNFALSE; /* Initialize root finding variables */ ark_mem->root_mem = NULL; @@ -110,7 +144,7 @@ ARKodeMem arkCreate(SUNContext sunctx) /* Initialize lrw and liw */ ark_mem->lrw = 18; - ark_mem->liw = 41; /* fcn/data ptr, int, long int, sunindextype, sunbooleantype */ + ark_mem->liw = 53; /* fcn/data ptr, int, long int, sunindextype, sunbooleantype */ /* No mallocs have been done yet */ ark_mem->VabstolMallocDone = SUNFALSE; @@ -133,7 +167,7 @@ ARKodeMem arkCreate(SUNContext sunctx) { arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Allocation of step adaptivity structure failed"); - arkFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } ark_mem->lrw += ARK_ADAPT_LRW; @@ -145,7 +179,7 @@ ARKodeMem arkCreate(SUNContext sunctx) { arkProcessError(NULL, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Allocation of step controller object failed"); - arkFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } ark_mem->hadapt_mem->owncontroller = SUNTRUE; @@ -177,12 +211,12 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->h0u = ZERO; /* Set default values for integrator optional inputs */ - iret = arkSetDefaults(ark_mem); + iret = ARKodeSetDefaults(ark_mem); if (iret != ARK_SUCCESS) { arkProcessError(NULL, 0, __LINE__, __func__, __FILE__, "Error setting default solver options"); - arkFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -191,12 +225,12 @@ ARKodeMem arkCreate(SUNContext sunctx) } /*--------------------------------------------------------------- - arkResize: + ARKodeResize: - arkResize re-initializes ARKODE's memory for a problem with a + ARKodeResize re-initializes ARKODE's memory for a problem with a changing vector size. It is assumed that the problem dynamics before and after the vector resize will be comparable, so that - all time-stepping heuristics prior to calling arkResize + all time-stepping heuristics prior to calling ARKodeResize remain valid after the call. If instead the dynamics should be re-calibrated, the ARKODE memory structure should be deleted with a call to *StepFree, and re-created with a call to @@ -227,20 +261,22 @@ ARKodeMem arkCreate(SUNContext sunctx) The return value is ARK_SUCCESS = 0 if no errors occurred, or a negative value otherwise. ---------------------------------------------------------------*/ -int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +int ARKodeResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { sunbooleantype resizeOK; sunindextype lrw1, liw1, lrw_diff, liw_diff; int retval; + ARKodeMem ark_mem; /* Check ark_mem */ - if (ark_mem == NULL) + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) @@ -327,37 +363,84 @@ int arkResize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, ark_mem->init_type = RESIZE_INIT; ark_mem->firststage = SUNTRUE; + /* Call the stepper-specific resize (if provided) */ + if (ark_mem->step_resize) + { + return (ark_mem->step_resize(arkode_mem, y0, hscale, t0, resize, resize_data)); + } + /* Problem has been successfully re-sized */ return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkSStolerances, arkSVtolerances, arkWFtolerances: + ARKodeReset: + + This routine resets an ARKode module to solve the same + problem from the given time with the input state (all counter + values are retained). + ---------------------------------------------------------------*/ +int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +{ + ARKodeMem ark_mem; + int retval; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Reset main ARKODE infrastructure */ + retval = arkInit(ark_mem, tR, yR, RESET_INIT); + if (retval != ARK_SUCCESS) + { + arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, + "ARKode reset failure"); + return (retval); + } + + /* Call stepper routine to perform remaining reset operations (if provided) */ + if (ark_mem->step_reset) + { + return (ark_mem->step_reset(arkode_mem, tR, yR)); + } + + return (ARK_SUCCESS); +} + +/*--------------------------------------------------------------- + ARKodeSStolerances, ARKodeSVtolerances, ARKodeWFtolerances: These functions specify the integration tolerances. One of them - SHOULD be called before the first call to arkEvolve; otherwise + SHOULD be called before the first call to ARKodeEvolve; otherwise default values of reltol=1e-4 and abstol=1e-9 will be used, which may be entirely incorrect for a specific problem. - arkSStolerances specifies scalar relative and absolute + ARKodeSStolerances specifies scalar relative and absolute tolerances. - arkSVtolerances specifies scalar relative tolerance and a + ARKodeSVtolerances specifies scalar relative tolerance and a vector absolute tolerance (a potentially different absolute tolerance for each vector component). - arkWFtolerances specifies a user-provides function (of type + ARKodeWFtolerances specifies a user-provides function (of type ARKEwtFn) which will be called to set the error weight vector. ---------------------------------------------------------------*/ -int arkSStolerances(ARKodeMem ark_mem, sunrealtype reltol, sunrealtype abstol) +int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) { - /* Check inputs */ - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Check inputs */ if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -393,18 +476,22 @@ int arkSStolerances(ARKodeMem ark_mem, sunrealtype reltol, sunrealtype abstol) return (ARK_SUCCESS); } -int arkSVtolerances(ARKodeMem ark_mem, sunrealtype reltol, N_Vector abstol) +int ARKodeSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) { /* local variables */ sunrealtype abstolmin; - /* Check inputs */ - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Check inputs */ if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -463,14 +550,17 @@ int arkSVtolerances(ARKodeMem ark_mem, sunrealtype reltol, N_Vector abstol) return (ARK_SUCCESS); } -int arkWFtolerances(ARKodeMem ark_mem, ARKEwtFn efun) +int ARKodeWFtolerances(void* arkode_mem, ARKEwtFn efun) { - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -488,7 +578,7 @@ int arkWFtolerances(ARKodeMem ark_mem, ARKEwtFn efun) } /*--------------------------------------------------------------- - arkResStolerance, arkResVtolerance, arkResFtolerance: + ARKodeResStolerance, ARKodeResVtolerance, ARKodeResFtolerance: These functions specify the absolute residual tolerance. Specification of the absolute residual tolerance is only @@ -499,25 +589,37 @@ int arkWFtolerances(ARKodeMem ark_mem, ARKEwtFn efun) ARKODE; otherwise the default value of rabstol=1e-9 will be used, which may be entirely incorrect for a specific problem. - arkResStolerances specifies a scalar residual tolerance. + ARKodeResStolerances specifies a scalar residual tolerance. - arkResVtolerances specifies a vector residual tolerance + ARKodeResVtolerances specifies a vector residual tolerance (a potentially different absolute residual tolerance for each vector component). - arkResFtolerances specifies a user-provides function (of + ARKodeResFtolerances specifies a user-provides function (of type ARKRwtFn) which will be called to set the residual weight vector. ---------------------------------------------------------------*/ -int arkResStolerance(ARKodeMem ark_mem, sunrealtype rabstol) +int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) { - /* Check inputs */ - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* Check inputs */ if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -559,18 +661,30 @@ int arkResStolerance(ARKodeMem ark_mem, sunrealtype rabstol) return (ARK_SUCCESS); } -int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol) +int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol) { /* local variables */ sunrealtype rabstolmin; - /* Check inputs */ - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* Check inputs */ if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -635,14 +749,26 @@ int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol) return (ARK_SUCCESS); } -int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun) +int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun) { - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, @@ -673,17 +799,17 @@ int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun) } /*--------------------------------------------------------------- - arkEvolve: + ARKodeEvolve: This routine is the main driver of ARKODE-based integrators. It integrates over a time interval defined by the user, by calling the time step module to do internal time steps. - The first time that arkEvolve is called for a successfully + The first time that ARKodeEvolve is called for a successfully initialized problem, it computes a tentative initial step size. - arkEvolve supports two modes as specified by itask: ARK_NORMAL and + ARKodeEvolve supports two modes as specified by itask: ARK_NORMAL and ARK_ONE_STEP. In the ARK_NORMAL mode, the solver steps until it reaches or passes tout and then interpolates to obtain y(tout). In the ARK_ONE_STEP mode, it takes one internal step @@ -694,8 +820,8 @@ int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun) exactly the specified stop time, and hence interpolation of y(tout) is not required. ---------------------------------------------------------------*/ -int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask) +int ARKodeEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask) { long int nstloc; int retval, kflag, istate, ir; @@ -705,16 +831,18 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, sunrealtype dsm; int nflag, attempts, ncf, nef, constrfails; int relax_fails; + ARKodeMem ark_mem; /* Check and process inputs */ /* Check if ark_mem exists */ - if (ark_mem == NULL) + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; /* Check if ark_mem was allocated */ if (ark_mem->MallocDone == SUNFALSE) @@ -748,6 +876,9 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, return (ARK_ILL_INPUT); } + /* start profiler */ + SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); + /* store copy of itask if using root-finding */ if (ark_mem->root_mem != NULL) { @@ -762,7 +893,11 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { ark_mem->tretlast = *tret = ark_mem->tcur; retval = arkInitialSetup(ark_mem, tout); - if (retval != ARK_SUCCESS) { return (retval); } + if (retval != ARK_SUCCESS) + { + SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); + return (retval); + } } /* perform stopping tests */ @@ -770,6 +905,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { if (arkStopTests(ark_mem, tout, yout, tret, itask, &retval)) { + SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); return (retval); } } @@ -923,7 +1059,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, ark_mem->nst_attempts++; #if SUNDIALS_LOGGING_LEVEL >= SUNDIALS_LOGGING_DEBUG - SUNLogger_QueueMsg(ARK_LOGGER, SUN_LOGLEVEL_DEBUG, "ARKODE::arkEvolve", + SUNLogger_QueueMsg(ARK_LOGGER, SUN_LOGLEVEL_DEBUG, "ARKODE::ARKodeEvolve", "start-step", "step = %li, attempt = %i, h = %" RSYM ", tcur = %" RSYM, @@ -988,6 +1124,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* unsuccessful step, if |h| = hmin, return ARK_ERR_FAILURE */ if (SUNRabs(ark_mem->h) <= ark_mem->hmin * ONEPSM) { + SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); return (ARK_ERR_FAILURE); } @@ -1072,7 +1209,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { if (ark_mem->tstopinterp) { - retval = arkGetDky(ark_mem, ark_mem->tstop, 0, yout); + retval = ARKodeGetDky(ark_mem, ark_mem->tstop, 0, yout); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, @@ -1101,7 +1238,7 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, /* In NORMAL mode, check if tout reached */ if ((itask == ARK_NORMAL) && (ark_mem->tcur - tout) * ark_mem->h >= ZERO) { - retval = arkGetDky(ark_mem, tout, 0, yout); + retval = ARKodeGetDky(ark_mem, tout, 0, yout); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, @@ -1127,11 +1264,13 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, } /* end looping for internal steps */ + /* stop profiler and return */ + SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); return (istate); } /*--------------------------------------------------------------- - arkGetDky: + ARKodeGetDky: This routine computes the k-th derivative of the interpolating polynomial at the time t and stores the result in the vector @@ -1143,25 +1282,29 @@ int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, the user through deg, unless higher-order derivatives are requested. - This function is called by arkEvolve with k=0 and t=tout to + This function is called by ARKodeEvolve with k=0 and t=tout to perform interpolation of outputs, but may also be called indirectly by the user via time step module *StepGetDky calls. Note: in all cases it will be called after ark_tcur has been updated to correspond with the end time of the last successful step. ---------------------------------------------------------------*/ -int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky) +int ARKodeGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) { sunrealtype s, tfuzz, tp, tn1; int retval; + ARKodeMem ark_mem; - /* Check all inputs for legality */ - if (ark_mem == NULL) + /* Check if ark_mem exists */ + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Check all inputs for legality */ if (dky == NULL) { arkProcessError(ark_mem, ARK_BAD_DKY, __LINE__, __func__, __FILE__, @@ -1203,11 +1346,11 @@ int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky) } /*--------------------------------------------------------------- - arkFree: + ARKodeFree: This routine frees the ARKODE infrastructure memory. ---------------------------------------------------------------*/ -void arkFree(void** arkode_mem) +void ARKodeFree(void** arkode_mem) { ARKodeMem ark_mem; @@ -1215,6 +1358,12 @@ void arkFree(void** arkode_mem) ark_mem = (ARKodeMem)(*arkode_mem); + /* free the time-stepper module memory (if provided) */ + if (ark_mem->step_free) + { + ark_mem->step_free(arkode_mem); + } + /* free vector storage */ arkFreeVectors(ark_mem); @@ -1324,7 +1473,7 @@ int arkRwtSet(N_Vector y, N_Vector weight, void* data) initialization, an error flag is returned. Otherwise, it returns ARK_SUCCESS. This routine should be called by an ARKODE timestepper module (not by the user). This routine must be - called prior to calling arkEvolve to evolve the problem. The + called prior to calling ARKodeEvolve to evolve the problem. The initialization type indicates if the values of internal counters should be reinitialized (FIRST_INIT) or retained (RESET_INIT). ---------------------------------------------------------------*/ @@ -1476,13 +1625,27 @@ int arkInit(ARKodeMem ark_mem, sunrealtype t0, N_Vector y0, int init_type) } /*--------------------------------------------------------------- - arkPrintMem: + ARKodePrintMem: This routine outputs the ark_mem structure to a specified file pointer. ---------------------------------------------------------------*/ -void arkPrintMem(ARKodeMem ark_mem, FILE* outfile) +void ARKodePrintMem(void* arkode_mem, FILE* outfile) { + ARKodeMem ark_mem; + + /* Check if ark_mem exists */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return; + } + ark_mem = (ARKodeMem)arkode_mem; + + /* if outfile==NULL, set it to stdout */ + if (outfile == NULL) { outfile = stdout; } + /* output general values */ fprintf(outfile, "itol = %i\n", ark_mem->itol); fprintf(outfile, "ritol = %i\n", ark_mem->ritol); @@ -1576,6 +1739,12 @@ void arkPrintMem(ARKodeMem ark_mem, FILE* outfile) fprintf(outfile, "constraints:\n"); N_VPrintFile(ark_mem->constraints, outfile); #endif + + /* Call stepper PrintMem function (if provided) */ + if (ark_mem->step_printmem) + { + ark_mem->step_printmem(arkode_mem, outfile); + } } /*--------------------------------------------------------------- @@ -2311,7 +2480,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, { if (ark_mem->tstopinterp) { - *ier = arkGetDky(ark_mem, ark_mem->tstop, 0, yout); + *ier = ARKodeGetDky(ark_mem, ark_mem->tstop, 0, yout); if (*ier != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -2341,7 +2510,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, if ((itask == ARK_NORMAL) && ((ark_mem->tcur - tout) * ark_mem->h >= ZERO)) { ark_mem->tretlast = *tret = tout; - *ier = arkGetDky(ark_mem, tout, 0, yout); + *ier = ARKodeGetDky(ark_mem, tout, 0, yout); if (*ier != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -2372,7 +2541,7 @@ int arkStopTests(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, This routine computes a tentative initial step size h0. If tout is too close to tn (= t0), then arkHin returns ARK_TOO_CLOSE and h remains uninitialized. Note that here tout - is either the value passed to arkEvolve at the first call or the + is either the value passed to ARKodeEvolve at the first call or the value of tstop (if tstop is enabled and it is closer to t0=tn than tout). If the RHS function fails unrecoverably, arkHin returns ARK_RHSFUNC_FAIL. If the RHS function fails recoverably diff --git a/src/arkode/arkode_adapt.c b/src/arkode/arkode_adapt.c index e10db72d5a..93a7c8b35b 100644 --- a/src/arkode/arkode_adapt.c +++ b/src/arkode/arkode_adapt.c @@ -37,7 +37,7 @@ ARKodeHAdaptMem arkAdaptInit(void) hadapt_mem = (ARKodeHAdaptMem)malloc(sizeof(struct ARKodeHAdaptMemRec)); if (hadapt_mem == NULL) { return (NULL); } - /* initialize values (default parameters are set in arkSetDefaults) */ + /* initialize values (default parameters are set in ARKodeSetDefaults) */ memset(hadapt_mem, 0, sizeof(struct ARKodeHAdaptMemRec)); hadapt_mem->nst_acc = 0; hadapt_mem->nst_exp = 0; diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 0d7fc94394..9070940bc4 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -89,33 +89,66 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } memset(step_mem, 0, sizeof(struct ARKodeARKStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_attachlinsol = arkStep_AttachLinsol; - ark_mem->step_attachmasssol = arkStep_AttachMasssol; - ark_mem->step_disablelsetup = arkStep_DisableLSetup; - ark_mem->step_disablemsetup = arkStep_DisableMSetup; - ark_mem->step_getlinmem = arkStep_GetLmem; - ark_mem->step_getmassmem = arkStep_GetMassMem; + ark_mem->step_attachlinsol = arkStep_AttachLinsol; + ark_mem->step_attachmasssol = arkStep_AttachMasssol; + ark_mem->step_disablelsetup = arkStep_DisableLSetup; + ark_mem->step_disablemsetup = arkStep_DisableMSetup; + ark_mem->step_getlinmem = arkStep_GetLmem; + ark_mem->step_getmassmem = arkStep_GetMassMem; ark_mem->step_getimplicitrhs = arkStep_GetImplicitRHS; - ark_mem->step_mmult = NULL; - ark_mem->step_getgammas = arkStep_GetGammas; - ark_mem->step_init = arkStep_Init; - ark_mem->step_fullrhs = arkStep_FullRHS; - ark_mem->step = arkStep_TakeStep_Z; - ark_mem->step_mem = (void*)step_mem; - - /* Set default values for ARKStep optional inputs */ - retval = ARKStepSetDefaults((void*)ark_mem); + ark_mem->step_mmult = NULL; + ark_mem->step_getgammas = arkStep_GetGammas; + ark_mem->step_init = arkStep_Init; + ark_mem->step_fullrhs = arkStep_FullRHS; + ark_mem->step = arkStep_TakeStep_Z; + ark_mem->step_setuserdata = arkStep_SetUserData; + ark_mem->step_printallstats = arkStep_PrintAllStats; + ark_mem->step_writeparameters = arkStep_WriteParameters; + ark_mem->step_resize = arkStep_Resize; + ark_mem->step_free = arkStep_Free; + ark_mem->step_printmem = arkStep_PrintMem; + ark_mem->step_setdefaults = arkStep_SetDefaults; + ark_mem->step_computestate = arkStep_ComputeState; + ark_mem->step_setrelaxfn = arkStep_SetRelaxFn; + ark_mem->step_setorder = arkStep_SetOrder; + ark_mem->step_setnonlinearsolver = arkStep_SetNonlinearSolver; + ark_mem->step_setlinear = arkStep_SetLinear; + ark_mem->step_setnonlinear = arkStep_SetNonlinear; + ark_mem->step_setnlsrhsfn = arkStep_SetNlsRhsFn; + ark_mem->step_setdeduceimplicitrhs = arkStep_SetDeduceImplicitRhs; + ark_mem->step_setnonlincrdown = arkStep_SetNonlinCRDown; + ark_mem->step_setnonlinrdiv = arkStep_SetNonlinRDiv; + ark_mem->step_setdeltagammamax = arkStep_SetDeltaGammaMax; + ark_mem->step_setlsetupfrequency = arkStep_SetLSetupFrequency; + ark_mem->step_setpredictormethod = arkStep_SetPredictorMethod; + ark_mem->step_setmaxnonliniters = arkStep_SetMaxNonlinIters; + ark_mem->step_setnonlinconvcoef = arkStep_SetNonlinConvCoef; + ark_mem->step_setstagepredictfn = arkStep_SetStagePredictFn; + ark_mem->step_getnumlinsolvsetups = arkStep_GetNumLinSolvSetups; + ark_mem->step_getcurrentgamma = arkStep_GetCurrentGamma; + ark_mem->step_getnonlinearsystemdata = arkStep_GetNonlinearSystemData; + ark_mem->step_getnumnonlinsolviters = arkStep_GetNumNonlinSolvIters; + ark_mem->step_getnumnonlinsolvconvfails = arkStep_GetNumNonlinSolvConvFails; + ark_mem->step_getnonlinsolvstats = arkStep_GetNonlinSolvStats; + ark_mem->step_supports_adaptive = SUNTRUE; + ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_supports_massmatrix = SUNTRUE; + ark_mem->step_supports_relaxation = SUNTRUE; + ark_mem->step_mem = (void*)step_mem; + + /* Set default values for optional inputs */ + retval = arkStep_SetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -130,17 +163,17 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, /* Clone the input vector to create sdata, zpred and zcor */ if (!arkAllocVec(ark_mem, y0, &(step_mem->sdata))) { - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } if (!arkAllocVec(ark_mem, y0, &(step_mem->zpred))) { - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } if (!arkAllocVec(ark_mem, y0, &(step_mem->zcor))) { - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -161,15 +194,15 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } - retval = ARKStepSetNonlinearSolver(ark_mem, NLS); + retval = ARKodeSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } step_mem->ownNLS = SUNTRUE; @@ -221,7 +254,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); - ARKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -229,14 +262,12 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, } /*--------------------------------------------------------------- - ARKStepResize: + arkStep_Resize: This routine resizes the memory within the ARKStep module. - It first resizes the main ARKODE infrastructure memory, and - then resizes its own data. ---------------------------------------------------------------*/ -int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +int arkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -248,7 +279,7 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Determing change in vector sizes */ + /* Determine change in vector sizes */ lrw1 = liw1 = 0; if (y0->ops->nvspace != NULL) { N_VSpace(y0, &lrw1, &liw1); } lrw_diff = lrw1 - ark_mem->lrw1; @@ -256,15 +287,6 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, ark_mem->lrw1 = lrw1; ark_mem->liw1 = liw1; - /* resize ARKODE infrastructure memory */ - retval = arkResize(ark_mem, y0, hscale, t0, resize, resize_data); - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to resize main ARKODE infrastructure"); - return (retval); - } - /* Resize the sdata, zpred and zcor vectors */ if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, &step_mem->sdata)) @@ -339,8 +361,8 @@ int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, return (ARK_MEM_FAIL); } - /* attach new Newton NLS object to ARKStep */ - retval = ARKStepSetNonlinearSolver(ark_mem, NLS); + /* attach new Newton NLS object */ + retval = ARKodeSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, @@ -432,202 +454,11 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, } /*--------------------------------------------------------------- - ARKStepReset: - - This routine resets the ARKStep module state to solve the same - problem from the given time with the input state (all counter - values are retained). - ---------------------------------------------------------------*/ -int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) -{ - ARKodeMem ark_mem; - ARKodeARKStepMem step_mem; - int retval; - - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - /* Initialize main ARKODE infrastructure */ - retval = arkInit(ark_mem, tR, yR, RESET_INIT); - - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to initialize main ARKODE infrastructure"); - return (retval); - } - - return (ARK_SUCCESS); -} - -/*--------------------------------------------------------------- - ARKStepSStolerances, ARKStepSVtolerances, ARKStepWFtolerances, - ARKStepResStolerance, ARKStepResVtolerance, ARKStepResFtolerance: - - These routines set integration tolerances (wrappers for general - ARKODE utility routines) - ---------------------------------------------------------------*/ -int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) -{ - /* unpack ark_mem, call arkSStolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSStolerances(ark_mem, reltol, abstol)); -} - -int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) -{ - /* unpack ark_mem, call arkSVtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSVtolerances(ark_mem, reltol, abstol)); -} - -int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) -{ - /* unpack ark_mem, call arkWFtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkWFtolerances(ark_mem, efun)); -} - -int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol) -{ - /* unpack ark_mem, call arkResStolerance, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkResStolerance(ark_mem, rabstol)); -} - -int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol) -{ - /* unpack ark_mem, call arkResVtolerance, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkResVtolerance(ark_mem, rabstol)); -} - -int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun) -{ - /* unpack ark_mem, call arkResFtolerance, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkResFtolerance(ark_mem, rfun)); -} - -/*--------------------------------------------------------------- - ARKStepRootInit: - - Initialize (attach) a rootfinding problem to the stepper - (wrappers for general ARKODE utility routine) - ---------------------------------------------------------------*/ -int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) -{ - /* unpack ark_mem, call arkRootInit, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkRootInit(ark_mem, nrtfn, g)); -} - -/*--------------------------------------------------------------- - ARKStepEvolve: - - This is the main time-integration driver (wrappers for general - ARKODE utility routine) - ---------------------------------------------------------------*/ -int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask) -{ - /* unpack ark_mem, call arkEvolve, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkEvolve(ark_mem, tout, yout, tret, itask); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - ARKStepGetDky: - - This returns interpolated output of the solution or its - derivatives over the most-recently-computed step (wrapper for - generic ARKODE utility routine) - ---------------------------------------------------------------*/ -int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) -{ - /* unpack ark_mem, call arkGetDky, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkGetDky(ark_mem, t, k, dky); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - ARKStepComputeState: + arkStep_ComputeState: Computes y based on the current prediction and given correction. ---------------------------------------------------------------*/ -int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) { int retval; ARKodeMem ark_mem; @@ -643,10 +474,9 @@ int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) } /*--------------------------------------------------------------- - ARKStepFree frees all ARKStep memory, and then calls an ARKODE - utility routine to free the ARKODE infrastructure memory. + arkStep_Free frees all ARKStep memory. ---------------------------------------------------------------*/ -void ARKStepFree(void** arkode_mem) +void arkStep_Free(void** arkode_mem) { int j; sunindextype Bliw, Blrw; @@ -787,19 +617,15 @@ void ARKStepFree(void** arkode_mem) free(ark_mem->step_mem); ark_mem->step_mem = NULL; } - - /* free memory for overall ARKODE infrastructure */ - arkFree(arkode_mem); } /*--------------------------------------------------------------- - ARKStepPrintMem: + arkStep_PrintMem: - This routine outputs the memory from the ARKStep structure and - the main ARKODE infrastructure to a specified file pointer - (useful when debugging). + This routine outputs the memory from the ARKStep structure to + a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void ARKStepPrintMem(void* arkode_mem, FILE* outfile) +void arkStep_PrintMem(void* arkode_mem, FILE* outfile) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -813,12 +639,6 @@ void ARKStepPrintMem(void* arkode_mem, FILE* outfile) retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } - /* if outfile==NULL, set it to stdout */ - if (outfile == NULL) { outfile = stdout; } - - /* output data from main ARKODE infrastructure */ - arkPrintMem(ark_mem, outfile); - /* output integer quantities */ fprintf(outfile, "ARKStep: q = %i\n", step_mem->q); fprintf(outfile, "ARKStep: p = %i\n", step_mem->p); @@ -3296,11 +3116,11 @@ int arkStep_MRIStepInnerEvolve(MRIStepInnerStepper stepper, sunrealtype t0, if (retval != ARK_SUCCESS) { return (retval); } /* set the stop time */ - retval = ARKStepSetStopTime(arkode_mem, tout); + retval = ARKodeSetStopTime(arkode_mem, tout); if (retval != ARK_SUCCESS) { return (retval); } /* evolve inner ODE */ - retval = ARKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + retval = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); if (retval < 0) { return (retval); } /* disable inner forcing */ @@ -3347,7 +3167,7 @@ int arkStep_MRIStepInnerReset(MRIStepInnerStepper stepper, sunrealtype tR, retval = MRIStepInnerStepper_GetContent(stepper, &arkode_mem); if (retval != ARK_SUCCESS) { return (retval); } - return (ARKStepReset(arkode_mem, tR, yR)); + return (ARKodeReset(arkode_mem, tR, yR)); } /*------------------------------------------------------------------------------ diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index 2d472ecde2..44a94bb327 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -186,6 +186,40 @@ int arkStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); int arkStep_TakeStep_Z(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); +int arkStep_SetUserData(void* arkode_mem, void* user_data); +int arkStep_SetDefaults(void* arkode_mem); +int arkStep_SetOrder(void* arkode_mem, int ord); +int arkStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +int arkStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); +int arkStep_SetLinear(void* arkode_mem, int timedepend); +int arkStep_SetNonlinear(void* arkode_mem); +int arkStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +int arkStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +int arkStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +int arkStep_SetLSetupFrequency(void* arkode_mem, int msbp); +int arkStep_SetPredictorMethod(void* arkode_mem, int pred_method); +int arkStep_SetMaxNonlinIters(void* arkode_mem, int maxcor); +int arkStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +int arkStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); +int arkStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); +int arkStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +int arkStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); +int arkStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); +int arkStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +int arkStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +int arkStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +int arkStep_WriteParameters(void* arkode_mem, FILE* fp); +int arkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); +int arkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); +void arkStep_Free(void** arkode_mem); +void arkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ int arkStep_AccessStepMem(void* arkode_mem, const char* fname, @@ -226,6 +260,7 @@ int arkStep_MRIStepInnerReset(MRIStepInnerStepper stepper, sunrealtype tR, N_Vector yR); /* private functions for relaxation */ +int arkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); int arkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, long int* relax_jac_fn_evals, sunrealtype* delta_e_out); int arkStep_GetOrder(ARKodeMem ark_mem); diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 58f78862c3..5195f08caa 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -30,165 +30,312 @@ ARKStep Optional input functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. ===============================================================*/ + +int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +{ + return (ARKodeReset(arkode_mem, tR, yR)); +} + +int ARKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +{ + return (ARKodeResize(arkode_mem, y0, hscale, t0, resize, resize_data)); +} + +int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) +{ + return (ARKodeRootInit(arkode_mem, nrtfn, g)); +} + +int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask) +{ + return (ARKodeEvolve(arkode_mem, tout, yout, tret, itask)); +} + +int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) +{ + return (ARKodeGetDky(arkode_mem, t, k, dky)); +} + +void ARKStepFree(void** arkode_mem) +{ + ARKodeFree(arkode_mem); +} + +void ARKStepPrintMem(void* arkode_mem, FILE* outfile) +{ + ARKodePrintMem(arkode_mem, outfile); +} + +int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) +{ + return (ARKodeSStolerances(arkode_mem, reltol, abstol)); +} + +int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) +{ + return (ARKodeSVtolerances(arkode_mem, reltol, abstol)); +} + +int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) +{ + return (ARKodeWFtolerances(arkode_mem, efun)); +} + +int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol) +{ + return (ARKodeResStolerance(arkode_mem, rabstol)); +} + +int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol) +{ + return (ARKodeResVtolerance(arkode_mem, rabstol)); +} + +int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun) +{ + return (ARKodeResFtolerance(arkode_mem, rfun)); +} + int ARKStepSetDenseOrder(void* arkode_mem, int dord) { - return (ARKStepSetInterpolantDegree(arkode_mem, dord)); + return (ARKodeSetDenseOrder(arkode_mem, dord)); } int ARKStepSetInterpolantDegree(void* arkode_mem, int degree) { - if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } - return (arkSetInterpolantDegree(arkode_mem, degree)); + return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } int ARKStepSetInterpolantType(void* arkode_mem, int itype) { - return (arkSetInterpolantType(arkode_mem, itype)); + return (ARKodeSetInterpolantType(arkode_mem, itype)); } int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { - return (arkSetMaxNumSteps(arkode_mem, mxsteps)); + return (ARKodeSetMaxNumSteps(arkode_mem, mxsteps)); } int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil) { - return (arkSetMaxHnilWarns(arkode_mem, mxhnil)); + return (ARKodeSetMaxHnilWarns(arkode_mem, mxhnil)); } int ARKStepSetInitStep(void* arkode_mem, sunrealtype hin) { - return (arkSetInitStep(arkode_mem, hin)); + return (ARKodeSetInitStep(arkode_mem, hin)); } int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin) { - return (arkSetMinStep(arkode_mem, hmin)); + return (ARKodeSetMinStep(arkode_mem, hmin)); } int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax) { - return (arkSetMaxStep(arkode_mem, hmax)); + return (ARKodeSetMaxStep(arkode_mem, hmax)); } int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop) { - return (arkSetStopTime(arkode_mem, tstop)); + return (ARKodeSetStopTime(arkode_mem, tstop)); } int ARKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) { - return (arkSetInterpolateStopTime(arkode_mem, interp)); + return (ARKodeSetInterpolateStopTime(arkode_mem, interp)); } int ARKStepClearStopTime(void* arkode_mem) { - return (arkClearStopTime(arkode_mem)); + return (ARKodeClearStopTime(arkode_mem)); } int ARKStepSetRootDirection(void* arkode_mem, int* rootdir) { - return (arkSetRootDirection(arkode_mem, rootdir)); + return (ARKodeSetRootDirection(arkode_mem, rootdir)); } int ARKStepSetNoInactiveRootWarn(void* arkode_mem) { - return (arkSetNoInactiveRootWarn(arkode_mem)); + return (ARKodeSetNoInactiveRootWarn(arkode_mem)); } int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints) { - return (arkSetConstraints(arkode_mem, constraints)); + return (ARKodeSetConstraints(arkode_mem, constraints)); } int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) { - return (arkSetMaxNumConstrFails(arkode_mem, maxfails)); + return (ARKodeSetMaxNumConstrFails(arkode_mem, maxfails)); } int ARKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) { - return (arkSetPostprocessStepFn(arkode_mem, ProcessStep)); + return (ARKodeSetPostprocessStepFn(arkode_mem, ProcessStep)); } int ARKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) { - return (arkSetPostprocessStageFn(arkode_mem, ProcessStage)); + return (ARKodeSetPostprocessStageFn(arkode_mem, ProcessStage)); } int ARKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust) { - return (arkSetAdaptivityAdjustment(arkode_mem, adjust)); + return (ARKodeSetAdaptivityAdjustment(arkode_mem, adjust)); } int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) { - return (arkSetCFLFraction(arkode_mem, cfl_frac)); + return (ARKodeSetCFLFraction(arkode_mem, cfl_frac)); } int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety) { - return (arkSetSafetyFactor(arkode_mem, safety)); + return (ARKodeSetSafetyFactor(arkode_mem, safety)); } int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) { - return (arkSetMaxGrowth(arkode_mem, mx_growth)); + return (ARKodeSetMaxGrowth(arkode_mem, mx_growth)); } int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min) { - return (arkSetMinReduction(arkode_mem, eta_min)); + return (ARKodeSetMinReduction(arkode_mem, eta_min)); } int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) { - return (arkSetFixedStepBounds(arkode_mem, lb, ub)); + return (ARKodeSetFixedStepBounds(arkode_mem, lb, ub)); } int ARKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) { - return (arkSetMaxFirstGrowth(arkode_mem, etamx1)); + return (ARKodeSetMaxFirstGrowth(arkode_mem, etamx1)); } int ARKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) { - return (arkSetMaxEFailGrowth(arkode_mem, etamxf)); + return (ARKodeSetMaxEFailGrowth(arkode_mem, etamxf)); } int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef) { - return (arkSetSmallNumEFails(arkode_mem, small_nef)); + return (ARKodeSetSmallNumEFails(arkode_mem, small_nef)); } int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) { - return (arkSetMaxCFailGrowth(arkode_mem, etacf)); + return (ARKodeSetMaxCFailGrowth(arkode_mem, etacf)); } int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) { - return (arkSetStabilityFn(arkode_mem, EStab, estab_data)); + return (ARKodeSetStabilityFn(arkode_mem, EStab, estab_data)); } int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef) { - return (arkSetMaxErrTestFails(arkode_mem, maxnef)); + return (ARKodeSetMaxErrTestFails(arkode_mem, maxnef)); } int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf) { - return (arkSetMaxConvFails(arkode_mem, maxncf)); + return (ARKodeSetMaxConvFails(arkode_mem, maxncf)); } int ARKStepSetAdaptController(void* arkode_mem, SUNAdaptController C) { - return (arkSetAdaptController(arkode_mem, C)); + return (ARKodeSetAdaptController(arkode_mem, C)); } int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) { - return (arkSetFixedStep(arkode_mem, hfixed)); + return (ARKodeSetFixedStep(arkode_mem, hfixed)); +} + +int ARKStepSetUserData(void* arkode_mem, void* user_data) +{ + return (ARKodeSetUserData(arkode_mem, user_data)); +} + +int ARKStepSetDefaults(void* arkode_mem) +{ + return (ARKodeSetDefaults(arkode_mem)); +} + +int ARKStepSetOrder(void* arkode_mem, int ord) +{ + return (ARKodeSetOrder(arkode_mem, ord)); +} + +int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +{ + return (ARKodeSetNonlinearSolver(arkode_mem, NLS)); +} + +int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) +{ + return (ARKodeSetNlsRhsFn(arkode_mem, nls_fi)); +} + +int ARKStepSetLinear(void* arkode_mem, int timedepend) +{ + return (ARKodeSetLinear(arkode_mem, timedepend)); +} + +int ARKStepSetNonlinear(void* arkode_mem) +{ + return (ARKodeSetNonlinear(arkode_mem)); +} + +int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +{ + return (ARKodeSetNonlinCRDown(arkode_mem, crdown)); +} + +int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +{ + return (ARKodeSetNonlinRDiv(arkode_mem, rdiv)); +} + +int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +{ + return (ARKodeSetDeltaGammaMax(arkode_mem, dgmax)); +} + +int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp) +{ + return (ARKodeSetLSetupFrequency(arkode_mem, msbp)); +} + +int ARKStepSetPredictorMethod(void* arkode_mem, int pred_method) +{ + return (ARKodeSetPredictorMethod(arkode_mem, pred_method)); +} + +int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) +{ + return (ARKodeSetMaxNonlinIters(arkode_mem, maxcor)); +} + +int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +{ + return (ARKodeSetNonlinConvCoef(arkode_mem, nlscoef)); +} + +int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +{ + return (ARKodeSetStagePredictFn(arkode_mem, PredictStage)); +} + +int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +{ + return (ARKodeSetDeduceImplicitRhs(arkode_mem, deduce)); } /*--------------------------------------------------------------- @@ -197,87 +344,87 @@ int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) ---------------------------------------------------------------*/ int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) { - return (arkLSSetLinearSolver(arkode_mem, LS, A)); + return (ARKodeSetLinearSolver(arkode_mem, LS, A)); } int ARKStepSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, sunbooleantype time_dep) { - return (arkLSSetMassLinearSolver(arkode_mem, LS, M, time_dep)); + return (ARKodeSetMassLinearSolver(arkode_mem, LS, M, time_dep)); } int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac) { - return (arkLSSetJacFn(arkode_mem, jac)); + return (ARKodeSetJacFn(arkode_mem, jac)); } int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass) { - return (arkLSSetMassFn(arkode_mem, mass)); + return (ARKodeSetMassFn(arkode_mem, mass)); } int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj) { - return (arkLSSetJacEvalFrequency(arkode_mem, msbj)); + return (ARKodeSetJacEvalFrequency(arkode_mem, msbj)); } int ARKStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) { - return (arkLSSetLinearSolutionScaling(arkode_mem, onoff)); + return (ARKodeSetLinearSolutionScaling(arkode_mem, onoff)); } int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac) { - return (arkLSSetEpsLin(arkode_mem, eplifac)); + return (ARKodeSetEpsLin(arkode_mem, eplifac)); } int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) { - return (arkLSSetMassEpsLin(arkode_mem, eplifac)); + return (ARKodeSetMassEpsLin(arkode_mem, eplifac)); } int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) { - return (arkLSSetNormFactor(arkode_mem, nrmfac)); + return (ARKodeSetLSNormFactor(arkode_mem, nrmfac)); } int ARKStepSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) { - return (arkLSSetMassNormFactor(arkode_mem, nrmfac)); + return (ARKodeSetMassLSNormFactor(arkode_mem, nrmfac)); } int ARKStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, ARKLsPrecSolveFn psolve) { - return (arkLSSetPreconditioner(arkode_mem, psetup, psolve)); + return (ARKodeSetPreconditioner(arkode_mem, psetup, psolve)); } int ARKStepSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, ARKLsMassPrecSolveFn psolve) { - return (arkLSSetMassPreconditioner(arkode_mem, psetup, psolve)); + return (ARKodeSetMassPreconditioner(arkode_mem, psetup, psolve)); } int ARKStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsJacTimesVecFn jtimes) { - return (arkLSSetJacTimes(arkode_mem, jtsetup, jtimes)); + return (ARKodeSetJacTimes(arkode_mem, jtsetup, jtimes)); } int ARKStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) { - return (arkLSSetJacTimesRhsFn(arkode_mem, jtimesRhsFn)); + return (ARKodeSetJacTimesRhsFn(arkode_mem, jtimesRhsFn)); } int ARKStepSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn msetup, ARKLsMassTimesVecFn mtimes, void* mtimes_data) { - return (arkLSSetMassTimes(arkode_mem, msetup, mtimes, mtimes_data)); + return (ARKodeSetMassTimes(arkode_mem, msetup, mtimes, mtimes_data)); } int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) { - return (arkLSSetLinSysFn(arkode_mem, linsys)); + return (ARKodeSetLinSysFn(arkode_mem, linsys)); } /*=============================================================== @@ -286,325 +433,388 @@ int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) ===============================================================*/ int ARKStepGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) { - return (arkGetNumStepAttempts(arkode_mem, nstep_attempts)); + return (ARKodeGetNumStepAttempts(arkode_mem, nstep_attempts)); } int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumSteps(arkode_mem, nsteps)); + return (ARKodeGetNumSteps(arkode_mem, nsteps)); } int ARKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused) { - return (arkGetActualInitStep(arkode_mem, hinused)); + return (ARKodeGetActualInitStep(arkode_mem, hinused)); } int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) { - return (arkGetLastStep(arkode_mem, hlast)); + return (ARKodeGetLastStep(arkode_mem, hlast)); } int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) { - return (arkGetCurrentStep(arkode_mem, hcur)); + return (ARKodeGetCurrentStep(arkode_mem, hcur)); } int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) { - return (arkGetCurrentTime(arkode_mem, tcur)); + return (ARKodeGetCurrentTime(arkode_mem, tcur)); } int ARKStepGetCurrentState(void* arkode_mem, N_Vector* state) { - return (arkGetCurrentState(arkode_mem, state)); + return (ARKodeGetCurrentState(arkode_mem, state)); +} + +int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +{ + return (ARKodeComputeState(arkode_mem, zcor, z)); } int ARKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) { - return (arkGetTolScaleFactor(arkode_mem, tolsfact)); + return (ARKodeGetTolScaleFactor(arkode_mem, tolsfact)); } int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight) { - return (arkGetErrWeights(arkode_mem, eweight)); + return (ARKodeGetErrWeights(arkode_mem, eweight)); } int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight) { - return (arkGetResWeights(arkode_mem, rweight)); + return (ARKodeGetResWeights(arkode_mem, rweight)); } int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) { - return (arkGetWorkSpace(arkode_mem, lenrw, leniw)); + return (ARKodeGetWorkSpace(arkode_mem, lenrw, leniw)); } int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals) { - return (arkGetNumGEvals(arkode_mem, ngevals)); + return (ARKodeGetNumGEvals(arkode_mem, ngevals)); } int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound) { - return (arkGetRootInfo(arkode_mem, rootsfound)); + return (ARKodeGetRootInfo(arkode_mem, rootsfound)); } int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) { - return (arkGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); + return (ARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); } int ARKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails) { - return (arkGetNumConstrFails(arkode_mem, nconstrfails)); + return (ARKodeGetNumConstrFails(arkode_mem, nconstrfails)); } int ARKStepGetNumExpSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumExpSteps(arkode_mem, nsteps)); + return (ARKodeGetNumExpSteps(arkode_mem, nsteps)); } int ARKStepGetNumAccSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumAccSteps(arkode_mem, nsteps)); + return (ARKodeGetNumAccSteps(arkode_mem, nsteps)); } int ARKStepGetNumErrTestFails(void* arkode_mem, long int* netfails) { - return (arkGetNumErrTestFails(arkode_mem, netfails)); + return (ARKodeGetNumErrTestFails(arkode_mem, netfails)); +} + +int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) +{ + return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, + gamma, sdata, user_data)); } int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails) { - return (arkGetNumStepSolveFails(arkode_mem, nncfails)); + return (ARKodeGetNumStepSolveFails(arkode_mem, nncfails)); } int ARKStepGetUserData(void* arkode_mem, void** user_data) { - return (arkGetUserData(arkode_mem, user_data)); + return (ARKodeGetUserData(arkode_mem, user_data)); } char* ARKStepGetReturnFlagName(long int flag) { - return (arkGetReturnFlagName(flag)); + return (ARKodeGetReturnFlagName(flag)); +} + +int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +{ + return (ARKodeGetCurrentGamma(arkode_mem, gamma)); +} + +int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +{ + return (ARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups)); +} + +int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) +{ + return (ARKodeGetEstLocalErrors(arkode_mem, ele)); +} + +int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +{ + return (ARKodeGetNumNonlinSolvIters(arkode_mem, nniters)); +} + +int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +{ + return (ARKodeGetNumNonlinSolvConvFails(arkode_mem, nnfails)); +} + +int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails) +{ + return (ARKodeGetNonlinSolvStats(arkode_mem, nniters, nnfails)); } + /*--------------------------------------------------------------- These wrappers for ARKLs module 'get' routines all are documented in arkode_arkstep.h. ---------------------------------------------------------------*/ int ARKStepGetJac(void* arkode_mem, SUNMatrix* J) { - return arkLSGetJac(arkode_mem, J); + return (ARKodeGetJac(arkode_mem, J)); } int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J) { - return arkLSGetJacTime(arkode_mem, t_J); + return (ARKodeGetJacTime(arkode_mem, t_J)); } int ARKStepGetJacNumSteps(void* arkode_mem, long* nst_J) { - return arkLSGetJacNumSteps(arkode_mem, nst_J); + return (ARKodeGetJacNumSteps(arkode_mem, nst_J)); } int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS) { - return (arkLSGetWorkSpace(arkode_mem, lenrwLS, leniwLS)); + return (ARKodeGetLinWorkSpace(arkode_mem, lenrwLS, leniwLS)); } int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals) { - return (arkLSGetNumJacEvals(arkode_mem, njevals)); + return (ARKodeGetNumJacEvals(arkode_mem, njevals)); } int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals) { - return (arkLSGetNumPrecEvals(arkode_mem, npevals)); + return (ARKodeGetNumPrecEvals(arkode_mem, npevals)); } int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves) { - return (arkLSGetNumPrecSolves(arkode_mem, npsolves)); + return (ARKodeGetNumPrecSolves(arkode_mem, npsolves)); } int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters) { - return (arkLSGetNumLinIters(arkode_mem, nliters)); + return (ARKodeGetNumLinIters(arkode_mem, nliters)); } int ARKStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails) { - return (arkLSGetNumConvFails(arkode_mem, nlcfails)); + return (ARKodeGetNumLinConvFails(arkode_mem, nlcfails)); } int ARKStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) { - return (arkLSGetNumJTSetupEvals(arkode_mem, njtsetups)); + return (ARKodeGetNumJTSetupEvals(arkode_mem, njtsetups)); } int ARKStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals) { - return (arkLSGetNumJtimesEvals(arkode_mem, njvevals)); + return (ARKodeGetNumJtimesEvals(arkode_mem, njvevals)); } int ARKStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) { - return (arkLSGetNumRhsEvals(arkode_mem, nfevalsLS)); + return (ARKodeGetNumLinRhsEvals(arkode_mem, nfevalsLS)); } int ARKStepGetLastLinFlag(void* arkode_mem, long int* flag) { - return (arkLSGetLastFlag(arkode_mem, flag)); + return (ARKodeGetLastLinFlag(arkode_mem, flag)); } int ARKStepGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, long int* leniwMLS) { - return (arkLSGetMassWorkSpace(arkode_mem, lenrwMLS, leniwMLS)); + return (ARKodeGetMassWorkSpace(arkode_mem, lenrwMLS, leniwMLS)); } int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups) { - return (arkLSGetNumMassSetups(arkode_mem, nmsetups)); + return (ARKodeGetNumMassSetups(arkode_mem, nmsetups)); } int ARKStepGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) { - return (arkLSGetNumMassMatvecSetups(arkode_mem, nmvsetups)); + return (ARKodeGetNumMassMultSetups(arkode_mem, nmvsetups)); } int ARKStepGetNumMassMult(void* arkode_mem, long int* nmvevals) { - return (arkLSGetNumMassMult(arkode_mem, nmvevals)); + return (ARKodeGetNumMassMult(arkode_mem, nmvevals)); } int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves) { - return (arkLSGetNumMassSolves(arkode_mem, nmsolves)); + return (ARKodeGetNumMassSolves(arkode_mem, nmsolves)); } int ARKStepGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals) { - return (arkLSGetNumMassPrecEvals(arkode_mem, nmpevals)); + return (ARKodeGetNumMassPrecEvals(arkode_mem, nmpevals)); } int ARKStepGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves) { - return (arkLSGetNumMassPrecSolves(arkode_mem, nmpsolves)); + return (ARKodeGetNumMassPrecSolves(arkode_mem, nmpsolves)); } int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters) { - return (arkLSGetNumMassIters(arkode_mem, nmiters)); + return (ARKodeGetNumMassIters(arkode_mem, nmiters)); } int ARKStepGetNumMassConvFails(void* arkode_mem, long int* nmcfails) { - return (arkLSGetNumMassConvFails(arkode_mem, nmcfails)); + return (ARKodeGetNumMassConvFails(arkode_mem, nmcfails)); } int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetups) { - return (arkLSGetNumMTSetups(arkode_mem, nmtsetups)); + return (ARKodeGetNumMTSetups(arkode_mem, nmtsetups)); } int ARKStepGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) { - return (arkLSGetCurrentMassMatrix(arkode_mem, M)); + return (ARKodeGetCurrentMassMatrix(arkode_mem, M)); } int ARKStepGetLastMassFlag(void* arkode_mem, long int* flag) { - return (arkLSGetLastMassFlag(arkode_mem, flag)); + return (ARKodeGetLastMassFlag(arkode_mem, flag)); } char* ARKStepGetLinReturnFlagName(long int flag) { - return (arkLSGetReturnFlagName(flag)); + return (ARKodeGetLinReturnFlagName(flag)); } /* ----------------------------------------------------------------------------- * Wrappers for the ARKODE relaxation module * ---------------------------------------------------------------------------*/ +/* ARKStep-specific utility routine */ +int arkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) +{ + return (arkRelaxCreate(arkode_mem, rfn, rjac, arkStep_RelaxDeltaE, + arkStep_GetOrder)); +} + int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) { - return arkRelaxCreate(arkode_mem, rfn, rjac, arkStep_RelaxDeltaE, - arkStep_GetOrder); + return (ARKodeSetRelaxFn(arkode_mem, rfn, rjac)); } int ARKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf) { - return arkRelaxSetEtaFail(arkode_mem, eta_rf); + return (ARKodeSetRelaxEtaFail(arkode_mem, eta_rf)); } int ARKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) { - return arkRelaxSetLowerBound(arkode_mem, lower); + return (ARKodeSetRelaxLowerBound(arkode_mem, lower)); } int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails) { - return arkRelaxSetMaxFails(arkode_mem, max_fails); + return (ARKodeSetRelaxMaxFails(arkode_mem, max_fails)); } int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters) { - return arkRelaxSetMaxIters(arkode_mem, max_iters); + return (ARKodeSetRelaxMaxIters(arkode_mem, max_iters)); } int ARKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) { - return arkRelaxSetSolver(arkode_mem, solver); + return (ARKodeSetRelaxSolver(arkode_mem, solver)); } int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) { - return arkRelaxSetResTol(arkode_mem, res_tol); + return (ARKodeSetRelaxResTol(arkode_mem, res_tol)); } int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) { - return arkRelaxSetTol(arkode_mem, rel_tol, abs_tol); + return (ARKodeSetRelaxTol(arkode_mem, rel_tol, abs_tol)); } int ARKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) { - return arkRelaxSetUpperBound(arkode_mem, upper); + return (ARKodeSetRelaxUpperBound(arkode_mem, upper)); } int ARKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) { - return arkRelaxGetNumRelaxFnEvals(arkode_mem, r_evals); + return (ARKodeGetNumRelaxFnEvals(arkode_mem, r_evals)); } int ARKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) { - return arkRelaxGetNumRelaxJacEvals(arkode_mem, J_evals); + return (ARKodeGetNumRelaxJacEvals(arkode_mem, J_evals)); } int ARKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails) { - return arkRelaxGetNumRelaxFails(arkode_mem, relax_fails); + return (ARKodeGetNumRelaxFails(arkode_mem, relax_fails)); } int ARKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails) { - return arkRelaxGetNumRelaxBoundFails(arkode_mem, fails); + return (ARKodeGetNumRelaxBoundFails(arkode_mem, fails)); } int ARKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails) { - return arkRelaxGetNumRelaxSolveFails(arkode_mem, fails); + return (ARKodeGetNumRelaxSolveFails(arkode_mem, fails)); } int ARKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters) { - return arkRelaxGetNumRelaxSolveIters(arkode_mem, iters); + return (ARKodeGetNumRelaxSolveIters(arkode_mem, iters)); +} + +int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +{ + return (ARKodePrintAllStats(arkode_mem, outfile, fmt)); +} + +int ARKStepWriteParameters(void* arkode_mem, FILE* fp) +{ + return (ARKodeWriteParameters(arkode_mem, fp)); } + /*=============================================================== DEPRECATED ARKStep optional input/output functions ===============================================================*/ @@ -634,20 +844,14 @@ int ARKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) ---------------------------------------------------------------*/ int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias) { - return (arkSetErrorBias(arkode_mem, bias)); + return (ARKodeSetErrorBias(arkode_mem, bias)); } /*=============================================================== ARKStep optional input functions -- stepper-specific ===============================================================*/ -/*--------------------------------------------------------------- - ARKStepSetUserData: - - Wrapper for generic arkSetUserData and arkLSSetUserData - routines. - ---------------------------------------------------------------*/ -int ARKStepSetUserData(void* arkode_mem, void* user_data) +int arkStep_SetUserData(void* arkode_mem, void* user_data) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -657,10 +861,6 @@ int ARKStepSetUserData(void* arkode_mem, void* user_data) retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* set user_data in ARKODE mem */ - retval = arkSetUserData(arkode_mem, user_data); - if (retval != ARK_SUCCESS) { return (retval); } - /* set user data in ARKODE LS mem */ if (step_mem->lmem != NULL) { @@ -678,8 +878,9 @@ int ARKStepSetUserData(void* arkode_mem, void* user_data) return (ARK_SUCCESS); } + /*--------------------------------------------------------------- - ARKStepSetDefaults: + arkStep_SetDefaults: Resets all ARKStep optional inputs to their default values. Does not change problem-defining function pointers or @@ -687,7 +888,7 @@ int ARKStepSetUserData(void* arkode_mem, void* user_data) structures/options related to the ARKODE infrastructure itself (e.g., root-finding and post-process step). ---------------------------------------------------------------*/ -int ARKStepSetDefaults(void* arkode_mem) +int arkStep_SetDefaults(void* arkode_mem) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -697,15 +898,6 @@ int ARKStepSetDefaults(void* arkode_mem) retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Set default ARKODE infrastructure parameters */ - retval = arkSetDefaults(ark_mem); - if (retval != ARK_SUCCESS) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error setting ARKODE infrastructure defaults"); - return (retval); - } - /* Set default values for integrator optional inputs */ step_mem->q = Q_DEFAULT; /* method order */ step_mem->p = 0; /* embedding order */ @@ -1022,17 +1214,11 @@ int ARKStepSetOptimalParams(void* arkode_mem) } /*--------------------------------------------------------------- - ARKStepSetOrder: + arkStep_SetOrder: Specifies the method order - - ** Note in documentation that this should not be called along - with ARKStepSetTable or ARKStepSetTableNum. This routine - is used to specify a desired method order using default Butcher - tables, whereas any user-supplied table will have their own - order associated with them. ---------------------------------------------------------------*/ -int ARKStepSetOrder(void* arkode_mem, int ord) +int arkStep_SetOrder(void* arkode_mem, int ord) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1069,7 +1255,7 @@ int ARKStepSetOrder(void* arkode_mem, int ord) } /*--------------------------------------------------------------- - ARKStepSetLinear: + arkStep_SetLinear: Specifies that the implicit portion of the problem is linear, and to tighten the linear solver tolerances while taking only @@ -1083,7 +1269,7 @@ int ARKStepSetOrder(void* arkode_mem, int ord) using an iterative linear solver this flag denotes time dependence of the preconditioner. ---------------------------------------------------------------*/ -int ARKStepSetLinear(void* arkode_mem, int timedepend) +int arkStep_SetLinear(void* arkode_mem, int timedepend) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1102,13 +1288,13 @@ int ARKStepSetLinear(void* arkode_mem, int timedepend) } /*--------------------------------------------------------------- - ARKStepSetNonlinear: + arkStep_SetNonlinear: Specifies that the implicit portion of the problem is nonlinear. - Used to undo a previous call to ARKStepSetLinear. Automatically + Used to undo a previous call to arkStep_SetLinear. Automatically loosens DeltaGammaMax back to default value. ---------------------------------------------------------------*/ -int ARKStepSetNonlinear(void* arkode_mem) +int arkStep_SetNonlinear(void* arkode_mem) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1190,11 +1376,11 @@ int ARKStepSetImplicit(void* arkode_mem) { if (ark_mem->itol == ARK_SV && ark_mem->Vabstol != NULL) { - retval = arkSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); + retval = ARKodeSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); } else { - retval = arkSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); + retval = ARKodeSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); } if (retval != ARK_SUCCESS) { return (retval); } } @@ -1241,11 +1427,11 @@ int ARKStepSetImEx(void* arkode_mem) { if (ark_mem->itol == ARK_SV && ark_mem->Vabstol != NULL) { - retval = arkSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); + retval = ARKodeSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); } else { - retval = arkSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); + retval = ARKodeSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); } if (retval != ARK_SUCCESS) { return (retval); } } @@ -1429,6 +1615,9 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, If either argument is negative (illegal), then this disables the corresponding table (e.g. itable = -1 -> explicit) + + Note: this routine should NOT be used in conjunction with + ARKodeSetOrder. ---------------------------------------------------------------*/ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, ARKODE_ERKTableID etable) @@ -1608,13 +1797,13 @@ int ARKStepSetTableName(void* arkode_mem, const char* itable, const char* etable } /*--------------------------------------------------------------- - ARKStepSetNonlinCRDown: + arkStep_SetNonlinCRDown: Specifies the user-provided nonlinear convergence constant crdown. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +int arkStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1632,13 +1821,13 @@ int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) } /*--------------------------------------------------------------- - ARKStepSetNonlinRDiv: + arkStep_SetNonlinRDiv: Specifies the user-provided nonlinear convergence constant rdiv. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +int arkStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1656,13 +1845,13 @@ int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) } /*--------------------------------------------------------------- - ARKStepSetDeltaGammaMax: + arkStep_SetDeltaGammaMax: Specifies the user-provided linear setup decision constant dgmax. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +int arkStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1680,14 +1869,14 @@ int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) } /*--------------------------------------------------------------- - ARKStepSetLSetupFrequency: + arkStep_SetLSetupFrequency: Specifies the user-provided linear setup decision constant msbp. Positive values give the frequency for calling lsetup; negative values imply recomputation of lsetup at each nonlinear solve; a zero value implies a reset to the default. ---------------------------------------------------------------*/ -int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp) +int arkStep_SetLSetupFrequency(void* arkode_mem, int msbp) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1705,13 +1894,13 @@ int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp) } /*--------------------------------------------------------------- - ARKStepSetPredictorMethod: + arkStep_SetPredictorMethod: Specifies the method to use for predicting implicit solutions. Non-default choices are {1,2,3,4}, all others will use default (trivial) predictor. ---------------------------------------------------------------*/ -int ARKStepSetPredictorMethod(void* arkode_mem, int pred_method) +int arkStep_SetPredictorMethod(void* arkode_mem, int pred_method) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1728,13 +1917,13 @@ int ARKStepSetPredictorMethod(void* arkode_mem, int pred_method) } /*--------------------------------------------------------------- - ARKStepSetMaxNonlinIters: + arkStep_SetMaxNonlinIters: Specifies the maximum number of nonlinear iterations during one solve. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) +int arkStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1771,12 +1960,12 @@ int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) } /*--------------------------------------------------------------- - ARKStepSetNonlinConvCoef: + arkStep_SetNonlinConvCoef: Specifies the coefficient in the nonlinear solver convergence test. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +int arkStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1794,11 +1983,11 @@ int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) } /*--------------------------------------------------------------- - ARKStepSetStagePredictFn: Specifies a user-provided step + arkStep_SetStagePredictFn: Specifies a user-provided step predictor function having type ARKStagePredictFn. A NULL input function disables calls to this routine. ---------------------------------------------------------------*/ -int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +int arkStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1813,7 +2002,7 @@ int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) } /*--------------------------------------------------------------- - ARKStepSetDeduceImplicitRhs: + arkStep_SetDeduceImplicitRhs: Specifies if an optimization is used to avoid an evaluation of fi after a nonlinear solve for an implicit stage. If stage @@ -1824,7 +2013,7 @@ int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) fi(z_i), and SUNFALSE indicates that fi(z_i) is computed with an additional evaluation of fi. ---------------------------------------------------------------*/ -int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +int arkStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1843,9 +2032,9 @@ int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) ===============================================================*/ /*--------------------------------------------------------------- - ARKStepGetCurrentGamma: Returns the current value of gamma + arkStep_GetCurrentGamma: Returns the current value of gamma ---------------------------------------------------------------*/ -int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +int arkStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma) { int retval; ARKodeMem ark_mem; @@ -1879,11 +2068,11 @@ int ARKStepGetNumRhsEvals(void* arkode_mem, long int* fe_evals, long int* fi_eva } /*--------------------------------------------------------------- - ARKStepGetNumLinSolvSetups: + arkStep_GetNumLinSolvSetups: Returns the current number of calls to the lsetup routine ---------------------------------------------------------------*/ -int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +int arkStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -1922,31 +2111,6 @@ int ARKStepGetCurrentButcherTables(void* arkode_mem, ARKodeButcherTable* Bi, return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - ARKStepGetEstLocalErrors: (updated to the correct vector, but - need to verify that it is unchanged between filling the - estimated error and the end of the time step) - - Returns an estimate of the local error - ---------------------------------------------------------------*/ -int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) -{ - ARKodeMem ark_mem; - ARKodeARKStepMem step_mem; - int retval; - - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - SUNFunctionBegin(ark_mem->sunctx); - - /* copy vector to output */ - N_VScale(ONE, ark_mem->tempv1, ele); - - return (ARK_SUCCESS); -} - /*--------------------------------------------------------------- ARKStepGetTimestepperStats: @@ -1980,11 +2144,11 @@ int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, } /*--------------------------------------------------------------- - ARKStepGetNumNonlinSolvIters: + arkStep_GetNumNonlinSolvIters: Returns the current number of nonlinear solver iterations ---------------------------------------------------------------*/ -int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +int arkStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -2000,11 +2164,11 @@ int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } /*--------------------------------------------------------------- - ARKStepGetNumNonlinSolvConvFails: + arkStep_GetNumNonlinSolvConvFails: Returns the current number of nonlinear solver convergence fails ---------------------------------------------------------------*/ -int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +int arkStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -2021,12 +2185,12 @@ int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } /*--------------------------------------------------------------- - ARKStepGetNonlinSolvStats: + arkStep_GetNonlinSolvStats: Returns nonlinear solver statistics ---------------------------------------------------------------*/ -int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails) +int arkStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -2043,11 +2207,11 @@ int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, } /*--------------------------------------------------------------- - ARKStepPrintAllStats: + arkStep_PrintAllStats: Prints integrator statistics ---------------------------------------------------------------*/ -int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -2059,10 +2223,6 @@ int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* step and rootfinding stats */ - retval = arkPrintAllStats(arkode_mem, outfile, fmt); - if (retval != ARK_SUCCESS) { return (retval); } - switch (fmt) { case SUN_OUTPUTFORMAT_TABLE: @@ -2199,29 +2359,20 @@ int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) ===============================================================*/ /*--------------------------------------------------------------- - ARKStepWriteParameters: + arkStep_WriteParameters: Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int ARKStepWriteParameters(void* arkode_mem, FILE* fp) +int arkStep_WriteParameters(void* arkode_mem, FILE* fp) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - int flag, retval; + int retval; /* access ARKodeARKStepMem structure */ retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* output ARKODE infrastructure parameters first */ - flag = arkWriteParameters(ark_mem, fp); - if (flag != ARK_SUCCESS) - { - arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error writing ARKODE infrastructure parameters"); - return (flag); - } - /* print integrator parameters to file */ fprintf(fp, "ARKStep time step module parameters:\n"); fprintf(fp, " Method order %i\n", step_mem->q); diff --git a/src/arkode/arkode_arkstep_nls.c b/src/arkode/arkode_arkstep_nls.c index f52325b487..e05464cb27 100644 --- a/src/arkode/arkode_arkstep_nls.c +++ b/src/arkode/arkode_arkstep_nls.c @@ -24,16 +24,16 @@ #include "arkode_impl.h" /*=============================================================== - Exported functions + Utility routines ===============================================================*/ /*--------------------------------------------------------------- - ARKStepSetNonlinearSolver: + arkStep_SetNonlinearSolver: This routine attaches a SUNNonlinearSolver object to the ARKStep module. ---------------------------------------------------------------*/ -int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +int arkStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) { ARKodeMem ark_mem; ARKodeARKStepMem step_mem; @@ -101,63 +101,6 @@ int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - ARKStepSetNlsRhsFn: - - This routine sets an alternative user-supplied implicit ODE - right-hand side function to use in the evaluation of nonlinear - system functions. - ---------------------------------------------------------------*/ -int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) -{ - ARKodeMem ark_mem; - ARKodeARKStepMem step_mem; - int retval; - - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - if (nls_fi) { step_mem->nls_fi = nls_fi; } - else { step_mem->nls_fi = step_mem->fi; } - - return (ARK_SUCCESS); -} - -/*--------------------------------------------------------------- - ARKStepGetNonlinearSystemData: - - This routine provides access to the relevant data needed to - compute the nonlinear system function. - ---------------------------------------------------------------*/ -int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, N_Vector* Fi, - sunrealtype* gamma, N_Vector* sdata, - void** user_data) -{ - ARKodeMem ark_mem; - ARKodeARKStepMem step_mem; - int retval; - - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - *tcur = ark_mem->tcur; - *zpred = step_mem->zpred; - *z = ark_mem->ycur; - *Fi = step_mem->Fi[step_mem->istage]; - *gamma = step_mem->gamma; - *sdata = step_mem->sdata; - *user_data = ark_mem->user_data; - - return (ARK_SUCCESS); -} - -/*--------------------------------------------------------------- - Utility routines called by ARKStep - ---------------------------------------------------------------*/ - /*--------------------------------------------------------------- arkStep_NlsInit: @@ -388,6 +331,59 @@ int arkStep_Nls(ARKodeMem ark_mem, int nflag) return (retval); } +/*--------------------------------------------------------------- + arkStep_SetNlsRhsFn: + + This routine sets an alternative user-supplied implicit ODE + right-hand side function to use in the evaluation of nonlinear + system functions. + ---------------------------------------------------------------*/ +int arkStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) +{ + ARKodeMem ark_mem; + ARKodeARKStepMem step_mem; + int retval; + + /* access ARKodeARKStepMem structure */ + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + if (retval != ARK_SUCCESS) { return (retval); } + + if (nls_fi) { step_mem->nls_fi = nls_fi; } + else { step_mem->nls_fi = step_mem->fi; } + + return (ARK_SUCCESS); +} + +/*--------------------------------------------------------------- + arkStep_GetNonlinearSystemData: + + This routine provides access to the relevant data needed to + compute the nonlinear system function. + ---------------------------------------------------------------*/ +int arkStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) +{ + ARKodeMem ark_mem; + ARKodeARKStepMem step_mem; + int retval; + + /* access ARKodeARKStepMem structure */ + retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + if (retval != ARK_SUCCESS) { return (retval); } + + *tcur = ark_mem->tcur; + *zpred = step_mem->zpred; + *z = ark_mem->ycur; + *Fi = step_mem->Fi[step_mem->istage]; + *gamma = step_mem->gamma; + *sdata = step_mem->sdata; + *user_data = ark_mem->user_data; + + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- Interface routines supplied to the SUNNonlinearSolver module ---------------------------------------------------------------*/ diff --git a/src/arkode/arkode_bandpre.c b/src/arkode/arkode_bandpre.c index 6eb5f576da..ab559527d6 100644 --- a/src/arkode/arkode_bandpre.c +++ b/src/arkode/arkode_bandpre.c @@ -187,7 +187,7 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, arkls_mem->pfree = ARKBandPrecFree; /* Attach preconditioner solve and setup functions */ - retval = arkLSSetPreconditioner(arkode_mem, ARKBandPrecSetup, ARKBandPrecSolve); + retval = ARKodeSetPreconditioner(arkode_mem, ARKBandPrecSetup, ARKBandPrecSolve); return (retval); } diff --git a/src/arkode/arkode_bbdpre.c b/src/arkode/arkode_bbdpre.c index 52f2ee29d9..e090d5084d 100644 --- a/src/arkode/arkode_bbdpre.c +++ b/src/arkode/arkode_bbdpre.c @@ -282,7 +282,7 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, arkls_mem->pfree = ARKBBDPrecFree; /* Attach preconditioner solve and setup functions */ - retval = arkLSSetPreconditioner(arkode_mem, ARKBBDPrecSetup, ARKBBDPrecSolve); + retval = ARKodeSetPreconditioner(arkode_mem, ARKBBDPrecSetup, ARKBBDPrecSolve); return (retval); } diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 8fec869acf..98cbaf4636 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -85,24 +85,34 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); - ERKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } memset(step_mem, 0, sizeof(struct ARKodeERKStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_init = erkStep_Init; + ark_mem->step_init = erkStep_Init; ark_mem->step_fullrhs = erkStep_FullRHS; - ark_mem->step = erkStep_TakeStep; - ark_mem->step_mem = (void*)step_mem; - - /* Set default values for ERKStep optional inputs */ - retval = ERKStepSetDefaults((void*)ark_mem); + ark_mem->step = erkStep_TakeStep; + ark_mem->step_printallstats = erkStep_PrintAllStats; + ark_mem->step_writeparameters = erkStep_WriteParameters; + ark_mem->step_resize = erkStep_Resize; + ark_mem->step_free = erkStep_Free; + ark_mem->step_printmem = erkStep_PrintMem; + ark_mem->step_setdefaults = erkStep_SetDefaults; + ark_mem->step_setrelaxfn = erkStep_SetRelaxFn; + ark_mem->step_setorder = erkStep_SetOrder; + ark_mem->step_supports_adaptive = SUNTRUE; + ark_mem->step_supports_relaxation = SUNTRUE; + ark_mem->step_mem = (void*)step_mem; + + /* Set default values for optional inputs */ + retval = erkStep_SetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); - ERKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -126,7 +136,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); - ERKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -134,14 +144,12 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) } /*--------------------------------------------------------------- - ERKStepResize: + erkStep_Resize: This routine resizes the memory within the ERKStep module. - It first resizes the main ARKODE infrastructure memory, and - then resizes its own data. ---------------------------------------------------------------*/ -int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +int erkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -152,7 +160,7 @@ int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Determing change in vector sizes */ + /* Determine change in vector sizes */ lrw1 = liw1 = 0; if (y0->ops->nvspace != NULL) { N_VSpace(y0, &lrw1, &liw1); } lrw_diff = lrw1 - ark_mem->lrw1; @@ -160,15 +168,6 @@ int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, ark_mem->lrw1 = lrw1; ark_mem->liw1 = liw1; - /* resize ARKODE infrastructure memory */ - retval = arkResize(ark_mem, y0, hscale, t0, resize, resize_data); - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to resize main ARKODE infrastructure"); - return (retval); - } - /* Resize the RHS vectors */ for (i = 0; i < step_mem->stages; i++) { @@ -248,139 +247,9 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) } /*--------------------------------------------------------------- - ERKStepReset: - - This routine resets the ERKStep module state to solve the same - problem from the given time with the input state (all counter - values are retained). - ---------------------------------------------------------------*/ -int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) -{ - ARKodeMem ark_mem; - ARKodeERKStepMem step_mem; - int retval; - - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - /* Initialize main ARKODE infrastructure */ - retval = arkInit(ark_mem, tR, yR, RESET_INIT); - - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to initialize main ARKODE infrastructure"); - return (retval); - } - - return (ARK_SUCCESS); -} - -/*--------------------------------------------------------------- - ERKStepSStolerances, ERKStepSVtolerances, ERKStepWFtolerances: - - These routines set integration tolerances (wrappers for general - ARKODE utility routines) - ---------------------------------------------------------------*/ -int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) -{ - /* unpack ark_mem, call arkSStolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSStolerances(ark_mem, reltol, abstol)); -} - -int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) -{ - /* unpack ark_mem, call arkSVtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSVtolerances(ark_mem, reltol, abstol)); -} - -int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) -{ - /* unpack ark_mem, call arkWFtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkWFtolerances(ark_mem, efun)); -} - -int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) -{ - /* unpack ark_mem, call arkRootInit, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkRootInit(ark_mem, nrtfn, g)); -} - -int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask) -{ - /* unpack ark_mem, call arkEvolve, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkEvolve(ark_mem, tout, yout, tret, itask); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) -{ - /* unpack ark_mem, call arkGetDky, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkGetDky(ark_mem, t, k, dky); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - ERKStepFree frees all ERKStep memory, and then calls an ARKODE - utility routine to free the ARKODE infrastructure memory. + erkStep_Free frees all ERKStep memory. ---------------------------------------------------------------*/ -void ERKStepFree(void** arkode_mem) +void erkStep_Free(void** arkode_mem) { int j; sunindextype Bliw, Blrw; @@ -436,19 +305,15 @@ void ERKStepFree(void** arkode_mem) free(ark_mem->step_mem); ark_mem->step_mem = NULL; } - - /* free memory for overall ARKODE infrastructure */ - arkFree(arkode_mem); } /*--------------------------------------------------------------- - ERKStepPrintMem: + erkStep_PrintMem: - This routine outputs the memory from the ERKStep structure and - the main ARKODE infrastructure to a specified file pointer - (useful when debugging). + This routine outputs the memory from the ERKStep structure to + a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void ERKStepPrintMem(void* arkode_mem, FILE* outfile) +void erkStep_PrintMem(void* arkode_mem, FILE* outfile) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -462,9 +327,6 @@ void ERKStepPrintMem(void* arkode_mem, FILE* outfile) retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } - /* output data from main ARKODE infrastructure */ - arkPrintMem(ark_mem, outfile); - /* output integer quantities */ fprintf(outfile, "ERKStep: q = %i\n", step_mem->q); fprintf(outfile, "ERKStep: p = %i\n", step_mem->p); diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index ef84f748ef..c4b83e1fe0 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -72,6 +72,16 @@ int erkStep_Init(void* arkode_mem, int init_type); int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); int erkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); +int erkStep_SetUserData(void* arkode_mem, void* user_data); +int erkStep_SetDefaults(void* arkode_mem); +int erkStep_SetOrder(void* arkode_mem, int ord); +int erkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +int erkStep_WriteParameters(void* arkode_mem, FILE* fp); +int erkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); +int erkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +void erkStep_Free(void** arkode_mem); +void erkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ int erkStep_AccessStepMem(void* arkode_mem, const char* fname, @@ -82,6 +92,7 @@ int erkStep_CheckButcherTable(ARKodeMem ark_mem); int erkStep_ComputeSolutions(ARKodeMem ark_mem, sunrealtype* dsm); /* private functions for relaxation */ +int erkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); int erkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, long int* relax_jac_fn_evals, sunrealtype* delta_e_out); int erkStep_GetOrder(ARKodeMem ark_mem); diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index de0d743497..2c5cd72ed4 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -30,162 +30,225 @@ ERKStep Optional input functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. ===============================================================*/ +int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +{ + return (ARKodeReset(arkode_mem, tR, yR)); +} + +int ERKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +{ + return (ARKodeResize(arkode_mem, y0, hscale, t0, resize, resize_data)); +} + +int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) +{ + return (ARKodeRootInit(arkode_mem, nrtfn, g)); +} + +int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask) +{ + return (ARKodeEvolve(arkode_mem, tout, yout, tret, itask)); +} + +int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) +{ + return (ARKodeGetDky(arkode_mem, t, k, dky)); +} + +void ERKStepFree(void** arkode_mem) +{ + ARKodeFree(arkode_mem); +} + +void ERKStepPrintMem(void* arkode_mem, FILE* outfile) +{ + ARKodePrintMem(arkode_mem, outfile); +} + +int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) +{ + return (ARKodeSStolerances(arkode_mem, reltol, abstol)); +} + +int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) +{ + return (ARKodeSVtolerances(arkode_mem, reltol, abstol)); +} + +int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) +{ + return (ARKodeWFtolerances(arkode_mem, efun)); +} + int ERKStepSetDenseOrder(void* arkode_mem, int dord) { - return (ERKStepSetInterpolantDegree(arkode_mem, dord)); + return (ARKodeSetInterpolantDegree(arkode_mem, dord)); } int ERKStepSetInterpolantDegree(void* arkode_mem, int degree) { if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } - return (arkSetInterpolantDegree(arkode_mem, degree)); + return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } int ERKStepSetInterpolantType(void* arkode_mem, int itype) { - return (arkSetInterpolantType(arkode_mem, itype)); + return (ARKodeSetInterpolantType(arkode_mem, itype)); } int ERKStepSetUserData(void* arkode_mem, void* user_data) { - return (arkSetUserData(arkode_mem, user_data)); + return (ARKodeSetUserData(arkode_mem, user_data)); } int ERKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { - return (arkSetMaxNumSteps(arkode_mem, mxsteps)); + return (ARKodeSetMaxNumSteps(arkode_mem, mxsteps)); } int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil) { - return (arkSetMaxHnilWarns(arkode_mem, mxhnil)); + return (ARKodeSetMaxHnilWarns(arkode_mem, mxhnil)); } int ERKStepSetInitStep(void* arkode_mem, sunrealtype hin) { - return (arkSetInitStep(arkode_mem, hin)); + return (ARKodeSetInitStep(arkode_mem, hin)); } int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin) { - return (arkSetMinStep(arkode_mem, hmin)); + return (ARKodeSetMinStep(arkode_mem, hmin)); } int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax) { - return (arkSetMaxStep(arkode_mem, hmax)); + return (ARKodeSetMaxStep(arkode_mem, hmax)); } int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop) { - return (arkSetStopTime(arkode_mem, tstop)); + return (ARKodeSetStopTime(arkode_mem, tstop)); } int ERKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) { - return (arkSetInterpolateStopTime(arkode_mem, interp)); + return (ARKodeSetInterpolateStopTime(arkode_mem, interp)); } int ERKStepClearStopTime(void* arkode_mem) { - return (arkClearStopTime(arkode_mem)); + return (ARKodeClearStopTime(arkode_mem)); } int ERKStepSetRootDirection(void* arkode_mem, int* rootdir) { - return (arkSetRootDirection(arkode_mem, rootdir)); + return (ARKodeSetRootDirection(arkode_mem, rootdir)); } int ERKStepSetNoInactiveRootWarn(void* arkode_mem) { - return (arkSetNoInactiveRootWarn(arkode_mem)); + return (ARKodeSetNoInactiveRootWarn(arkode_mem)); } int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints) { - return (arkSetConstraints(arkode_mem, constraints)); + return (ARKodeSetConstraints(arkode_mem, constraints)); } int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) { - return (arkSetMaxNumConstrFails(arkode_mem, maxfails)); + return (ARKodeSetMaxNumConstrFails(arkode_mem, maxfails)); } int ERKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) { - return (arkSetPostprocessStepFn(arkode_mem, ProcessStep)); + return (ARKodeSetPostprocessStepFn(arkode_mem, ProcessStep)); } int ERKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) { - return (arkSetPostprocessStageFn(arkode_mem, ProcessStage)); + return (ARKodeSetPostprocessStageFn(arkode_mem, ProcessStage)); } int ERKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust) { - return (arkSetAdaptivityAdjustment(arkode_mem, adjust)); + return (ARKodeSetAdaptivityAdjustment(arkode_mem, adjust)); } int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) { - return (arkSetCFLFraction(arkode_mem, cfl_frac)); + return (ARKodeSetCFLFraction(arkode_mem, cfl_frac)); } int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety) { - return (arkSetSafetyFactor(arkode_mem, safety)); + return (ARKodeSetSafetyFactor(arkode_mem, safety)); } int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) { - return (arkSetMaxGrowth(arkode_mem, mx_growth)); + return (ARKodeSetMaxGrowth(arkode_mem, mx_growth)); } int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min) { - return (arkSetMinReduction(arkode_mem, eta_min)); + return (ARKodeSetMinReduction(arkode_mem, eta_min)); } int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) { - return (arkSetFixedStepBounds(arkode_mem, lb, ub)); + return (ARKodeSetFixedStepBounds(arkode_mem, lb, ub)); } int ERKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) { - return (arkSetMaxFirstGrowth(arkode_mem, etamx1)); + return (ARKodeSetMaxFirstGrowth(arkode_mem, etamx1)); } int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) { - return (arkSetMaxEFailGrowth(arkode_mem, etamxf)); + return (ARKodeSetMaxEFailGrowth(arkode_mem, etamxf)); } int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef) { - return (arkSetSmallNumEFails(arkode_mem, small_nef)); + return (ARKodeSetSmallNumEFails(arkode_mem, small_nef)); } int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) { - return (arkSetStabilityFn(arkode_mem, EStab, estab_data)); + return (ARKodeSetStabilityFn(arkode_mem, EStab, estab_data)); } int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef) { - return (arkSetMaxErrTestFails(arkode_mem, maxnef)); + return (ARKodeSetMaxErrTestFails(arkode_mem, maxnef)); } int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) { - return (arkSetFixedStep(arkode_mem, hfixed)); + return (ARKodeSetFixedStep(arkode_mem, hfixed)); } int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C) { - return (arkSetAdaptController(arkode_mem, C)); + return (ARKodeSetAdaptController(arkode_mem, C)); } +int ERKStepSetDefaults(void* arkode_mem) +{ + return (ARKodeSetDefaults(arkode_mem)); +} + +int ERKStepSetOrder(void* arkode_mem, int ord) +{ + return (ARKodeSetOrder(arkode_mem, ord)); +} + + /*=============================================================== ERKStep Optional output functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. @@ -193,175 +256,197 @@ int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C) int ERKStepGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) { - return (arkGetNumStepAttempts(arkode_mem, nstep_attempts)); + return (ARKodeGetNumStepAttempts(arkode_mem, nstep_attempts)); } int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumSteps(arkode_mem, nsteps)); + return (ARKodeGetNumSteps(arkode_mem, nsteps)); } int ERKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused) { - return (arkGetActualInitStep(arkode_mem, hinused)); + return (ARKodeGetActualInitStep(arkode_mem, hinused)); } int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) { - return (arkGetLastStep(arkode_mem, hlast)); + return (ARKodeGetLastStep(arkode_mem, hlast)); } int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) { - return (arkGetCurrentStep(arkode_mem, hcur)); + return (ARKodeGetCurrentStep(arkode_mem, hcur)); } int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) { - return (arkGetCurrentTime(arkode_mem, tcur)); + return (ARKodeGetCurrentTime(arkode_mem, tcur)); } int ERKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) { - return (arkGetTolScaleFactor(arkode_mem, tolsfact)); + return (ARKodeGetTolScaleFactor(arkode_mem, tolsfact)); } int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight) { - return (arkGetErrWeights(arkode_mem, eweight)); + return (ARKodeGetErrWeights(arkode_mem, eweight)); } int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) { - return (arkGetWorkSpace(arkode_mem, lenrw, leniw)); + return (ARKodeGetWorkSpace(arkode_mem, lenrw, leniw)); } int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals) { - return (arkGetNumGEvals(arkode_mem, ngevals)); + return (ARKodeGetNumGEvals(arkode_mem, ngevals)); } int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound) { - return (arkGetRootInfo(arkode_mem, rootsfound)); + return (ARKodeGetRootInfo(arkode_mem, rootsfound)); } int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) { - return (arkGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); + return (ARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); } int ERKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails) { - return (arkGetNumConstrFails(arkode_mem, nconstrfails)); + return (ARKodeGetNumConstrFails(arkode_mem, nconstrfails)); } int ERKStepGetNumExpSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumExpSteps(arkode_mem, nsteps)); + return (ARKodeGetNumExpSteps(arkode_mem, nsteps)); } int ERKStepGetNumAccSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumAccSteps(arkode_mem, nsteps)); + return (ARKodeGetNumAccSteps(arkode_mem, nsteps)); } int ERKStepGetNumErrTestFails(void* arkode_mem, long int* netfails) { - return (arkGetNumErrTestFails(arkode_mem, netfails)); + return (ARKodeGetNumErrTestFails(arkode_mem, netfails)); } int ERKStepGetUserData(void* arkode_mem, void** user_data) { - return (arkGetUserData(arkode_mem, user_data)); + return (ARKodeGetUserData(arkode_mem, user_data)); } char* ERKStepGetReturnFlagName(long int flag) { - return (arkGetReturnFlagName(flag)); + return (ARKodeGetReturnFlagName(flag)); +} + +int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) +{ + return (ARKodeGetEstLocalErrors(arkode_mem, ele)); } /* ----------------------------------------------------------------------------- * Wrappers for the ARKODE relaxation module * ---------------------------------------------------------------------------*/ +/* ERKStep-specific utility routine */ +int erkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) +{ + return (arkRelaxCreate(arkode_mem, rfn, rjac, erkStep_RelaxDeltaE, + erkStep_GetOrder)); +} + int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) { - return arkRelaxCreate(arkode_mem, rfn, rjac, erkStep_RelaxDeltaE, - erkStep_GetOrder); + return (ARKodeSetRelaxFn(arkode_mem, rfn, rjac)); } int ERKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf) { - return arkRelaxSetEtaFail(arkode_mem, eta_rf); + return (ARKodeSetRelaxEtaFail(arkode_mem, eta_rf)); } int ERKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) { - return arkRelaxSetLowerBound(arkode_mem, lower); + return (ARKodeSetRelaxLowerBound(arkode_mem, lower)); } int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails) { - return arkRelaxSetMaxFails(arkode_mem, max_fails); + return (ARKodeSetRelaxMaxFails(arkode_mem, max_fails)); } int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters) { - return arkRelaxSetMaxIters(arkode_mem, max_iters); + return (ARKodeSetRelaxMaxIters(arkode_mem, max_iters)); } int ERKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) { - return arkRelaxSetSolver(arkode_mem, solver); + return (ARKodeSetRelaxSolver(arkode_mem, solver)); } int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) { - return arkRelaxSetResTol(arkode_mem, res_tol); + return (ARKodeSetRelaxResTol(arkode_mem, res_tol)); } int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) { - return arkRelaxSetTol(arkode_mem, rel_tol, abs_tol); + return (ARKodeSetRelaxTol(arkode_mem, rel_tol, abs_tol)); } int ERKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) { - return arkRelaxSetUpperBound(arkode_mem, upper); + return (ARKodeSetRelaxUpperBound(arkode_mem, upper)); } int ERKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) { - return arkRelaxGetNumRelaxFnEvals(arkode_mem, r_evals); + return (ARKodeGetNumRelaxFnEvals(arkode_mem, r_evals)); } int ERKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) { - return arkRelaxGetNumRelaxJacEvals(arkode_mem, J_evals); + return (ARKodeGetNumRelaxJacEvals(arkode_mem, J_evals)); } int ERKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails) { - return arkRelaxGetNumRelaxFails(arkode_mem, relax_fails); + return (ARKodeGetNumRelaxFails(arkode_mem, relax_fails)); } int ERKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails) { - return arkRelaxGetNumRelaxBoundFails(arkode_mem, fails); + return (ARKodeGetNumRelaxBoundFails(arkode_mem, fails)); } int ERKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails) { - return arkRelaxGetNumRelaxSolveFails(arkode_mem, fails); + return (ARKodeGetNumRelaxSolveFails(arkode_mem, fails)); } int ERKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters) { - return arkRelaxGetNumRelaxSolveIters(arkode_mem, iters); + return (ARKodeGetNumRelaxSolveIters(arkode_mem, iters)); +} + +int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +{ + return (ARKodePrintAllStats(arkode_mem, outfile, fmt)); +} + +int ERKStepWriteParameters(void* arkode_mem, FILE* fp) +{ + return (ARKodeWriteParameters(arkode_mem, fp)); } + /*=============================================================== DEPRECATED ERKStep optional input/output functions ===============================================================*/ @@ -391,7 +476,7 @@ int ERKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) ---------------------------------------------------------------*/ int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias) { - return (arkSetErrorBias(arkode_mem, bias)); + return (ARKodeSetErrorBias(arkode_mem, bias)); } /*=============================================================== @@ -399,13 +484,13 @@ int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias) ===============================================================*/ /*--------------------------------------------------------------- - ERKStepSetDefaults: + erkStep_SetDefaults: Resets all ERKStep optional inputs to their default values. Does not change problem-defining function pointers or user_data pointer. ---------------------------------------------------------------*/ -int ERKStepSetDefaults(void* arkode_mem) +int erkStep_SetDefaults(void* arkode_mem) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -416,15 +501,6 @@ int ERKStepSetDefaults(void* arkode_mem) retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Set default ARKODE infrastructure parameters */ - retval = arkSetDefaults(arkode_mem); - if (retval != ARK_SUCCESS) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error setting ARKODE infrastructure defaults"); - return (retval); - } - /* Remove current SUNAdaptController object, and replace with "PI" */ retval = SUNAdaptController_Space(ark_mem->hadapt_mem->hcontroller, &lenrw, &leniw); @@ -478,11 +554,11 @@ int ERKStepSetDefaults(void* arkode_mem) } /*--------------------------------------------------------------- - ERKStepSetOrder: + erkStep_SetOrder: Specifies the method order ---------------------------------------------------------------*/ -int ERKStepSetOrder(void* arkode_mem, int ord) +int erkStep_SetOrder(void* arkode_mem, int ord) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -686,29 +762,6 @@ int ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable* B) return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - ERKStepGetEstLocalErrors: (updated to the correct vector, but - need to verify that it is unchanged between filling the - estimated error and the end of the time step) - - Returns an estimate of the local error - ---------------------------------------------------------------*/ -int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) -{ - ARKodeMem ark_mem; - ARKodeERKStepMem step_mem; - int retval; - - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - /* copy vector to output */ - N_VScale(ONE, ark_mem->tempv1, ele); - - return (ARK_SUCCESS); -} - /*--------------------------------------------------------------- ERKStepGetTimestepperStats: @@ -739,11 +792,11 @@ int ERKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, } /*--------------------------------------------------------------- - ERKStepPrintAllStats: + erkStep_PrintAllStats: Prints integrator statistics ---------------------------------------------------------------*/ -int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int erkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -753,9 +806,6 @@ int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - retval = arkPrintAllStats(arkode_mem, outfile, fmt); - if (retval != ARK_SUCCESS) { return (retval); } - switch (fmt) { case SUN_OUTPUTFORMAT_TABLE: @@ -779,11 +829,11 @@ int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) ===============================================================*/ /*--------------------------------------------------------------- - ERKStepWriteParameters: + erkStep_WriteParameters: Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int ERKStepWriteParameters(void* arkode_mem, FILE* fp) +int erkStep_WriteParameters(void* arkode_mem, FILE* fp) { ARKodeMem ark_mem; ARKodeERKStepMem step_mem; @@ -793,15 +843,6 @@ int ERKStepWriteParameters(void* arkode_mem, FILE* fp) retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* output ARKODE infrastructure parameters first */ - retval = arkWriteParameters(arkode_mem, fp); - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error writing ARKODE infrastructure parameters"); - return (retval); - } - /* print integrator parameters to file */ fprintf(fp, "ERKStep time step module parameters:\n"); fprintf(fp, " Method order %i\n", step_mem->q); diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 54065a7fcb..ddeb0110d8 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -189,6 +189,43 @@ typedef int (*ARKTimestepGetGammasFn)(void* arkode_mem, sunrealtype* gamma, typedef int (*ARKTimestepFullRHSFn)(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); typedef int (*ARKTimestepStepFn)(void* arkode_mem, sunrealtype* dsm, int* nflag); +typedef int (*ARKTimetepSetUserDataFn)(void* arkode_mem, void* user_data); +typedef int (*ARKTimestepPrintAllStats)(void* arkode_mem, FILE* outfile, + SUNOutputFormat fmt); +typedef int (*ARKTimestepWriteParameters)(void* arkode_mem, FILE* fp); +typedef int (*ARKTimestepResize)(void* arkode_mem, N_Vector ynew, + sunrealtype hscale, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); +typedef int (*ARKTimestepReset)(void* arkode_mem, sunrealtype tR, N_Vector yR); +typedef void (*ARKTimestepFree)(void** arkode_mem); +typedef void (*ARKTimestepPrintMem)(void* arkode_mem, FILE* outfile); +typedef int (*ARKTimestepSetDefaults)(void* arkode_mem); +typedef int (*ARKTimestepComputeState)(void* arkode_mem, N_Vector zcor, N_Vector z); +typedef int (*ARKTimestepSetRelaxFn)(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +typedef int (*ARKTimestepSetOrder)(void* arkode_mem, int maxord); +typedef int (*ARKTimestepSetNonlinearSolver)(void* arkode_mem, SUNNonlinearSolver NLS); +typedef int (*ARKTimestepSetLinear)(void* arkode_mem, int timedepend); +typedef int (*ARKTimestepSetNonlinear)(void* arkode_mem); +typedef int (*ARKTimestepSetNlsRhsFn)(void* arkode_mem, ARKRhsFn nls_fi); +typedef int (*ARKTimestepSetDeduceImplicitRhs)(void* arkode_mem, sunbooleantype deduce); +typedef int (*ARKTimestepSetNonlinCRDown)(void* arkode_mem, sunrealtype crdown); +typedef int (*ARKTimestepSetNonlinRDiv)(void* arkode_mem, sunrealtype rdiv); +typedef int (*ARKTimestepSetDeltaGammaMax)(void* arkode_mem, sunrealtype dgmax); +typedef int (*ARKTimestepSetLSetupFrequency)(void* arkode_mem, int msbp); +typedef int (*ARKTimestepSetPredictorMethod)(void* arkode_mem, int method); +typedef int (*ARKTimestepSetMaxNonlinIters)(void* arkode_mem, int maxcor); +typedef int (*ARKTimestepSetNonlinConvCoef)(void* arkode_mem, sunrealtype nlscoef); +typedef int (*ARKTimestepSetStagePredictFn)(void* arkode_mem, ARKStagePredictFn PredictStage); +typedef int (*ARKTimestepGetNumLinSolvSetups)(void* arkode_mem, long int* nlinsetups); +typedef int (*ARKTimestepGetCurrentGamma)(void* arkode_mem, sunrealtype* gamma); +typedef int (*ARKTimestepGetNonlinearSystemData)(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, + N_Vector* Fi, sunrealtype* gamma, + N_Vector* sdata, void** user_data); +typedef int (*ARKTimestepGetNumNonlinSolvIters)(void* arkode_mem, long int* nniters); +typedef int (*ARKTimestepGetNumNonlinSolvConvFails)(void* arkode_mem, long int* nnfails); +typedef int (*ARKTimestepGetNonlinSolvStats)(void* arkode_mem, long int* nniters, + long int* nnfails); /*=============================================================== ARKODE interpolation module definition @@ -308,6 +345,40 @@ struct ARKodeMemRec ARKTimestepInitFn step_init; ARKTimestepFullRHSFn step_fullrhs; ARKTimestepStepFn step; + ARKTimetepSetUserDataFn step_setuserdata; + ARKTimestepPrintAllStats step_printallstats; + ARKTimestepWriteParameters step_writeparameters; + ARKTimestepResize step_resize; + ARKTimestepReset step_reset; + ARKTimestepFree step_free; + ARKTimestepPrintMem step_printmem; + ARKTimestepSetDefaults step_setdefaults; + ARKTimestepComputeState step_computestate; + ARKTimestepSetRelaxFn step_setrelaxfn; + ARKTimestepSetOrder step_setorder; + ARKTimestepSetNonlinearSolver step_setnonlinearsolver; + ARKTimestepSetLinear step_setlinear; + ARKTimestepSetNonlinear step_setnonlinear; + ARKTimestepSetNlsRhsFn step_setnlsrhsfn; + ARKTimestepSetDeduceImplicitRhs step_setdeduceimplicitrhs; + ARKTimestepSetNonlinCRDown step_setnonlincrdown; + ARKTimestepSetNonlinRDiv step_setnonlinrdiv; + ARKTimestepSetDeltaGammaMax step_setdeltagammamax; + ARKTimestepSetLSetupFrequency step_setlsetupfrequency; + ARKTimestepSetPredictorMethod step_setpredictormethod; + ARKTimestepSetMaxNonlinIters step_setmaxnonliniters; + ARKTimestepSetNonlinConvCoef step_setnonlinconvcoef; + ARKTimestepSetStagePredictFn step_setstagepredictfn; + ARKTimestepGetNumLinSolvSetups step_getnumlinsolvsetups; + ARKTimestepGetCurrentGamma step_getcurrentgamma; + ARKTimestepGetNonlinearSystemData step_getnonlinearsystemdata; + ARKTimestepGetNumNonlinSolvIters step_getnumnonlinsolviters; + ARKTimestepGetNumNonlinSolvConvFails step_getnumnonlinsolvconvfails; + ARKTimestepGetNonlinSolvStats step_getnonlinsolvstats; + sunbooleantype step_supports_adaptive; + sunbooleantype step_supports_algebraic; + sunbooleantype step_supports_massmatrix; + sunbooleantype step_supports_relaxation; void* step_mem; /* N_Vector storage */ @@ -887,7 +958,6 @@ sunbooleantype arkResizeVecArray(ARKVecResizeFn resize, void* resize_data, int count, N_Vector tmpl, N_Vector** v, sunindextype lrw_diff, long int* lrw, sunindextype liw_diff, long int* liw); -void arkPrintMem(ARKodeMem ark_mem, FILE* outfile); sunbooleantype arkCheckTimestepper(ARKodeMem ark_mem); sunbooleantype arkCheckNvector(N_Vector tmpl); sunbooleantype arkAllocVectors(ARKodeMem ark_mem, N_Vector tmpl); @@ -913,21 +983,7 @@ int arkRwtSetSS(ARKodeMem ark_mem, N_Vector My, N_Vector weight); int arkRwtSetSV(ARKodeMem ark_mem, N_Vector My, N_Vector weight); ARKodeMem arkCreate(SUNContext sunctx); -int arkResize(ARKodeMem ark_mem, N_Vector ynew, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -int arkSStolerances(ARKodeMem ark_mem, sunrealtype reltol, sunrealtype abstol); -int arkSVtolerances(ARKodeMem ark_mem, sunrealtype reltol, N_Vector abstol); -int arkWFtolerances(ARKodeMem ark_mem, ARKEwtFn efun); -int arkResStolerance(ARKodeMem ark_mem, sunrealtype rabstol); -int arkResVtolerance(ARKodeMem ark_mem, N_Vector rabstol); -int arkResFtolerance(ARKodeMem ark_mem, ARKRwtFn rfun); -int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g); -int arkEvolve(ARKodeMem ark_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask); -int arkGetDky(ARKodeMem ark_mem, sunrealtype t, int k, N_Vector dky); -void arkFree(void** arkode_mem); - -int arkWriteParameters(ARKodeMem ark_mem, FILE* fp); + int arkPredict_MaximumOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess); int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess); int arkPredict_CutoffOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess); @@ -941,68 +997,9 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, int arkAccessHAdaptMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeHAdaptMem* hadapt_mem); -int arkSetAdaptController(void* arkode_mem, SUNAdaptController C); -int arkSetDefaults(void* arkode_mem); -int arkSetDenseOrder(void* arkode_mem, int dord); -int arkSetInterpolantType(void* arkode_mem, int itype); -int arkSetInterpolantDegree(void* arkode_mem, int degree); -int arkSetUserData(void* arkode_mem, void* user_data); -int arkSetMaxNumSteps(void* arkode_mem, long int mxsteps); -int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil); -int arkSetInitStep(void* arkode_mem, sunrealtype hin); -int arkSetMinStep(void* arkode_mem, sunrealtype hmin); -int arkSetMaxStep(void* arkode_mem, sunrealtype hmax); -int arkSetStopTime(void* arkode_mem, sunrealtype tstop); -int arkSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); -int arkClearStopTime(void* arkode_mem); -int arkSetFixedStep(void* arkode_mem, sunrealtype hfixed); -int arkSetRootDirection(void* arkode_mem, int* rootdir); -int arkSetNoInactiveRootWarn(void* arkode_mem); -int arkSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); -int arkSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); -int arkSetConstraints(void* arkode_mem, N_Vector constraints); -int arkSetMaxNumConstrFails(void* arkode_mem, int maxfails); -int arkSetAdaptivityAdjustment(void* arkode_mem, int adjust); -int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); -int arkSetSafetyFactor(void* arkode_mem, sunrealtype safety); -int arkSetErrorBias(void* arkode_mem, sunrealtype bias); -int arkSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); -int arkSetMinReduction(void* arkode_mem, sunrealtype eta_min); -int arkSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); int arkSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, sunrealtype adapt_params[3]); int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); -int arkSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); -int arkSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); -int arkSetSmallNumEFails(void* arkode_mem, int small_nef); -int arkSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); -int arkSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); -int arkSetMaxErrTestFails(void* arkode_mem, int maxnef); -int arkSetMaxConvFails(void* arkode_mem, int maxncf); -int arkSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); -int arkGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); -int arkGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts); -int arkGetNumSteps(void* arkode_mem, long int* nsteps); -int arkGetActualInitStep(void* arkode_mem, sunrealtype* hinused); -int arkGetLastStep(void* arkode_mem, sunrealtype* hlast); -int arkGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -int arkGetCurrentState(void* arkode_mem, N_Vector* ycur); -int arkGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -int arkGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); -int arkGetErrWeights(void* arkode_mem, N_Vector eweight); -int arkGetResWeights(void* arkode_mem, N_Vector rweight); -int arkGetNumGEvals(void* arkode_mem, long int* ngevals); -int arkGetRootInfo(void* arkode_mem, int* rootsfound); -int arkGetNumConstrFails(void* arkode_mem, long int* nconstrfails); -int arkGetNumExpSteps(void* arkode_mem, long int* nsteps); -int arkGetNumAccSteps(void* arkode_mem, long int* nsteps); -int arkGetNumErrTestFails(void* arkode_mem, long int* netfails); -int arkGetNumStepSolveFails(void* arkode_mem, long int* nncfails); -int arkGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, - sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); -int arkGetUserData(void* arkode_mem, void** user_data); -int arkPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -char* arkGetReturnFlagName(long int flag); ARKODE_DIRKTableID arkButcherTableDIRKNameToID(const char* imethod); ARKODE_ERKTableID arkButcherTableERKNameToID(const char* emethod); diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 1f0bb406e8..8de1341496 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -34,7 +34,7 @@ ===============================================================*/ /*--------------------------------------------------------------- - arkSetDefaults: + ARKodeSetDefaults: Resets all optional inputs to ARKODE default values. Does not change problem-defining function pointers fe and fi or @@ -42,9 +42,10 @@ structures/options related to root-finding (those can be reset using ARKodeRootInit) or post-processing a step (ProcessStep). ---------------------------------------------------------------*/ -int arkSetDefaults(void* arkode_mem) +int ARKodeSetDefaults(void* arkode_mem) { ARKodeMem ark_mem; + int retval; if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, @@ -53,6 +54,13 @@ int arkSetDefaults(void* arkode_mem) } ark_mem = (ARKodeMem)arkode_mem; + /* Set stepper defaults (if provided) */ + if (ark_mem->step_setdefaults) + { + retval = ark_mem->step_setdefaults(arkode_mem); + if (retval != ARK_SUCCESS) { return retval; } + } + /* Set default values for integrator optional inputs */ ark_mem->use_compensated_sums = SUNFALSE; ark_mem->fixedstep = SUNFALSE; /* default to use adaptive steps */ @@ -101,7 +109,36 @@ int arkSetDefaults(void* arkode_mem) } /*--------------------------------------------------------------- - arkSetInterpolantType: + ARKodeSetOrder: + + Specifies the method order + ---------------------------------------------------------------*/ +int ARKodeSetOrder(void* arkode_mem, int ord) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setorder) + { + return (ark_mem->step_setorder(arkode_mem, ord)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetInterpolantType: Specifies use of the Lagrange or Hermite interpolation modules. itype == ARK_INTERP_HERMITE specifies the Hermite (nonstiff) @@ -115,7 +152,7 @@ int arkSetDefaults(void* arkode_mem) ARK_MEM_FAIL if the interpolation module cannot be allocated. ARK_ILL_INPUT if the itype argument is not recognized. ---------------------------------------------------------------*/ -int arkSetInterpolantType(void* arkode_mem, int itype) +int ARKodeSetInterpolantType(void* arkode_mem, int itype) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -177,7 +214,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) } /*--------------------------------------------------------------- - arkSetInterpolantDegree: + ARKodeSetInterpolantDegree: Specifies the polynomial degree for the dense output interpolation module. @@ -190,7 +227,7 @@ int arkSetInterpolantType(void* arkode_mem, int itype) initialized. ARK_ILL_INPUT if the degree is illegal. ---------------------------------------------------------------*/ -int arkSetInterpolantDegree(void* arkode_mem, int degree) +int ARKodeSetInterpolantDegree(void* arkode_mem, int degree) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -217,15 +254,445 @@ int arkSetInterpolantDegree(void* arkode_mem, int degree) } /* pass 'degree' to interpolation module, returning its value */ + if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } return (arkInterpSetDegree(ark_mem, ark_mem->interp, degree)); } /*--------------------------------------------------------------- - arkSetUserData: + ARKodeSetDenseOrder: + + Specifies the polynomial degree for the dense output + interpolation module. + + Return values: + ARK_SUCCESS on success. + ARK_MEM_NULL on NULL-valued arkode_mem input or nonexistent + interpolation module. + ARK_INTERP_FAIL if the interpolation module is already + initialized. + ARK_ILL_INPUT if the degree is illegal. + ---------------------------------------------------------------*/ +int ARKodeSetDenseOrder(void* arkode_mem, int degree) +{ + return (ARKodeSetInterpolantDegree(arkode_mem, degree)); +} + +/*--------------------------------------------------------------- + ARKodeSetNonlinearSolver: + + This routine attaches a SUNNonlinearSolver object to the + time-stepping module. + ---------------------------------------------------------------*/ +int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnonlinearsolver) + { + return (ark_mem->step_setnonlinearsolver(arkode_mem, NLS)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetLinear: + + Specifies that the implicit portion of the problem is linear, + and to tighten the linear solver tolerances while taking only + one Newton iteration. DO NOT USE IN COMBINATION WITH THE + FIXED-POINT SOLVER. Automatically tightens DeltaGammaMax + to ensure that step size changes cause Jacobian recomputation. + + The argument should be 1 or 0, where 1 indicates that the + Jacobian of fi with respect to y depends on time, and + 0 indicates that it is not time dependent. Alternately, when + using an iterative linear solver this flag denotes time + dependence of the preconditioner. + ---------------------------------------------------------------*/ +int ARKodeSetLinear(void* arkode_mem, int timedepend) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setlinear) + { + return (ark_mem->step_setlinear(arkode_mem, timedepend)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetNonlinear: + + Specifies that the implicit portion of the problem is nonlinear. + Used to undo a previous call to ARKodeSetLinear. + ---------------------------------------------------------------*/ +int ARKodeSetNonlinear(void* arkode_mem) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnonlinear) + { + return (ark_mem->step_setnonlinear(arkode_mem)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetNlsRhsFn: + + This routine sets an alternative user-supplied implicit ODE + right-hand side function to use in the evaluation of nonlinear + system functions. + ---------------------------------------------------------------*/ +int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnlsrhsfn) + { + return (ark_mem->step_setnlsrhsfn(arkode_mem, nls_fi)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetDeduceImplicitRhs: + + Specifies if an optimization is used to avoid an evaluation of + fi after a nonlinear solve for an implicit stage. If stage + postprocessecing in enabled, this option is ignored, and the + RHS is never deduced. + + An argument of SUNTRUE indicates that the RHS should be deduced, + and SUNFALSE indicates that the RHS should be computed with + an additional evaluation. + ---------------------------------------------------------------*/ +int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setdeduceimplicitrhs) + { + return (ark_mem->step_setdeduceimplicitrhs(arkode_mem, deduce)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetNonlinCRDown: + + Specifies the user-provided nonlinear convergence constant + crdown. Legal values are strictly positive; illegal values + imply a reset to the default. + ---------------------------------------------------------------*/ +int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnonlincrdown) + { + return (ark_mem->step_setnonlincrdown(arkode_mem, crdown)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetNonlinRDiv: + + Specifies the user-provided nonlinear convergence constant + rdiv. Legal values are strictly positive; illegal values + imply a reset to the default. + ---------------------------------------------------------------*/ +int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnonlinrdiv) + { + return (ark_mem->step_setnonlinrdiv(arkode_mem, rdiv)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetDeltaGammaMax: + + Specifies the user-provided linear setup decision constant + dgmax. Legal values are strictly positive; illegal values imply + a reset to the default. + ---------------------------------------------------------------*/ +int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setdeltagammamax) + { + return (ark_mem->step_setdeltagammamax(arkode_mem, dgmax)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetLSetupFrequency: + + Specifies the user-provided linear setup decision constant + msbp. Positive values give the frequency for calling lsetup; + negative values imply recomputation of lsetup at each nonlinear + solve; a zero value implies a reset to the default. + ---------------------------------------------------------------*/ +int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setlsetupfrequency) + { + return (ark_mem->step_setlsetupfrequency(arkode_mem, msbp)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetPredictorMethod: + + Specifies the method to use for predicting implicit solutions. + ---------------------------------------------------------------*/ +int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setpredictormethod) + { + return (ark_mem->step_setpredictormethod(arkode_mem, pred_method)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetMaxNonlinIters: + + Specifies the maximum number of nonlinear iterations during + one solve. A non-positive input implies a reset to the + default value. + ---------------------------------------------------------------*/ +int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setmaxnonliniters) + { + return (ark_mem->step_setmaxnonliniters(arkode_mem, maxcor)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetNonlinConvCoef: + + Specifies the coefficient in the nonlinear solver convergence + test. A non-positive input implies a reset to the default value. + ---------------------------------------------------------------*/ +int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setnonlinconvcoef) + { + return (ark_mem->step_setnonlinconvcoef(arkode_mem, nlscoef)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetStagePredictFn: Specifies a user-provided step + predictor function having type ARKStagePredictFn. A + NULL input function disables calls to this routine. + ---------------------------------------------------------------*/ +int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine (if provided) */ + if (ark_mem->step_setstagepredictfn) + { + return (ark_mem->step_setstagepredictfn(arkode_mem, PredictStage)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeSetUserData: Specifies the user data pointer for f ---------------------------------------------------------------*/ -int arkSetUserData(void* arkode_mem, void* user_data) +int ARKodeSetUserData(void* arkode_mem, void* user_data) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -249,17 +716,23 @@ int arkSetUserData(void* arkode_mem, void* user_data) /* Set data for post-processing a step */ if (ark_mem->ProcessStep != NULL) { ark_mem->ps_data = user_data; } + /* Set user data into stepper (if provided) */ + if (ark_mem->step_setuserdata) + { + return (ark_mem->step_setuserdata(arkode_mem, user_data)); + } + return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkSetAdaptController: + ARKodeSetAdaptController: Specifies a non-default SUNAdaptController time step controller object. If a NULL-valued SUNAdaptController is input, the default will be re-enabled. ---------------------------------------------------------------*/ -int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) +int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C) { int retval; long int lenrw, leniw; @@ -272,6 +745,14 @@ int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* Remove current SUNAdaptController object (delete if owned, and then nullify pointer) */ retval = SUNAdaptController_Space(ark_mem->hadapt_mem->hcontroller, &lenrw, @@ -321,11 +802,11 @@ int arkSetAdaptController(void* arkode_mem, SUNAdaptController C) } /*--------------------------------------------------------------- - arkSetMaxNumSteps: + ARKodeSetMaxNumSteps: Specifies the maximum number of integration steps ---------------------------------------------------------------*/ -int arkSetMaxNumSteps(void* arkode_mem, long int mxsteps) +int ARKodeSetMaxNumSteps(void* arkode_mem, long int mxsteps) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -344,11 +825,11 @@ int arkSetMaxNumSteps(void* arkode_mem, long int mxsteps) } /*--------------------------------------------------------------- - arkSetMaxHnilWarns: + ARKodeSetMaxHnilWarns: Specifies the maximum number of warnings for small h ---------------------------------------------------------------*/ -int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil) +int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -359,6 +840,14 @@ int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* Passing mxhnil=0 sets the default, otherwise use input. */ if (mxhnil == 0) { ark_mem->mxhnil = 10; } else { ark_mem->mxhnil = mxhnil; } @@ -367,11 +856,11 @@ int arkSetMaxHnilWarns(void* arkode_mem, int mxhnil) } /*--------------------------------------------------------------- - arkSetInitStep: + ARKodeSetInitStep: Specifies the initial step size ---------------------------------------------------------------*/ -int arkSetInitStep(void* arkode_mem, sunrealtype hin) +int ARKodeSetInitStep(void* arkode_mem, sunrealtype hin) { ARKodeMem ark_mem; int retval; @@ -398,11 +887,11 @@ int arkSetInitStep(void* arkode_mem, sunrealtype hin) } /*--------------------------------------------------------------- - arkSetMinStep: + ARKodeSetMinStep: Specifies the minimum step size ---------------------------------------------------------------*/ -int arkSetMinStep(void* arkode_mem, sunrealtype hmin) +int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -413,6 +902,14 @@ int arkSetMinStep(void* arkode_mem, sunrealtype hmin) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* Passing a value <= 0 sets hmin = 0 */ if (hmin <= ZERO) { @@ -435,11 +932,11 @@ int arkSetMinStep(void* arkode_mem, sunrealtype hmin) } /*--------------------------------------------------------------- - arkSetMaxStep: + ARKodeSetMaxStep: Specifies the maximum step size ---------------------------------------------------------------*/ -int arkSetMaxStep(void* arkode_mem, sunrealtype hmax) +int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax) { sunrealtype hmax_inv; ARKodeMem ark_mem; @@ -449,7 +946,15 @@ int arkSetMaxStep(void* arkode_mem, sunrealtype hmax) MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; + ark_mem = (ARKodeMem)arkode_mem; + + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } /* Passing a value <= 0 sets hmax = infinity */ if (hmax <= ZERO) @@ -474,11 +979,11 @@ int arkSetMaxStep(void* arkode_mem, sunrealtype hmax) } /*--------------------------------------------------------------- - arkSetStopTime: + ARKodeSetStopTime: Specifies the time beyond which the integration is not to proceed. ---------------------------------------------------------------*/ -int arkSetStopTime(void* arkode_mem, sunrealtype tstop) +int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -491,7 +996,7 @@ int arkSetStopTime(void* arkode_mem, sunrealtype tstop) /* If ARKODE was called at least once, test if tstop is legal (i.e. if it was not already passed). - If arkSetStopTime is called before the first call to ARKODE, + If ARKodeSetStopTime is called before the first call to ARKODE, tstop will be checked in ARKODE. */ if (ark_mem->nst > 0) { @@ -510,12 +1015,12 @@ int arkSetStopTime(void* arkode_mem, sunrealtype tstop) } /*--------------------------------------------------------------- - arkSetInterpolateStopTime: + ARKodeSetInterpolateStopTime: Specifies to use interpolation to fill the solution output at the stop time (instead of a copy). ---------------------------------------------------------------*/ -int arkSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) +int ARKodeSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -530,11 +1035,11 @@ int arkSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) } /*--------------------------------------------------------------- - arkClearStopTime: + ARKodeClearStopTime: Disable the stop time. ---------------------------------------------------------------*/ -int arkClearStopTime(void* arkode_mem) +int ARKodeClearStopTime(void* arkode_mem) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -551,7 +1056,7 @@ int arkClearStopTime(void* arkode_mem) } /*--------------------------------------------------------------- - arkSetFixedStep: + ARKodeSetFixedStep: Specifies to use a fixed time step size instead of performing any form of temporal adaptivity. ARKODE will use this step size @@ -564,7 +1069,7 @@ int arkClearStopTime(void* arkode_mem) Any nonzero argument will result in the use of that fixed step size; an argument of 0 will re-enable temporal adaptivity. ---------------------------------------------------------------*/ -int arkSetFixedStep(void* arkode_mem, sunrealtype hfixed) +int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed) { int retval; ARKodeMem ark_mem; @@ -576,16 +1081,24 @@ int arkSetFixedStep(void* arkode_mem, sunrealtype hfixed) } ark_mem = (ARKodeMem)arkode_mem; + /* ensure that when hfixed=0, the time step module supports adaptivity */ + if ((hfixed == ZERO) && (!ark_mem->step_supports_adaptive)) + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "temporal adaptivity is not supported by this time step module"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* re-attach internal error weight functions if necessary */ if ((hfixed == ZERO) && (!ark_mem->user_efun)) { if (ark_mem->itol == ARK_SV && ark_mem->Vabstol != NULL) { - retval = arkSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); + retval = ARKodeSVtolerances(ark_mem, ark_mem->reltol, ark_mem->Vabstol); } else { - retval = arkSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); + retval = ARKodeSStolerances(ark_mem, ark_mem->reltol, ark_mem->Sabstol); } if (retval != ARK_SUCCESS) { return (retval); } } @@ -599,18 +1112,18 @@ int arkSetFixedStep(void* arkode_mem, sunrealtype hfixed) else { ark_mem->fixedstep = SUNFALSE; } /* Notify ARKODE to use hfixed as the initial step size, and return */ - retval = arkSetInitStep(arkode_mem, hfixed); + retval = ARKodeSetInitStep(arkode_mem, hfixed); return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkSetRootDirection: + ARKodeSetRootDirection: Specifies the direction of zero-crossings to be monitored. The default is to monitor both crossings. ---------------------------------------------------------------*/ -int arkSetRootDirection(void* arkode_mem, int* rootdir) +int ARKodeSetRootDirection(void* arkode_mem, int* rootdir) { ARKodeMem ark_mem; ARKodeRootMem ark_root_mem; @@ -645,12 +1158,12 @@ int arkSetRootDirection(void* arkode_mem, int* rootdir) } /*--------------------------------------------------------------- - arkSetNoInactiveRootWarn: + ARKodeSetNoInactiveRootWarn: Disables issuing a warning if some root function appears to be identically zero at the beginning of the integration ---------------------------------------------------------------*/ -int arkSetNoInactiveRootWarn(void* arkode_mem) +int ARKodeSetNoInactiveRootWarn(void* arkode_mem) { ARKodeMem ark_mem; ARKodeRootMem ark_root_mem; @@ -673,7 +1186,7 @@ int arkSetNoInactiveRootWarn(void* arkode_mem) } /*--------------------------------------------------------------- - arkSetPostprocessStepFn: + ARKodeSetPostprocessStepFn: Specifies a user-provided step postprocessing function having type ARKPostProcessFn. A NULL input function disables step @@ -683,7 +1196,7 @@ int arkSetNoInactiveRootWarn(void* arkode_mem) THEN ALL THEORETICAL GUARANTEES OF SOLUTION ACCURACY AND STABILITY ARE LOST. ---------------------------------------------------------------*/ -int arkSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) +int ARKodeSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -702,7 +1215,7 @@ int arkSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) } /*--------------------------------------------------------------- - arkSetPostprocessStageFn: + ARKodeSetPostprocessStageFn: Specifies a user-provided stage postprocessing function having type ARKPostProcessFn. A NULL input function disables @@ -713,13 +1226,13 @@ int arkSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) STABILITY ARE LOST. While it is possible to perform postprocessing when - ARKStepSetDeduceImplicitRhs is enabled, this can cause implicit + ARKodeSetDeduceImplicitRhs is enabled, this can cause implicit RHS evaluations to be inconsistent with the postprocessed stage values. It is strongly recommended to disable - ARKStepSetDeduceImplicitRhs in order to guarantee + ARKodeSetDeduceImplicitRhs in order to guarantee postprocessing constraints are enforced. ---------------------------------------------------------------*/ -int arkSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) +int ARKodeSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -737,11 +1250,11 @@ int arkSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) } /*--------------------------------------------------------------- - arkSetConstraints: + ARKodeSetConstraints: Activates or Deactivates inequality constraint checking. ---------------------------------------------------------------*/ -int arkSetConstraints(void* arkode_mem, N_Vector constraints) +int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) { sunrealtype temptest; ARKodeMem ark_mem; @@ -753,6 +1266,14 @@ int arkSetConstraints(void* arkode_mem, N_Vector constraints) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive && (constraints != NULL)) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* If there are no constraints, destroy data structures */ if (constraints == NULL) { @@ -795,12 +1316,12 @@ int arkSetConstraints(void* arkode_mem, N_Vector constraints) } /*--------------------------------------------------------------- - arkSetMaxNumConstrFails: + ARKodeSetMaxNumConstrFails: Set max number of allowed constraint failures in a step before returning an error ---------------------------------------------------------------*/ -int arkSetMaxNumConstrFails(void* arkode_mem, int maxfails) +int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -811,6 +1332,14 @@ int arkSetMaxNumConstrFails(void* arkode_mem, int maxfails) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* Passing maxfails = 0 sets the default, otherwise set to input */ if (maxfails <= 0) { ark_mem->maxconstrfails = MAXCONSTRFAILS; } else { ark_mem->maxconstrfails = maxfails; } @@ -1113,14 +1642,14 @@ int arkSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) } /*--------------------------------------------------------------- - arkSetCFLFraction: + ARKodeSetCFLFraction: Specifies the safety factor to use on the maximum explicitly- stable step size. Allowable values must be within the open interval (0,1). A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) +int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1128,6 +1657,14 @@ int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* check for allowable parameters */ if (cfl_frac >= ONE) { @@ -1144,7 +1681,7 @@ int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) } /*--------------------------------------------------------------- - arkSetAdaptivityAdjustment: + ARKodeSetAdaptivityAdjustment: Adjusts the method order supplied to the temporal adaptivity controller. For example, if the user expects order reduction @@ -1152,7 +1689,7 @@ int arkSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) assume a reduced order of accuracy for the method by specifying a value adjust < 0. ---------------------------------------------------------------*/ -int arkSetAdaptivityAdjustment(void* arkode_mem, int adjust) +int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1160,20 +1697,28 @@ int arkSetAdaptivityAdjustment(void* arkode_mem, int adjust) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* store requested adjustment */ hadapt_mem->adjust = adjust; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkSetSafetyFactor: + ARKodeSetSafetyFactor: Specifies the safety factor to use on the error-based predicted time step size. Allowable values must be within the open interval (0,1). A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkSetSafetyFactor(void* arkode_mem, sunrealtype safety) +int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1181,6 +1726,14 @@ int arkSetSafetyFactor(void* arkode_mem, sunrealtype safety) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* check for allowable parameters */ if (safety >= ONE) { @@ -1197,13 +1750,13 @@ int arkSetSafetyFactor(void* arkode_mem, sunrealtype safety) } /*--------------------------------------------------------------- - arkSetErrorBias: + ARKodeSetErrorBias: Specifies the error bias to use when performing adaptive-step error control. Allowable values must be >= 1.0. Any illegal value implies a reset to the default value. ---------------------------------------------------------------*/ -int arkSetErrorBias(void* arkode_mem, sunrealtype bias) +int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1211,6 +1764,14 @@ int arkSetErrorBias(void* arkode_mem, sunrealtype bias) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* set allowed value, otherwise set default */ if (bias < ONE) { @@ -1230,14 +1791,14 @@ int arkSetErrorBias(void* arkode_mem, sunrealtype bias) } /*--------------------------------------------------------------- - arkSetMaxGrowth: + ARKodeSetMaxGrowth: Specifies the maximum step size growth factor to be allowed between successive integration steps. Note: the first step uses a separate maximum growth factor. Allowable values must be > 1.0. Any illegal value implies a reset to the default. ---------------------------------------------------------------*/ -int arkSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) +int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1245,6 +1806,14 @@ int arkSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* set allowed value, otherwise set default */ if (mx_growth <= ONE) { hadapt_mem->growth = GROWTH; } else { hadapt_mem->growth = mx_growth; } @@ -1253,14 +1822,14 @@ int arkSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) } /*--------------------------------------------------------------- - arkSetMinReduction: + ARKodeSetMinReduction: Specifies the minimum possible step size reduction factor to be allowed between successive integration steps. Allowable values must be > 0.0 and < 1.0. Any illegal value implies a reset to the default. ---------------------------------------------------------------*/ -int arkSetMinReduction(void* arkode_mem, sunrealtype eta_min) +int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1268,6 +1837,14 @@ int arkSetMinReduction(void* arkode_mem, sunrealtype eta_min) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* set allowed value, otherwise set default */ if (eta_min >= ONE || eta_min <= ZERO) { hadapt_mem->etamin = ETAMIN; } else { hadapt_mem->etamin = eta_min; } @@ -1276,13 +1853,13 @@ int arkSetMinReduction(void* arkode_mem, sunrealtype eta_min) } /*--------------------------------------------------------------- - arkSetFixedStepBounds: + ARKodeSetFixedStepBounds: Specifies the step size growth interval within which the step size will remain unchanged. Allowable values must enclose the value 1.0. Any illegal interval implies a reset to the default. ---------------------------------------------------------------*/ -int arkSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) +int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1290,6 +1867,14 @@ int arkSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* set allowable interval, otherwise set defaults */ if ((lb <= ONE) && (ub >= ONE)) { @@ -1306,13 +1891,13 @@ int arkSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) } /*--------------------------------------------------------------- - arkSetMaxFirstGrowth: + ARKodeSetMaxFirstGrowth: Specifies the user-provided time step adaptivity constant etamx1. Legal values are greater than 1.0. Illegal values imply a reset to the default value. ---------------------------------------------------------------*/ -int arkSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) +int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1320,6 +1905,14 @@ int arkSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* if argument legal set it, otherwise set default */ if (etamx1 <= ONE) { hadapt_mem->etamx1 = ETAMX1; } else { hadapt_mem->etamx1 = etamx1; } @@ -1328,13 +1921,13 @@ int arkSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) } /*--------------------------------------------------------------- - arkSetMaxEFailGrowth: + ARKodeSetMaxEFailGrowth: Specifies the user-provided time step adaptivity constant etamxf. Legal values are in the interval (0,1]. Illegal values imply a reset to the default value. ---------------------------------------------------------------*/ -int arkSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) +int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1342,6 +1935,14 @@ int arkSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* if argument legal set it, otherwise set default */ if ((etamxf <= ZERO) || (etamxf > ONE)) { hadapt_mem->etamxf = ETAMXF; } else { hadapt_mem->etamxf = etamxf; } @@ -1350,13 +1951,13 @@ int arkSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) } /*--------------------------------------------------------------- - arkSetSmallNumEFails: + ARKodeSetSmallNumEFails: Specifies the user-provided time step adaptivity constant small_nef. Legal values are > 0. Illegal values imply a reset to the default value. ---------------------------------------------------------------*/ -int arkSetSmallNumEFails(void* arkode_mem, int small_nef) +int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1364,6 +1965,14 @@ int arkSetSmallNumEFails(void* arkode_mem, int small_nef) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* if argument legal set it, otherwise set default */ if (small_nef <= 0) { hadapt_mem->small_nef = SMALL_NEF; } else { hadapt_mem->small_nef = small_nef; } @@ -1372,13 +1981,13 @@ int arkSetSmallNumEFails(void* arkode_mem, int small_nef) } /*--------------------------------------------------------------- - arkSetMaxCFailGrowth: + ARKodeSetMaxCFailGrowth: Specifies the user-provided time step adaptivity constant etacf. Legal values are in the interval (0,1]. Illegal values imply a reset to the default value. ---------------------------------------------------------------*/ -int arkSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) +int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1386,6 +1995,14 @@ int arkSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* if argument legal set it, otherwise set default */ if ((etacf <= ZERO) || (etacf > ONE)) { hadapt_mem->etacf = ETACF; } else { hadapt_mem->etacf = etacf; } @@ -1394,13 +2011,13 @@ int arkSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) } /*--------------------------------------------------------------- - arkSetStabilityFn: + ARKodeSetStabilityFn: Specifies the user-provided explicit time step stability function to use. A NULL input function implies a reset to the default function (empty). ---------------------------------------------------------------*/ -int arkSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) +int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) { int retval; ARKodeHAdaptMem hadapt_mem; @@ -1408,6 +2025,14 @@ int arkSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) retval = arkAccessHAdaptMem(arkode_mem, __func__, &ark_mem, &hadapt_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* NULL argument sets default, otherwise set inputs */ if (EStab == NULL) { @@ -1424,13 +2049,13 @@ int arkSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) } /*--------------------------------------------------------------- - arkSetMaxErrTestFails: + ARKodeSetMaxErrTestFails: Specifies the maximum number of error test failures during one step try. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkSetMaxErrTestFails(void* arkode_mem, int maxnef) +int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1441,6 +2066,14 @@ int arkSetMaxErrTestFails(void* arkode_mem, int maxnef) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + /* argument <= 0 sets default, otherwise set input */ if (maxnef <= 0) { ark_mem->maxnef = MAXNEF; } else { ark_mem->maxnef = maxnef; } @@ -1448,13 +2081,13 @@ int arkSetMaxErrTestFails(void* arkode_mem, int maxnef) } /*--------------------------------------------------------------- - arkSetMaxConvFails: + ARKodeSetMaxConvFails: Specifies the maximum number of nonlinear convergence failures during one step try. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkSetMaxConvFails(void* arkode_mem, int maxncf) +int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1465,6 +2098,14 @@ int arkSetMaxConvFails(void* arkode_mem, int maxncf) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* argument <= 0 sets default, otherwise set input */ if (maxncf <= 0) { ark_mem->maxncf = MAXNCF; } else { ark_mem->maxncf = maxncf; } @@ -1472,12 +2113,12 @@ int arkSetMaxConvFails(void* arkode_mem, int maxncf) } /*--------------------------------------------------------------- - arkSetUseCompensatedSums: + ARKodeSetUseCompensatedSums: Specifies that ARKODE should use compensated (Kahan) summation where relevant to mitigate roundoff error. ---------------------------------------------------------------*/ -int arkSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) +int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1499,11 +2140,11 @@ int arkSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) ===============================================================*/ /*--------------------------------------------------------------- - arkGetNumStepAttempts: + ARKodeGetNumStepAttempts: Returns the current number of steps attempted by the solver ---------------------------------------------------------------*/ -int arkGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) +int ARKodeGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1519,11 +2160,11 @@ int arkGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) } /*--------------------------------------------------------------- - arkGetNumSteps: + ARKodeGetNumSteps: Returns the current number of integration steps ---------------------------------------------------------------*/ -int arkGetNumSteps(void* arkode_mem, long int* nsteps) +int ARKodeGetNumSteps(void* arkode_mem, long int* nsteps) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1539,11 +2180,11 @@ int arkGetNumSteps(void* arkode_mem, long int* nsteps) } /*--------------------------------------------------------------- - arkGetActualInitStep: + ARKodeGetActualInitStep: Returns the step size used on the first step ---------------------------------------------------------------*/ -int arkGetActualInitStep(void* arkode_mem, sunrealtype* hinused) +int ARKodeGetActualInitStep(void* arkode_mem, sunrealtype* hinused) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1559,11 +2200,11 @@ int arkGetActualInitStep(void* arkode_mem, sunrealtype* hinused) } /*--------------------------------------------------------------- - arkGetLastStep: + ARKodeGetLastStep: Returns the step size used on the last successful step ---------------------------------------------------------------*/ -int arkGetLastStep(void* arkode_mem, sunrealtype* hlast) +int ARKodeGetLastStep(void* arkode_mem, sunrealtype* hlast) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1579,11 +2220,11 @@ int arkGetLastStep(void* arkode_mem, sunrealtype* hlast) } /*--------------------------------------------------------------- - arkGetCurrentStep: + ARKodeGetCurrentStep: Returns the step size to be attempted on the next step ---------------------------------------------------------------*/ -int arkGetCurrentStep(void* arkode_mem, sunrealtype* hcur) +int ARKodeGetCurrentStep(void* arkode_mem, sunrealtype* hcur) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1599,12 +2240,12 @@ int arkGetCurrentStep(void* arkode_mem, sunrealtype* hcur) } /*--------------------------------------------------------------- - arkGetCurrentState: + ARKodeGetCurrentState: Returns the current solution (before or after as step) or stage value (during step solve). ---------------------------------------------------------------*/ -int arkGetCurrentState(void* arkode_mem, N_Vector* state) +int ARKodeGetCurrentState(void* arkode_mem, N_Vector* state) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1620,11 +2261,32 @@ int arkGetCurrentState(void* arkode_mem, N_Vector* state) } /*--------------------------------------------------------------- - arkGetCurrentTime: + ARKodeGetEstLocalErrors: + + Returns an estimate of the local error + ---------------------------------------------------------------*/ +int ARKodeGetEstLocalErrors(void* arkode_mem, N_Vector ele) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* copy vector to output */ + N_VScale(ONE, ark_mem->tempv1, ele); + return (ARK_SUCCESS); +} + +/*--------------------------------------------------------------- + ARKodeGetCurrentTime: Returns the current value of the independent variable ---------------------------------------------------------------*/ -int arkGetCurrentTime(void* arkode_mem, sunrealtype* tcur) +int ARKodeGetCurrentTime(void* arkode_mem, sunrealtype* tcur) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1640,11 +2302,38 @@ int arkGetCurrentTime(void* arkode_mem, sunrealtype* tcur) } /*--------------------------------------------------------------- - arkGetTolScaleFactor: + ARKodeGetCurrentGamma: Returns the current value of gamma + ---------------------------------------------------------------*/ +int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getcurrentgamma) + { + return (ark_mem->step_getcurrentgamma(arkode_mem, gamma)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetTolScaleFactor: Returns a suggested factor for scaling tolerances ---------------------------------------------------------------*/ -int arkGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) +int ARKodeGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1660,11 +2349,11 @@ int arkGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) } /*--------------------------------------------------------------- - arkGetErrWeights: + ARKodeGetErrWeights: This routine returns the current error weight vector. ---------------------------------------------------------------*/ -int arkGetErrWeights(void* arkode_mem, N_Vector eweight) +int ARKodeGetErrWeights(void* arkode_mem, N_Vector eweight) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1680,11 +2369,11 @@ int arkGetErrWeights(void* arkode_mem, N_Vector eweight) } /*--------------------------------------------------------------- - arkGetResWeights: + ARKodeGetResWeights: This routine returns the current residual weight vector. ---------------------------------------------------------------*/ -int arkGetResWeights(void* arkode_mem, N_Vector rweight) +int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1695,16 +2384,24 @@ int arkGetResWeights(void* arkode_mem, N_Vector rweight) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + N_VScale(ONE, ark_mem->rwt, rweight); return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetWorkSpace: + ARKodeGetWorkSpace: Returns integrator work space requirements ---------------------------------------------------------------*/ -int arkGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) +int ARKodeGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1721,11 +2418,11 @@ int arkGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) } /*--------------------------------------------------------------- - arkGetNumGEvals: + ARKodeGetNumGEvals: Returns the current number of calls to g (for rootfinding) ---------------------------------------------------------------*/ -int arkGetNumGEvals(void* arkode_mem, long int* ngevals) +int ARKodeGetNumGEvals(void* arkode_mem, long int* ngevals) { ARKodeMem ark_mem; ARKodeRootMem ark_root_mem; @@ -1748,11 +2445,11 @@ int arkGetNumGEvals(void* arkode_mem, long int* ngevals) } /*--------------------------------------------------------------- - arkGetRootInfo: + ARKodeGetRootInfo: Returns pointer to array rootsfound showing roots found ---------------------------------------------------------------*/ -int arkGetRootInfo(void* arkode_mem, int* rootsfound) +int ARKodeGetRootInfo(void* arkode_mem, int* rootsfound) { int i; ARKodeMem ark_mem; @@ -1779,12 +2476,12 @@ int arkGetRootInfo(void* arkode_mem, int* rootsfound) } /*--------------------------------------------------------------- - arkGetStepStats: + ARKodeGetStepStats: Returns step statistics ---------------------------------------------------------------*/ -int arkGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, - sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) +int ARKodeGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, + sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1804,11 +2501,11 @@ int arkGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, } /*--------------------------------------------------------------- - arkGetNumConstrFails: + ARKodeGetNumConstrFails: Returns the current number of constraint fails ---------------------------------------------------------------*/ -int arkGetNumConstrFails(void* arkode_mem, long int* nconstrfails) +int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1819,16 +2516,24 @@ int arkGetNumConstrFails(void* arkode_mem, long int* nconstrfails) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + *nconstrfails = ark_mem->nconstrfails; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetNumExpSteps: + ARKodeGetNumExpSteps: Returns the current number of stability-limited steps ---------------------------------------------------------------*/ -int arkGetNumExpSteps(void* arkode_mem, long int* nsteps) +int ARKodeGetNumExpSteps(void* arkode_mem, long int* nsteps) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1839,16 +2544,24 @@ int arkGetNumExpSteps(void* arkode_mem, long int* nsteps) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + *nsteps = ark_mem->hadapt_mem->nst_exp; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetNumAccSteps: + ARKodeGetNumAccSteps: Returns the current number of accuracy-limited steps ---------------------------------------------------------------*/ -int arkGetNumAccSteps(void* arkode_mem, long int* nsteps) +int ARKodeGetNumAccSteps(void* arkode_mem, long int* nsteps) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1859,16 +2572,24 @@ int arkGetNumAccSteps(void* arkode_mem, long int* nsteps) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + *nsteps = ark_mem->hadapt_mem->nst_acc; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetNumErrTestFails: + ARKodeGetNumErrTestFails: Returns the current number of error test failures ---------------------------------------------------------------*/ -int arkGetNumErrTestFails(void* arkode_mem, long int* netfails) +int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1879,17 +2600,177 @@ int arkGetNumErrTestFails(void* arkode_mem, long int* netfails) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for non-adaptive time stepper modules */ + if (!ark_mem->step_supports_adaptive) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_ILL_INPUT); + } + *netfails = ark_mem->netf; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetNumStepSolveFails: + ARKodeComputeState: + + Computes y based on the current prediction and a given + correction. + ---------------------------------------------------------------*/ +int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_computestate) + { + return (ark_mem->step_computestate(arkode_mem, zcor, z)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetNonlinearSystemData: + + This routine provides access to the relevant data needed to + compute the nonlinear system function. + ---------------------------------------------------------------*/ +int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getnonlinearsystemdata) + { + return (ark_mem->step_getnonlinearsystemdata(arkode_mem, tcur, zpred, z, + Fi, gamma, sdata, user_data)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetNumNonlinSolvIters: + + Returns the current number of nonlinear solver iterations + ---------------------------------------------------------------*/ +int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getnumnonlinsolviters) + { + return (ark_mem->step_getnumnonlinsolviters(arkode_mem, nniters)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetNumNonlinSolvConvFails: + + Returns the current number of nonlinear solver convergence fails + ---------------------------------------------------------------*/ +int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getnumnonlinsolvconvfails) + { + return (ark_mem->step_getnumnonlinsolvconvfails(arkode_mem, nnfails)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetNonlinSolvStats: + + Returns nonlinear solver statistics + ---------------------------------------------------------------*/ +int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getnonlinsolvstats) + { + return (ark_mem->step_getnonlinsolvstats(arkode_mem, nniters, nnfails)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetNumStepSolveFails: Returns the current number of failed steps due to an algebraic solver convergence failure. ---------------------------------------------------------------*/ -int arkGetNumStepSolveFails(void* arkode_mem, long int* nncfails) +int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1900,16 +2781,53 @@ int arkGetNumStepSolveFails(void* arkode_mem, long int* nncfails) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + *nncfails = ark_mem->ncfn; return (ARK_SUCCESS); } /*--------------------------------------------------------------- - arkGetUserData: + ARKodeGetNumLinSolvSetups: + + Returns the current number of calls to the lsetup routine + ---------------------------------------------------------------*/ +int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper routine to compute the state (if provided) */ + if (ark_mem->step_getnumlinsolvsetups) + { + return (ark_mem->step_getnumlinsolvsetups(arkode_mem, nlinsetups)); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support this function"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +/*--------------------------------------------------------------- + ARKodeGetUserData: Returns the user data pointer ---------------------------------------------------------------*/ -int arkGetUserData(void* arkode_mem, void** user_data) +int ARKodeGetUserData(void* arkode_mem, void** user_data) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -1926,12 +2844,12 @@ int arkGetUserData(void* arkode_mem, void** user_data) } /*----------------------------------------------------------------- - arkPrintAllStats + ARKodePrintAllStats Prints the current value of all statistics ---------------------------------------------------------------*/ -int arkPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int ARKodePrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) { int retval; ARKodeMem ark_mem; @@ -2002,12 +2920,18 @@ int arkPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) if (retval != ARK_SUCCESS) { return (retval); } } + /* Print stepper stats (if provided) */ + if (ark_mem->step_printallstats) + { + return (ark_mem->step_printallstats(arkode_mem, outfile, fmt)); + } + return (ARK_SUCCESS); } /*-----------------------------------------------------------------*/ -char* arkGetReturnFlagName(long int flag) +char* ARKodeGetReturnFlagName(long int flag) { char* name; name = (char*)malloc(27 * sizeof(char)); @@ -2066,7 +2990,12 @@ char* arkGetReturnFlagName(long int flag) case ARK_INTERP_FAIL: sprintf(name, "ARK_INTERP_FAIL"); break; case ARK_INVALID_TABLE: sprintf(name, "ARK_INVALID_TABLE"); break; case ARK_CONTEXT_ERR: sprintf(name, "ARK_CONTEXT_ERR"); break; + case ARK_RELAX_FAIL: sprintf(name, "ARK_RELAX_FAIL"); break; + case ARK_RELAX_MEM_NULL: sprintf(name, "ARK_RELAX_MEM_NULL"); break; + case ARK_RELAX_FUNC_FAIL: sprintf(name, "ARK_RELAX_FUNC_FAIL"); break; + case ARK_RELAX_JAC_FAIL: sprintf(name, "ARK_RELAX_JAC_FAIL"); break; case ARK_CONTROLLER_ERR: sprintf(name, "ARK_CONTROLLER_ERR"); break; + case ARK_STEPPER_UNSUPPORTED: sprintf(name, "ARK_STEPPER_UNSUPPORTED"); break; case ARK_UNRECOGNIZED_ERROR: sprintf(name, "ARK_UNRECOGNIZED_ERROR"); break; default: sprintf(name, "NONE"); } @@ -2079,18 +3008,20 @@ char* arkGetReturnFlagName(long int flag) ===============================================================*/ /*--------------------------------------------------------------- - arkodeWriteParameters: + ARKodeWriteParameters: Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int arkWriteParameters(ARKodeMem ark_mem, FILE* fp) +int ARKodeWriteParameters(void* arkode_mem, FILE* fp) { - if (ark_mem == NULL) + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; /* print integrator parameters to file */ fprintf(fp, "ARKODE solver parameters:\n"); @@ -2165,6 +3096,12 @@ int arkWriteParameters(ARKodeMem ark_mem, FILE* fp) fprintf(fp, " Maximum number of convergence test failures = %i\n", ark_mem->maxncf); + /* Call stepper routine (if provided) */ + if (ark_mem->step_writeparameters) + { + return (ark_mem->step_writeparameters(ark_mem, fp)); + } + return (ARK_SUCCESS); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index bf43998744..8178fd7de2 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -43,9 +43,9 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, ===============================================================*/ /*--------------------------------------------------------------- - arkLSSetLinearSolver specifies the linear solver. + ARKodeSetLinearSolver specifies the linear solver. ---------------------------------------------------------------*/ -int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) +int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -63,6 +63,14 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + if (LS == NULL) { arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -298,8 +306,8 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) linear solver and user-supplied routine to perform the mass-matrix-vector product. ---------------------------------------------------------------*/ -int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, - sunbooleantype time_dep) +int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, + sunbooleantype time_dep) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -317,6 +325,14 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + if (LS == NULL) { arkProcessError(ark_mem, ARKLS_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -525,9 +541,9 @@ int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, ===============================================================*/ /*--------------------------------------------------------------- - arkLSSetJacFn specifies the Jacobian function. + ARKodeSetJacFn specifies the Jacobian function. ---------------------------------------------------------------*/ -int arkLSSetJacFn(void* arkode_mem, ARKLsJacFn jac) +int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -537,6 +553,14 @@ int arkLSSetJacFn(void* arkode_mem, ARKLsJacFn jac) retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* return with failure if jac cannot be used */ if ((jac != NULL) && (arkls_mem->A == NULL)) { @@ -568,9 +592,9 @@ int arkLSSetJacFn(void* arkode_mem, ARKLsJacFn jac) } /*--------------------------------------------------------------- - arkLSSetMassFn specifies the mass matrix function. + ARKodeSetMassFn specifies the mass matrix function. ---------------------------------------------------------------*/ -int arkLSSetMassFn(void* arkode_mem, ARKLsMassFn mass) +int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -580,6 +604,14 @@ int arkLSSetMassFn(void* arkode_mem, ARKLsMassFn mass) retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + /* return with failure if mass cannot be used */ if (mass == NULL) { @@ -602,38 +634,57 @@ int arkLSSetMassFn(void* arkode_mem, ARKLsMassFn mass) } /*--------------------------------------------------------------- - arkLSSetEpsLin specifies the nonlinear -> linear tolerance + ARKodeSetEpsLin specifies the nonlinear -> linear tolerance scale factor. ---------------------------------------------------------------*/ -int arkLSSetEpsLin(void* arkode_mem, sunrealtype eplifac) +int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; store input and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* store input and return */ arkls_mem->eplifac = (eplifac <= ZERO) ? ARKLS_EPLIN : eplifac; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSSetNormFactor sets or computes the factor to use when + ARKodeSetLSNormFactor sets or computes the factor to use when converting from the integrator tolerance (WRMS norm) to the linear solver tolerance (L2 norm). ---------------------------------------------------------------*/ -int arkLSSetNormFactor(void* arkode_mem, sunrealtype nrmfac) +int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; store input and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* store input and return */ if (nrmfac > ZERO) { /* set user-provided factor */ @@ -655,37 +706,55 @@ int arkLSSetNormFactor(void* arkode_mem, sunrealtype nrmfac) } /*--------------------------------------------------------------- - arkLSSetJacEvalFrequency specifies the frequency for + ARKodeSetJacEvalFrequency specifies the frequency for recomputing the Jacobian matrix and/or preconditioner. ---------------------------------------------------------------*/ -int arkLSSetJacEvalFrequency(void* arkode_mem, long int msbj) +int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; store input and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* store input and return */ arkls_mem->msbj = (msbj <= ZERO) ? ARKLS_MSBJ : msbj; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSSetLinearSolutionScaling enables or disables scaling the + ARKodeSetLinearSolutionScaling enables or disables scaling the linear solver solution to account for changes in gamma. ---------------------------------------------------------------*/ -int arkLSSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) +int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; store input and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* check for valid solver type */ if (!(arkls_mem->matrixbased)) { return (ARKLS_ILL_INPUT); } @@ -696,11 +765,11 @@ int arkLSSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) } /*--------------------------------------------------------------- - arkLSSetPreconditioner specifies the user-supplied + ARKodeSetPreconditioner specifies the user-supplied preconditioner setup and solve routines. ---------------------------------------------------------------*/ -int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve) +int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -712,6 +781,14 @@ int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { @@ -741,11 +818,11 @@ int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, } /*--------------------------------------------------------------- - arkLSSetJacTimes specifies the user-supplied Jacobian-vector + ARKodeSetJacTimes specifies the user-supplied Jacobian-vector product setup and multiply routines. ---------------------------------------------------------------*/ -int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes) +int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -755,6 +832,14 @@ int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* issue error if LS object does not allow user-supplied ATimes */ if (arkls_mem->LS->ops->setatimes == NULL) { @@ -792,11 +877,11 @@ int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, } /*--------------------------------------------------------------- - arkLSSetJacTimesRhsFn specifies an alternative user-supplied + ARKodeSetJacTimesRhsFn specifies an alternative user-supplied ODE right-hand side function to use in the internal finite difference Jacobian-vector product. ---------------------------------------------------------------*/ -int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) +int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -806,6 +891,14 @@ int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* check if using internal finite difference approximation */ if (!(arkls_mem->jtimesDQ)) { @@ -831,8 +924,8 @@ int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) return (ARKLS_SUCCESS); } -/* arkLSSetLinSysFn specifies the linear system setup function. */ -int arkLSSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) +/* ARKodeSetLinSysFn specifies the linear system setup function. */ +int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -842,6 +935,14 @@ int arkLSSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* return with failure if linsys cannot be used */ if ((linsys != NULL) && (arkls_mem->A == NULL)) { @@ -894,53 +995,83 @@ int arkLSSetUserData(void* arkode_mem, void* user_data) } /*=============================================================== - Optional Get functions (called by time-stepper modules) + Optional Get functions ===============================================================*/ -int arkLSGetJac(void* arkode_mem, SUNMatrix* J) +int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *J = arkls_mem->savedJ; return ARKLS_SUCCESS; } -int arkLSGetJacTime(void* arkode_mem, sunrealtype* t_J) +int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *t_J = arkls_mem->tnlj; return ARKLS_SUCCESS; } -int arkLSGetJacNumSteps(void* arkode_mem, long int* nst_J) +int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nst_J = arkls_mem->nstlj; return ARKLS_SUCCESS; } /*--------------------------------------------------------------- - arkLSGetWorkSpace returns the length of workspace allocated for + ARKodeGetLinWorkSpace returns the length of workspace allocated for the ARKLS linear solver interface. ---------------------------------------------------------------*/ -int arkLSGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) +int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) { ARKodeMem ark_mem; ARKLsMem arkls_mem; @@ -952,6 +1083,14 @@ int arkLSGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + /* start with fixed sizes plus vector/matrix pointers */ *lenrw = 3; *leniw = 30; @@ -993,181 +1132,281 @@ int arkLSGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) } /*--------------------------------------------------------------- - arkLSGetNumJacEvals returns the number of Jacobian evaluations + ARKodeGetNumJacEvals returns the number of Jacobian evaluations ---------------------------------------------------------------*/ -int arkLSGetNumJacEvals(void* arkode_mem, long int* njevals) +int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *njevals = arkls_mem->nje; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumRhsEvals returns the number of calls to the ODE + ARKodeGetNumLinRhsEvals returns the number of calls to the ODE function needed for the DQ Jacobian approximation or J*v product approximation. ---------------------------------------------------------------*/ -int arkLSGetNumRhsEvals(void* arkode_mem, long int* nfevalsLS) +int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nfevalsLS = arkls_mem->nfeDQ; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumPrecEvals returns the number of calls to the + ARKodeGetNumPrecEvals returns the number of calls to the user- or ARKODE-supplied preconditioner setup routine. ---------------------------------------------------------------*/ -int arkLSGetNumPrecEvals(void* arkode_mem, long int* npevals) +int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *npevals = arkls_mem->npe; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumPrecSolves returns the number of calls to the + ARKodeGetNumPrecSolves returns the number of calls to the user- or ARKODE-supplied preconditioner solve routine. ---------------------------------------------------------------*/ -int arkLSGetNumPrecSolves(void* arkode_mem, long int* npsolves) +int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *npsolves = arkls_mem->nps; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumLinIters returns the number of linear iterations + ARKodeGetNumLinIters returns the number of linear iterations (if accessible from the LS object). ---------------------------------------------------------------*/ -int arkLSGetNumLinIters(void* arkode_mem, long int* nliters) +int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nliters = arkls_mem->nli; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumConvFails returns the number of linear solver + ARKodeGetNumLinConvFails returns the number of linear solver convergence failures (as reported by the LS object). ---------------------------------------------------------------*/ -int arkLSGetNumConvFails(void* arkode_mem, long int* nlcfails) +int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nlcfails = arkls_mem->ncfl; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumJTSetupEvals returns the number of calls to the + ARKodeGetNumJTSetupEvals returns the number of calls to the user-supplied Jacobian-vector product setup routine. ---------------------------------------------------------------*/ -int arkLSGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) +int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *njtsetups = arkls_mem->njtsetup; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumJtimesEvals returns the number of calls to the + ARKodeGetNumJtimesEvals returns the number of calls to the Jacobian-vector product multiply routine. ---------------------------------------------------------------*/ -int arkLSGetNumJtimesEvals(void* arkode_mem, long int* njvevals) +int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *njvevals = arkls_mem->njtimes; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassMatvecSetups returns the number of calls to the + ARKodeGetNumMassMultSetups returns the number of calls to the mass matrix-vector setup routine. ---------------------------------------------------------------*/ -int arkLSGetNumMassMatvecSetups(void* arkode_mem, long int* nmvsetups) +int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKMassMem structure; set output value and return */ + /* access ARKMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmvsetups = arkls_mem->nmvsetup; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetLastFlag returns the last flag set in a ARKLS + ARKodeGetLastLinFlag returns the last flag set in a ARKLS function. ---------------------------------------------------------------*/ -int arkLSGetLastFlag(void* arkode_mem, long int* flag) +int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) { ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure; set output value and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *flag = arkls_mem->last_flag; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetReturnFlagName translates from the integer error code + ARKodeGetLinReturnFlagName translates from the integer error code returned by an ARKLs routine to the corresponding string equivalent for that flag ---------------------------------------------------------------*/ -char* arkLSGetReturnFlagName(long int flag) +char* ARKodeGetLinReturnFlagName(long int flag) { char* name = (char*)malloc(30 * sizeof(char)); @@ -1192,38 +1431,57 @@ char* arkLSGetReturnFlagName(long int flag) } /*--------------------------------------------------------------- - arkLSSetMassEpsLin specifies the nonlinear -> linear tolerance + ARKodeSetMassEpsLin specifies the nonlinear -> linear tolerance scale factor for mass matrix linear systems. ---------------------------------------------------------------*/ -int arkLSSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) +int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; store input and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* store input and return */ arkls_mem->eplifac = (eplifac <= ZERO) ? ARKLS_EPLIN : eplifac; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSSetMassNormFactor sets or computes the factor to use when + ARKodeSetMassLSNormFactor sets or computes the factor to use when converting from the integrator tolerance (WRMS norm) to the linear solver tolerance (L2 norm). ---------------------------------------------------------------*/ -int arkLSSetMassNormFactor(void* arkode_mem, sunrealtype nrmfac) +int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMem structure; store input and return */ + /* access ARKLsMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* store input and return */ if (nrmfac > ZERO) { /* set user-provided factor */ @@ -1245,11 +1503,11 @@ int arkLSSetMassNormFactor(void* arkode_mem, sunrealtype nrmfac) } /*--------------------------------------------------------------- - arkLSSetMassPreconditioner specifies the user-supplied + ARKodeSetMassPreconditioner specifies the user-supplied preconditioner setup and solve routines. ---------------------------------------------------------------*/ -int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, - ARKLsMassPrecSolveFn psolve) +int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, + ARKLsMassPrecSolveFn psolve) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -1261,6 +1519,14 @@ int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { @@ -1290,11 +1556,11 @@ int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, } /*--------------------------------------------------------------- - arkLSSetMassTimes specifies the user-supplied mass + ARKodeSetMassTimes specifies the user-supplied mass matrix-vector product setup and multiply routines. ---------------------------------------------------------------*/ -int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, - ARKLsMassTimesVecFn mtimes, void* mtimes_data) +int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, + ARKLsMassTimesVecFn mtimes, void* mtimes_data) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -1304,6 +1570,14 @@ int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + /* issue error if mtimes function is unusable */ if (mtimes == NULL) { @@ -1361,9 +1635,9 @@ int arkLSSetMassUserData(void* arkode_mem, void* user_data) } /*--------------------------------------------------------------- - arkLSGetMassWorkSpace + ARKodeGetMassWorkSpace ---------------------------------------------------------------*/ -int arkLSGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) +int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -1375,6 +1649,14 @@ int arkLSGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + /* start with fixed sizes plus vector/matrix pointers */ *lenrw = 2; *leniw = 23; @@ -1416,145 +1698,225 @@ int arkLSGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) } /*--------------------------------------------------------------- - arkLSGetNumMassSetups returns the number of mass matrix + ARKodeGetNumMassSetups returns the number of mass matrix solver 'setup' calls ---------------------------------------------------------------*/ -int arkLSGetNumMassSetups(void* arkode_mem, long int* nmsetups) +int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmsetups = arkls_mem->nmsetups; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassMult returns the number of calls to the user- + ARKodeGetNumMassMult returns the number of calls to the user- supplied or internal mass matrix-vector product multiply routine. ---------------------------------------------------------------*/ -int arkLSGetNumMassMult(void* arkode_mem, long int* nmvevals) +int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmvevals = arkls_mem->nmtimes; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassSolves returns the number of mass matrix + ARKodeGetNumMassSolves returns the number of mass matrix solver 'solve' calls ---------------------------------------------------------------*/ -int arkLSGetNumMassSolves(void* arkode_mem, long int* nmsolves) +int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmsolves = arkls_mem->nmsolves; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassPrecEvals returns the number of calls to the + ARKodeGetNumMassPrecEvals returns the number of calls to the user- or ARKODE-supplied preconditioner setup routine. ---------------------------------------------------------------*/ -int arkLSGetNumMassPrecEvals(void* arkode_mem, long int* npevals) +int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *npevals = arkls_mem->npe; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassPrecSolves returns the number of calls to the + ARKodeGetNumMassPrecSolves returns the number of calls to the user- or ARKODE-supplied preconditioner solve routine. ---------------------------------------------------------------*/ -int arkLSGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) +int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *npsolves = arkls_mem->nps; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassIters returns the number of mass matrix solver + ARKodeGetNumMassIters returns the number of mass matrix solver linear iterations (if accessible from the LS object). ---------------------------------------------------------------*/ -int arkLSGetNumMassIters(void* arkode_mem, long int* nmiters) +int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmiters = arkls_mem->nli; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMassConvFails returns the number of linear solver + ARKodeGetNumMassConvFails returns the number of linear solver convergence failures (as reported by the LS object). ---------------------------------------------------------------*/ -int arkLSGetNumMassConvFails(void* arkode_mem, long int* nmcfails) +int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *nmcfails = arkls_mem->ncfl; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetMassMatrix returns the current mass matrix. + ARKodeGetCurrentMassMatrix returns the current mass matrix. ---------------------------------------------------------------*/ -int arkLSGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) +int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *M = arkls_mem->M; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetNumMTSetups returns the number of calls to the + ARKodeGetNumMTSetups returns the number of calls to the user-supplied mass matrix-vector product setup routine. ---------------------------------------------------------------*/ -int arkLSGetNumMTSetups(void* arkode_mem, long int* nmtsetups) +int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; @@ -1563,23 +1925,43 @@ int arkLSGetNumMTSetups(void* arkode_mem, long int* nmtsetups) /* access ARKLsMassMem structure; set output value and return */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output value and return */ *nmtsetups = arkls_mem->nmtsetup; return (ARKLS_SUCCESS); } /*--------------------------------------------------------------- - arkLSGetLastMassFlag returns the last flag set in a ARKLS + ARKodeGetLastMassFlag returns the last flag set in a ARKLS function. ---------------------------------------------------------------*/ -int arkLSGetLastMassFlag(void* arkode_mem, long int* flag) +int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) { ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ + /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } + + /* Guard against use for time steppers that do not support mass matrices */ + if (!ark_mem->step_supports_massmatrix) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_ILL_INPUT); + } + + /* set output and return */ *flag = arkls_mem->last_flag; return (ARKLS_SUCCESS); } diff --git a/src/arkode/arkode_ls_impl.h b/src/arkode/arkode_ls_impl.h index 8dc2723c2f..968c654bb9 100644 --- a/src/arkode/arkode_ls_impl.h +++ b/src/arkode/arkode_ls_impl.h @@ -257,57 +257,12 @@ int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, sunbooleantype time_dep); -int arkLSSetJacFn(void* arkode_mem, ARKLsJacFn jac); -int arkLSSetMassFn(void* arkode_mem, ARKLsMassFn mass); -int arkLSSetEpsLin(void* arkode_mem, sunrealtype eplifac); -int arkLSSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); -int arkLSSetNormFactor(void* arkode_mem, sunrealtype nrmfac); -int arkLSSetMassNormFactor(void* arkode_mem, sunrealtype nrmfac); -int arkLSSetJacEvalFrequency(void* arkode_mem, long int msbj); -int arkLSSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); -int arkLSSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -int arkLSSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, - ARKLsMassPrecSolveFn psolve); -int arkLSSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -int arkLSSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); -int arkLSSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn msetup, - ARKLsMassTimesVecFn mtimes, void* mtimes_data); -int arkLSSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); - int arkLSSetUserData(void* arkode_mem, void* user_data); + int arkLSSetMassUserData(void* arkode_mem, void* user_data); -int arkLSGetJac(void* arkode_mem, SUNMatrix* J); -int arkLSGetJacTime(void* arkode_mem, sunrealtype* t_J); -int arkLSGetJacNumSteps(void* arkode_mem, long int* nst_J); -int arkLSGetWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS); -int arkLSGetNumJacEvals(void* arkode_mem, long int* njevals); -int arkLSGetNumPrecEvals(void* arkode_mem, long int* npevals); -int arkLSGetNumPrecSolves(void* arkode_mem, long int* npsolves); -int arkLSGetNumLinIters(void* arkode_mem, long int* nliters); -int arkLSGetNumConvFails(void* arkode_mem, long int* nlcfails); -int arkLSGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); -int arkLSGetNumJtimesEvals(void* arkode_mem, long int* njvevals); -int arkLSGetNumRhsEvals(void* arkode_mem, long int* nfevalsLS); -int arkLSGetLastFlag(void* arkode_mem, long int* flag); - -int arkLSGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, - long int* leniwMLS); -int arkLSGetNumMassSetups(void* arkode_mem, long int* nmsetups); -int arkLSGetNumMassMult(void* arkode_mem, long int* nmvevals); -int arkLSGetNumMassMatvecSetups(void* arkode_mem, long int* nmvsetups); -int arkLSGetNumMassSolves(void* arkode_mem, long int* nmsolves); -int arkLSGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals); -int arkLSGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves); -int arkLSGetNumMassIters(void* arkode_mem, long int* nmiters); -int arkLSGetNumMassConvFails(void* arkode_mem, long int* nmcfails); -int arkLSGetNumMTSetups(void* arkode_mem, long int* nmtsetups); int arkLSGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); -int arkLSGetLastMassFlag(void* arkode_mem, long int* flag); -char* arkLSGetReturnFlagName(long int flag); /*--------------------------------------------------------------- Error Messages diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 25d1620834..0f7b736480 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -99,29 +99,59 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, MSG_ARK_ARKMEM_FAIL); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } memset(step_mem, 0, sizeof(struct ARKodeMRIStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_attachlinsol = mriStep_AttachLinsol; - ark_mem->step_disablelsetup = mriStep_DisableLSetup; - ark_mem->step_getlinmem = mriStep_GetLmem; + ark_mem->step_attachlinsol = mriStep_AttachLinsol; + ark_mem->step_disablelsetup = mriStep_DisableLSetup; + ark_mem->step_getlinmem = mriStep_GetLmem; ark_mem->step_getimplicitrhs = mriStep_GetImplicitRHS; - ark_mem->step_getgammas = mriStep_GetGammas; - ark_mem->step_init = mriStep_Init; - ark_mem->step_fullrhs = mriStep_FullRHS; - ark_mem->step = mriStep_TakeStep; - ark_mem->step_mem = (void*)step_mem; - - /* Set default values for MRIStep optional inputs */ - retval = MRIStepSetDefaults((void*)ark_mem); + ark_mem->step_getgammas = mriStep_GetGammas; + ark_mem->step_init = mriStep_Init; + ark_mem->step_fullrhs = mriStep_FullRHS; + ark_mem->step = mriStep_TakeStep; + ark_mem->step_setuserdata = mriStep_SetUserData; + ark_mem->step_printallstats = mriStep_PrintAllStats; + ark_mem->step_writeparameters = mriStep_WriteParameters; + ark_mem->step_resize = mriStep_Resize; + ark_mem->step_reset = mriStep_Reset; + ark_mem->step_free = mriStep_Free; + ark_mem->step_printmem = mriStep_PrintMem; + ark_mem->step_setdefaults = mriStep_SetDefaults; + ark_mem->step_computestate = mriStep_ComputeState; + ark_mem->step_setorder = mriStep_SetOrder; + ark_mem->step_setnonlinearsolver = mriStep_SetNonlinearSolver; + ark_mem->step_setlinear = mriStep_SetLinear; + ark_mem->step_setnonlinear = mriStep_SetNonlinear; + ark_mem->step_setnlsrhsfn = mriStep_SetNlsRhsFn; + ark_mem->step_setdeduceimplicitrhs = mriStep_SetDeduceImplicitRhs; + ark_mem->step_setnonlincrdown = mriStep_SetNonlinCRDown; + ark_mem->step_setnonlinrdiv = mriStep_SetNonlinRDiv; + ark_mem->step_setdeltagammamax = mriStep_SetDeltaGammaMax; + ark_mem->step_setlsetupfrequency = mriStep_SetLSetupFrequency; + ark_mem->step_setpredictormethod = mriStep_SetPredictorMethod; + ark_mem->step_setmaxnonliniters = mriStep_SetMaxNonlinIters; + ark_mem->step_setnonlinconvcoef = mriStep_SetNonlinConvCoef; + ark_mem->step_setstagepredictfn = mriStep_SetStagePredictFn; + ark_mem->step_getnumlinsolvsetups = mriStep_GetNumLinSolvSetups; + ark_mem->step_getcurrentgamma = mriStep_GetCurrentGamma; + ark_mem->step_getnonlinearsystemdata = mriStep_GetNonlinearSystemData; + ark_mem->step_getnumnonlinsolviters = mriStep_GetNumNonlinSolvIters; + ark_mem->step_getnumnonlinsolvconvfails = mriStep_GetNumNonlinSolvConvFails; + ark_mem->step_getnonlinsolvstats = mriStep_GetNonlinSolvStats; + ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_mem = (void*)step_mem; + + /* Set default values for optional inputs */ + retval = mriStep_SetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -153,15 +183,15 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } - retval = MRIStepSetNonlinearSolver(ark_mem, NLS); + retval = ARKodeSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } step_mem->ownNLS = SUNTRUE; @@ -196,7 +226,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -209,7 +239,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "A required inner stepper function is NULL"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -218,14 +248,12 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, } /*--------------------------------------------------------------- - MRIStepResize: + mriStep_Resize: This routine resizes the memory within the MRIStep module. - It first resizes the main ARKODE infrastructure memory, and - then resizes its own data. ---------------------------------------------------------------*/ -int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data) +int mriStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -237,7 +265,7 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Determing change in vector sizes */ + /* Determine change in vector sizes */ lrw1 = liw1 = 0; if (y0->ops->nvspace != NULL) { N_VSpace(y0, &lrw1, &liw1); } lrw_diff = lrw1 - ark_mem->lrw1; @@ -245,15 +273,6 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, ark_mem->lrw1 = lrw1; ark_mem->liw1 = liw1; - /* resize ARKODE infrastructure memory (use hscale = 1.0) */ - retval = arkResize(ark_mem, y0, SUN_RCONST(1.0), t0, resize, resize_data); - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to resize main ARKODE infrastructure"); - return (retval); - } - /* Resize Fse */ if (step_mem->Fse) { @@ -331,8 +350,8 @@ int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, return (ARK_MEM_FAIL); } - /* attach new Newton NLS object to MRIStep */ - retval = MRIStepSetNonlinearSolver(ark_mem, NLS); + /* attach new Newton NLS object */ + retval = ARKodeSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, @@ -417,15 +436,15 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error creating default Newton solver"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (ARK_MEM_FAIL); } - retval = MRIStepSetNonlinearSolver(ark_mem, NLS); + retval = ARKodeSetNonlinearSolver(ark_mem, NLS); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Error attaching default Newton solver"); - MRIStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (ARK_MEM_FAIL); } step_mem->ownNLS = SUNTRUE; @@ -455,13 +474,14 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, } /*--------------------------------------------------------------- - MRIStepReset: + mriStep_Reset: This routine resets the MRIStep module state to solve the same problem from the given time with the input state (all counter - values are retained). + values are retained). It is called after the main ARKODE + infrastructure is reset. ---------------------------------------------------------------*/ -int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -471,16 +491,6 @@ int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Initialize main ARKODE infrastructure */ - retval = arkInit(ark_mem, tR, yR, RESET_INIT); - - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to initialize main ARKODE infrastructure"); - return (retval); - } - /* Reset the inner integrator with this same state */ retval = mriStepInnerStepper_Reset(step_mem->stepper, tR, yR); if (retval != ARK_SUCCESS) { return (ARK_INNERSTEP_FAIL); } @@ -489,129 +499,11 @@ int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) } /*--------------------------------------------------------------- - MRIStepSStolerances, MRIStepSVtolerances, MRIStepWFtolerances: - - These routines set integration tolerances (wrappers for general - ARKODE utility routines) - ---------------------------------------------------------------*/ -int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) -{ - /* unpack ark_mem, call arkSStolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSStolerances(ark_mem, reltol, abstol)); -} - -int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) -{ - /* unpack ark_mem, call arkSVtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkSVtolerances(ark_mem, reltol, abstol)); -} - -int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun) -{ - /* unpack ark_mem, call arkWFtolerances, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkWFtolerances(ark_mem, efun)); -} - -/*--------------------------------------------------------------- - MRIStepRootInit: - - Initialize (attach) a rootfinding problem to the stepper - (wrappers for general ARKODE utility routine) - ---------------------------------------------------------------*/ -int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) -{ - /* unpack ark_mem, call arkRootInit, and return */ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkRootInit(ark_mem, nrtfn, g)); -} - -/*--------------------------------------------------------------- - MRIStepEvolve: - - This is the main time-integration driver (wrappers for general - ARKODE utility routine) - ---------------------------------------------------------------*/ -int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask) -{ - /* unpack ark_mem, call arkEvolve, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkEvolve(ark_mem, tout, yout, tret, itask); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - MRIStepGetDky: - - This returns interpolated output of the solution or its - derivatives over the most-recently-computed step (wrapper for - generic ARKODE utility routine) - ---------------------------------------------------------------*/ -int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) -{ - /* unpack ark_mem, call arkGetDky, and return */ - int retval; - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkGetDky(ark_mem, t, k, dky); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - MRIStepComputeState: + mriStep_ComputeState: Computes y based on the current prediction and given correction. ---------------------------------------------------------------*/ -int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) { int retval; ARKodeMem ark_mem; @@ -627,10 +519,9 @@ int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) } /*--------------------------------------------------------------- - MRIStepFree frees all MRIStep memory, and then calls an ARKODE - utility routine to free the ARKODE infrastructure memory. + mriStep_Free frees all MRIStep memory. ---------------------------------------------------------------*/ -void MRIStepFree(void** arkode_mem) +void mriStep_Free(void** arkode_mem) { sunindextype Cliw, Clrw; ARKodeMem ark_mem; @@ -745,19 +636,15 @@ void MRIStepFree(void** arkode_mem) free(ark_mem->step_mem); ark_mem->step_mem = NULL; } - - /* free memory for overall ARKODE infrastructure */ - arkFree(arkode_mem); } /*--------------------------------------------------------------- - MRIStepPrintMem: + mriStep_PrintMem: - This routine outputs the memory from the MRIStep structure and - the main ARKODE infrastructure to a specified file pointer - (useful when debugging). + This routine outputs the memory from the MRIStep structure to + a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void MRIStepPrintMem(void* arkode_mem, FILE* outfile) +void mriStep_PrintMem(void* arkode_mem, FILE* outfile) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -767,13 +654,6 @@ void MRIStepPrintMem(void* arkode_mem, FILE* outfile) retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return; } - /* if outfile==NULL, set it to stdout */ - if (outfile == NULL) { outfile = stdout; } - - /* output data from main ARKODE infrastructure */ - fprintf(outfile, "MRIStep Slow Stepper Mem:\n"); - arkPrintMem(ark_mem, outfile); - /* output integer quantities */ fprintf(outfile, "MRIStep: q = %i\n", step_mem->q); fprintf(outfile, "MRIStep: p = %i\n", step_mem->p); @@ -857,7 +737,6 @@ void MRIStepPrintMem(void* arkode_mem, FILE* outfile) /* print the inner stepper memory */ mriStepInnerStepper_PrintMem(step_mem->stepper, outfile); - return; } diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index e3e1a6e990..706f49e12c 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -199,6 +199,40 @@ int mriStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); +int mriStep_SetUserData(void* arkode_mem, void* user_data); +int mriStep_SetDefaults(void* arkode_mem); +int mriStep_SetOrder(void* arkode_mem, int ord); +int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +int mriStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); +int mriStep_SetLinear(void* arkode_mem, int timedepend); +int mriStep_SetNonlinear(void* arkode_mem); +int mriStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +int mriStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +int mriStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +int mriStep_SetLSetupFrequency(void* arkode_mem, int msbp); +int mriStep_SetPredictorMethod(void* arkode_mem, int pred_method); +int mriStep_SetMaxNonlinIters(void* arkode_mem, int maxcor); +int mriStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +int mriStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); +int mriStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); +int mriStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +int mriStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); +int mriStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); +int mriStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +int mriStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +int mriStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +int mriStep_WriteParameters(void* arkode_mem, FILE* fp); +int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); +int mriStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); +void mriStep_Free(void** arkode_mem); +void mriStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ int mriStep_AccessStepMem(void* arkode_mem, const char* fname, diff --git a/src/arkode/arkode_mristep_io.c b/src/arkode/arkode_mristep_io.c index 376bcb2385..eeedc65a48 100644 --- a/src/arkode/arkode_mristep_io.c +++ b/src/arkode/arkode_mristep_io.c @@ -27,65 +27,207 @@ MRIStep Optional input functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. ===============================================================*/ +int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +{ + return (ARKodeReset(arkode_mem, tR, yR)); +} + +int MRIStepResize(void* arkode_mem, N_Vector y0, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data) +{ + return (ARKodeResize(arkode_mem, y0, ONE, t0, resize, resize_data)); +} + +int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) +{ + return (ARKodeRootInit(arkode_mem, nrtfn, g)); +} + +int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask) +{ + return (ARKodeEvolve(arkode_mem, tout, yout, tret, itask)); +} + +int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) +{ + return (ARKodeGetDky(arkode_mem, t, k, dky)); +} + +void MRIStepFree(void** arkode_mem) +{ + ARKodeFree(arkode_mem); +} + +void MRIStepPrintMem(void* arkode_mem, FILE* outfile) +{ + ARKodePrintMem(arkode_mem, outfile); +} + +int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) +{ + return (ARKodeSStolerances(arkode_mem, reltol, abstol)); +} + +int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) +{ + return (ARKodeSVtolerances(arkode_mem, reltol, abstol)); +} + +int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun) +{ + return (ARKodeWFtolerances(arkode_mem, efun)); +} + +int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) +{ + return (ARKodeSetFixedStep(arkode_mem, hfixed)); +} + +int MRIStepSetUserData(void* arkode_mem, void* user_data) +{ + return (ARKodeSetUserData(arkode_mem, user_data)); +} + +int MRIStepSetDefaults(void* arkode_mem) +{ + return (ARKodeSetDefaults(arkode_mem)); +} + +int MRIStepSetOrder(void* arkode_mem, int ord) +{ + return (ARKodeSetOrder(arkode_mem, ord)); +} + int MRIStepSetDenseOrder(void* arkode_mem, int dord) { - return (MRIStepSetInterpolantDegree(arkode_mem, dord)); + return (ARKodeSetInterpolantDegree(arkode_mem, dord)); +} + +int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +{ + return (ARKodeSetNonlinearSolver(arkode_mem, NLS)); +} + +int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) +{ + return (ARKodeSetNlsRhsFn(arkode_mem, nls_fi)); +} + +int MRIStepSetLinear(void* arkode_mem, int timedepend) +{ + return (ARKodeSetLinear(arkode_mem, timedepend)); +} + +int MRIStepSetNonlinear(void* arkode_mem) +{ + return (ARKodeSetNonlinear(arkode_mem)); +} + +int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +{ + return (ARKodeSetNonlinCRDown(arkode_mem, crdown)); +} + +int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +{ + return (ARKodeSetNonlinRDiv(arkode_mem, rdiv)); +} + +int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +{ + return (ARKodeSetDeltaGammaMax(arkode_mem, dgmax)); +} + +int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp) +{ + return (ARKodeSetLSetupFrequency(arkode_mem, msbp)); +} + +int MRIStepSetPredictorMethod(void* arkode_mem, int pred_method) +{ + return (ARKodeSetPredictorMethod(arkode_mem, pred_method)); +} + +int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) +{ + return (ARKodeSetMaxNonlinIters(arkode_mem, maxcor)); +} + +int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +{ + return (ARKodeSetNonlinConvCoef(arkode_mem, nlscoef)); +} + +int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +{ + return (ARKodeSetStagePredictFn(arkode_mem, PredictStage)); +} + +int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +{ + return (ARKodeSetDeduceImplicitRhs(arkode_mem, deduce)); +} + +int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) +{ + return (ARKodeGetWorkSpace(arkode_mem, lenrw, leniw)); } int MRIStepSetInterpolantDegree(void* arkode_mem, int degree) { if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } - return (arkSetInterpolantDegree(arkode_mem, degree)); + return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } int MRIStepSetInterpolantType(void* arkode_mem, int itype) { - return (arkSetInterpolantType(arkode_mem, itype)); + return (ARKodeSetInterpolantType(arkode_mem, itype)); } int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { - return (arkSetMaxNumSteps(arkode_mem, mxsteps)); + return (ARKodeSetMaxNumSteps(arkode_mem, mxsteps)); } int MRIStepSetMaxHnilWarns(void* arkode_mem, int mxhnil) { - return (arkSetMaxHnilWarns(arkode_mem, mxhnil)); + return (ARKodeSetMaxHnilWarns(arkode_mem, mxhnil)); } int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop) { - return (arkSetStopTime(arkode_mem, tstop)); + return (ARKodeSetStopTime(arkode_mem, tstop)); } int MRIStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) { - return (arkSetInterpolateStopTime(arkode_mem, interp)); + return (ARKodeSetInterpolateStopTime(arkode_mem, interp)); } int MRIStepClearStopTime(void* arkode_mem) { - return (arkClearStopTime(arkode_mem)); + return (ARKodeClearStopTime(arkode_mem)); } int MRIStepSetRootDirection(void* arkode_mem, int* rootdir) { - return (arkSetRootDirection(arkode_mem, rootdir)); + return (ARKodeSetRootDirection(arkode_mem, rootdir)); } int MRIStepSetNoInactiveRootWarn(void* arkode_mem) { - return (arkSetNoInactiveRootWarn(arkode_mem)); + return (ARKodeSetNoInactiveRootWarn(arkode_mem)); } int MRIStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) { - return (arkSetPostprocessStepFn(arkode_mem, ProcessStep)); + return (ARKodeSetPostprocessStepFn(arkode_mem, ProcessStep)); } int MRIStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) { - return (arkSetPostprocessStageFn(arkode_mem, ProcessStage)); + return (ARKodeSetPostprocessStageFn(arkode_mem, ProcessStage)); } /*--------------------------------------------------------------- @@ -94,54 +236,54 @@ int MRIStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage ---------------------------------------------------------------*/ int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) { - return (arkLSSetLinearSolver(arkode_mem, LS, A)); + return (ARKodeSetLinearSolver(arkode_mem, LS, A)); } int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac) { - return (arkLSSetJacFn(arkode_mem, jac)); + return (ARKodeSetJacFn(arkode_mem, jac)); } int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj) { - return (arkLSSetJacEvalFrequency(arkode_mem, msbj)); + return (ARKodeSetJacEvalFrequency(arkode_mem, msbj)); } int MRIStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) { - return (arkLSSetLinearSolutionScaling(arkode_mem, onoff)); + return (ARKodeSetLinearSolutionScaling(arkode_mem, onoff)); } int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac) { - return (arkLSSetEpsLin(arkode_mem, eplifac)); + return (ARKodeSetEpsLin(arkode_mem, eplifac)); } int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) { - return (arkLSSetNormFactor(arkode_mem, nrmfac)); + return (ARKodeSetLSNormFactor(arkode_mem, nrmfac)); } int MRIStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, ARKLsPrecSolveFn psolve) { - return (arkLSSetPreconditioner(arkode_mem, psetup, psolve)); + return (ARKodeSetPreconditioner(arkode_mem, psetup, psolve)); } int MRIStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsJacTimesVecFn jtimes) { - return (arkLSSetJacTimes(arkode_mem, jtsetup, jtimes)); + return (ARKodeSetJacTimes(arkode_mem, jtsetup, jtimes)); } int MRIStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) { - return (arkLSSetJacTimesRhsFn(arkode_mem, jtimesRhsFn)); + return (ARKodeSetJacTimesRhsFn(arkode_mem, jtimesRhsFn)); } int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) { - return (arkLSSetLinSysFn(arkode_mem, linsys)); + return (ARKodeSetLinSysFn(arkode_mem, linsys)); } /*=============================================================== @@ -150,57 +292,107 @@ int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) ===============================================================*/ int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps) { - return (arkGetNumSteps(arkode_mem, nssteps)); + return (ARKodeGetNumSteps(arkode_mem, nssteps)); } int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast) { - return (arkGetLastStep(arkode_mem, hlast)); + return (ARKodeGetLastStep(arkode_mem, hlast)); } int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) { - return (arkGetCurrentTime(arkode_mem, tcur)); + return (ARKodeGetCurrentTime(arkode_mem, tcur)); } int MRIStepGetCurrentState(void* arkode_mem, N_Vector* state) { - return (arkGetCurrentState(arkode_mem, state)); + return (ARKodeGetCurrentState(arkode_mem, state)); +} + +int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +{ + return (ARKodeComputeState(arkode_mem, zcor, z)); } int MRIStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) { - return (arkGetTolScaleFactor(arkode_mem, tolsfact)); + return (ARKodeGetTolScaleFactor(arkode_mem, tolsfact)); } int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight) { - return (arkGetErrWeights(arkode_mem, eweight)); + return (ARKodeGetErrWeights(arkode_mem, eweight)); } int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals) { - return (arkGetNumGEvals(arkode_mem, ngevals)); + return (ARKodeGetNumGEvals(arkode_mem, ngevals)); } int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound) { - return (arkGetRootInfo(arkode_mem, rootsfound)); + return (ARKodeGetRootInfo(arkode_mem, rootsfound)); +} + +int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) +{ + return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, + gamma, sdata, user_data)); } int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails) { - return (arkGetNumStepSolveFails(arkode_mem, nncfails)); + return (ARKodeGetNumStepSolveFails(arkode_mem, nncfails)); } int MRIStepGetUserData(void* arkode_mem, void** user_data) { - return (arkGetUserData(arkode_mem, user_data)); + return (ARKodeGetUserData(arkode_mem, user_data)); } char* MRIStepGetReturnFlagName(long int flag) { - return (arkGetReturnFlagName(flag)); + return (ARKodeGetReturnFlagName(flag)); +} + +int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +{ + return (ARKodeGetCurrentGamma(arkode_mem, gamma)); +} + +int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +{ + return (ARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups)); +} + +int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +{ + return (ARKodeGetNumNonlinSolvIters(arkode_mem, nniters)); +} + +int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +{ + return (ARKodeGetNumNonlinSolvConvFails(arkode_mem, nnfails)); +} + +int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails) +{ + return (ARKodeGetNonlinSolvStats(arkode_mem, nniters, nnfails)); +} + +int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +{ + return (ARKodePrintAllStats(arkode_mem, outfile, fmt)); +} + +int MRIStepWriteParameters(void* arkode_mem, FILE* fp) +{ + return (ARKodeWriteParameters(arkode_mem, fp)); } /*--------------------------------------------------------------- @@ -209,85 +401,79 @@ char* MRIStepGetReturnFlagName(long int flag) ---------------------------------------------------------------*/ int MRIStepGetJac(void* arkode_mem, SUNMatrix* J) { - return arkLSGetJac(arkode_mem, J); + return (ARKodeGetJac(arkode_mem, J)); } int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J) { - return arkLSGetJacTime(arkode_mem, t_J); + return (ARKodeGetJacTime(arkode_mem, t_J)); } int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J) { - return arkLSGetJacNumSteps(arkode_mem, nst_J); + return (ARKodeGetJacNumSteps(arkode_mem, nst_J)); } int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS) { - return (arkLSGetWorkSpace(arkode_mem, lenrwLS, leniwLS)); + return (ARKodeGetLinWorkSpace(arkode_mem, lenrwLS, leniwLS)); } int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals) { - return (arkLSGetNumJacEvals(arkode_mem, njevals)); + return (ARKodeGetNumJacEvals(arkode_mem, njevals)); } int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals) { - return (arkLSGetNumPrecEvals(arkode_mem, npevals)); + return (ARKodeGetNumPrecEvals(arkode_mem, npevals)); } int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves) { - return (arkLSGetNumPrecSolves(arkode_mem, npsolves)); + return (ARKodeGetNumPrecSolves(arkode_mem, npsolves)); } int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters) { - return (arkLSGetNumLinIters(arkode_mem, nliters)); + return (ARKodeGetNumLinIters(arkode_mem, nliters)); } int MRIStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails) { - return (arkLSGetNumConvFails(arkode_mem, nlcfails)); + return (ARKodeGetNumLinConvFails(arkode_mem, nlcfails)); } int MRIStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) { - return (arkLSGetNumJTSetupEvals(arkode_mem, njtsetups)); + return (ARKodeGetNumJTSetupEvals(arkode_mem, njtsetups)); } int MRIStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals) { - return (arkLSGetNumJtimesEvals(arkode_mem, njvevals)); + return (ARKodeGetNumJtimesEvals(arkode_mem, njvevals)); } int MRIStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) { - return (arkLSGetNumRhsEvals(arkode_mem, nfevalsLS)); + return (ARKodeGetNumLinRhsEvals(arkode_mem, nfevalsLS)); } int MRIStepGetLastLinFlag(void* arkode_mem, long int* flag) { - return (arkLSGetLastFlag(arkode_mem, flag)); + return (ARKodeGetLastLinFlag(arkode_mem, flag)); } char* MRIStepGetLinReturnFlagName(long int flag) { - return (arkLSGetReturnFlagName(flag)); + return (ARKodeGetLinReturnFlagName(flag)); } /*=============================================================== MRIStep optional input functions -- stepper-specific ===============================================================*/ -/*--------------------------------------------------------------- - MRIStepSetUserData: - - Wrapper for generic arkSetUserData and arkLSSetUserData - routines. - ---------------------------------------------------------------*/ -int MRIStepSetUserData(void* arkode_mem, void* user_data) +int mriStep_SetUserData(void* arkode_mem, void* user_data) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -297,10 +483,6 @@ int MRIStepSetUserData(void* arkode_mem, void* user_data) retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* set user_data in ARKODE mem */ - retval = arkSetUserData(arkode_mem, user_data); - if (retval != ARK_SUCCESS) { return (retval); } - /* set user data in ARKODELS mem */ if (step_mem->lmem != NULL) { @@ -312,13 +494,13 @@ int MRIStepSetUserData(void* arkode_mem, void* user_data) } /*--------------------------------------------------------------- - MRIStepSetDefaults: + mriStep_SetDefaults: Resets all MRIStep optional inputs to their default values. Does not change problem-defining function pointers or user_data pointer. ---------------------------------------------------------------*/ -int MRIStepSetDefaults(void* arkode_mem) +int mriStep_SetDefaults(void* arkode_mem) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -348,14 +530,13 @@ int MRIStepSetDefaults(void* arkode_mem) step_mem->jcur = SUNFALSE; step_mem->convfail = ARK_NO_FAILURES; step_mem->stage_predict = NULL; /* no user-supplied stage predictor */ - return (ARK_SUCCESS); } /*--------------------------------------------------------------- - MRIStepSetLinear: + mriStep_SetLinear: - Specifies that the implicit slow function, fs(t,y), is linear + Specifies that the implicit slow function, fsi(t,y), is linear in y, and to tighten the linear solver tolerances while taking only one Newton iteration. DO NOT USE IN COMBINATION WITH THE FIXED-POINT SOLVER. Automatically tightens DeltaGammaMax @@ -367,7 +548,7 @@ int MRIStepSetDefaults(void* arkode_mem) using an iterative linear solver this flag denotes time dependence of the preconditioner. ---------------------------------------------------------------*/ -int MRIStepSetLinear(void* arkode_mem, int timedepend) +int mriStep_SetLinear(void* arkode_mem, int timedepend) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -386,14 +567,14 @@ int MRIStepSetLinear(void* arkode_mem, int timedepend) } /*--------------------------------------------------------------- - MRIStepSetNonlinear: + mriStep_SetNonlinear: - Specifies that the implicit slow function, fs(t,y), is + Specifies that the implicit slow function, fsi(t,y), is nonlinear in y. Used to undo a previous call to - MRIStepSetLinear. Automatically loosens DeltaGammaMax back to + mriStep_SetLinear. Automatically loosens DeltaGammaMax back to default value. ---------------------------------------------------------------*/ -int MRIStepSetNonlinear(void* arkode_mem) +int mriStep_SetNonlinear(void* arkode_mem) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -412,14 +593,11 @@ int MRIStepSetNonlinear(void* arkode_mem) } /*--------------------------------------------------------------- - MRIStepSetOrder: + mriStep_SetOrder: Specifies the method order - - NOTE: This should not be called along with MRIStepSetCoupling. - Any user-supplied coupling table will specify the order. ---------------------------------------------------------------*/ -int MRIStepSetOrder(void* arkode_mem, int ord) +int mriStep_SetOrder(void* arkode_mem, int ord) { int retval; ARKodeMem ark_mem; @@ -545,41 +723,13 @@ int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn) } /*--------------------------------------------------------------- - MRIStepSetFixedStep: - - Wrapper for generic arkSetFixedStep routine. Additionally - enforces current MRIStep constraint for fixed time-stepping. - ---------------------------------------------------------------*/ -int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed) -{ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - - if (hsfixed == ZERO) - { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "MRIStep does not support adaptive steps at this time."); - return (ARK_ILL_INPUT); - } - - /* call generic routine for remaining work */ - return (arkSetFixedStep(ark_mem, hsfixed)); -} - -/*--------------------------------------------------------------- - MRIStepSetNonlinCRDown: + mriStep_SetNonlinCRDown: Specifies the user-provided nonlinear convergence constant crdown. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +int mriStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -597,13 +747,13 @@ int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) } /*--------------------------------------------------------------- - MRIStepSetNonlinRDiv: + mriStep_SetNonlinRDiv: Specifies the user-provided nonlinear convergence constant rdiv. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +int mriStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -621,13 +771,13 @@ int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) } /*--------------------------------------------------------------- - MRIStepSetDeltaGammaMax: + mriStep_SetDeltaGammaMax: Specifies the user-provided linear setup decision constant dgmax. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +int mriStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -645,14 +795,14 @@ int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) } /*--------------------------------------------------------------- - MRIStepSetLSetupFrequency: + mriStep_SetLSetupFrequency: Specifies the user-provided linear setup decision constant msbp. Positive values give the frequency for calling lsetup; negative values imply recomputation of lsetup at each nonlinear solve; a zero value implies a reset to the default. ---------------------------------------------------------------*/ -int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp) +int mriStep_SetLSetupFrequency(void* arkode_mem, int msbp) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -670,13 +820,13 @@ int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp) } /*--------------------------------------------------------------- - MRIStepSetPredictorMethod: + mriStep_SetPredictorMethod: Specifies the method to use for predicting implicit solutions. Non-default choices are {1,2,3,4}, all others will use default (trivial) predictor. ---------------------------------------------------------------*/ -int MRIStepSetPredictorMethod(void* arkode_mem, int pred_method) +int mriStep_SetPredictorMethod(void* arkode_mem, int pred_method) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -693,13 +843,13 @@ int MRIStepSetPredictorMethod(void* arkode_mem, int pred_method) } /*--------------------------------------------------------------- - MRIStepSetMaxNonlinIters: + mriStep_SetMaxNonlinIters: Specifies the maximum number of nonlinear iterations during one solve. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) +int mriStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -734,12 +884,12 @@ int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) } /*--------------------------------------------------------------- - MRIStepSetNonlinConvCoef: + mriStep_SetNonlinConvCoef: Specifies the coefficient in the nonlinear solver convergence test. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +int mriStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -757,11 +907,11 @@ int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) } /*--------------------------------------------------------------- - MRIStepSetStagePredictFn: Specifies a user-provided step + mriStep_SetStagePredictFn: Specifies a user-provided step predictor function having type ARKStagePredictFn. A NULL input function disables calls to this routine. ---------------------------------------------------------------*/ -int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +int mriStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -776,7 +926,7 @@ int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) } /*--------------------------------------------------------------- - MRIStepSetDeduceImplicitRhs: + mriStep_SetDeduceImplicitRhs: Specifies if an optimization is used to avoid an evaluation of fi after a nonlinear solve for an implicit stage. If stage @@ -787,7 +937,7 @@ int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) fi(z_i), and SUNFALSE indicates that fi(z_i) is computed with an additional evaluation of fi. ---------------------------------------------------------------*/ -int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +int mriStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -805,27 +955,6 @@ int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) MRIStep optional output functions -- stepper-specific ===============================================================*/ -int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) -{ - ARKodeMem ark_mem; - ARKodeMRIStepMem step_mem; - int retval; - - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - /* Get ARKODE workspace */ - retval = arkGetWorkSpace(arkode_mem, lenrw, leniw); - if (retval) { return retval; } - - /* Get the inner stepper workspace */ - *lenrw += step_mem->stepper->lrw; - *leniw += step_mem->stepper->liw; - - return (ARK_SUCCESS); -} - /*--------------------------------------------------------------- MRIStepGetLastInnerStepFlag: @@ -848,9 +977,9 @@ int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag) } /*--------------------------------------------------------------- - MRIStepGetCurrentGamma: Returns the current value of gamma + mriStep_GetCurrentGamma: Returns the current value of gamma ---------------------------------------------------------------*/ -int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +int mriStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma) { int retval; ARKodeMem ark_mem; @@ -885,11 +1014,11 @@ int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, } /*--------------------------------------------------------------- - MRIStepGetNumLinSolvSetups: + mriStep_GetNumLinSolvSetups: Returns the current number of calls to the lsetup routine ---------------------------------------------------------------*/ -int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +int mriStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -906,11 +1035,11 @@ int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) } /*--------------------------------------------------------------- - MRIStepGetNumNonlinSolvIters: + mriStep_GetNumNonlinSolvIters: Returns the current number of nonlinear solver iterations ---------------------------------------------------------------*/ -int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +int mriStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -926,11 +1055,11 @@ int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } /*--------------------------------------------------------------- - MRIStepGetNumNonlinSolvConvFails: + mriStep_GetNumNonlinSolvConvFails: Returns the current number of nonlinear solver convergence fails ---------------------------------------------------------------*/ -int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +int mriStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -947,12 +1076,12 @@ int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } /*--------------------------------------------------------------- - MRIStepGetNonlinSolvStats: + mriStep_GetNonlinSolvStats: Returns nonlinear solver statistics ---------------------------------------------------------------*/ -int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails) +int mriStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -990,11 +1119,11 @@ int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling* MRIC) } /*--------------------------------------------------------------- - MRIStepPrintAllStats: + mriStep_PrintAllStats: Prints integrator statistics ---------------------------------------------------------------*/ -int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -1005,10 +1134,6 @@ int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* step and rootfinding stats */ - retval = arkPrintAllStats(arkode_mem, outfile, fmt); - if (retval != ARK_SUCCESS) { return (retval); } - switch (fmt) { case SUN_OUTPUTFORMAT_TABLE: @@ -1113,11 +1238,11 @@ int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) ===============================================================*/ /*--------------------------------------------------------------- - MRIStepWriteParameters: + mriStep_WriteParameters: Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int MRIStepWriteParameters(void* arkode_mem, FILE* fp) +int mriStep_WriteParameters(void* arkode_mem, FILE* fp) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -1127,14 +1252,39 @@ int MRIStepWriteParameters(void* arkode_mem, FILE* fp) retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* output ARKODE infrastructure parameters first */ - retval = arkWriteParameters(arkode_mem, fp); - if (retval != ARK_SUCCESS) + /* print integrator parameters to file */ + fprintf(fp, "MRIStep time step module parameters:\n"); + fprintf(fp, " Method order %i\n", step_mem->q); + if (step_mem->linear) { - arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error writing ARKODE infrastructure parameters"); - return (retval); + fprintf(fp, " Linear implicit problem"); + if (step_mem->linear_timedep) + { + fprintf(fp, " (time-dependent Jacobian)\n"); + } + else { fprintf(fp, " (time-independent Jacobian)\n"); } + } + if (step_mem->explicit_rhs && step_mem->implicit_rhs) + { + fprintf(fp, " ImEx slow time scale\n"); + } + else if (step_mem->implicit_rhs) { fprintf(fp, " Implicit slow time scale\n"); } + else { fprintf(fp, " Explicit slow time scale\n"); } + + if (step_mem->implicit_rhs) + { + fprintf(fp, " Implicit predictor method = %i\n", step_mem->predictor); + fprintf(fp, " Implicit solver tolerance coefficient = %" RSYM "\n", + step_mem->nlscoef); + fprintf(fp, " Maximum number of nonlinear corrections = %i\n", + step_mem->maxcor); + fprintf(fp, " Nonlinear convergence rate constant = %" RSYM "\n", + step_mem->crdown); + fprintf(fp, " Nonlinear divergence tolerance = %" RSYM "\n", step_mem->rdiv); + fprintf(fp, " Gamma factor LSetup tolerance = %" RSYM "\n", step_mem->dgmax); + fprintf(fp, " Number of steps between LSetup calls = %i\n", step_mem->msbp); } + fprintf(fp, "\n"); return (ARK_SUCCESS); } diff --git a/src/arkode/arkode_mristep_nls.c b/src/arkode/arkode_mristep_nls.c index a48ae86d56..a309894170 100644 --- a/src/arkode/arkode_mristep_nls.c +++ b/src/arkode/arkode_mristep_nls.c @@ -28,12 +28,12 @@ ===============================================================*/ /*--------------------------------------------------------------- - MRIStepSetNonlinearSolver: + mriStep_SetNonlinearSolver: This routine attaches a SUNNonlinearSolver object to the MRIStep module. ---------------------------------------------------------------*/ -int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -129,13 +129,13 @@ int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) } /*--------------------------------------------------------------- - MRIStepSetNlsRhsFn: + mriStep_SetNlsRhsFn: This routine sets an alternative user-supplied slow ODE right-hand side function to use in the evaluation of nonlinear system functions. ---------------------------------------------------------------*/ -int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) +int mriStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; @@ -152,15 +152,15 @@ int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) } /*--------------------------------------------------------------- - MRIStepGetNonlinearSystemData: + mriStep_GetNonlinearSystemData: This routine provides access to the relevant data needed to compute the nonlinear system function. ---------------------------------------------------------------*/ -int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, N_Vector* F, - sunrealtype* gamma, N_Vector* sdata, - void** user_data) +int mriStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* F, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) { ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index f9de44e45c..29cb246340 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -415,7 +415,31 @@ int arkRelaxSolve(ARKodeMem ark_mem, ARKodeRelaxMem relax_mem, * Set functions * ---------------------------------------------------------------------------*/ -int arkRelaxSetEtaFail(void* arkode_mem, sunrealtype eta_fail) +int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + /* Call stepper-specific routine (if it exists) */ + if (ark_mem->step_setrelaxfn) + { + return ark_mem->step_setrelaxfn(arkode_mem, rfn, rjac); + } + else + { + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_STEPPER_UNSUPPORTED); + } +} + +int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_fail) { int retval; ARKodeMem ark_mem; @@ -424,13 +448,21 @@ int arkRelaxSetEtaFail(void* arkode_mem, sunrealtype eta_fail) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (eta_fail > ZERO && eta_fail < ONE) { relax_mem->eta_fail = eta_fail; } else { relax_mem->eta_fail = ARK_RELAX_DEFAULT_ETA_FAIL; } return ARK_SUCCESS; } -int arkRelaxSetLowerBound(void* arkode_mem, sunrealtype lower) +int ARKodeSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) { int retval; ARKodeMem ark_mem; @@ -439,13 +471,21 @@ int arkRelaxSetLowerBound(void* arkode_mem, sunrealtype lower) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (lower > ZERO && lower < ONE) { relax_mem->lower_bound = lower; } else { relax_mem->lower_bound = ARK_RELAX_DEFAULT_LOWER_BOUND; } return ARK_SUCCESS; } -int arkRelaxSetMaxFails(void* arkode_mem, int max_fails) +int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails) { int retval; ARKodeMem ark_mem; @@ -454,13 +494,21 @@ int arkRelaxSetMaxFails(void* arkode_mem, int max_fails) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (max_fails > 0) { relax_mem->max_fails = max_fails; } else { relax_mem->max_fails = ARK_RELAX_DEFAULT_MAX_FAILS; } return ARK_SUCCESS; } -int arkRelaxSetMaxIters(void* arkode_mem, int max_iters) +int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters) { int retval; ARKodeMem ark_mem; @@ -469,13 +517,21 @@ int arkRelaxSetMaxIters(void* arkode_mem, int max_iters) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (max_iters > 0) { relax_mem->max_iters = max_iters; } else { relax_mem->max_iters = ARK_RELAX_DEFAULT_MAX_ITERS; } return ARK_SUCCESS; } -int arkRelaxSetSolver(void* arkode_mem, ARKRelaxSolver solver) +int ARKodeSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) { int retval; ARKodeMem ark_mem; @@ -484,6 +540,14 @@ int arkRelaxSetSolver(void* arkode_mem, ARKRelaxSolver solver) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (solver != ARK_RELAX_BRENT && solver != ARK_RELAX_NEWTON) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -496,7 +560,7 @@ int arkRelaxSetSolver(void* arkode_mem, ARKRelaxSolver solver) return ARK_SUCCESS; } -int arkRelaxSetResTol(void* arkode_mem, sunrealtype res_tol) +int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) { int retval; ARKodeMem ark_mem; @@ -505,13 +569,21 @@ int arkRelaxSetResTol(void* arkode_mem, sunrealtype res_tol) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (res_tol > ZERO) { relax_mem->res_tol = res_tol; } else { relax_mem->res_tol = ARK_RELAX_DEFAULT_RES_TOL; } return ARK_SUCCESS; } -int arkRelaxSetTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) +int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) { int retval; ARKodeMem ark_mem; @@ -520,6 +592,14 @@ int arkRelaxSetTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (rel_tol > ZERO) { relax_mem->rel_tol = rel_tol; } else { relax_mem->rel_tol = ARK_RELAX_DEFAULT_REL_TOL; } @@ -529,7 +609,7 @@ int arkRelaxSetTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) return ARK_SUCCESS; } -int arkRelaxSetUpperBound(void* arkode_mem, sunrealtype upper) +int ARKodeSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) { int retval; ARKodeMem ark_mem; @@ -538,6 +618,14 @@ int arkRelaxSetUpperBound(void* arkode_mem, sunrealtype upper) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + if (upper > ONE) { relax_mem->upper_bound = upper; } else { relax_mem->upper_bound = ARK_RELAX_DEFAULT_UPPER_BOUND; } @@ -548,7 +636,7 @@ int arkRelaxSetUpperBound(void* arkode_mem, sunrealtype upper) * Get functions * ---------------------------------------------------------------------------*/ -int arkRelaxGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) +int ARKodeGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) { int retval; ARKodeMem ark_mem; @@ -557,12 +645,20 @@ int arkRelaxGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *r_evals = relax_mem->num_relax_fn_evals; return ARK_SUCCESS; } -int arkRelaxGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) +int ARKodeGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) { int retval; ARKodeMem ark_mem; @@ -571,12 +667,20 @@ int arkRelaxGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *J_evals = relax_mem->num_relax_jac_evals; return ARK_SUCCESS; } -int arkRelaxGetNumRelaxFails(void* arkode_mem, long int* relax_fails) +int ARKodeGetNumRelaxFails(void* arkode_mem, long int* relax_fails) { int retval; ARKodeMem ark_mem; @@ -585,12 +689,20 @@ int arkRelaxGetNumRelaxFails(void* arkode_mem, long int* relax_fails) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *relax_fails = relax_mem->num_fails; return ARK_SUCCESS; } -int arkRelaxGetNumRelaxSolveFails(void* arkode_mem, long int* fails) +int ARKodeGetNumRelaxSolveFails(void* arkode_mem, long int* fails) { int retval; ARKodeMem ark_mem; @@ -599,12 +711,20 @@ int arkRelaxGetNumRelaxSolveFails(void* arkode_mem, long int* fails) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *fails = relax_mem->nls_fails; return ARK_SUCCESS; } -int arkRelaxGetNumRelaxBoundFails(void* arkode_mem, long int* fails) +int ARKodeGetNumRelaxBoundFails(void* arkode_mem, long int* fails) { int retval; ARKodeMem ark_mem; @@ -613,12 +733,20 @@ int arkRelaxGetNumRelaxBoundFails(void* arkode_mem, long int* fails) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *fails = relax_mem->bound_fails; return ARK_SUCCESS; } -int arkRelaxGetNumRelaxSolveIters(void* arkode_mem, long int* iters) +int ARKodeGetNumRelaxSolveIters(void* arkode_mem, long int* iters) { int retval; ARKodeMem ark_mem; @@ -627,6 +755,14 @@ int arkRelaxGetNumRelaxSolveIters(void* arkode_mem, long int* iters) retval = arkRelaxAccessMem(arkode_mem, __func__, &ark_mem, &relax_mem); if (retval) { return retval; } + /* Guard against use for time steppers that do not allow relaxation */ + if (!ark_mem->step_supports_relaxation) + { + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "time-stepping module does not support relaxation"); + return (ARK_ILL_INPUT); + } + *iters = relax_mem->nls_iters; return ARK_SUCCESS; diff --git a/src/arkode/arkode_relaxation_impl.h b/src/arkode/arkode_relaxation_impl.h index c52cb2521c..cc116193ff 100644 --- a/src/arkode/arkode_relaxation_impl.h +++ b/src/arkode/arkode_relaxation_impl.h @@ -107,22 +107,6 @@ int arkRelax(ARKodeMem ark_mem, int* relax_fails, sunrealtype* dsm_inout, int* nflag_out); /* User Functions */ -int arkRelaxSetEtaFail(void* arkode_mem, sunrealtype eta_fail); -int arkRelaxSetLowerBound(void* arkode_mem, sunrealtype lower); -int arkRelaxSetMaxFails(void* arkode_mem, int max_fails); -int arkRelaxSetMaxIters(void* arkode_mem, int max_iters); -int arkRelaxSetSolver(void* arkode_mem, ARKRelaxSolver solver); -int arkRelaxSetResTol(void* arkode_mem, sunrealtype res_tol); -int arkRelaxSetTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol); -int arkRelaxSetUpperBound(void* arkode_mem, sunrealtype upper); - -int arkRelaxGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); -int arkRelaxGetNumRelaxJacEvals(void* arkode_mem, long int* j_evals); -int arkRelaxGetNumRelaxFails(void* arkode_mem, long int* relax_fails); -int arkRelaxGetNumRelaxBoundFails(void* arkode_mem, long int* fails); -int arkRelaxGetNumRelaxSolveFails(void* arkode_mem, long int* fails); -int arkRelaxGetNumRelaxSolveIters(void* arkode_mem, long int* iters); - int arkRelaxPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); /* ----------------------------------------------------------------------------- diff --git a/src/arkode/arkode_root.c b/src/arkode/arkode_root.c index a0e02df7e7..f60334c658 100644 --- a/src/arkode/arkode_root.c +++ b/src/arkode/arkode_root.c @@ -25,26 +25,28 @@ #include "arkode_impl.h" /*--------------------------------------------------------------- - arkRootInit: + ARKodeRootInit: - arkRootInit initializes a rootfinding problem to be solved + ARKodeRootInit initializes a rootfinding problem to be solved during the integration of the ODE system. It loads the root function pointer and the number of root functions, notifies ARKODE that the "fullrhs" function is required, and allocates workspace memory. The return value is ARK_SUCCESS = 0 if no errors occurred, or a negative value otherwise. ---------------------------------------------------------------*/ -int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) +int ARKodeRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) { int i, nrt; - /* Check ark_mem pointer */ - if (ark_mem == NULL) + /* unpack ark_mem */ + ARKodeMem ark_mem; + if (arkode_mem == NULL) { arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, MSG_ARK_NO_MEM); return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; nrt = (nrtfn < 0) ? 0 : nrtfn; /* Ensure that stepper provides fullrhs function */ @@ -91,7 +93,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->liw += ARK_ROOT_LIW; } - /* If rerunning arkRootInit() with a different number of root + /* If rerunning ARKodeRootInit() with a different number of root functions (changing number of gfun components), then free currently held memory resources */ if ((nrt != ark_mem->root_mem->nrtfn) && (ark_mem->root_mem->nrtfn > 0)) @@ -113,7 +115,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) ark_mem->liw -= 3 * (ark_mem->root_mem->nrtfn); } - /* If arkRootInit() was called with nrtfn == 0, then set + /* If ARKodeRootInit() was called with nrtfn == 0, then set nrtfn to zero and gfun to NULL before returning */ if (nrt == 0) { @@ -122,7 +124,7 @@ int arkRootInit(ARKodeMem ark_mem, int nrtfn, ARKRootFn g) return (ARK_SUCCESS); } - /* If rerunning arkRootInit() with the same number of root + /* If rerunning ARKodeRootInit() with the same number of root functions (not changing number of gfun components), then check if the root function argument has changed */ /* If g != NULL then return as currently reserved memory @@ -499,7 +501,7 @@ int arkRootCheck2(void* arkode_mem) if (rootmem->irfnd == 0) { return (ARK_SUCCESS); } /* Set ark_ycur = y(tlo) */ - (void)arkGetDky(ark_mem, rootmem->tlo, 0, ark_mem->ycur); + (void)ARKodeGetDky(ark_mem, rootmem->tlo, 0, ark_mem->ycur); /* Evaluate root-finding function: glo = g(tlo, y(tlo)) */ retval = rootmem->gfun(rootmem->tlo, ark_mem->ycur, rootmem->glo, @@ -539,7 +541,7 @@ int arkRootCheck2(void* arkode_mem) else { /* set ark_ycur = y(tplus) via interpolation */ - (void)arkGetDky(ark_mem, tplus, 0, ark_mem->ycur); + (void)ARKodeGetDky(ark_mem, tplus, 0, ark_mem->ycur); } /* set ghi = g(tplus,y(tplus)) */ retval = rootmem->gfun(tplus, ark_mem->ycur, rootmem->ghi, rootmem->root_data); @@ -609,7 +611,7 @@ int arkRootCheck3(void* arkode_mem) else { rootmem->thi = rootmem->toutc; - (void)arkGetDky(ark_mem, rootmem->thi, 0, ark_mem->ycur); + (void)ARKodeGetDky(ark_mem, rootmem->thi, 0, ark_mem->ycur); } } @@ -637,7 +639,7 @@ int arkRootCheck3(void* arkode_mem) if (ier == ARK_SUCCESS) { return (ARK_SUCCESS); } /* If a root was found, interpolate to get y(trout) and return. */ - (void)arkGetDky(ark_mem, rootmem->trout, 0, ark_mem->ycur); + (void)ARKodeGetDky(ark_mem, rootmem->trout, 0, ark_mem->ycur); return (RTFOUND); } @@ -826,7 +828,7 @@ int arkRootfind(void* arkode_mem) tmid = rootmem->thi - fracsub * (rootmem->thi - rootmem->tlo); } - (void)arkGetDky(ark_mem, tmid, 0, ark_mem->ycur); + (void)ARKodeGetDky(ark_mem, tmid, 0, ark_mem->ycur); retval = rootmem->gfun(tmid, ark_mem->ycur, rootmem->grout, rootmem->root_data); rootmem->nge++; diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index 7ac45ee764..14c545323d 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -103,7 +103,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, /* Allocate vectors in stepper mem */ if (!arkAllocVec(ark_mem, y0, &(step_mem->sdata))) { - SPRKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -111,23 +111,29 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, { if (!arkAllocVec(ark_mem, y0, &(step_mem->yerr))) { - SPRKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } } else { step_mem->yerr = NULL; } - ark_mem->step_init = sprkStep_Init; + ark_mem->step_init = sprkStep_Init; ark_mem->step_fullrhs = sprkStep_FullRHS; - ark_mem->step = sprkStep_TakeStep; - ark_mem->step_mem = (void*)step_mem; - - /* Set default values for SPRKStep optional inputs */ - retval = SPRKStepSetDefaults((void*)ark_mem); + ark_mem->step = sprkStep_TakeStep; + ark_mem->step_printallstats = sprkStep_PrintAllStats; + ark_mem->step_writeparameters = sprkStep_WriteParameters; + ark_mem->step_resize = sprkStep_Resize; + ark_mem->step_free = sprkStep_Free; + ark_mem->step_setdefaults = sprkStep_SetDefaults; + ark_mem->step_setorder = sprkStep_SetOrder; + ark_mem->step_mem = (void*)step_mem; + + /* Set default values for optional inputs */ + retval = sprkStep_SetDefaults((void*)ark_mem); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Error setting default solver options"); - SPRKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } @@ -145,7 +151,7 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, /* SPRKStep uses Lagrange interpolation by default, since Hermite is less compatible with these methods. */ - arkSetInterpolantType(ark_mem, ARK_INTERP_LAGRANGE); + ARKodeSetInterpolantType(ark_mem, ARK_INTERP_LAGRANGE); /* Initialize main ARKODE infrastructure */ retval = arkInit(ark_mem, t0, y0, FIRST_INIT); @@ -153,13 +159,61 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, { arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, "Unable to initialize main ARKODE infrastructure"); - SPRKStepFree((void**)&ark_mem); + ARKodeFree((void**)&ark_mem); return (NULL); } return ((void*)ark_mem); } +/*--------------------------------------------------------------- + sprkStep_Resize: + + This routine resizes the memory within the SPRKStep module. + ---------------------------------------------------------------*/ +int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +{ + ARKodeMem ark_mem = NULL; + ARKodeSPRKStepMem step_mem = NULL; + sunindextype lrw1, liw1, lrw_diff, liw_diff; + int retval; + + /* access ARKodeSPRKStepMem structure */ + retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + if (retval != ARK_SUCCESS) { return (retval); } + + /* Determine change in vector sizes */ + lrw1 = liw1 = 0; + if (y0->ops->nvspace != NULL) { N_VSpace(y0, &lrw1, &liw1); } + lrw_diff = lrw1 - ark_mem->lrw1; + liw_diff = liw1 - ark_mem->liw1; + ark_mem->lrw1 = lrw1; + ark_mem->liw1 = liw1; + + /* Resize the local vectors */ + if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, + &step_mem->sdata)) + { + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + "Unable to resize vector"); + return (ARK_MEM_FAIL); + } + + if (step_mem->yerr) + { + if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, + &step_mem->yerr)) + { + arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, + "Unable to resize vector"); + return (ARK_MEM_FAIL); + } + } + + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- SPRKStepReInit: @@ -231,13 +285,13 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, } /*--------------------------------------------------------------- - SPRKStepReset: + sprkStep_Reset: This routine resets the SPRKStep module state to solve the same problem from the given time with the input state (all counter values are retained). ---------------------------------------------------------------*/ -int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; @@ -247,76 +301,14 @@ int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Initialize main ARKODE infrastructure */ - retval = arkInit(ark_mem, tR, yR, RESET_INIT); - - if (retval != ARK_SUCCESS) - { - arkProcessError(ark_mem, retval, __LINE__, __func__, __FILE__, - "Unable to initialize main ARKODE infrastructure"); - return (retval); - } - N_VConst(SUN_RCONST(0.0), step_mem->yerr); - return (ARK_SUCCESS); } /*--------------------------------------------------------------- - SPRKStepEvolve: - - This is the main time-integration driver (wrappers for general - ARKODE utility routine) - ---------------------------------------------------------------*/ -int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask) -{ - /* unpack ark_mem, call arkEvolve, and return */ - ARKodeMem ark_mem = NULL; - int retval = 0; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkEvolve(ark_mem, tout, yout, tret, itask); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - SPRKStepGetDky: - - This returns interpolated output of the solution or its - derivatives over the most-recently-computed step (wrapper for - generic ARKODE utility routine) - ---------------------------------------------------------------*/ -int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) -{ - /* unpack ark_mem, call arkGetDky, and return */ - ARKodeMem ark_mem = NULL; - int retval = 0; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - SUNDIALS_MARK_FUNCTION_BEGIN(ARK_PROFILER); - retval = arkGetDky(ark_mem, t, k, dky); - SUNDIALS_MARK_FUNCTION_END(ARK_PROFILER); - return (retval); -} - -/*--------------------------------------------------------------- - SPRKStepFree frees all SPRKStep memory, and then calls an ARKODE - utility routine to free the ARKODE infrastructure memory. + sprkStep_Free frees all SPRKStep memory. ---------------------------------------------------------------*/ -void SPRKStepFree(void** arkode_mem) +void sprkStep_Free(void** arkode_mem) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; @@ -347,9 +339,6 @@ void SPRKStepFree(void** arkode_mem) free(ark_mem->step_mem); ark_mem->step_mem = NULL; } - - /* free memory for overall ARKODE infrastructure */ - arkFree(arkode_mem); } /*=============================================================== @@ -458,20 +447,6 @@ int sprkStep_Init(void* arkode_mem, int init_type) return (ARK_SUCCESS); } -int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) -{ - /* unpack ark_mem, call arkRootInit, and return */ - ARKodeMem ark_mem = NULL; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - return (arkRootInit(ark_mem, nrtfn, g)); -} - /* Utility to call f1 and increment the counter */ inline int sprkStep_f1(ARKodeSPRKStepMem step_mem, sunrealtype tcur, N_Vector ycur, N_Vector f1, void* user_data) diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 720e9732ee..7f536b74f2 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -72,6 +72,16 @@ int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); +int sprkStep_SetUserData(void* arkode_mem, void* user_data); +int sprkStep_SetDefaults(void* arkode_mem); +int sprkStep_SetOrder(void* arkode_mem, int ord); +int sprkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +int sprkStep_WriteParameters(void* arkode_mem, FILE* fp); +int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); +int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +void sprkStep_Free(void** arkode_mem); +void sprkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index d26c5410eb..042e3a9f32 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -32,55 +32,102 @@ SPRKStep Optional input functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. ===============================================================*/ +int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) +{ + return (ARKodeReset(arkode_mem, tR, yR)); +} + +int SPRKStepResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data) +{ + return (ARKodeResize(arkode_mem, y0, hscale, t0, resize, resize_data)); +} + +int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask) +{ + return (ARKodeEvolve(arkode_mem, tout, yout, tret, itask)); +} + +int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) +{ + return (ARKodeGetDky(arkode_mem, t, k, dky)); +} + +void SPRKStepFree(void** arkode_mem) +{ + ARKodeFree(arkode_mem); +} + +void SPRKStepPrintMem(void* arkode_mem, FILE* outfile) +{ + ARKodePrintMem(arkode_mem, outfile); +} + +int SPRKStepSetUserData(void* arkode_mem, void* user_data) +{ + return (ARKodeSetUserData(arkode_mem, user_data)); +} + +int SPRKStepSetDefaults(void* arkode_mem) +{ + return (ARKodeSetDefaults(arkode_mem)); +} + +int SPRKStepSetOrder(void* arkode_mem, int ord) +{ + return (ARKodeSetOrder(arkode_mem, ord)); +} + int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree) { if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } - return (arkSetInterpolantDegree(arkode_mem, degree)); + return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } int SPRKStepSetInterpolantType(void* arkode_mem, int itype) { - return (arkSetInterpolantType(arkode_mem, itype)); + return (ARKodeSetInterpolantType(arkode_mem, itype)); } int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) { - return (arkSetMaxNumSteps(arkode_mem, mxsteps)); + return (ARKodeSetMaxNumSteps(arkode_mem, mxsteps)); } int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop) { - return (arkSetStopTime(arkode_mem, tstop)); + return (ARKodeSetStopTime(arkode_mem, tstop)); } int SPRKStepSetRootDirection(void* arkode_mem, int* rootdir) { - return (arkSetRootDirection(arkode_mem, rootdir)); + return (ARKodeSetRootDirection(arkode_mem, rootdir)); } int SPRKStepSetNoInactiveRootWarn(void* arkode_mem) { - return (arkSetNoInactiveRootWarn(arkode_mem)); + return (ARKodeSetNoInactiveRootWarn(arkode_mem)); } int SPRKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) { - return (arkSetMaxNumConstrFails(arkode_mem, maxfails)); + return (ARKodeSetMaxNumConstrFails(arkode_mem, maxfails)); } int SPRKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep) { - return (arkSetPostprocessStepFn(arkode_mem, ProcessStep)); + return (ARKodeSetPostprocessStepFn(arkode_mem, ProcessStep)); } int SPRKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage) { - return (arkSetPostprocessStageFn(arkode_mem, ProcessStage)); + return (ARKodeSetPostprocessStageFn(arkode_mem, ProcessStage)); } int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) { - return (arkSetFixedStep(arkode_mem, hfixed)); + return (ARKodeSetFixedStep(arkode_mem, hfixed)); } /*=============================================================== @@ -89,78 +136,82 @@ int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) ===============================================================*/ int SPRKStepGetNumStepAttempts(void* arkode_mem, long int* nstep_attempts) { - return (arkGetNumStepAttempts(arkode_mem, nstep_attempts)); + return (ARKodeGetNumStepAttempts(arkode_mem, nstep_attempts)); } int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps) { - return (arkGetNumSteps(arkode_mem, nsteps)); + return (ARKodeGetNumSteps(arkode_mem, nsteps)); } int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) { - return (arkGetLastStep(arkode_mem, hlast)); + return (ARKodeGetLastStep(arkode_mem, hlast)); } int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) { - return (arkGetCurrentStep(arkode_mem, hcur)); + return (ARKodeGetCurrentStep(arkode_mem, hcur)); } int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) { - return (arkGetCurrentTime(arkode_mem, tcur)); + return (ARKodeGetCurrentTime(arkode_mem, tcur)); } int SPRKStepGetCurrentState(void* arkode_mem, N_Vector* state) { - return (arkGetCurrentState(arkode_mem, state)); + return (ARKodeGetCurrentState(arkode_mem, state)); +} + +int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) +{ + return (ARKodeRootInit(arkode_mem, nrtfn, g)); } int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound) { - return (arkGetRootInfo(arkode_mem, rootsfound)); + return (ARKodeGetRootInfo(arkode_mem, rootsfound)); } int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) { - return (arkGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); + return (ARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); } int SPRKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails) { - return (arkGetNumConstrFails(arkode_mem, nconstrfails)); + return (ARKodeGetNumConstrFails(arkode_mem, nconstrfails)); } int SPRKStepGetUserData(void* arkode_mem, void** user_data) { - return (arkGetUserData(arkode_mem, user_data)); + return (ARKodeGetUserData(arkode_mem, user_data)); } char* SPRKStepGetReturnFlagName(long int flag) { - return (arkGetReturnFlagName(flag)); + return (ARKodeGetReturnFlagName(flag)); } -/*=============================================================== - SPRKStep optional input functions -- stepper-specific - ===============================================================*/ - -/*--------------------------------------------------------------- - SPRKStepSetUserData: +int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +{ + return (ARKodePrintAllStats(arkode_mem, outfile, fmt)); +} - Wrapper for generic arkSetUserData and arkLSSetUserData - routines. - ---------------------------------------------------------------*/ -int SPRKStepSetUserData(void* arkode_mem, void* user_data) +int SPRKStepWriteParameters(void* arkode_mem, FILE* fp) { - return (arkSetUserData(arkode_mem, user_data)); + return (ARKodeWriteParameters(arkode_mem, fp)); } +/*=============================================================== + SPRKStep optional input functions -- stepper-specific + ===============================================================*/ + /*--------------------------------------------------------------- - SPRKStepSetDefaults: + sprkStep_SetDefaults: Resets all SPRKStep optional inputs to their default values. Does not change problem-defining function pointers or @@ -168,7 +219,7 @@ int SPRKStepSetUserData(void* arkode_mem, void* user_data) structures/options related to the ARKODE infrastructure itself (e.g., root-finding and post-process step). ---------------------------------------------------------------*/ -int SPRKStepSetDefaults(void* arkode_mem) +int sprkStep_SetDefaults(void* arkode_mem) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; @@ -178,17 +229,8 @@ int SPRKStepSetDefaults(void* arkode_mem) retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* Set default ARKODE infrastructure parameters */ - retval = arkSetDefaults(ark_mem); - if (retval != ARK_SUCCESS) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error setting ARKODE infrastructure defaults"); - return (retval); - } - /* use the default method order */ - SPRKStepSetOrder(arkode_mem, 0); + sprkStep_SetOrder(arkode_mem, 0); return (ARK_SUCCESS); } @@ -210,7 +252,7 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) if (onoff) { - arkSetUseCompensatedSums(arkode_mem, SUNTRUE); + retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNTRUE); ark_mem->step = sprkStep_TakeStep_Compensated; if (!step_mem->yerr) { @@ -222,11 +264,11 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) } else { - arkSetUseCompensatedSums(arkode_mem, SUNFALSE); + retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNFALSE); ark_mem->step = sprkStep_TakeStep; } - return (ARK_SUCCESS); + return (retval); } /*--------------------------------------------------------------- @@ -235,7 +277,7 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) Specifies the SPRK method ** Note in documentation that this should not be called along - with SPRKStepSetOrder. ** + with ARKodeSetOrder. ** ---------------------------------------------------------------*/ int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage) { @@ -285,14 +327,11 @@ int SPRKStepSetMethodName(void* arkode_mem, const char* method) } /*--------------------------------------------------------------- - SPRKStepSetOrder: + sprkStep_SetOrder: Specifies the method order - - ** Note in documentation that this should not be called along - with SPRKStepSetMethod. ** ---------------------------------------------------------------*/ -int SPRKStepSetOrder(void* arkode_mem, int ord) +int sprkStep_SetOrder(void* arkode_mem, int ord) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; @@ -364,11 +403,11 @@ int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage) } /*--------------------------------------------------------------- - SPRKStepPrintAllStats: + sprkStep_PrintAllStats: Prints integrator statistics ---------------------------------------------------------------*/ -int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int sprkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; @@ -378,10 +417,6 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* step and rootfinding stats */ - retval = arkPrintAllStats(arkode_mem, outfile, fmt); - if (retval != ARK_SUCCESS) { return (retval); } - switch (fmt) { case SUN_OUTPUTFORMAT_TABLE: @@ -408,30 +443,20 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) ===============================================================*/ /*--------------------------------------------------------------- - SPRKStepWriteParameters: + sprkStep_WriteParameters: Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int SPRKStepWriteParameters(void* arkode_mem, FILE* fp) +int sprkStep_WriteParameters(void* arkode_mem, FILE* fp) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; - int flag = 0; int retval = 0; /* access ARKodeSPRKStepMem structure */ retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - /* output ARKODE infrastructure parameters first */ - flag = arkWriteParameters(ark_mem, fp); - if (flag != ARK_SUCCESS) - { - arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - "Error writing ARKODE infrastructure parameters"); - return (flag); - } - /* print integrator parameters to file */ fprintf(fp, "SPRKStep time step module parameters:\n"); fprintf(fp, " Method order %i\n", step_mem->method->q); diff --git a/src/arkode/fmod/farkode_mod.c b/src/arkode/fmod/farkode_mod.c index a66b1b0dcd..cf1dda27b9 100644 --- a/src/arkode/fmod/farkode_mod.c +++ b/src/arkode/fmod/farkode_mod.c @@ -242,6 +242,34 @@ enum { #include "arkode/arkode_ls.h" +#include +#ifdef _MSC_VER +# ifndef strtoull +# define strtoull _strtoui64 +# endif +# ifndef strtoll +# define strtoll _strtoi64 +# endif +#endif + + +typedef struct { + void* data; + size_t size; +} SwigArrayWrapper; + + +SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { + SwigArrayWrapper result; + result.data = NULL; + result.size = 0; + return result; +} + + +#include + + typedef struct { void* cptr; int cmemflags; @@ -256,65 +284,1973 @@ SWIGINTERN SwigClassWrapper SwigClassWrapper_uninitialized() { } -#include -#ifdef _MSC_VER -# ifndef strtoull -# define strtoull _strtoui64 -# endif -# ifndef strtoll -# define strtoll _strtoi64 -# endif -#endif - - -#include +SWIGINTERN void SWIG_assign(SwigClassWrapper* self, SwigClassWrapper other) { + if (self->cptr == NULL) { + /* LHS is unassigned */ + if (other.cmemflags & SWIG_MEM_RVALUE) { + /* Capture pointer from RHS, clear 'moving' flag */ + self->cptr = other.cptr; + self->cmemflags = other.cmemflags & (~SWIG_MEM_RVALUE); + } else { + /* Become a reference to the other object */ + self->cptr = other.cptr; + self->cmemflags = other.cmemflags & (~SWIG_MEM_OWN); + } + } else if (other.cptr == NULL) { + /* Replace LHS with a null pointer */ + free(self->cptr); + *self = SwigClassWrapper_uninitialized(); + } else { + if (self->cmemflags & SWIG_MEM_OWN) { + free(self->cptr); + } + self->cptr = other.cptr; + if (other.cmemflags & SWIG_MEM_RVALUE) { + /* Capture RHS */ + self->cmemflags = other.cmemflags & ~SWIG_MEM_RVALUE; + } else { + /* Point to RHS */ + self->cmemflags = other.cmemflags & ~SWIG_MEM_OWN; + } + } +} + +SWIGEXPORT int _wrap_FARKodeResize(void *farg1, N_Vector farg2, double const *farg3, double const *farg4, ARKVecResizeFn farg5, void *farg6) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + sunrealtype arg3 ; + sunrealtype arg4 ; + ARKVecResizeFn arg5 = (ARKVecResizeFn) 0 ; + void *arg6 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + arg3 = (sunrealtype)(*farg3); + arg4 = (sunrealtype)(*farg4); + arg5 = (ARKVecResizeFn)(farg5); + arg6 = (void *)(farg6); + result = (int)ARKodeResize(arg1,arg2,arg3,arg4,arg5,arg6); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeReset(void *farg1, double const *farg2, N_Vector farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + N_Vector arg3 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (N_Vector)(farg3); + result = (int)ARKodeReset(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSStolerances(void *farg1, double const *farg2, double const *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + sunrealtype arg3 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (sunrealtype)(*farg3); + result = (int)ARKodeSStolerances(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSVtolerances(void *farg1, double const *farg2, N_Vector farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + N_Vector arg3 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (N_Vector)(farg3); + result = (int)ARKodeSVtolerances(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeWFtolerances(void *farg1, ARKEwtFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKEwtFn arg2 = (ARKEwtFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKEwtFn)(farg2); + result = (int)ARKodeWFtolerances(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeResStolerance(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeResStolerance(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeResVtolerance(void *farg1, N_Vector farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + result = (int)ARKodeResVtolerance(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeResFtolerance(void *farg1, ARKRwtFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRwtFn arg2 = (ARKRwtFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRwtFn)(farg2); + result = (int)ARKodeResFtolerance(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeRootInit(void *farg1, int const *farg2, ARKRootFn farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + ARKRootFn arg3 = (ARKRootFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + arg3 = (ARKRootFn)(farg3); + result = (int)ARKodeRootInit(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRootDirection(void *farg1, int *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int *arg2 = (int *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int *)(farg2); + result = (int)ARKodeSetRootDirection(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNoInactiveRootWarn(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)ARKodeSetNoInactiveRootWarn(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetDefaults(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)ARKodeSetDefaults(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetOrder(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetOrder(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetInterpolantType(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetInterpolantType(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetInterpolantDegree(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetInterpolantDegree(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetDenseOrder(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetDenseOrder(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNonlinearSolver(void *farg1, SUNNonlinearSolver farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNNonlinearSolver arg2 = (SUNNonlinearSolver) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNNonlinearSolver)(farg2); + result = (int)ARKodeSetNonlinearSolver(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetLinear(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetLinear(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNonlinear(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)ARKodeSetNonlinear(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNlsRhsFn(void *farg1, ARKRhsFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRhsFn)(farg2); + result = (int)ARKodeSetNlsRhsFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetDeduceImplicitRhs(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetDeduceImplicitRhs(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetAdaptController(void *farg1, SUNAdaptController farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNAdaptController arg2 = (SUNAdaptController) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNAdaptController)(farg2); + result = (int)ARKodeSetAdaptController(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetAdaptivityAdjustment(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetAdaptivityAdjustment(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetCFLFraction(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetCFLFraction(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetErrorBias(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetErrorBias(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetSafetyFactor(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetSafetyFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxGrowth(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMaxGrowth(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMinReduction(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMinReduction(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetFixedStepBounds(void *farg1, double const *farg2, double const *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + sunrealtype arg3 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (sunrealtype)(*farg3); + result = (int)ARKodeSetFixedStepBounds(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxFirstGrowth(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMaxFirstGrowth(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxEFailGrowth(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMaxEFailGrowth(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetSmallNumEFails(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetSmallNumEFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxCFailGrowth(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMaxCFailGrowth(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNonlinCRDown(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetNonlinCRDown(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNonlinRDiv(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetNonlinRDiv(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetDeltaGammaMax(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetDeltaGammaMax(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetLSetupFrequency(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetLSetupFrequency(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetPredictorMethod(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetPredictorMethod(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetStabilityFn(void *farg1, ARKExpStabFn farg2, void *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKExpStabFn arg2 = (ARKExpStabFn) 0 ; + void *arg3 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKExpStabFn)(farg2); + arg3 = (void *)(farg3); + result = (int)ARKodeSetStabilityFn(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxErrTestFails(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetMaxErrTestFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxNonlinIters(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetMaxNonlinIters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxConvFails(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetMaxConvFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetNonlinConvCoef(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetNonlinConvCoef(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetConstraints(void *farg1, N_Vector farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + result = (int)ARKodeSetConstraints(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxNumSteps(void *farg1, long const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long)(*farg2); + result = (int)ARKodeSetMaxNumSteps(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxHnilWarns(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetMaxHnilWarns(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetInitStep(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetInitStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMinStep(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMinStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxStep(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMaxStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetInterpolateStopTime(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetInterpolateStopTime(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetStopTime(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetStopTime(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeClearStopTime(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)ARKodeClearStopTime(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetFixedStep(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetFixedStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMaxNumConstrFails(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetMaxNumConstrFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetUseCompensatedSums(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetUseCompensatedSums(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetUserData(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + void *arg2 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (void *)(farg2); + result = (int)ARKodeSetUserData(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetPostprocessStepFn(void *farg1, ARKPostProcessFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKPostProcessFn arg2 = (ARKPostProcessFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKPostProcessFn)(farg2); + result = (int)ARKodeSetPostprocessStepFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetPostprocessStageFn(void *farg1, ARKPostProcessFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKPostProcessFn arg2 = (ARKPostProcessFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKPostProcessFn)(farg2); + result = (int)ARKodeSetPostprocessStageFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetStagePredictFn(void *farg1, ARKStagePredictFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKStagePredictFn arg2 = (ARKStagePredictFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKStagePredictFn)(farg2); + result = (int)ARKodeSetStagePredictFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeEvolve(void *farg1, double const *farg2, N_Vector farg3, double *farg4, int const *farg5) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + N_Vector arg3 = (N_Vector) 0 ; + sunrealtype *arg4 = (sunrealtype *) 0 ; + int arg5 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (N_Vector)(farg3); + arg4 = (sunrealtype *)(farg4); + arg5 = (int)(*farg5); + result = (int)ARKodeEvolve(arg1,arg2,arg3,arg4,arg5); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetDky(void *farg1, double const *farg2, int const *farg3, N_Vector farg4) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int arg3 ; + N_Vector arg4 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (int)(*farg3); + arg4 = (N_Vector)(farg4); + result = (int)ARKodeGetDky(arg1,arg2,arg3,arg4); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeComputeState(void *farg1, N_Vector farg2, N_Vector farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + N_Vector arg3 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + arg3 = (N_Vector)(farg3); + result = (int)ARKodeComputeState(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumExpSteps(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumExpSteps(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumAccSteps(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumAccSteps(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumStepAttempts(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumStepAttempts(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumLinSolvSetups(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumLinSolvSetups(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumErrTestFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumErrTestFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetEstLocalErrors(void *farg1, N_Vector farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + result = (int)ARKodeGetEstLocalErrors(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetWorkSpace(void *farg1, long *farg2, long *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + result = (int)ARKodeGetWorkSpace(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumSteps(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumSteps(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetActualInitStep(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetActualInitStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetLastStep(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetLastStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetCurrentStep(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetCurrentStep(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetCurrentTime(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetCurrentTime(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetCurrentState(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector *arg2 = (N_Vector *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector *)(farg2); + result = (int)ARKodeGetCurrentState(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetCurrentGamma(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetCurrentGamma(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetCurrentMassMatrix(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNMatrix *arg2 = (SUNMatrix *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNMatrix *)(farg2); + result = (int)ARKodeGetCurrentMassMatrix(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetTolScaleFactor(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetTolScaleFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetErrWeights(void *farg1, N_Vector farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + result = (int)ARKodeGetErrWeights(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetResWeights(void *farg1, N_Vector farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (N_Vector)(farg2); + result = (int)ARKodeGetResWeights(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumGEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumGEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetRootInfo(void *farg1, int *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int *arg2 = (int *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int *)(farg2); + result = (int)ARKodeGetRootInfo(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumConstrFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumConstrFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetUserData(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + void **arg2 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (void **)(farg2); + result = (int)ARKodeGetUserData(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodePrintAllStats(void *farg1, void *farg2, int const *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + FILE *arg2 = (FILE *) 0 ; + SUNOutputFormat arg3 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (FILE *)(farg2); + arg3 = (SUNOutputFormat)(*farg3); + result = (int)ARKodePrintAllStats(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT SwigArrayWrapper _wrap_FARKodeGetReturnFlagName(long const *farg1) { + SwigArrayWrapper fresult ; + long arg1 ; + char *result = 0 ; + + arg1 = (long)(*farg1); + result = (char *)ARKodeGetReturnFlagName(arg1); + fresult.size = strlen((const char*)(result)); + fresult.data = (char *)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeWriteParameters(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + FILE *arg2 = (FILE *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (FILE *)(farg2); + result = (int)ARKodeWriteParameters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetStepStats(void *farg1, long *farg2, double *farg3, double *farg4, double *farg5, double *farg6) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype *arg4 = (sunrealtype *) 0 ; + sunrealtype *arg5 = (sunrealtype *) 0 ; + sunrealtype *arg6 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (sunrealtype *)(farg3); + arg4 = (sunrealtype *)(farg4); + arg5 = (sunrealtype *)(farg5); + arg6 = (sunrealtype *)(farg6); + result = (int)ARKodeGetStepStats(arg1,arg2,arg3,arg4,arg5,arg6); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNonlinearSystemData(void *farg1, double *farg2, void *farg3, void *farg4, void *farg5, double *farg6, void *farg7, void *farg8) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector *arg5 = (N_Vector *) 0 ; + sunrealtype *arg6 = (sunrealtype *) 0 ; + N_Vector *arg7 = (N_Vector *) 0 ; + void **arg8 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + arg3 = (N_Vector *)(farg3); + arg4 = (N_Vector *)(farg4); + arg5 = (N_Vector *)(farg5); + arg6 = (sunrealtype *)(farg6); + arg7 = (N_Vector *)(farg7); + arg8 = (void **)(farg8); + result = (int)ARKodeGetNonlinearSystemData(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumNonlinSolvIters(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumNonlinSolvIters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumNonlinSolvConvFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumNonlinSolvConvFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNonlinSolvStats(void *farg1, long *farg2, long *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + result = (int)ARKodeGetNonlinSolvStats(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumStepSolveFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumStepSolveFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetJac(void *farg1, void *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNMatrix *arg2 = (SUNMatrix *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNMatrix *)(farg2); + result = (int)ARKodeGetJac(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetJacTime(void *farg1, double *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype *arg2 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype *)(farg2); + result = (int)ARKodeGetJacTime(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetJacNumSteps(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetJacNumSteps(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetLinWorkSpace(void *farg1, long *farg2, long *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + result = (int)ARKodeGetLinWorkSpace(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumJacEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumJacEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumPrecEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumPrecEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumPrecSolves(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumPrecSolves(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumLinIters(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumLinIters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumLinConvFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumLinConvFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumJTSetupEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumJTSetupEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumJtimesEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumJtimesEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumLinRhsEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumLinRhsEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetLastLinFlag(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetLastLinFlag(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetMassWorkSpace(void *farg1, long *farg2, long *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + result = (int)ARKodeGetMassWorkSpace(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassSetups(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassSetups(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassMultSetups(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassMultSetups(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassMult(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassMult(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassSolves(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassSolves(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassPrecEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassPrecEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassPrecSolves(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassPrecSolves(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassIters(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassIters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMassConvFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMassConvFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumMTSetups(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumMTSetups(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetLastMassFlag(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetLastMassFlag(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT SwigArrayWrapper _wrap_FARKodeGetLinReturnFlagName(long const *farg1) { + SwigArrayWrapper fresult ; + long arg1 ; + char *result = 0 ; + + arg1 = (long)(*farg1); + result = (char *)ARKodeGetLinReturnFlagName(arg1); + fresult.size = strlen((const char*)(result)); + fresult.data = (char *)(result); + return fresult; +} + + +SWIGEXPORT void _wrap_FARKodeFree(void *farg1) { + void **arg1 = (void **) 0 ; + + arg1 = (void **)(farg1); + ARKodeFree(arg1); +} + + +SWIGEXPORT void _wrap_FARKodePrintMem(void *farg1, void *farg2) { + void *arg1 = (void *) 0 ; + FILE *arg2 = (FILE *) 0 ; + + arg1 = (void *)(farg1); + arg2 = (FILE *)(farg2); + ARKodePrintMem(arg1,arg2); +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxFn(void *farg1, ARKRelaxFn farg2, ARKRelaxJacFn farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRelaxFn arg2 = (ARKRelaxFn) 0 ; + ARKRelaxJacFn arg3 = (ARKRelaxJacFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRelaxFn)(farg2); + arg3 = (ARKRelaxJacFn)(farg3); + result = (int)ARKodeSetRelaxFn(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxEtaFail(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetRelaxEtaFail(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxLowerBound(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetRelaxLowerBound(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxMaxFails(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetRelaxMaxFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxMaxIters(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetRelaxMaxIters(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxSolver(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRelaxSolver arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRelaxSolver)(*farg2); + result = (int)ARKodeSetRelaxSolver(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxResTol(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetRelaxResTol(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxTol(void *farg1, double const *farg2, double const *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + sunrealtype arg3 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + arg3 = (sunrealtype)(*farg3); + result = (int)ARKodeSetRelaxTol(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetRelaxUpperBound(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetRelaxUpperBound(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumRelaxFnEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxFnEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumRelaxJacEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxJacEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeGetNumRelaxFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} -SWIGINTERN void SWIG_assign(SwigClassWrapper* self, SwigClassWrapper other) { - if (self->cptr == NULL) { - /* LHS is unassigned */ - if (other.cmemflags & SWIG_MEM_RVALUE) { - /* Capture pointer from RHS, clear 'moving' flag */ - self->cptr = other.cptr; - self->cmemflags = other.cmemflags & (~SWIG_MEM_RVALUE); - } else { - /* Become a reference to the other object */ - self->cptr = other.cptr; - self->cmemflags = other.cmemflags & (~SWIG_MEM_OWN); - } - } else if (other.cptr == NULL) { - /* Replace LHS with a null pointer */ - free(self->cptr); - *self = SwigClassWrapper_uninitialized(); - } else { - if (self->cmemflags & SWIG_MEM_OWN) { - free(self->cptr); - } - self->cptr = other.cptr; - if (other.cmemflags & SWIG_MEM_RVALUE) { - /* Capture RHS */ - self->cmemflags = other.cmemflags & ~SWIG_MEM_RVALUE; - } else { - /* Point to RHS */ - self->cmemflags = other.cmemflags & ~SWIG_MEM_OWN; - } - } +SWIGEXPORT int _wrap_FARKodeGetNumRelaxBoundFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxBoundFails(arg1,arg2); + fresult = (int)(result); + return fresult; } -typedef struct { - void* data; - size_t size; -} SwigArrayWrapper; +SWIGEXPORT int _wrap_FARKodeGetNumRelaxSolveFails(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxSolveFails(arg1,arg2); + fresult = (int)(result); + return fresult; +} -SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { - SwigArrayWrapper result; - result.data = NULL; - result.size = 0; - return result; +SWIGEXPORT int _wrap_FARKodeGetNumRelaxSolveIters(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)ARKodeGetNumRelaxSolveIters(arg1,arg2); + fresult = (int)(result); + return fresult; } + SWIGEXPORT int _wrap_FARKBandPrecInit(void *farg1, int64_t const *farg2, int64_t const *farg3, int64_t const *farg4) { int fresult ; void *arg1 = (void *) 0 ; @@ -1055,4 +2991,244 @@ SWIGEXPORT int _wrap_FARKodeSPRKTable_ToButcher(void *farg1, void *farg2, void * } +SWIGEXPORT int _wrap_FARKodeSetLinearSolver(void *farg1, SUNLinearSolver farg2, SUNMatrix farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNLinearSolver arg2 = (SUNLinearSolver) 0 ; + SUNMatrix arg3 = (SUNMatrix) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNLinearSolver)(farg2); + arg3 = (SUNMatrix)(farg3); + result = (int)ARKodeSetLinearSolver(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassLinearSolver(void *farg1, SUNLinearSolver farg2, SUNMatrix farg3, int const *farg4) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNLinearSolver arg2 = (SUNLinearSolver) 0 ; + SUNMatrix arg3 = (SUNMatrix) 0 ; + int arg4 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNLinearSolver)(farg2); + arg3 = (SUNMatrix)(farg3); + arg4 = (int)(*farg4); + result = (int)ARKodeSetMassLinearSolver(arg1,arg2,arg3,arg4); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetJacFn(void *farg1, ARKLsJacFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsJacFn arg2 = (ARKLsJacFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsJacFn)(farg2); + result = (int)ARKodeSetJacFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassFn(void *farg1, ARKLsMassFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsMassFn arg2 = (ARKLsMassFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsMassFn)(farg2); + result = (int)ARKodeSetMassFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetJacEvalFrequency(void *farg1, long const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long)(*farg2); + result = (int)ARKodeSetJacEvalFrequency(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetLinearSolutionScaling(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)ARKodeSetLinearSolutionScaling(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetEpsLin(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetEpsLin(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassEpsLin(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMassEpsLin(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetLSNormFactor(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetLSNormFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassLSNormFactor(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)ARKodeSetMassLSNormFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetPreconditioner(void *farg1, ARKLsPrecSetupFn farg2, ARKLsPrecSolveFn farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsPrecSetupFn arg2 = (ARKLsPrecSetupFn) 0 ; + ARKLsPrecSolveFn arg3 = (ARKLsPrecSolveFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsPrecSetupFn)(farg2); + arg3 = (ARKLsPrecSolveFn)(farg3); + result = (int)ARKodeSetPreconditioner(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassPreconditioner(void *farg1, ARKLsMassPrecSetupFn farg2, ARKLsMassPrecSolveFn farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsMassPrecSetupFn arg2 = (ARKLsMassPrecSetupFn) 0 ; + ARKLsMassPrecSolveFn arg3 = (ARKLsMassPrecSolveFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsMassPrecSetupFn)(farg2); + arg3 = (ARKLsMassPrecSolveFn)(farg3); + result = (int)ARKodeSetMassPreconditioner(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetJacTimes(void *farg1, ARKLsJacTimesSetupFn farg2, ARKLsJacTimesVecFn farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsJacTimesSetupFn arg2 = (ARKLsJacTimesSetupFn) 0 ; + ARKLsJacTimesVecFn arg3 = (ARKLsJacTimesVecFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsJacTimesSetupFn)(farg2); + arg3 = (ARKLsJacTimesVecFn)(farg3); + result = (int)ARKodeSetJacTimes(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetJacTimesRhsFn(void *farg1, ARKRhsFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRhsFn)(farg2); + result = (int)ARKodeSetJacTimesRhsFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetMassTimes(void *farg1, ARKLsMassTimesSetupFn farg2, ARKLsMassTimesVecFn farg3, void *farg4) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsMassTimesSetupFn arg2 = (ARKLsMassTimesSetupFn) 0 ; + ARKLsMassTimesVecFn arg3 = (ARKLsMassTimesVecFn) 0 ; + void *arg4 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsMassTimesSetupFn)(farg2); + arg3 = (ARKLsMassTimesVecFn)(farg3); + arg4 = (void *)(farg4); + result = (int)ARKodeSetMassTimes(arg1,arg2,arg3,arg4); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FARKodeSetLinSysFn(void *farg1, ARKLsLinSysFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKLsLinSysFn arg2 = (ARKLsLinSysFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKLsLinSysFn)(farg2); + result = (int)ARKodeSetLinSysFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + diff --git a/src/arkode/fmod/farkode_mod.f90 b/src/arkode/fmod/farkode_mod.f90 index 7724193873..18ef81a68e 100644 --- a/src/arkode/fmod/farkode_mod.f90 +++ b/src/arkode/fmod/farkode_mod.f90 @@ -92,6 +92,7 @@ module farkode_mod integer(C_INT), parameter, public :: ARK_RELAX_FUNC_FAIL = -45_C_INT integer(C_INT), parameter, public :: ARK_RELAX_JAC_FAIL = -46_C_INT integer(C_INT), parameter, public :: ARK_CONTROLLER_ERR = -47_C_INT + integer(C_INT), parameter, public :: ARK_STEPPER_UNSUPPORTED = -48_C_INT integer(C_INT), parameter, public :: ARK_UNRECOGNIZED_ERROR = -99_C_INT ! typedef enum ARKRelaxSolver enum, bind(c) @@ -100,6 +101,145 @@ module farkode_mod end enum integer, parameter, public :: ARKRelaxSolver = kind(ARK_RELAX_BRENT) public :: ARK_RELAX_BRENT, ARK_RELAX_NEWTON + public :: FARKodeResize + public :: FARKodeReset + public :: FARKodeSStolerances + public :: FARKodeSVtolerances + public :: FARKodeWFtolerances + public :: FARKodeResStolerance + public :: FARKodeResVtolerance + public :: FARKodeResFtolerance + public :: FARKodeRootInit + public :: FARKodeSetRootDirection + public :: FARKodeSetNoInactiveRootWarn + public :: FARKodeSetDefaults + public :: FARKodeSetOrder + public :: FARKodeSetInterpolantType + public :: FARKodeSetInterpolantDegree + public :: FARKodeSetDenseOrder + public :: FARKodeSetNonlinearSolver + public :: FARKodeSetLinear + public :: FARKodeSetNonlinear + public :: FARKodeSetNlsRhsFn + public :: FARKodeSetDeduceImplicitRhs + public :: FARKodeSetAdaptController + public :: FARKodeSetAdaptivityAdjustment + public :: FARKodeSetCFLFraction + public :: FARKodeSetErrorBias + public :: FARKodeSetSafetyFactor + public :: FARKodeSetMaxGrowth + public :: FARKodeSetMinReduction + public :: FARKodeSetFixedStepBounds + public :: FARKodeSetMaxFirstGrowth + public :: FARKodeSetMaxEFailGrowth + public :: FARKodeSetSmallNumEFails + public :: FARKodeSetMaxCFailGrowth + public :: FARKodeSetNonlinCRDown + public :: FARKodeSetNonlinRDiv + public :: FARKodeSetDeltaGammaMax + public :: FARKodeSetLSetupFrequency + public :: FARKodeSetPredictorMethod + public :: FARKodeSetStabilityFn + public :: FARKodeSetMaxErrTestFails + public :: FARKodeSetMaxNonlinIters + public :: FARKodeSetMaxConvFails + public :: FARKodeSetNonlinConvCoef + public :: FARKodeSetConstraints + public :: FARKodeSetMaxNumSteps + public :: FARKodeSetMaxHnilWarns + public :: FARKodeSetInitStep + public :: FARKodeSetMinStep + public :: FARKodeSetMaxStep + public :: FARKodeSetInterpolateStopTime + public :: FARKodeSetStopTime + public :: FARKodeClearStopTime + public :: FARKodeSetFixedStep + public :: FARKodeSetMaxNumConstrFails + public :: FARKodeSetUseCompensatedSums + public :: FARKodeSetUserData + public :: FARKodeSetPostprocessStepFn + public :: FARKodeSetPostprocessStageFn + public :: FARKodeSetStagePredictFn + public :: FARKodeEvolve + public :: FARKodeGetDky + public :: FARKodeComputeState + public :: FARKodeGetNumExpSteps + public :: FARKodeGetNumAccSteps + public :: FARKodeGetNumStepAttempts + public :: FARKodeGetNumLinSolvSetups + public :: FARKodeGetNumErrTestFails + public :: FARKodeGetEstLocalErrors + public :: FARKodeGetWorkSpace + public :: FARKodeGetNumSteps + public :: FARKodeGetActualInitStep + public :: FARKodeGetLastStep + public :: FARKodeGetCurrentStep + public :: FARKodeGetCurrentTime + public :: FARKodeGetCurrentState + public :: FARKodeGetCurrentGamma + public :: FARKodeGetCurrentMassMatrix + public :: FARKodeGetTolScaleFactor + public :: FARKodeGetErrWeights + public :: FARKodeGetResWeights + public :: FARKodeGetNumGEvals + public :: FARKodeGetRootInfo + public :: FARKodeGetNumConstrFails + public :: FARKodeGetUserData + public :: FARKodePrintAllStats + type, bind(C) :: SwigArrayWrapper + type(C_PTR), public :: data = C_NULL_PTR + integer(C_SIZE_T), public :: size = 0 + end type + public :: FARKodeGetReturnFlagName + public :: FARKodeWriteParameters + public :: FARKodeGetStepStats + public :: FARKodeGetNonlinearSystemData + public :: FARKodeGetNumNonlinSolvIters + public :: FARKodeGetNumNonlinSolvConvFails + public :: FARKodeGetNonlinSolvStats + public :: FARKodeGetNumStepSolveFails + public :: FARKodeGetJac + public :: FARKodeGetJacTime + public :: FARKodeGetJacNumSteps + public :: FARKodeGetLinWorkSpace + public :: FARKodeGetNumJacEvals + public :: FARKodeGetNumPrecEvals + public :: FARKodeGetNumPrecSolves + public :: FARKodeGetNumLinIters + public :: FARKodeGetNumLinConvFails + public :: FARKodeGetNumJTSetupEvals + public :: FARKodeGetNumJtimesEvals + public :: FARKodeGetNumLinRhsEvals + public :: FARKodeGetLastLinFlag + public :: FARKodeGetMassWorkSpace + public :: FARKodeGetNumMassSetups + public :: FARKodeGetNumMassMultSetups + public :: FARKodeGetNumMassMult + public :: FARKodeGetNumMassSolves + public :: FARKodeGetNumMassPrecEvals + public :: FARKodeGetNumMassPrecSolves + public :: FARKodeGetNumMassIters + public :: FARKodeGetNumMassConvFails + public :: FARKodeGetNumMTSetups + public :: FARKodeGetLastMassFlag + public :: FARKodeGetLinReturnFlagName + public :: FARKodeFree + public :: FARKodePrintMem + public :: FARKodeSetRelaxFn + public :: FARKodeSetRelaxEtaFail + public :: FARKodeSetRelaxLowerBound + public :: FARKodeSetRelaxMaxFails + public :: FARKodeSetRelaxMaxIters + public :: FARKodeSetRelaxSolver + public :: FARKodeSetRelaxResTol + public :: FARKodeSetRelaxTol + public :: FARKodeSetRelaxUpperBound + public :: FARKodeGetNumRelaxFnEvals + public :: FARKodeGetNumRelaxJacEvals + public :: FARKodeGetNumRelaxFails + public :: FARKodeGetNumRelaxBoundFails + public :: FARKodeGetNumRelaxSolveFails + public :: FARKodeGetNumRelaxSolveIters public :: FARKBandPrecInit public :: FARKBandPrecGetWorkSpace public :: FARKBandPrecGetNumRhsEvals @@ -188,10 +328,6 @@ module farkode_mod ARKODE_ESDIRK437L2SA_7_3_4, ARKODE_ESDIRK547L2SA_7_4_5, ARKODE_ESDIRK547L2SA2_7_4_5, ARKODE_ARK2_DIRK_3_1_2, & ARKODE_MAX_DIRK_NUM public :: FARKodeButcherTable_LoadDIRK - type, bind(C) :: SwigArrayWrapper - type(C_PTR), public :: data = C_NULL_PTR - integer(C_SIZE_T), public :: size = 0 - end type public :: FARKodeButcherTable_LoadDIRKByName ! typedef enum ARKODE_ERKTableID enum, bind(c) @@ -294,78 +430,88 @@ module farkode_mod integer(C_INT), parameter, public :: ARKLS_MASSFUNC_RECVR = -10_C_INT integer(C_INT), parameter, public :: ARKLS_SUNMAT_FAIL = -11_C_INT integer(C_INT), parameter, public :: ARKLS_SUNLS_FAIL = -12_C_INT + public :: FARKodeSetLinearSolver + public :: FARKodeSetMassLinearSolver + public :: FARKodeSetJacFn + public :: FARKodeSetMassFn + public :: FARKodeSetJacEvalFrequency + public :: FARKodeSetLinearSolutionScaling + public :: FARKodeSetEpsLin + public :: FARKodeSetMassEpsLin + public :: FARKodeSetLSNormFactor + public :: FARKodeSetMassLSNormFactor + public :: FARKodeSetPreconditioner + public :: FARKodeSetMassPreconditioner + public :: FARKodeSetJacTimes + public :: FARKodeSetJacTimesRhsFn + public :: FARKodeSetMassTimes + public :: FARKodeSetLinSysFn ! WRAPPER DECLARATIONS interface -function swigc_FARKBandPrecInit(farg1, farg2, farg3, farg4) & -bind(C, name="_wrap_FARKBandPrecInit") & +function swigc_FARKodeResize(farg1, farg2, farg3, farg4, farg5, farg6) & +bind(C, name="_wrap_FARKodeResize") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -integer(C_INT64_T), intent(in) :: farg2 -integer(C_INT64_T), intent(in) :: farg3 -integer(C_INT64_T), intent(in) :: farg4 +type(C_PTR), value :: farg2 +real(C_DOUBLE), intent(in) :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +type(C_FUNPTR), value :: farg5 +type(C_PTR), value :: farg6 integer(C_INT) :: fresult end function -function swigc_FARKBandPrecGetWorkSpace(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKBandPrecGetWorkSpace") & +function swigc_FARKodeReset(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeReset") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 +real(C_DOUBLE), intent(in) :: farg2 type(C_PTR), value :: farg3 integer(C_INT) :: fresult end function -function swigc_FARKBandPrecGetNumRhsEvals(farg1, farg2) & -bind(C, name="_wrap_FARKBandPrecGetNumRhsEvals") & +function swigc_FARKodeSStolerances(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSStolerances") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 +real(C_DOUBLE), intent(in) :: farg2 +real(C_DOUBLE), intent(in) :: farg3 integer(C_INT) :: fresult end function -function swigc_FARKBBDPrecInit(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9) & -bind(C, name="_wrap_FARKBBDPrecInit") & +function swigc_FARKodeSVtolerances(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSVtolerances") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -integer(C_INT64_T), intent(in) :: farg2 -integer(C_INT64_T), intent(in) :: farg3 -integer(C_INT64_T), intent(in) :: farg4 -integer(C_INT64_T), intent(in) :: farg5 -integer(C_INT64_T), intent(in) :: farg6 -real(C_DOUBLE), intent(in) :: farg7 -type(C_FUNPTR), value :: farg8 -type(C_FUNPTR), value :: farg9 +real(C_DOUBLE), intent(in) :: farg2 +type(C_PTR), value :: farg3 integer(C_INT) :: fresult end function -function swigc_FARKBBDPrecReInit(farg1, farg2, farg3, farg4) & -bind(C, name="_wrap_FARKBBDPrecReInit") & +function swigc_FARKodeWFtolerances(farg1, farg2) & +bind(C, name="_wrap_FARKodeWFtolerances") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -integer(C_INT64_T), intent(in) :: farg2 -integer(C_INT64_T), intent(in) :: farg3 -real(C_DOUBLE), intent(in) :: farg4 +type(C_FUNPTR), value :: farg2 integer(C_INT) :: fresult end function -function swigc_FARKBBDPrecGetWorkSpace(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKBBDPrecGetWorkSpace") & +function swigc_FARKodeResStolerance(farg1, farg2) & +bind(C, name="_wrap_FARKodeResStolerance") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 +real(C_DOUBLE), intent(in) :: farg2 integer(C_INT) :: fresult end function -function swigc_FARKBBDPrecGetNumGfnEvals(farg1, farg2) & -bind(C, name="_wrap_FARKBBDPrecGetNumGfnEvals") & +function swigc_FARKodeResVtolerance(farg1, farg2) & +bind(C, name="_wrap_FARKodeResVtolerance") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 @@ -373,436 +519,4084 @@ function swigc_FARKBBDPrecGetNumGfnEvals(farg1, farg2) & integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_q_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_q_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine - -function swigc_ARKodeButcherTableMem_q_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_q_get") & +function swigc_FARKodeResFtolerance(farg1, farg2) & +bind(C, name="_wrap_FARKodeResFtolerance") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_p_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_p_set") +function swigc_FARKodeRootInit(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeRootInit") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 integer(C_INT), intent(in) :: farg2 -end subroutine +type(C_FUNPTR), value :: farg3 +integer(C_INT) :: fresult +end function -function swigc_ARKodeButcherTableMem_p_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_p_get") & +function swigc_FARKodeSetRootDirection(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRootDirection") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_stages_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_stages_set") +function swigc_FARKodeSetNoInactiveRootWarn(farg1) & +bind(C, name="_wrap_FARKodeSetNoInactiveRootWarn") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function -function swigc_ARKodeButcherTableMem_stages_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_stages_get") & +function swigc_FARKodeSetDefaults(farg1) & +bind(C, name="_wrap_FARKodeSetDefaults") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_A_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_A_set") +function swigc_FARKodeSetOrder(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetOrder") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -function swigc_ARKodeButcherTableMem_A_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_A_get") & +function swigc_FARKodeSetInterpolantType(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetInterpolantType") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_c_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_c_set") +function swigc_FARKodeSetInterpolantDegree(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetInterpolantDegree") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -function swigc_ARKodeButcherTableMem_c_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_c_get") & +function swigc_FARKodeSetDenseOrder(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetDenseOrder") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_b_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_b_set") +function swigc_FARKodeSetNonlinearSolver(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetNonlinearSolver") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 type(C_PTR), value :: farg2 -end subroutine +integer(C_INT) :: fresult +end function -function swigc_ARKodeButcherTableMem_b_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_b_get") & +function swigc_FARKodeSetLinear(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetLinear") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_ARKodeButcherTableMem_d_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_d_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine - -function swigc_ARKodeButcherTableMem_d_get(farg1) & -bind(C, name="_wrap_ARKodeButcherTableMem_d_get") & +function swigc_FARKodeSetNonlinear(farg1) & +bind(C, name="_wrap_FARKodeSetNonlinear") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult end function -function swigc_new_ARKodeButcherTableMem() & -bind(C, name="_wrap_new_ARKodeButcherTableMem") & +function swigc_FARKodeSetNlsRhsFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetNlsRhsFn") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: fresult +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_delete_ARKodeButcherTableMem(farg1) & -bind(C, name="_wrap_delete_ARKodeButcherTableMem") +function swigc_FARKodeSetDeduceImplicitRhs(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetDeduceImplicitRhs") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper), intent(inout) :: farg1 -end subroutine +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -subroutine swigc_ARKodeButcherTableMem_op_assign__(farg1, farg2) & -bind(C, name="_wrap_ARKodeButcherTableMem_op_assign__") +function swigc_FARKodeSetAdaptController(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetAdaptController") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper), intent(inout) :: farg1 -type(SwigClassWrapper) :: farg2 -end subroutine +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function -function swigc_FARKodeButcherTable_Alloc(farg1, farg2) & -bind(C, name="_wrap_FARKodeButcherTable_Alloc") & +function swigc_FARKodeSetAdaptivityAdjustment(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetAdaptivityAdjustment") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 +type(C_PTR), value :: farg1 integer(C_INT), intent(in) :: farg2 -type(C_PTR) :: fresult +integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_Create(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & -bind(C, name="_wrap_FARKodeButcherTable_Create") & +function swigc_FARKodeSetCFLFraction(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetCFLFraction") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 -integer(C_INT), intent(in) :: farg2 -integer(C_INT), intent(in) :: farg3 -type(C_PTR), value :: farg4 -type(C_PTR), value :: farg5 -type(C_PTR), value :: farg6 -type(C_PTR), value :: farg7 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_Copy(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_Copy") & +function swigc_FARKodeSetErrorBias(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetErrorBias") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR) :: fresult +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_FARKodeButcherTable_Space(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKodeButcherTable_Space") +function swigc_FARKodeSetSafetyFactor(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetSafetyFactor") & +result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 -end subroutine +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -subroutine swigc_FARKodeButcherTable_Free(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_Free") +function swigc_FARKodeSetMaxGrowth(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxGrowth") & +result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -end subroutine +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -subroutine swigc_FARKodeButcherTable_Write(farg1, farg2) & -bind(C, name="_wrap_FARKodeButcherTable_Write") +function swigc_FARKodeSetMinReduction(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMinReduction") & +result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -end subroutine +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -function swigc_FARKodeButcherTable_IsStifflyAccurate(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_IsStifflyAccurate") & +function swigc_FARKodeSetFixedStepBounds(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetFixedStepBounds") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +real(C_DOUBLE), intent(in) :: farg3 integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_CheckOrder(farg1, farg2, farg3, farg4) & -bind(C, name="_wrap_FARKodeButcherTable_CheckOrder") & +function swigc_FARKodeSetMaxFirstGrowth(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxFirstGrowth") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 -type(C_PTR), value :: farg4 +real(C_DOUBLE), intent(in) :: farg2 integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_CheckARKOrder(farg1, farg2, farg3, farg4, farg5) & -bind(C, name="_wrap_FARKodeButcherTable_CheckARKOrder") & +function swigc_FARKodeSetMaxEFailGrowth(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxEFailGrowth") & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 -type(C_PTR), value :: farg4 -type(C_PTR), value :: farg5 +real(C_DOUBLE), intent(in) :: farg2 integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_LoadDIRK(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_LoadDIRK") & +function swigc_FARKodeSetSmallNumEFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetSmallNumEFails") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_LoadDIRKByName(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_LoadDIRKByName") & +function swigc_FARKodeSetMaxCFailGrowth(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxCFailGrowth") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(SwigArrayWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_LoadERK(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_LoadERK") & +function swigc_FARKodeSetNonlinCRDown(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetNonlinCRDown") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -function swigc_FARKodeButcherTable_LoadERKByName(farg1) & -bind(C, name="_wrap_FARKodeButcherTable_LoadERKByName") & +function swigc_FARKodeSetNonlinRDiv(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetNonlinRDiv") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(SwigArrayWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_ARKodeSPRKTableMem_q_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeSPRKTableMem_q_set") +function swigc_FARKodeSetDeltaGammaMax(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetDeltaGammaMax") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetLSetupFrequency(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetLSetupFrequency") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 integer(C_INT), intent(in) :: farg2 -end subroutine +integer(C_INT) :: fresult +end function -function swigc_ARKodeSPRKTableMem_q_get(farg1) & -bind(C, name="_wrap_ARKodeSPRKTableMem_q_get") & +function swigc_FARKodeSetPredictorMethod(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetPredictorMethod") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 integer(C_INT) :: fresult end function -subroutine swigc_ARKodeSPRKTableMem_stages_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeSPRKTableMem_stages_set") +function swigc_FARKodeSetStabilityFn(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetStabilityFn") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMaxErrTestFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxErrTestFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 integer(C_INT), intent(in) :: farg2 -end subroutine +integer(C_INT) :: fresult +end function -function swigc_ARKodeSPRKTableMem_stages_get(farg1) & -bind(C, name="_wrap_ARKodeSPRKTableMem_stages_get") & +function swigc_FARKodeSetMaxNonlinIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxNonlinIters") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 integer(C_INT) :: fresult end function -subroutine swigc_ARKodeSPRKTableMem_a_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeSPRKTableMem_a_set") +function swigc_FARKodeSetMaxConvFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxConvFails") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -function swigc_ARKodeSPRKTableMem_a_get(farg1) & -bind(C, name="_wrap_ARKodeSPRKTableMem_a_get") & +function swigc_FARKodeSetNonlinConvCoef(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetNonlinConvCoef") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_ARKodeSPRKTableMem_ahat_set(farg1, farg2) & -bind(C, name="_wrap_ARKodeSPRKTableMem_ahat_set") +function swigc_FARKodeSetConstraints(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetConstraints") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg1 type(C_PTR), value :: farg2 -end subroutine +integer(C_INT) :: fresult +end function -function swigc_ARKodeSPRKTableMem_ahat_get(farg1) & -bind(C, name="_wrap_ARKodeSPRKTableMem_ahat_get") & +function swigc_FARKodeSetMaxNumSteps(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxNumSteps") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +integer(C_LONG), intent(in) :: farg2 +integer(C_INT) :: fresult end function -function swigc_new_ARKodeSPRKTableMem() & -bind(C, name="_wrap_new_ARKodeSPRKTableMem") & +function swigc_FARKodeSetMaxHnilWarns(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxHnilWarns") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: fresult +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult end function -subroutine swigc_delete_ARKodeSPRKTableMem(farg1) & -bind(C, name="_wrap_delete_ARKodeSPRKTableMem") +function swigc_FARKodeSetInitStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetInitStep") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper), intent(inout) :: farg1 -end subroutine +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -subroutine swigc_ARKodeSPRKTableMem_op_assign__(farg1, farg2) & -bind(C, name="_wrap_ARKodeSPRKTableMem_op_assign__") +function swigc_FARKodeSetMinStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMinStep") & +result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper), intent(inout) :: farg1 -type(SwigClassWrapper) :: farg2 -end subroutine +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function -function swigc_FARKodeSPRKTable_Create(farg1, farg2, farg3, farg4) & -bind(C, name="_wrap_FARKodeSPRKTable_Create") & +function swigc_FARKodeSetMaxStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxStep") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetInterpolateStopTime(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetInterpolateStopTime") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetStopTime(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetStopTime") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeClearStopTime(farg1) & +bind(C, name="_wrap_FARKodeClearStopTime") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetFixedStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetFixedStep") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMaxNumConstrFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMaxNumConstrFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetUseCompensatedSums(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetUseCompensatedSums") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetUserData(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetUserData") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetPostprocessStepFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetPostprocessStepFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetPostprocessStageFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetPostprocessStageFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetStagePredictFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetStagePredictFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeEvolve(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FARKodeEvolve") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 type(C_PTR), value :: farg3 type(C_PTR), value :: farg4 -type(C_PTR) :: fresult +integer(C_INT), intent(in) :: farg5 +integer(C_INT) :: fresult end function -function swigc_FARKodeSPRKTable_Alloc(farg1) & -bind(C, name="_wrap_FARKodeSPRKTable_Alloc") & +function swigc_FARKodeGetDky(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKodeGetDky") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT), intent(in) :: farg3 +type(C_PTR), value :: farg4 +integer(C_INT) :: fresult end function -function swigc_FARKodeSPRKTable_Load(farg1) & -bind(C, name="_wrap_FARKodeSPRKTable_Load") & +function swigc_FARKodeComputeState(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeComputeState") & result(fresult) use, intrinsic :: ISO_C_BINDING -integer(C_INT), intent(in) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult end function -function swigc_FARKodeSPRKTable_LoadByName(farg1) & -bind(C, name="_wrap_FARKodeSPRKTable_LoadByName") & +function swigc_FARKodeGetNumExpSteps(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumExpSteps") & result(fresult) use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(SwigArrayWrapper) :: farg1 -type(C_PTR) :: fresult +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumAccSteps(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumAccSteps") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumStepAttempts(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumStepAttempts") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumLinSolvSetups(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumLinSolvSetups") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumErrTestFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumErrTestFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetEstLocalErrors(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetEstLocalErrors") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetWorkSpace(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeGetWorkSpace") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumSteps(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumSteps") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetActualInitStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetActualInitStep") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetLastStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetLastStep") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetCurrentStep(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetCurrentStep") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetCurrentTime(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetCurrentTime") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetCurrentState(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetCurrentState") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetCurrentGamma(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetCurrentGamma") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetCurrentMassMatrix(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetCurrentMassMatrix") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetTolScaleFactor(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetTolScaleFactor") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetErrWeights(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetErrWeights") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetResWeights(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetResWeights") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumGEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumGEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetRootInfo(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetRootInfo") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumConstrFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumConstrFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetUserData(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetUserData") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodePrintAllStats(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodePrintAllStats") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT), intent(in) :: farg3 +integer(C_INT) :: fresult +end function + + subroutine SWIG_free(cptr) & + bind(C, name="free") + use, intrinsic :: ISO_C_BINDING + type(C_PTR), value :: cptr +end subroutine +function swigc_FARKodeGetReturnFlagName(farg1) & +bind(C, name="_wrap_FARKodeGetReturnFlagName") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +integer(C_LONG), intent(in) :: farg1 +type(SwigArrayWrapper) :: fresult +end function + +function swigc_FARKodeWriteParameters(farg1, farg2) & +bind(C, name="_wrap_FARKodeWriteParameters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetStepStats(farg1, farg2, farg3, farg4, farg5, farg6) & +bind(C, name="_wrap_FARKodeGetStepStats") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNonlinearSystemData(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8) & +bind(C, name="_wrap_FARKodeGetNonlinearSystemData") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +type(C_PTR), value :: farg8 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumNonlinSolvIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumNonlinSolvIters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumNonlinSolvConvFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumNonlinSolvConvFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNonlinSolvStats(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeGetNonlinSolvStats") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumStepSolveFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumStepSolveFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetJac(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetJac") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetJacTime(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetJacTime") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetJacNumSteps(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetJacNumSteps") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetLinWorkSpace(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeGetLinWorkSpace") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumJacEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumJacEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumPrecEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumPrecEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumPrecSolves(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumPrecSolves") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumLinIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumLinIters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumLinConvFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumLinConvFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumJTSetupEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumJTSetupEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumJtimesEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumJtimesEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumLinRhsEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumLinRhsEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetLastLinFlag(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetLastLinFlag") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetMassWorkSpace(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeGetMassWorkSpace") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassSetups(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassSetups") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassMultSetups(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassMultSetups") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassMult(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassMult") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassSolves(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassSolves") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassPrecEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassPrecEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassPrecSolves(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassPrecSolves") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassIters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMassConvFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMassConvFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumMTSetups(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumMTSetups") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetLastMassFlag(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetLastMassFlag") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetLinReturnFlagName(farg1) & +bind(C, name="_wrap_FARKodeGetLinReturnFlagName") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +integer(C_LONG), intent(in) :: farg1 +type(SwigArrayWrapper) :: fresult +end function + +subroutine swigc_FARKodeFree(farg1) & +bind(C, name="_wrap_FARKodeFree") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +end subroutine + +subroutine swigc_FARKodePrintMem(farg1, farg2) & +bind(C, name="_wrap_FARKodePrintMem") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_FARKodeSetRelaxFn(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetRelaxFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxEtaFail(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxEtaFail") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxLowerBound(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxLowerBound") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxMaxFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxMaxFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxMaxIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxMaxIters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxSolver(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxSolver") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxResTol(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxResTol") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxTol(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetRelaxTol") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +real(C_DOUBLE), intent(in) :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetRelaxUpperBound(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetRelaxUpperBound") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxFnEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxFnEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxJacEvals(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxJacEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxBoundFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxBoundFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxSolveFails(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxSolveFails") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeGetNumRelaxSolveIters(farg1, farg2) & +bind(C, name="_wrap_FARKodeGetNumRelaxSolveIters") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKBandPrecInit(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKBandPrecInit") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT64_T), intent(in) :: farg2 +integer(C_INT64_T), intent(in) :: farg3 +integer(C_INT64_T), intent(in) :: farg4 +integer(C_INT) :: fresult +end function + +function swigc_FARKBandPrecGetWorkSpace(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKBandPrecGetWorkSpace") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKBandPrecGetNumRhsEvals(farg1, farg2) & +bind(C, name="_wrap_FARKBandPrecGetNumRhsEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKBBDPrecInit(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9) & +bind(C, name="_wrap_FARKBBDPrecInit") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT64_T), intent(in) :: farg2 +integer(C_INT64_T), intent(in) :: farg3 +integer(C_INT64_T), intent(in) :: farg4 +integer(C_INT64_T), intent(in) :: farg5 +integer(C_INT64_T), intent(in) :: farg6 +real(C_DOUBLE), intent(in) :: farg7 +type(C_FUNPTR), value :: farg8 +type(C_FUNPTR), value :: farg9 +integer(C_INT) :: fresult +end function + +function swigc_FARKBBDPrecReInit(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKBBDPrecReInit") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT64_T), intent(in) :: farg2 +integer(C_INT64_T), intent(in) :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +integer(C_INT) :: fresult +end function + +function swigc_FARKBBDPrecGetWorkSpace(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKBBDPrecGetWorkSpace") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKBBDPrecGetNumGfnEvals(farg1, farg2) & +bind(C, name="_wrap_FARKBBDPrecGetNumGfnEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_q_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_q_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_q_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_q_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_p_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_p_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_p_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_p_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_stages_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_stages_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_stages_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_stages_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_A_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_A_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_A_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_A_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_c_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_c_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_c_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_c_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_b_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_b_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_b_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_b_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_ARKodeButcherTableMem_d_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_d_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeButcherTableMem_d_get(farg1) & +bind(C, name="_wrap_ARKodeButcherTableMem_d_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_new_ARKodeButcherTableMem() & +bind(C, name="_wrap_new_ARKodeButcherTableMem") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: fresult +end function + +subroutine swigc_delete_ARKodeButcherTableMem(farg1) & +bind(C, name="_wrap_delete_ARKodeButcherTableMem") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper), intent(inout) :: farg1 +end subroutine + +subroutine swigc_ARKodeButcherTableMem_op_assign__(farg1, farg2) & +bind(C, name="_wrap_ARKodeButcherTableMem_op_assign__") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper), intent(inout) :: farg1 +type(SwigClassWrapper) :: farg2 +end subroutine + +function swigc_FARKodeButcherTable_Alloc(farg1, farg2) & +bind(C, name="_wrap_FARKodeButcherTable_Alloc") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeButcherTable_Create(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & +bind(C, name="_wrap_FARKodeButcherTable_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT), intent(in) :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeButcherTable_Copy(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_Copy") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_FARKodeButcherTable_Space(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeButcherTable_Space") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +end subroutine + +subroutine swigc_FARKodeButcherTable_Free(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_Free") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +end subroutine + +subroutine swigc_FARKodeButcherTable_Write(farg1, farg2) & +bind(C, name="_wrap_FARKodeButcherTable_Write") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_FARKodeButcherTable_IsStifflyAccurate(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_IsStifflyAccurate") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeButcherTable_CheckOrder(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKodeButcherTable_CheckOrder") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeButcherTable_CheckARKOrder(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FARKodeButcherTable_CheckARKOrder") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeButcherTable_LoadDIRK(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_LoadDIRK") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeButcherTable_LoadDIRKByName(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_LoadDIRKByName") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +type(SwigArrayWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeButcherTable_LoadERK(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_LoadERK") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeButcherTable_LoadERKByName(farg1) & +bind(C, name="_wrap_FARKodeButcherTable_LoadERKByName") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +type(SwigArrayWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_ARKodeSPRKTableMem_q_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeSPRKTableMem_q_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_ARKodeSPRKTableMem_q_get(farg1) & +bind(C, name="_wrap_ARKodeSPRKTableMem_q_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeSPRKTableMem_stages_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeSPRKTableMem_stages_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_ARKodeSPRKTableMem_stages_get(farg1) & +bind(C, name="_wrap_ARKodeSPRKTableMem_stages_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + +subroutine swigc_ARKodeSPRKTableMem_a_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeSPRKTableMem_a_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeSPRKTableMem_a_get(farg1) & +bind(C, name="_wrap_ARKodeSPRKTableMem_a_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_ARKodeSPRKTableMem_ahat_set(farg1, farg2) & +bind(C, name="_wrap_ARKodeSPRKTableMem_ahat_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +function swigc_ARKodeSPRKTableMem_ahat_get(farg1) & +bind(C, name="_wrap_ARKodeSPRKTableMem_ahat_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_new_ARKodeSPRKTableMem() & +bind(C, name="_wrap_new_ARKodeSPRKTableMem") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: fresult +end function + +subroutine swigc_delete_ARKodeSPRKTableMem(farg1) & +bind(C, name="_wrap_delete_ARKodeSPRKTableMem") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper), intent(inout) :: farg1 +end subroutine + +subroutine swigc_ARKodeSPRKTableMem_op_assign__(farg1, farg2) & +bind(C, name="_wrap_ARKodeSPRKTableMem_op_assign__") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper), intent(inout) :: farg1 +type(SwigClassWrapper) :: farg2 +end subroutine + +function swigc_FARKodeSPRKTable_Create(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKodeSPRKTable_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeSPRKTable_Alloc(farg1) & +bind(C, name="_wrap_FARKodeSPRKTable_Alloc") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeSPRKTable_Load(farg1) & +bind(C, name="_wrap_FARKodeSPRKTable_Load") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeSPRKTable_LoadByName(farg1) & +bind(C, name="_wrap_FARKodeSPRKTable_LoadByName") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +type(SwigArrayWrapper) :: farg1 +type(C_PTR) :: fresult +end function + +function swigc_FARKodeSPRKTable_Copy(farg1) & +bind(C, name="_wrap_FARKodeSPRKTable_Copy") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR) :: fresult +end function + +subroutine swigc_FARKodeSPRKTable_Write(farg1, farg2) & +bind(C, name="_wrap_FARKodeSPRKTable_Write") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +end subroutine + +subroutine swigc_FARKodeSPRKTable_Space(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSPRKTable_Space") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +end subroutine + +subroutine swigc_FARKodeSPRKTable_Free(farg1) & +bind(C, name="_wrap_FARKodeSPRKTable_Free") +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +end subroutine + +function swigc_FARKodeSPRKTable_ToButcher(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSPRKTable_ToButcher") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetLinearSolver(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetLinearSolver") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassLinearSolver(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKodeSetMassLinearSolver") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT), intent(in) :: farg4 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetJacFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetJacFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMassFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetJacEvalFrequency(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetJacEvalFrequency") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_LONG), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetLinearSolutionScaling(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetLinearSolutionScaling") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetEpsLin(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetEpsLin") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassEpsLin(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMassEpsLin") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetLSNormFactor(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetLSNormFactor") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassLSNormFactor(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetMassLSNormFactor") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetPreconditioner(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetPreconditioner") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassPreconditioner(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetMassPreconditioner") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetJacTimes(farg1, farg2, farg3) & +bind(C, name="_wrap_FARKodeSetJacTimes") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetJacTimesRhsFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetJacTimesRhsFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetMassTimes(farg1, farg2, farg3, farg4) & +bind(C, name="_wrap_FARKodeSetMassTimes") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +type(C_PTR), value :: farg4 +integer(C_INT) :: fresult +end function + +function swigc_FARKodeSetLinSysFn(farg1, farg2) & +bind(C, name="_wrap_FARKodeSetLinSysFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +end interface + + +contains + ! MODULE SUBPROGRAMS +function FARKodeResize(arkode_mem, ynew, hscale, t0, resize, resize_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: ynew +real(C_DOUBLE), intent(in) :: hscale +real(C_DOUBLE), intent(in) :: t0 +type(C_FUNPTR), intent(in), value :: resize +type(C_PTR) :: resize_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +real(C_DOUBLE) :: farg3 +real(C_DOUBLE) :: farg4 +type(C_FUNPTR) :: farg5 +type(C_PTR) :: farg6 + +farg1 = arkode_mem +farg2 = c_loc(ynew) +farg3 = hscale +farg4 = t0 +farg5 = resize +farg6 = resize_data +fresult = swigc_FARKodeResize(farg1, farg2, farg3, farg4, farg5, farg6) +swig_result = fresult +end function + +function FARKodeReset(arkode_mem, tr, yr) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: tr +type(N_Vector), target, intent(inout) :: yr +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = tr +farg3 = c_loc(yr) +fresult = swigc_FARKodeReset(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSStolerances(arkode_mem, reltol, abstol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: reltol +real(C_DOUBLE), intent(in) :: abstol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +real(C_DOUBLE) :: farg3 + +farg1 = arkode_mem +farg2 = reltol +farg3 = abstol +fresult = swigc_FARKodeSStolerances(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSVtolerances(arkode_mem, reltol, abstol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: reltol +type(N_Vector), target, intent(inout) :: abstol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = reltol +farg3 = c_loc(abstol) +fresult = swigc_FARKodeSVtolerances(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeWFtolerances(arkode_mem, efun) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: efun +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = efun +fresult = swigc_FARKodeWFtolerances(farg1, farg2) +swig_result = fresult +end function + +function FARKodeResStolerance(arkode_mem, rabstol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: rabstol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = rabstol +fresult = swigc_FARKodeResStolerance(farg1, farg2) +swig_result = fresult +end function + +function FARKodeResVtolerance(arkode_mem, rabstol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: rabstol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(rabstol) +fresult = swigc_FARKodeResVtolerance(farg1, farg2) +swig_result = fresult +end function + +function FARKodeResFtolerance(arkode_mem, rfun) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: rfun +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = rfun +fresult = swigc_FARKodeResFtolerance(farg1, farg2) +swig_result = fresult +end function + +function FARKodeRootInit(arkode_mem, nrtfn, g) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: nrtfn +type(C_FUNPTR), intent(in), value :: g +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 +type(C_FUNPTR) :: farg3 + +farg1 = arkode_mem +farg2 = nrtfn +farg3 = g +fresult = swigc_FARKodeRootInit(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetRootDirection(arkode_mem, rootdir) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), dimension(*), target, intent(inout) :: rootdir +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(rootdir(1)) +fresult = swigc_FARKodeSetRootDirection(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNoInactiveRootWarn(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FARKodeSetNoInactiveRootWarn(farg1) +swig_result = fresult +end function + +function FARKodeSetDefaults(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FARKodeSetDefaults(farg1) +swig_result = fresult +end function + +function FARKodeSetOrder(arkode_mem, maxord) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: maxord +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = maxord +fresult = swigc_FARKodeSetOrder(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetInterpolantType(arkode_mem, itype) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: itype +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = itype +fresult = swigc_FARKodeSetInterpolantType(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetInterpolantDegree(arkode_mem, degree) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: degree +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = degree +fresult = swigc_FARKodeSetInterpolantDegree(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetDenseOrder(arkode_mem, dord) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: dord +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = dord +fresult = swigc_FARKodeSetDenseOrder(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNonlinearSolver(arkode_mem, nls) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(SUNNonlinearSolver), target, intent(inout) :: nls +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nls) +fresult = swigc_FARKodeSetNonlinearSolver(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetLinear(arkode_mem, timedepend) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: timedepend +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = timedepend +fresult = swigc_FARKodeSetLinear(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNonlinear(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FARKodeSetNonlinear(farg1) +swig_result = fresult +end function + +function FARKodeSetNlsRhsFn(arkode_mem, nls_fi) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: nls_fi +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = nls_fi +fresult = swigc_FARKodeSetNlsRhsFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetDeduceImplicitRhs(arkode_mem, deduce) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: deduce +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = deduce +fresult = swigc_FARKodeSetDeduceImplicitRhs(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetAdaptController(arkode_mem, c) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(SUNAdaptController), target, intent(inout) :: c +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(c) +fresult = swigc_FARKodeSetAdaptController(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetAdaptivityAdjustment(arkode_mem, adjust) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: adjust +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = adjust +fresult = swigc_FARKodeSetAdaptivityAdjustment(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetCFLFraction(arkode_mem, cfl_frac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: cfl_frac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = cfl_frac +fresult = swigc_FARKodeSetCFLFraction(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetErrorBias(arkode_mem, bias) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: bias +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = bias +fresult = swigc_FARKodeSetErrorBias(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetSafetyFactor(arkode_mem, safety) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: safety +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = safety +fresult = swigc_FARKodeSetSafetyFactor(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxGrowth(arkode_mem, mx_growth) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: mx_growth +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = mx_growth +fresult = swigc_FARKodeSetMaxGrowth(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMinReduction(arkode_mem, eta_min) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: eta_min +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = eta_min +fresult = swigc_FARKodeSetMinReduction(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetFixedStepBounds(arkode_mem, lb, ub) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: lb +real(C_DOUBLE), intent(in) :: ub +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +real(C_DOUBLE) :: farg3 + +farg1 = arkode_mem +farg2 = lb +farg3 = ub +fresult = swigc_FARKodeSetFixedStepBounds(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetMaxFirstGrowth(arkode_mem, etamx1) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: etamx1 +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = etamx1 +fresult = swigc_FARKodeSetMaxFirstGrowth(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxEFailGrowth(arkode_mem, etamxf) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: etamxf +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = etamxf +fresult = swigc_FARKodeSetMaxEFailGrowth(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetSmallNumEFails(arkode_mem, small_nef) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: small_nef +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = small_nef +fresult = swigc_FARKodeSetSmallNumEFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxCFailGrowth(arkode_mem, etacf) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: etacf +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = etacf +fresult = swigc_FARKodeSetMaxCFailGrowth(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNonlinCRDown(arkode_mem, crdown) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: crdown +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = crdown +fresult = swigc_FARKodeSetNonlinCRDown(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNonlinRDiv(arkode_mem, rdiv) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: rdiv +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = rdiv +fresult = swigc_FARKodeSetNonlinRDiv(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetDeltaGammaMax(arkode_mem, dgmax) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: dgmax +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = dgmax +fresult = swigc_FARKodeSetDeltaGammaMax(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetLSetupFrequency(arkode_mem, msbp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: msbp +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = msbp +fresult = swigc_FARKodeSetLSetupFrequency(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetPredictorMethod(arkode_mem, method) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: method +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = method +fresult = swigc_FARKodeSetPredictorMethod(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetStabilityFn(arkode_mem, estab, estab_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: estab +type(C_PTR) :: estab_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = estab +farg3 = estab_data +fresult = swigc_FARKodeSetStabilityFn(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetMaxErrTestFails(arkode_mem, maxnef) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: maxnef +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = maxnef +fresult = swigc_FARKodeSetMaxErrTestFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxNonlinIters(arkode_mem, maxcor) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: maxcor +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = maxcor +fresult = swigc_FARKodeSetMaxNonlinIters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxConvFails(arkode_mem, maxncf) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: maxncf +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = maxncf +fresult = swigc_FARKodeSetMaxConvFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetNonlinConvCoef(arkode_mem, nlscoef) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: nlscoef +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = nlscoef +fresult = swigc_FARKodeSetNonlinConvCoef(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetConstraints(arkode_mem, constraints) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: constraints +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(constraints) +fresult = swigc_FARKodeSetConstraints(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxNumSteps(arkode_mem, mxsteps) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), intent(in) :: mxsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_LONG) :: farg2 + +farg1 = arkode_mem +farg2 = mxsteps +fresult = swigc_FARKodeSetMaxNumSteps(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxHnilWarns(arkode_mem, mxhnil) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: mxhnil +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = mxhnil +fresult = swigc_FARKodeSetMaxHnilWarns(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetInitStep(arkode_mem, hin) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: hin +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = hin +fresult = swigc_FARKodeSetInitStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMinStep(arkode_mem, hmin) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: hmin +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = hmin +fresult = swigc_FARKodeSetMinStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxStep(arkode_mem, hmax) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: hmax +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = hmax +fresult = swigc_FARKodeSetMaxStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetInterpolateStopTime(arkode_mem, interp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: interp +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = interp +fresult = swigc_FARKodeSetInterpolateStopTime(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetStopTime(arkode_mem, tstop) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: tstop +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = tstop +fresult = swigc_FARKodeSetStopTime(farg1, farg2) +swig_result = fresult +end function + +function FARKodeClearStopTime(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FARKodeClearStopTime(farg1) +swig_result = fresult +end function + +function FARKodeSetFixedStep(arkode_mem, hfixed) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: hfixed +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = hfixed +fresult = swigc_FARKodeSetFixedStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMaxNumConstrFails(arkode_mem, maxfails) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: maxfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = maxfails +fresult = swigc_FARKodeSetMaxNumConstrFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetUseCompensatedSums(arkode_mem, onoff) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: onoff +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = onoff +fresult = swigc_FARKodeSetUseCompensatedSums(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetUserData(arkode_mem, user_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR) :: user_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = user_data +fresult = swigc_FARKodeSetUserData(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetPostprocessStepFn(arkode_mem, processstep) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: processstep +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = processstep +fresult = swigc_FARKodeSetPostprocessStepFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetPostprocessStageFn(arkode_mem, processstage) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: processstage +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = processstage +fresult = swigc_FARKodeSetPostprocessStageFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetStagePredictFn(arkode_mem, predictstage) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: predictstage +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = predictstage +fresult = swigc_FARKodeSetStagePredictFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeEvolve(arkode_mem, tout, yout, tret, itask) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: tout +type(N_Vector), target, intent(inout) :: yout +real(C_DOUBLE), dimension(*), target, intent(inout) :: tret +integer(C_INT), intent(in) :: itask +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +type(C_PTR) :: farg3 +type(C_PTR) :: farg4 +integer(C_INT) :: farg5 + +farg1 = arkode_mem +farg2 = tout +farg3 = c_loc(yout) +farg4 = c_loc(tret(1)) +farg5 = itask +fresult = swigc_FARKodeEvolve(farg1, farg2, farg3, farg4, farg5) +swig_result = fresult +end function + +function FARKodeGetDky(arkode_mem, t, k, dky) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: t +integer(C_INT), intent(in) :: k +type(N_Vector), target, intent(inout) :: dky +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +integer(C_INT) :: farg3 +type(C_PTR) :: farg4 + +farg1 = arkode_mem +farg2 = t +farg3 = k +farg4 = c_loc(dky) +fresult = swigc_FARKodeGetDky(farg1, farg2, farg3, farg4) +swig_result = fresult +end function + +function FARKodeComputeState(arkode_mem, zcor, z) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: zcor +type(N_Vector), target, intent(inout) :: z +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(zcor) +farg3 = c_loc(z) +fresult = swigc_FARKodeComputeState(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeGetNumExpSteps(arkode_mem, expsteps) & +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) :: expsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(expsteps(1)) +fresult = swigc_FARKodeGetNumExpSteps(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumAccSteps(arkode_mem, accsteps) & +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) :: accsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(accsteps(1)) +fresult = swigc_FARKodeGetNumAccSteps(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumStepAttempts(arkode_mem, step_attempts) & +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) :: step_attempts +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(step_attempts(1)) +fresult = swigc_FARKodeGetNumStepAttempts(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumLinSolvSetups(arkode_mem, nlinsetups) & +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) :: nlinsetups +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nlinsetups(1)) +fresult = swigc_FARKodeGetNumLinSolvSetups(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumErrTestFails(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) :: netfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(netfails(1)) +fresult = swigc_FARKodeGetNumErrTestFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetEstLocalErrors(arkode_mem, ele) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: ele +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(ele) +fresult = swigc_FARKodeGetEstLocalErrors(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetWorkSpace(arkode_mem, lenrw, leniw) & +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) :: lenrw +integer(C_LONG), dimension(*), target, intent(inout) :: leniw +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(lenrw(1)) +farg3 = c_loc(leniw(1)) +fresult = swigc_FARKodeGetWorkSpace(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeGetNumSteps(arkode_mem, nsteps) & +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) :: nsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nsteps(1)) +fresult = swigc_FARKodeGetNumSteps(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetActualInitStep(arkode_mem, hinused) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: hinused +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(hinused(1)) +fresult = swigc_FARKodeGetActualInitStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetLastStep(arkode_mem, hlast) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: hlast +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(hlast(1)) +fresult = swigc_FARKodeGetLastStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetCurrentStep(arkode_mem, hcur) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: hcur +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(hcur(1)) +fresult = swigc_FARKodeGetCurrentStep(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetCurrentTime(arkode_mem, tcur) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: tcur +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(tcur(1)) +fresult = swigc_FARKodeGetCurrentTime(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetCurrentState(arkode_mem, state) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR) :: state +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = state +fresult = swigc_FARKodeGetCurrentState(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetCurrentGamma(arkode_mem, gamma) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: gamma +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(gamma(1)) +fresult = swigc_FARKodeGetCurrentGamma(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetCurrentMassMatrix(arkode_mem, m) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR), target, intent(inout) :: m +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(m) +fresult = swigc_FARKodeGetCurrentMassMatrix(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetTolScaleFactor(arkode_mem, tolsfac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: tolsfac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(tolsfac(1)) +fresult = swigc_FARKodeGetTolScaleFactor(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetErrWeights(arkode_mem, eweight) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: eweight +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(eweight) +fresult = swigc_FARKodeGetErrWeights(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetResWeights(arkode_mem, rweight) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(N_Vector), target, intent(inout) :: rweight +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(rweight) +fresult = swigc_FARKodeGetResWeights(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumGEvals(arkode_mem, ngevals) & +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) :: ngevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(ngevals(1)) +fresult = swigc_FARKodeGetNumGEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetRootInfo(arkode_mem, rootsfound) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), dimension(*), target, intent(inout) :: rootsfound +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(rootsfound(1)) +fresult = swigc_FARKodeGetRootInfo(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumConstrFails(arkode_mem, nconstrfails) & +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) :: nconstrfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nconstrfails(1)) +fresult = swigc_FARKodeGetNumConstrFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetUserData(arkode_mem, user_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR), target, intent(inout) :: user_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(user_data) +fresult = swigc_FARKodeGetUserData(farg1, farg2) +swig_result = fresult +end function + +function FARKodePrintAllStats(arkode_mem, outfile, fmt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR) :: outfile +integer(SUNOutputFormat), intent(in) :: fmt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +integer(C_INT) :: farg3 + +farg1 = arkode_mem +farg2 = outfile +farg3 = fmt +fresult = swigc_FARKodePrintAllStats(farg1, farg2, farg3) +swig_result = fresult +end function + + +subroutine SWIG_chararray_to_string(wrap, string) + use, intrinsic :: ISO_C_BINDING + type(SwigArrayWrapper), intent(IN) :: wrap + character(kind=C_CHAR, len=:), allocatable, intent(OUT) :: string + character(kind=C_CHAR), dimension(:), pointer :: chars + integer(kind=C_SIZE_T) :: i + call c_f_pointer(wrap%data, chars, [wrap%size]) + allocate(character(kind=C_CHAR, len=wrap%size) :: string) + do i=1, wrap%size + string(i:i) = chars(i) + end do +end subroutine + +function FARKodeGetReturnFlagName(flag) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +character(kind=C_CHAR, len=:), allocatable :: swig_result +integer(C_LONG), intent(in) :: flag +type(SwigArrayWrapper) :: fresult +integer(C_LONG) :: farg1 + +farg1 = flag +fresult = swigc_FARKodeGetReturnFlagName(farg1) +call SWIG_chararray_to_string(fresult, swig_result) +if (.false.) call SWIG_free(fresult%data) +end function + +function FARKodeWriteParameters(arkode_mem, fp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR) :: fp +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = fp +fresult = swigc_FARKodeWriteParameters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur) & +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) :: nsteps +real(C_DOUBLE), dimension(*), target, intent(inout) :: hinused +real(C_DOUBLE), dimension(*), target, intent(inout) :: hlast +real(C_DOUBLE), dimension(*), target, intent(inout) :: hcur +real(C_DOUBLE), dimension(*), target, intent(inout) :: tcur +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 + +farg1 = arkode_mem +farg2 = c_loc(nsteps(1)) +farg3 = c_loc(hinused(1)) +farg4 = c_loc(hlast(1)) +farg5 = c_loc(hcur(1)) +farg6 = c_loc(tcur(1)) +fresult = swigc_FARKodeGetStepStats(farg1, farg2, farg3, farg4, farg5, farg6) +swig_result = fresult +end function + +function FARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, fi, gamma, sdata, user_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: tcur +type(C_PTR) :: zpred +type(C_PTR) :: z +type(C_PTR) :: fi +real(C_DOUBLE), dimension(*), target, intent(inout) :: gamma +type(C_PTR) :: sdata +type(C_PTR), target, intent(inout) :: user_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 +type(C_PTR) :: farg7 +type(C_PTR) :: farg8 + +farg1 = arkode_mem +farg2 = c_loc(tcur(1)) +farg3 = zpred +farg4 = z +farg5 = fi +farg6 = c_loc(gamma(1)) +farg7 = sdata +farg8 = c_loc(user_data) +fresult = swigc_FARKodeGetNonlinearSystemData(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8) +swig_result = fresult +end function + +function FARKodeGetNumNonlinSolvIters(arkode_mem, nniters) & +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) :: nniters +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nniters(1)) +fresult = swigc_FARKodeGetNumNonlinSolvIters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumNonlinSolvConvFails(arkode_mem, nnfails) & +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) :: nnfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nnfails(1)) +fresult = swigc_FARKodeGetNumNonlinSolvConvFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNonlinSolvStats(arkode_mem, nniters, nnfails) & +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) :: nniters +integer(C_LONG), dimension(*), target, intent(inout) :: nnfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(nniters(1)) +farg3 = c_loc(nnfails(1)) +fresult = swigc_FARKodeGetNonlinSolvStats(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeGetNumStepSolveFails(arkode_mem, nncfails) & +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) :: nncfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nncfails(1)) +fresult = swigc_FARKodeGetNumStepSolveFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetJac(arkode_mem, j) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_PTR), target, intent(inout) :: j +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(j) +fresult = swigc_FARKodeGetJac(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetJacTime(arkode_mem, t_j) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), dimension(*), target, intent(inout) :: t_j +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(t_j(1)) +fresult = swigc_FARKodeGetJacTime(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetJacNumSteps(arkode_mem, nst_j) & +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) :: nst_j +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nst_j(1)) +fresult = swigc_FARKodeGetJacNumSteps(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetLinWorkSpace(arkode_mem, lenrwls, leniwls) & +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) :: lenrwls +integer(C_LONG), dimension(*), target, intent(inout) :: leniwls +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(lenrwls(1)) +farg3 = c_loc(leniwls(1)) +fresult = swigc_FARKodeGetLinWorkSpace(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeGetNumJacEvals(arkode_mem, njevals) & +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) :: njevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(njevals(1)) +fresult = swigc_FARKodeGetNumJacEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumPrecEvals(arkode_mem, npevals) & +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) :: npevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(npevals(1)) +fresult = swigc_FARKodeGetNumPrecEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumPrecSolves(arkode_mem, npsolves) & +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) :: npsolves +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(npsolves(1)) +fresult = swigc_FARKodeGetNumPrecSolves(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumLinIters(arkode_mem, nliters) & +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) :: nliters +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nliters(1)) +fresult = swigc_FARKodeGetNumLinIters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumLinConvFails(arkode_mem, nlcfails) & +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) :: nlcfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nlcfails(1)) +fresult = swigc_FARKodeGetNumLinConvFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumJTSetupEvals(arkode_mem, njtsetups) & +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) :: njtsetups +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(njtsetups(1)) +fresult = swigc_FARKodeGetNumJTSetupEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumJtimesEvals(arkode_mem, njvevals) & +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) :: njvevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(njvevals(1)) +fresult = swigc_FARKodeGetNumJtimesEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumLinRhsEvals(arkode_mem, nfevalsls) & +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) :: nfevalsls +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nfevalsls(1)) +fresult = swigc_FARKodeGetNumLinRhsEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetLastLinFlag(arkode_mem, flag) & +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) :: flag +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(flag(1)) +fresult = swigc_FARKodeGetLastLinFlag(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetMassWorkSpace(arkode_mem, lenrwmls, leniwmls) & +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) :: lenrwmls +integer(C_LONG), dimension(*), target, intent(inout) :: leniwmls +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(lenrwmls(1)) +farg3 = c_loc(leniwmls(1)) +fresult = swigc_FARKodeGetMassWorkSpace(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeGetNumMassSetups(arkode_mem, nmsetups) & +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) :: nmsetups +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmsetups(1)) +fresult = swigc_FARKodeGetNumMassSetups(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassMultSetups(arkode_mem, nmvsetups) & +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) :: nmvsetups +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmvsetups(1)) +fresult = swigc_FARKodeGetNumMassMultSetups(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassMult(arkode_mem, nmvevals) & +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) :: nmvevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmvevals(1)) +fresult = swigc_FARKodeGetNumMassMult(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassSolves(arkode_mem, nmsolves) & +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) :: nmsolves +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmsolves(1)) +fresult = swigc_FARKodeGetNumMassSolves(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassPrecEvals(arkode_mem, nmpevals) & +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) :: nmpevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmpevals(1)) +fresult = swigc_FARKodeGetNumMassPrecEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassPrecSolves(arkode_mem, nmpsolves) & +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) :: nmpsolves +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmpsolves(1)) +fresult = swigc_FARKodeGetNumMassPrecSolves(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassIters(arkode_mem, nmiters) & +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) :: nmiters +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmiters(1)) +fresult = swigc_FARKodeGetNumMassIters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMassConvFails(arkode_mem, nmcfails) & +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) :: nmcfails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmcfails(1)) +fresult = swigc_FARKodeGetNumMassConvFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumMTSetups(arkode_mem, nmtsetups) & +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) :: nmtsetups +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nmtsetups(1)) +fresult = swigc_FARKodeGetNumMTSetups(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetLastMassFlag(arkode_mem, flag) & +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) :: flag +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(flag(1)) +fresult = swigc_FARKodeGetLastMassFlag(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetLinReturnFlagName(flag) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +character(kind=C_CHAR, len=:), allocatable :: swig_result +integer(C_LONG), intent(in) :: flag +type(SwigArrayWrapper) :: fresult +integer(C_LONG) :: farg1 + +farg1 = flag +fresult = swigc_FARKodeGetLinReturnFlagName(farg1) +call SWIG_chararray_to_string(fresult, swig_result) +if (.false.) call SWIG_free(fresult%data) +end function + +subroutine FARKodeFree(arkode_mem) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), target, intent(inout) :: arkode_mem +type(C_PTR) :: farg1 + +farg1 = c_loc(arkode_mem) +call swigc_FARKodeFree(farg1) +end subroutine + +subroutine FARKodePrintMem(arkode_mem, outfile) +use, intrinsic :: ISO_C_BINDING +type(C_PTR) :: arkode_mem +type(C_PTR) :: outfile +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = outfile +call swigc_FARKodePrintMem(farg1, farg2) +end subroutine + +function FARKodeSetRelaxFn(arkode_mem, rfn, rjac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: rfn +type(C_FUNPTR), intent(in), value :: rjac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 + +farg1 = arkode_mem +farg2 = rfn +farg3 = rjac +fresult = swigc_FARKodeSetRelaxFn(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetRelaxEtaFail(arkode_mem, eta_rf) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: eta_rf +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = eta_rf +fresult = swigc_FARKodeSetRelaxEtaFail(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxLowerBound(arkode_mem, lower) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: lower +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = lower +fresult = swigc_FARKodeSetRelaxLowerBound(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxMaxFails(arkode_mem, max_fails) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: max_fails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = max_fails +fresult = swigc_FARKodeSetRelaxMaxFails(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxMaxIters(arkode_mem, max_iters) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: max_iters +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = max_iters +fresult = swigc_FARKodeSetRelaxMaxIters(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxSolver(arkode_mem, solver) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(ARKRelaxSolver), intent(in) :: solver +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = solver +fresult = swigc_FARKodeSetRelaxSolver(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxResTol(arkode_mem, res_tol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: res_tol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = res_tol +fresult = swigc_FARKodeSetRelaxResTol(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetRelaxTol(arkode_mem, rel_tol, abs_tol) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: rel_tol +real(C_DOUBLE), intent(in) :: abs_tol +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 +real(C_DOUBLE) :: farg3 + +farg1 = arkode_mem +farg2 = rel_tol +farg3 = abs_tol +fresult = swigc_FARKodeSetRelaxTol(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetRelaxUpperBound(arkode_mem, upper) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: upper +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = upper +fresult = swigc_FARKodeSetRelaxUpperBound(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumRelaxFnEvals(arkode_mem, r_evals) & +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) :: r_evals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(r_evals(1)) +fresult = swigc_FARKodeGetNumRelaxFnEvals(farg1, farg2) +swig_result = fresult +end function + +function FARKodeGetNumRelaxJacEvals(arkode_mem, j_evals) & +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) :: j_evals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(j_evals(1)) +fresult = swigc_FARKodeGetNumRelaxJacEvals(farg1, farg2) +swig_result = fresult end function -function swigc_FARKodeSPRKTable_Copy(farg1) & -bind(C, name="_wrap_FARKodeSPRKTable_Copy") & -result(fresult) +function FARKodeGetNumRelaxFails(arkode_mem, relax_fails) & +result(swig_result) use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR) :: fresult +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: relax_fails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(relax_fails(1)) +fresult = swigc_FARKodeGetNumRelaxFails(farg1, farg2) +swig_result = fresult end function -subroutine swigc_FARKodeSPRKTable_Write(farg1, farg2) & -bind(C, name="_wrap_FARKodeSPRKTable_Write") +function FARKodeGetNumRelaxBoundFails(arkode_mem, fails) & +result(swig_result) use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -end subroutine +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: fails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 -subroutine swigc_FARKodeSPRKTable_Space(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKodeSPRKTable_Space") -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 -end subroutine +farg1 = arkode_mem +farg2 = c_loc(fails(1)) +fresult = swigc_FARKodeGetNumRelaxBoundFails(farg1, farg2) +swig_result = fresult +end function -subroutine swigc_FARKodeSPRKTable_Free(farg1) & -bind(C, name="_wrap_FARKodeSPRKTable_Free") +function FARKodeGetNumRelaxSolveFails(arkode_mem, fails) & +result(swig_result) use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -end subroutine +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: fails +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 -function swigc_FARKodeSPRKTable_ToButcher(farg1, farg2, farg3) & -bind(C, name="_wrap_FARKodeSPRKTable_ToButcher") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult +farg1 = arkode_mem +farg2 = c_loc(fails(1)) +fresult = swigc_FARKodeGetNumRelaxSolveFails(farg1, farg2) +swig_result = fresult end function -end interface +function FARKodeGetNumRelaxSolveIters(arkode_mem, iters) & +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) :: iters +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +farg1 = arkode_mem +farg2 = c_loc(iters(1)) +fresult = swigc_FARKodeGetNumRelaxSolveIters(farg1, farg2) +swig_result = fresult +end function -contains - ! MODULE SUBPROGRAMS function FARKBandPrecInit(arkode_mem, n, mu, ml) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -1661,5 +5455,285 @@ function FARKodeSPRKTable_ToButcher(sprk_storage, a_ptr, b_ptr) & swig_result = fresult end function +function FARKodeSetLinearSolver(arkode_mem, ls, a) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(SUNLinearSolver), target, intent(inout) :: ls +type(SUNMatrix), target, intent(inout) :: a +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 + +farg1 = arkode_mem +farg2 = c_loc(ls) +farg3 = c_loc(a) +fresult = swigc_FARKodeSetLinearSolver(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetMassLinearSolver(arkode_mem, ls, m, time_dep) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(SUNLinearSolver), target, intent(inout) :: ls +type(SUNMatrix), target, intent(inout) :: m +integer(C_INT), intent(in) :: time_dep +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 +integer(C_INT) :: farg4 + +farg1 = arkode_mem +farg2 = c_loc(ls) +farg3 = c_loc(m) +farg4 = time_dep +fresult = swigc_FARKodeSetMassLinearSolver(farg1, farg2, farg3, farg4) +swig_result = fresult +end function + +function FARKodeSetJacFn(arkode_mem, jac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: jac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = jac +fresult = swigc_FARKodeSetJacFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMassFn(arkode_mem, mass) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: mass +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = mass +fresult = swigc_FARKodeSetMassFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetJacEvalFrequency(arkode_mem, msbj) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), intent(in) :: msbj +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_LONG) :: farg2 + +farg1 = arkode_mem +farg2 = msbj +fresult = swigc_FARKodeSetJacEvalFrequency(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetLinearSolutionScaling(arkode_mem, onoff) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: onoff +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = onoff +fresult = swigc_FARKodeSetLinearSolutionScaling(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetEpsLin(arkode_mem, eplifac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: eplifac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = eplifac +fresult = swigc_FARKodeSetEpsLin(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMassEpsLin(arkode_mem, eplifac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: eplifac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = eplifac +fresult = swigc_FARKodeSetMassEpsLin(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetLSNormFactor(arkode_mem, nrmfac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: nrmfac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = nrmfac +fresult = swigc_FARKodeSetLSNormFactor(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMassLSNormFactor(arkode_mem, nrmfac) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: nrmfac +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = nrmfac +fresult = swigc_FARKodeSetMassLSNormFactor(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetPreconditioner(arkode_mem, psetup, psolve) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: psetup +type(C_FUNPTR), intent(in), value :: psolve +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 + +farg1 = arkode_mem +farg2 = psetup +farg3 = psolve +fresult = swigc_FARKodeSetPreconditioner(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetMassPreconditioner(arkode_mem, psetup, psolve) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: psetup +type(C_FUNPTR), intent(in), value :: psolve +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 + +farg1 = arkode_mem +farg2 = psetup +farg3 = psolve +fresult = swigc_FARKodeSetMassPreconditioner(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetJacTimes(arkode_mem, jtsetup, jtimes) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: jtsetup +type(C_FUNPTR), intent(in), value :: jtimes +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 + +farg1 = arkode_mem +farg2 = jtsetup +farg3 = jtimes +fresult = swigc_FARKodeSetJacTimes(farg1, farg2, farg3) +swig_result = fresult +end function + +function FARKodeSetJacTimesRhsFn(arkode_mem, jtimesrhsfn) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: jtimesrhsfn +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = jtimesrhsfn +fresult = swigc_FARKodeSetJacTimesRhsFn(farg1, farg2) +swig_result = fresult +end function + +function FARKodeSetMassTimes(arkode_mem, msetup, mtimes, mtimes_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: msetup +type(C_FUNPTR), intent(in), value :: mtimes +type(C_PTR) :: mtimes_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 +type(C_PTR) :: farg4 + +farg1 = arkode_mem +farg2 = msetup +farg3 = mtimes +farg4 = mtimes_data +fresult = swigc_FARKodeSetMassTimes(farg1, farg2, farg3, farg4) +swig_result = fresult +end function + +function FARKodeSetLinSysFn(arkode_mem, linsys) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: linsys +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = linsys +fresult = swigc_FARKodeSetLinSysFn(farg1, farg2) +swig_result = fresult +end function + end module From 6ad80b7b9ec9ba97f5fc91756411dc9692063d97 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Thu, 18 Apr 2024 13:52:28 -0500 Subject: [PATCH 03/39] Ported all exampls to use new shared ARKODE UI functions; fixed some minor bugs --- .../ark_brusselator1D_task_local_nls.cpp | 110 +++--- .../CXX_parallel/ark_diffusion_reaction_p.cpp | 314 +++++++++--------- examples/arkode/CXX_parallel/ark_heat2D_p.cpp | 106 +++--- .../arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp | 94 +++--- .../CXX_parhyp/ark_heat2D_hypre_pfmg.cpp | 110 +++--- .../CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp | 102 +++--- .../CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp | 164 ++++----- .../ark_advection_diffusion_reaction.cpp | 273 +++++++-------- .../ark_advection_diffusion_reaction.hpp | 108 +++--- .../arkode/CXX_serial/ark_analytic_sys.cpp | 62 ++-- examples/arkode/CXX_serial/ark_heat2D.cpp | 106 +++--- examples/arkode/CXX_serial/ark_kpr_Mt.cpp | 138 ++++---- examples/arkode/CXX_serial/ark_pendulum.cpp | 92 ++--- .../ark_brusselator1D_FEM_sludist.cpp | 84 ++--- .../ark_heat2D_hypre_pfmg_xbraid.cpp | 100 +++--- .../arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp | 96 +++--- .../arkode/CXX_xbraid/ark_heat2D_xbraid.cpp | 98 +++--- .../C_manyvector/ark_brusselator1D_manyvec.c | 68 ++-- .../arkode/C_openmp/ark_brusselator1D_omp.c | 60 ++-- examples/arkode/C_openmp/ark_heat1D_omp.c | 80 ++--- .../C_openmpdev/ark_analytic_nonlin_ompdev.c | 24 +- .../C_openmpdev/ark_heat1D_adapt_ompdev.c | 90 ++--- .../arkode/C_openmpdev/ark_heat1D_ompdev.c | 78 ++--- .../ark_brusselator1D_task_local_nls.c | 116 +++---- .../arkode/C_parallel/ark_diurnal_kry_bbd_p.c | 92 ++--- .../arkode/C_parallel/ark_diurnal_kry_p.c | 96 +++--- examples/arkode/C_parhyp/ark_diurnal_kry_ph.c | 92 ++--- examples/arkode/C_petsc/ark_petsc_ex25.c | 52 +-- .../arkode/C_serial/ark_KrylovDemo_prec.c | 108 +++--- examples/arkode/C_serial/ark_analytic.c | 64 ++-- examples/arkode/C_serial/ark_analytic_mels.c | 70 ++-- .../arkode/C_serial/ark_analytic_nonlin.c | 16 +- examples/arkode/C_serial/ark_brusselator.c | 76 ++--- examples/arkode/C_serial/ark_brusselator1D.c | 60 ++-- .../C_serial/ark_brusselator1D_FEM_slu.c | 84 ++--- .../C_serial/ark_brusselator1D_imexmri.c | 138 ++++---- .../arkode/C_serial/ark_brusselator1D_klu.c | 56 ++-- .../arkode/C_serial/ark_brusselator_1D_mri.c | 70 ++-- examples/arkode/C_serial/ark_brusselator_fp.c | 50 +-- .../arkode/C_serial/ark_brusselator_mri.c | 34 +- .../C_serial/ark_conserved_exp_entropy_ark.c | 92 ++--- .../C_serial/ark_conserved_exp_entropy_erk.c | 60 ++-- .../C_serial/ark_damped_harmonic_symplectic.c | 24 +- .../C_serial/ark_dissipated_exp_entropy.c | 92 ++--- .../arkode/C_serial/ark_harmonic_symplectic.c | 28 +- examples/arkode/C_serial/ark_heat1D.c | 78 ++--- examples/arkode/C_serial/ark_heat1D_adapt.c | 78 ++--- examples/arkode/C_serial/ark_kepler.c | 63 ++-- examples/arkode/C_serial/ark_kpr_mri.c | 114 +++---- .../arkode/C_serial/ark_onewaycouple_mri.c | 26 +- .../C_serial/ark_reaction_diffusion_mri.c | 38 +-- examples/arkode/C_serial/ark_robertson.c | 56 ++-- .../C_serial/ark_robertson_constraints.c | 96 +++--- examples/arkode/C_serial/ark_robertson_root.c | 95 +++--- .../arkode/C_serial/ark_twowaycouple_mri.c | 26 +- .../ark_analytic_complex_f2003.f90 | 14 +- .../F2003_custom/ark_brusselator1D_f2003.f90 | 40 +-- ...ark_brusselator1D_task_local_nls_f2003.f90 | 112 +++---- .../F2003_parallel/ark_diag_kry_bbd_f2003.f90 | 68 ++-- .../F2003_parallel/ark_diag_non_f2003.f90 | 32 +- .../F2003_parallel/ark_heat2D_f2003.f90 | 62 ++-- .../F2003_serial/ark_analytic_f2003.f90 | 66 ++-- .../ark_bruss1D_FEM_klu_f2003.f90 | 88 ++--- .../arkode/F2003_serial/ark_bruss_f2003.f90 | 72 ++-- .../F2003_serial/ark_diurnal_kry_bp_f2003.f90 | 76 ++--- .../arkode/F2003_serial/ark_kpr_mri_f2003.f90 | 98 +++--- .../F2003_serial/ark_roberts_dnsL_f2003.f90 | 116 +++---- .../F2003_serial/ark_roberts_dns_f2003.f90 | 116 +++---- include/arkode/arkode_erkstep.h | 3 +- src/arkode/fmod/farkode_erkstep_mod.c | 8 +- src/arkode/fmod/farkode_erkstep_mod.f90 | 26 +- 71 files changed, 2866 insertions(+), 2928 deletions(-) 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 From f7b9e400d233883c26343e727f583624aa7ce039 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Thu, 18 Apr 2024 16:25:51 -0500 Subject: [PATCH 04/39] Ported all unit tests and benchmark codes to use new shared ARKODE UI functions --- .../kokkos/arkode_driver.cpp | 182 +++++++-------- .../raja/arkode_driver.cpp | 182 +++++++-------- benchmarks/diffusion_2D/main_arkode.cpp | 58 ++--- .../CXX_parallel/ark_test_heat2D_mri.cpp | 176 +++++++------- .../CXX_serial/ark_test_analytic_sys_mri.cpp | 150 ++++++------ .../CXX_serial/ark_test_dahlquist_ark.cpp | 70 +++--- .../CXX_serial/ark_test_dahlquist_erk.cpp | 42 ++-- .../CXX_serial/ark_test_dahlquist_mri.cpp | 68 +++--- .../arkode/CXX_serial/ark_test_getjac.cpp | 30 +-- .../arkode/CXX_serial/ark_test_getjac_mri.cpp | 36 +-- .../C_serial/ark_test_arkstepsetforcing.c | 102 ++++---- .../arkode/C_serial/ark_test_getuserdata.c | 34 +-- .../arkode/C_serial/ark_test_innerstepper.c | 16 +- .../arkode/C_serial/ark_test_interp.c | 136 +++++------ .../arkode/C_serial/ark_test_reset.c | 218 +++++++++--------- .../arkode/C_serial/ark_test_tstop.c | 20 +- .../gtest/test_arkode_error_handling.cpp | 4 +- 17 files changed, 763 insertions(+), 761 deletions(-) diff --git a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp index 0acdc8625e..10a9ff1751 100644 --- a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp @@ -71,26 +71,26 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData*", 1, udata->myid)) + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } @@ -106,8 +106,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -121,15 +121,15 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1, udata->myid)) + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1, udata->myid)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, NULL, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1, udata->myid)) + retval = ARKodeSetPreconditioner(arkode_mem, NULL, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1, udata->myid)) { return 1; } @@ -144,8 +144,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -177,8 +177,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -192,24 +192,24 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1, udata->myid); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1, udata->myid); if (uopt->nls == "newton") { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1, udata->myid); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1, udata->myid); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1, udata->myid); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1, udata->myid); } /* Print final statistics */ @@ -230,7 +230,7 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNNonlinSolFree(NLS); if (LS) { SUNLinSolFree(LS); } @@ -265,26 +265,26 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData*", 1, udata->myid)) + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } @@ -300,8 +300,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -314,15 +314,15 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1, udata->myid)) + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1, udata->myid)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, NULL, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1, udata->myid)) + retval = ARKodeSetPreconditioner(arkode_mem, NULL, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1, udata->myid)) { return 1; } @@ -338,8 +338,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -354,8 +354,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -387,8 +387,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -402,24 +402,24 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1, udata->myid); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1, udata->myid); if (uopt->nls == "newton") { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1, udata->myid); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1, udata->myid); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1, udata->myid); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1, udata->myid); } /* Print final statistics */ @@ -440,7 +440,7 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); if (NLS) { SUNNonlinSolFree(NLS); } if (LS) { SUNLinSolFree(LS); } @@ -470,30 +470,30 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ERKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ERKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ERKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ERKStepSetUserData", 1, udata->myid)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ERKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ERKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ERKStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "ERKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } /* Set fixed step size */ - retval = ERKStepSetFixedStep(arkode_mem, 1e-5); - if (check_retval(&retval, "ERKStepSetFixedStep", 1, udata->myid)) + retval = ARKodeSetFixedStep(arkode_mem, 1e-5); + if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) { return 1; } @@ -518,8 +518,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, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -533,14 +533,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, udata->myid); - retval = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ERKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_retval(&retval, "ERKStepGetNumRhsEvals", 1, udata->myid); - retval = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ERKStepGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); /* Print final statistics */ if (udata->myid == 0) @@ -552,7 +552,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* Return success */ return (0); @@ -575,8 +575,8 @@ int TaskLocalNlsResidual(N_Vector ycor, N_Vector F, void* arkode_mem) sunrealtype tcur, gamma; void* user_data; - ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, - &sdata, &user_data); + ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, + &sdata, &user_data); udata = (UserData*)user_data; /* update 'z' value as stored predictor + current corrector */ @@ -615,8 +615,8 @@ int TaskLocalLSolve(N_Vector delta, void* arkode_mem) sunrealtype tcur, gamma; void* user_data = NULL; - ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, - &sdata, &user_data); + ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, + &sdata, &user_data); udata = (UserData*)user_data; SUNDIALS_CXX_MARK_FUNCTION(udata->prof); diff --git a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp index 0acdc8625e..10a9ff1751 100644 --- a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp @@ -71,26 +71,26 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData*", 1, udata->myid)) + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } @@ -106,8 +106,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -121,15 +121,15 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1, udata->myid)) + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1, udata->myid)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, NULL, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1, udata->myid)) + retval = ARKodeSetPreconditioner(arkode_mem, NULL, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1, udata->myid)) { return 1; } @@ -144,8 +144,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -177,8 +177,8 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -192,24 +192,24 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1, udata->myid); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1, udata->myid); if (uopt->nls == "newton") { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1, udata->myid); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1, udata->myid); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1, udata->myid); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1, udata->myid); } /* Print final statistics */ @@ -230,7 +230,7 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNNonlinSolFree(NLS); if (LS) { SUNLinSolFree(LS); } @@ -265,26 +265,26 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ARKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ARKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ARKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKStepSetUserData*", 1, udata->myid)) + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ARKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_retval(&retval, "ARKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } @@ -300,8 +300,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -314,15 +314,15 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach linear solver */ - retval = ARKStepSetLinearSolver(arkode_mem, LS, NULL); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1, udata->myid)) + retval = ARKodeSetLinearSolver(arkode_mem, LS, NULL); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1, udata->myid)) { return 1; } /* Attach preconditioner */ - retval = ARKStepSetPreconditioner(arkode_mem, NULL, PSolve); - if (check_retval(&retval, "ARKStepSetPreconditioner", 1, udata->myid)) + retval = ARKodeSetPreconditioner(arkode_mem, NULL, PSolve); + if (check_retval(&retval, "ARKodeSetPreconditioner", 1, udata->myid)) { return 1; } @@ -338,8 +338,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -354,8 +354,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Attach nonlinear solver */ - retval = ARKStepSetNonlinearSolver(arkode_mem, NLS); - if (check_retval(&retval, "ARKStepSetNonlinearSolver", 1, udata->myid)) + retval = ARKodeSetNonlinearSolver(arkode_mem, NLS); + if (check_retval(&retval, "ARKodeSetNonlinearSolver", 1, udata->myid)) { return 1; } @@ -387,8 +387,8 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) do { /* Integrate to output time */ - retval = ARKStepEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -402,24 +402,24 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) while (iout < uopt->nout); /* Get final statistics */ - retval = ARKStepGetNumSteps(arkode_mem, &nst); - check_retval(&retval, "ARKStepGetNumSteps", 1, udata->myid); - retval = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ARKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); - retval = ARKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ARKStepGetNumErrTestFails", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvIters(arkode_mem, &nni); - check_retval(&retval, "ARKStepGetNumNonlinSolvIters", 1, udata->myid); - retval = ARKStepGetNumNonlinSolvConvFails(arkode_mem, &ncnf); - check_retval(&retval, "ARKStepGetNumNonlinSolvConvFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); + check_retval(&retval, "ARKodeGetNumNonlinSolvIters", 1, udata->myid); + retval = ARKodeGetNumNonlinSolvConvFails(arkode_mem, &ncnf); + check_retval(&retval, "ARKodeGetNumNonlinSolvConvFails", 1, udata->myid); if (uopt->nls == "newton") { - retval = ARKStepGetNumLinIters(arkode_mem, &nli); - check_retval(&retval, "ARKStepGetNumLinIters", 1, udata->myid); - retval = ARKStepGetNumPrecSolves(arkode_mem, &npsol); - check_retval(&retval, "ARKStepGetNumPrecSolves", 1, udata->myid); + retval = ARKodeGetNumLinIters(arkode_mem, &nli); + check_retval(&retval, "ARKodeGetNumLinIters", 1, udata->myid); + retval = ARKodeGetNumPrecSolves(arkode_mem, &npsol); + check_retval(&retval, "ARKodeGetNumPrecSolves", 1, udata->myid); } /* Print final statistics */ @@ -440,7 +440,7 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); if (NLS) { SUNNonlinSolFree(NLS); } if (LS) { SUNLinSolFree(LS); } @@ -470,30 +470,30 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) } /* Select the method order */ - retval = ERKStepSetOrder(arkode_mem, uopt->order); - if (check_retval(&retval, "ERKStepSetOrder", 1, udata->myid)) { return 1; } + retval = ARKodeSetOrder(arkode_mem, uopt->order); + if (check_retval(&retval, "ARKodeSetOrder", 1, udata->myid)) { return 1; } /* Attach user data */ - retval = ERKStepSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ERKStepSetUserData", 1, udata->myid)) { return 1; } + retval = ARKodeSetUserData(arkode_mem, (void*)udata); + if (check_retval(&retval, "ARKodeSetUserData", 1, udata->myid)) { return 1; } /* Specify tolerances */ - retval = ERKStepSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ERKStepSStolerances", 1, udata->myid)) + retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ - retval = ERKStepSetMaxNumSteps(arkode_mem, 1000000); - if (check_retval(&retval, "ERKStepSetMaxNumSteps", 1, udata->myid)) + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); + if (check_retval(&retval, "ARKodeSetMaxNumSteps", 1, udata->myid)) { return 1; } /* Set fixed step size */ - retval = ERKStepSetFixedStep(arkode_mem, 1e-5); - if (check_retval(&retval, "ERKStepSetFixedStep", 1, udata->myid)) + retval = ARKodeSetFixedStep(arkode_mem, 1e-5); + if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) { return 1; } @@ -518,8 +518,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, udata->myid)) { break; } + retval = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1, udata->myid)) { break; } /* Output state */ if (uopt->nout > 0) { WriteOutput(t, y, udata, uopt); } @@ -533,14 +533,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, udata->myid); - retval = ERKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_retval(&retval, "ERKStepGetNumStepAttempts", 1, udata->myid); + retval = ARKodeGetNumSteps(arkode_mem, &nst); + check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); + retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); check_retval(&retval, "ERKStepGetNumRhsEvals", 1, udata->myid); - retval = ERKStepGetNumErrTestFails(arkode_mem, &netf); - check_retval(&retval, "ERKStepGetNumErrTestFails", 1, udata->myid); + retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); + check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); /* Print final statistics */ if (udata->myid == 0) @@ -552,7 +552,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) } /* Clean up */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* Return success */ return (0); @@ -575,8 +575,8 @@ int TaskLocalNlsResidual(N_Vector ycor, N_Vector F, void* arkode_mem) sunrealtype tcur, gamma; void* user_data; - ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, - &sdata, &user_data); + ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, + &sdata, &user_data); udata = (UserData*)user_data; /* update 'z' value as stored predictor + current corrector */ @@ -615,8 +615,8 @@ int TaskLocalLSolve(N_Vector delta, void* arkode_mem) sunrealtype tcur, gamma; void* user_data = NULL; - ARKStepGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, - &sdata, &user_data); + ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, &gamma, + &sdata, &user_data); udata = (UserData*)user_data; SUNDIALS_CXX_MARK_FUNCTION(udata->prof); diff --git a/benchmarks/diffusion_2D/main_arkode.cpp b/benchmarks/diffusion_2D/main_arkode.cpp index e3f8962ad8..c35bf9e9c7 100644 --- a/benchmarks/diffusion_2D/main_arkode.cpp +++ b/benchmarks/diffusion_2D/main_arkode.cpp @@ -245,49 +245,49 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkode_mem, uopts.rtol, uopts.atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, uopts.rtol, uopts.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; } #if defined(USE_SUPERLU_DIST) if (uopts.ls == "sludist") { - ARKStepSetJacFn(arkode_mem, diffusion_jac); - if (check_flag(&flag, "ARKStepSetJacFn", 1)) return 1; + ARKodeSetJacFn(arkode_mem, diffusion_jac); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) return 1; } #endif if (uopts.preconditioning) { // 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, uopts.msbp); - if (check_flag(&flag, "ARKStepSetLSetupFrequency", 1)) { return 1; } + flag = ARKodeSetLSetupFrequency(arkode_mem, uopts.msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } } // Set linear solver tolerance factor - flag = ARKStepSetEpsLin(arkode_mem, uopts.epslin); - if (check_flag(&flag, "ARKStepSetEpsLin", 1)) { return 1; } + flag = ARKodeSetEpsLin(arkode_mem, uopts.epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } // Select method order - flag = ARKStepSetOrder(arkode_mem, uopts.order); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, uopts.order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } // Set fixed step size or adaptivity method if (uopts.hfixed > ZERO) { - flag = ARKStepSetFixedStep(arkode_mem, uopts.hfixed); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, uopts.hfixed); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } } else { @@ -299,17 +299,17 @@ int main(int argc, char* argv[]) // Specify linearly implicit non-time-dependent RHS if (uopts.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, uopts.maxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, uopts.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 @@ -341,8 +341,8 @@ int main(int argc, char* argv[]) SUNDIALS_MARK_BEGIN(prof, "Evolve"); // Evolve in time - 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; } SUNDIALS_MARK_END(prof, "Evolve"); @@ -367,8 +367,8 @@ int main(int argc, char* argv[]) if (outproc) { cout << "Final integrator statistics:" << endl; - flag = ARKStepPrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); - if (check_flag(&flag, "ARKStepPrintAllStats", 1)) { return 1; } + flag = ARKodePrintAllStats(arkode_mem, stdout, SUN_OUTPUTFORMAT_TABLE); + if (check_flag(&flag, "ARKodePrintAllStats", 1)) { return 1; } } // --------- @@ -378,7 +378,7 @@ int main(int argc, char* argv[]) // Free MPI Cartesian communicator MPI_Comm_free(&(udata.comm_c)); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); SUNLinSolFree(LS); // Free the SuperLU_DIST structures (also frees user allocated arrays diff --git a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp index 8a60b4801e..86b8efb0d3 100644 --- a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp +++ b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp @@ -258,86 +258,86 @@ int main(int argc, char* argv[]) if (check_flag((void*)C, "MRIStepCoupling_MIStoMRI", 0)) { return 1; } // Set routines - flag = ARKStepSetUserData(arkstep_mem, - (void*)udata); // Pass udata to user functions - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSetNonlinConvCoef(arkstep_mem, - SUN_RCONST(1.e-7)); // Update solver convergence coeff. - if (check_flag(&flag, "ARKStepSetNonlinConvCoef", 1)) { return 1; } - flag = ARKStepSStolerances(arkstep_mem, rtol, atol); // Specify tolerances - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetFixedStep(arkstep_mem, Tf / Nt); // Specify fixed time step size - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetUserData(arkstep_mem, + (void*)udata); // Pass udata to user functions + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetNonlinConvCoef(arkstep_mem, + SUN_RCONST(1.e-7)); // Update solver convergence coeff. + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return 1; } + flag = ARKodeSStolerances(arkstep_mem, rtol, atol); // Specify tolerances + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkstep_mem, Tf / Nt); // Specify fixed time step size + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } flag = ARKStepSetTables(arkstep_mem, 2, 0, B, NULL); // Specify Butcher table if (check_flag(&flag, "ARKStepSetTables", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkstep_mem, 2 * Nt); // Increase num internal steps - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - - flag = MRIStepSetUserData(mristep_mem, - (void*)udata); // Pass udata to user functions - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } - flag = MRIStepSetNonlinConvCoef(mristep_mem, - SUN_RCONST(1.e-7)); // Update solver convergence coeff. - if (check_flag(&flag, "MRIStepSetNonlinConvCoef", 1)) { return 1; } - flag = MRIStepSStolerances(mristep_mem, rtol, atol); // Specify tolerances - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } - flag = MRIStepSetFixedStep(mristep_mem, Tf / Nt); // Specify fixed time step sizes - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } - flag = ARKStepSetFixedStep(inner_mem, Tf / Nt / 10); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } - flag = MRIStepSetCoupling(mristep_mem, C); // Specify Butcher table + flag = ARKodeSetMaxNumSteps(arkstep_mem, 2 * Nt); // Increase num internal steps + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + + flag = ARKodeSetUserData(mristep_mem, + (void*)udata); // Pass udata to user functions + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSetNonlinConvCoef(mristep_mem, + SUN_RCONST(1.e-7)); // Update solver convergence coeff. + if (check_flag(&flag, "ARKodeSetNonlinConvCoef", 1)) { return 1; } + flag = ARKodeSStolerances(mristep_mem, rtol, atol); // Specify tolerances + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetFixedStep(mristep_mem, Tf / Nt); // Specify fixed time step sizes + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(inner_mem, Tf / Nt / 10); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } + flag = MRIStepSetCoupling(mristep_mem, C); // Specify coupling table if (check_flag(&flag, "MRIStepSetCoupling", 1)) { return 1; } - flag = MRIStepSetMaxNumSteps(mristep_mem, 2 * Nt); // Increase num internal steps - if (check_flag(&flag, "MRIStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(mristep_mem, 2 * Nt); // Increase num internal steps + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Linear solver interface - flag = ARKStepSetLinearSolver(arkstep_mem, LSa, NULL); // Attach linear solver - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetPreconditioner(arkstep_mem, PSet, - PSol); // Specify the Preconditoner - if (check_flag(&flag, "ARKStepSetPreconditioner", 1)) { return 1; } - - flag = MRIStepSetLinearSolver(mristep_mem, LSm, NULL); // Attach linear solver - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } - flag = MRIStepSetPreconditioner(mristep_mem, PSet, - PSol); // Specify the Preconditoner - if (check_flag(&flag, "MRIStepSetPreconditioner", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkstep_mem, LSa, NULL); // Attach linear solver + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetPreconditioner(arkstep_mem, PSet, + PSol); // Specify the Preconditoner + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } + + flag = ARKodeSetLinearSolver(mristep_mem, LSm, NULL); // Attach linear solver + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetPreconditioner(mristep_mem, PSet, + PSol); // Specify the Preconditoner + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } // Optionally specify linearly implicit RHS, with non-time-dependent preconditioner if (linear) { - flag = ARKStepSetLinear(arkstep_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkstep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } - flag = MRIStepSetLinear(mristep_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(mristep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } - // First call ARKStep to evolve the full problem, and print results + // First call ARKodeEvolve to evolve the full problem, and print results t = T0; N_VConst(ZERO, y); - flag = ARKStepEvolve(arkstep_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } - flag = ARKStepGetNumSteps(arkstep_mem, &ark_nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeEvolve(arkstep_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } + flag = ARKodeGetNumSteps(arkstep_mem, &ark_nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } flag = ARKStepGetNumRhsEvals(arkstep_mem, &ark_nfe, &ark_nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return 1; } - flag = ARKStepGetNumLinSolvSetups(arkstep_mem, &ark_nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvIters(arkstep_mem, &ark_nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkstep_mem, &ark_ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return 1; } - flag = ARKStepGetNumLinIters(arkstep_mem, &ark_nli); - if (check_flag(&flag, "ARKStepGetNumLinIters", 1)) { return 1; } - flag = ARKStepGetNumJtimesEvals(arkstep_mem, &ark_nJv); - if (check_flag(&flag, "ARKStepGetNumJtimesEvals", 1)) { return 1; } - flag = ARKStepGetNumLinConvFails(arkstep_mem, &ark_nlcf); - if (check_flag(&flag, "ARKStepGetNumLinConvFails", 1)) { return 1; } - flag = ARKStepGetNumPrecEvals(arkstep_mem, &ark_npe); - if (check_flag(&flag, "ARKStepGetNumPrecEvals", 1)) { return 1; } - flag = ARKStepGetNumPrecSolves(arkstep_mem, &ark_nps); - if (check_flag(&flag, "ARKStepGetNumPrecSolves", 1)) { return 1; } + flag = ARKodeGetNumLinSolvSetups(arkstep_mem, &ark_nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(arkstep_mem, &ark_nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkstep_mem, &ark_ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } + flag = ARKodeGetNumLinIters(arkstep_mem, &ark_nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return 1; } + flag = ARKodeGetNumJtimesEvals(arkstep_mem, &ark_nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return 1; } + flag = ARKodeGetNumLinConvFails(arkstep_mem, &ark_nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return 1; } + flag = ARKodeGetNumPrecEvals(arkstep_mem, &ark_npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return 1; } + flag = ARKodeGetNumPrecSolves(arkstep_mem, &ark_nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return 1; } if (outproc) { cout << "\nARKStep Solver Statistics:\n"; @@ -356,31 +356,31 @@ int main(int argc, char* argv[]) << ark_ncfn << "\n"; } - // Second call MRIStep to evolve the full problem, and print results + // Second call ARKodeEvolve to evolve the full problem, and print results t = T0; N_VConst(ZERO, y); - flag = MRIStepEvolve(mristep_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "MRIStepEvolve", 1)) { return 1; } - flag = MRIStepGetNumSteps(mristep_mem, &mri_nst); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return 1; } + flag = ARKodeEvolve(mristep_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } + flag = ARKodeGetNumSteps(mristep_mem, &mri_nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } flag = MRIStepGetNumRhsEvals(mristep_mem, &mri_nfse, &mri_nfsi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return 1; } - flag = MRIStepGetNumLinSolvSetups(mristep_mem, &mri_nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return 1; } - flag = MRIStepGetNumNonlinSolvIters(mristep_mem, &mri_nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = MRIStepGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) { return 1; } - flag = MRIStepGetNumLinIters(mristep_mem, &mri_nli); - if (check_flag(&flag, "MRIStepGetNumLinIters", 1)) { return 1; } - flag = MRIStepGetNumJtimesEvals(mristep_mem, &mri_nJv); - if (check_flag(&flag, "MRIStepGetNumJtimesEvals", 1)) { return 1; } - flag = MRIStepGetNumLinConvFails(mristep_mem, &mri_nlcf); - if (check_flag(&flag, "MRIStepGetNumLinConvFails", 1)) { return 1; } - flag = MRIStepGetNumPrecEvals(mristep_mem, &mri_npe); - if (check_flag(&flag, "MRIStepGetNumPrecEvals", 1)) { return 1; } - flag = MRIStepGetNumPrecSolves(mristep_mem, &mri_nps); - if (check_flag(&flag, "MRIStepGetNumPrecSolves", 1)) { return 1; } + flag = ARKodeGetNumLinSolvSetups(mristep_mem, &mri_nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(mristep_mem, &mri_nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } + flag = ARKodeGetNumLinIters(mristep_mem, &mri_nli); + if (check_flag(&flag, "ARKodeGetNumLinIters", 1)) { return 1; } + flag = ARKodeGetNumJtimesEvals(mristep_mem, &mri_nJv); + if (check_flag(&flag, "ARKodeGetNumJtimesEvals", 1)) { return 1; } + flag = ARKodeGetNumLinConvFails(mristep_mem, &mri_nlcf); + if (check_flag(&flag, "ARKodeGetNumLinConvFails", 1)) { return 1; } + flag = ARKodeGetNumPrecEvals(mristep_mem, &mri_npe); + if (check_flag(&flag, "ARKodeGetNumPrecEvals", 1)) { return 1; } + flag = ARKodeGetNumPrecSolves(mristep_mem, &mri_nps); + if (check_flag(&flag, "ARKodeGetNumPrecSolves", 1)) { return 1; } if (outproc) { cout << "\nMRIStep Solver Statistics:\n"; @@ -491,9 +491,9 @@ int main(int argc, char* argv[]) ARKodeButcherTable_Free(B); // Free Butcher table ARKodeButcherTable_Free(Bc); // Free Butcher table MRIStepCoupling_Free(C); // Free MRI coupling table - ARKStepFree(&arkstep_mem); // Free integrator memory - MRIStepFree(&mristep_mem); - ARKStepFree(&inner_mem); + ARKodeFree(&arkstep_mem); // Free integrator memory + ARKodeFree(&mristep_mem); + ARKodeFree(&inner_mem); MRIStepInnerStepper_Free(&inner_stepper); SUNLinSolFree(LSa); // Free linear solver SUNLinSolFree(LSm); diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp index 1a6cbe642a..e2cb57a011 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp @@ -162,31 +162,31 @@ int main(int argc, char* argv[]) if (check_flag((void*)C, "MRIStepCoupling_MIStoMRI", 0)) { return 1; } // Set routines - flag = ARKStepSetUserData(arkstep_mem, - (void*)&lamda); // Pass lamda to user functions - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } - flag = ARKStepSStolerances(arkstep_mem, reltol, abstol); // Specify tolerances - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } - flag = ARKStepSetFixedStep(arkstep_mem, Tf / Nt); // Specify fixed time step size - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetUserData(arkstep_mem, + (void*)&lamda); // Pass lamda to user functions + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(arkstep_mem, reltol, abstol); // Specify tolerances + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkstep_mem, Tf / Nt); // Specify fixed time step size + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } flag = ARKStepSetTables(arkstep_mem, 2, 0, B, NULL); // Specify Butcher table if (check_flag(&flag, "ARKStepSetTables", 1)) { return 1; } - flag = ARKStepSetMaxNumSteps(arkstep_mem, 2 * Nt); // Increase num internal steps - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } - - flag = MRIStepSetUserData(mristep_mem, - (void*)&lamda); // Pass lamda to user functions - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } - flag = MRIStepSStolerances(mristep_mem, reltol, abstol); // Specify tolerances - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } - flag = MRIStepSetFixedStep(mristep_mem, Tf / Nt); // Specify fixed time step sizes - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } - flag = ARKStepSetFixedStep(inner_mem, Tf / Nt / 10); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } - flag = MRIStepSetCoupling(mristep_mem, C); // Specify Butcher table + flag = ARKodeSetMaxNumSteps(arkstep_mem, 2 * Nt); // Increase num internal steps + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } + + flag = ARKodeSetUserData(mristep_mem, + (void*)&lamda); // Pass lamda to user functions + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } + flag = ARKodeSStolerances(mristep_mem, reltol, abstol); // Specify tolerances + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } + flag = ARKodeSetFixedStep(mristep_mem, Tf / Nt); // Specify fixed time step sizes + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(inner_mem, Tf / Nt / 10); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } + flag = MRIStepSetCoupling(mristep_mem, C); // Specify coupling table if (check_flag(&flag, "MRIStepSetCoupling", 1)) { return 1; } - flag = MRIStepSetMaxNumSteps(mristep_mem, 2 * Nt); // Increase num internal steps - if (check_flag(&flag, "MRIStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(mristep_mem, 2 * Nt); // Increase num internal steps + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } // Initialize implicit solver data structures if (fixedpoint) @@ -194,13 +194,13 @@ int main(int argc, char* argv[]) // Initialize fixed-point solvers and attach to integrators NLSa = SUNNonlinSol_FixedPoint(y, 50, sunctx); if (check_flag((void*)NLSa, "SUNNonlinSol_FixedPoint", 0)) { return 1; } - flag = ARKStepSetNonlinearSolver(arkstep_mem, NLSa); - if (check_flag(&flag, "ARKStepSetNonlinearSolver", 1)) { return 1; } + flag = ARKodeSetNonlinearSolver(arkstep_mem, NLSa); + if (check_flag(&flag, "ARKodeSetNonlinearSolver", 1)) { return 1; } NLSm = SUNNonlinSol_FixedPoint(y, 50, sunctx); if (check_flag((void*)NLSm, "SUNNonlinSol_FixedPoint", 0)) { return 1; } - flag = MRIStepSetNonlinearSolver(mristep_mem, NLSm); - if (check_flag(&flag, "MRIStepSetNonlinearSolver", 1)) { return 1; } + flag = ARKodeSetNonlinearSolver(mristep_mem, NLSm); + if (check_flag(&flag, "ARKodeSetNonlinearSolver", 1)) { return 1; } } else { @@ -216,47 +216,47 @@ int main(int argc, char* argv[]) if (check_flag((void*)LSm, "SUNLinSol_Dense", 0)) { return 1; } // Linear solver interface - flag = ARKStepSetLinearSolver(arkstep_mem, LSa, Aa); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } - flag = ARKStepSetJacFn(arkstep_mem, Jac); - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkstep_mem, LSa, Aa); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(arkstep_mem, Jac); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } - flag = MRIStepSetLinearSolver(mristep_mem, LSm, Am); - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } - flag = MRIStepSetJacFn(mristep_mem, Jac); - if (check_flag(&flag, "MRIStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetLinearSolver(mristep_mem, LSm, Am); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetJacFn(mristep_mem, Jac); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } // Specify linearly implicit RHS, with non-time-dependent Jacobian - flag = ARKStepSetLinear(arkstep_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkstep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } - flag = MRIStepSetLinear(mristep_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(mristep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } - // First call ARKStep to evolve the full problem, and print results + // First call ARKodeEvolve to evolve the full problem, and print results t = T0; N_VConst(ONE, y); - flag = ARKStepEvolve(arkstep_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } - flag = ARKStepGetCurrentTime(arkstep_mem, &tcur); - if (check_flag(&flag, "ARKStepGetCurrentTime", 1)) { return 1; } - flag = ARKStepGetNumSteps(arkstep_mem, &ark_nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeEvolve(arkstep_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } + flag = ARKodeGetCurrentTime(arkstep_mem, &tcur); + if (check_flag(&flag, "ARKodeGetCurrentTime", 1)) { return 1; } + flag = ARKodeGetNumSteps(arkstep_mem, &ark_nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } flag = ARKStepGetNumRhsEvals(arkstep_mem, &ark_nfe, &ark_nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvIters(arkstep_mem, &ark_nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = ARKStepGetNumNonlinSolvConvFails(arkstep_mem, &ark_ncfn); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvConvFails", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(arkstep_mem, &ark_nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvConvFails(arkstep_mem, &ark_ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } if (!fixedpoint) { - flag = ARKStepGetNumLinSolvSetups(arkstep_mem, &ark_nsetups); - if (check_flag(&flag, "ARKStepGetNumLinSolvSetups", 1)) { return 1; } - flag = ARKStepGetNumJacEvals(arkstep_mem, &ark_nje); - if (check_flag(&flag, "ARKStepGetNumJacEvals", 1)) { return 1; } - flag = ARKStepGetNumLinRhsEvals(arkstep_mem, &ark_nfeLS); - check_flag(&flag, "ARKStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(arkstep_mem, &ark_nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } + flag = ARKodeGetNumJacEvals(arkstep_mem, &ark_nje); + if (check_flag(&flag, "ARKodeGetNumJacEvals", 1)) { return 1; } + flag = ARKodeGetNumLinRhsEvals(arkstep_mem, &ark_nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); } cout << "\nARKStep Solver Statistics:\n"; cout << " Return time = " << t << "\n"; @@ -275,29 +275,29 @@ int main(int argc, char* argv[]) cout << " Total number of Jacobian evaluations = " << ark_nje << "\n"; } - // Second call MRIStep to evolve the full problem, and print results + // Second call ARKodeEvolve to evolve the full problem, and print results t = T0; N_VConst(ZERO, y); - flag = MRIStepEvolve(mristep_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "MRIStepEvolve", 1)) { return 1; } - flag = MRIStepGetCurrentTime(arkstep_mem, &tcur); - if (check_flag(&flag, "MRIStepGetCurrentTime", 1)) { return 1; } - flag = MRIStepGetNumSteps(mristep_mem, &mri_nst); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return 1; } + flag = ARKodeEvolve(mristep_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } + flag = ARKodeGetCurrentTime(arkstep_mem, &tcur); + if (check_flag(&flag, "ARKodeGetCurrentTime", 1)) { return 1; } + flag = ARKodeGetNumSteps(mristep_mem, &mri_nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } flag = MRIStepGetNumRhsEvals(mristep_mem, &mri_nfse, &mri_nfsi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return 1; } - flag = MRIStepGetNumNonlinSolvIters(mristep_mem, &mri_nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return 1; } - flag = MRIStepGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(mristep_mem, &mri_nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } if (!fixedpoint) { - flag = MRIStepGetNumLinSolvSetups(mristep_mem, &mri_nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return 1; } - flag = MRIStepGetNumJacEvals(mristep_mem, &mri_nje); - if (check_flag(&flag, "MRIStepGetNumJacEvals", 1)) { return 1; } - flag = MRIStepGetNumLinRhsEvals(mristep_mem, &mri_nfeLS); - check_flag(&flag, "MRIStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinSolvSetups(mristep_mem, &mri_nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } + flag = ARKodeGetNumJacEvals(mristep_mem, &mri_nje); + if (check_flag(&flag, "ARKodeGetNumJacEvals", 1)) { return 1; } + flag = ARKodeGetNumLinRhsEvals(mristep_mem, &mri_nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); } cout << "\nMRIStep Solver Statistics:\n"; cout << " Return time = " << t << "\n"; @@ -369,9 +369,9 @@ int main(int argc, char* argv[]) ARKodeButcherTable_Free(B); // Free Butcher table ARKodeButcherTable_Free(Bc); // Free Butcher table MRIStepCoupling_Free(C); // Free MRI coupling table - ARKStepFree(&arkstep_mem); // Free integrator memory - MRIStepFree(&mristep_mem); - ARKStepFree(&inner_mem); + ARKodeFree(&arkstep_mem); // Free integrator memory + ARKodeFree(&mristep_mem); + ARKodeFree(&inner_mem); MRIStepInnerStepper_Free(&inner_stepper); if (fixedpoint) { diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp index d08ddf3a30..6a98c79797 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp @@ -468,16 +468,16 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, if (check_flag((void*)arkstep_mem, "ARKStepCreate", 0)) { return 1; } // Set user data - flag = ARKStepSetUserData(arkstep_mem, &prob_data); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkstep_mem, &prob_data); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkstep_mem, prob_opts.reltol, prob_opts.abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkstep_mem, prob_opts.reltol, prob_opts.abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Specify fixed time step size - flag = ARKStepSetFixedStep(arkstep_mem, prob_opts.h); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkstep_mem, prob_opts.h); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Attach Butcher tables (ignore actual method order) flag = ARKStepSetTables(arkstep_mem, 1, 0, Bi, Be); @@ -486,8 +486,8 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Lagrange interpolant (removes additional RHS evaluation with DIRK methods) if (prob_opts.i_type == interp_type::lagrange) { - flag = ARKStepSetInterpolantType(arkstep_mem, ARK_INTERP_LAGRANGE); - if (check_flag(&flag, "ARKStepSetInterpolantType", 1)) { return 1; } + flag = ARKodeSetInterpolantType(arkstep_mem, ARK_INTERP_LAGRANGE); + if (check_flag(&flag, "ARKodeSetInterpolantType", 1)) { return 1; } } // Create matrix and linear solver (if necessary) @@ -504,20 +504,20 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, if (check_flag((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } // Attach linear solver - flag = ARKStepSetLinearSolver(arkstep_mem, LS, A); - if (check_flag(&flag, "ARKStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(arkstep_mem, LS, A); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } // Set Jacobian function - flag = ARKStepSetJacFn(arkstep_mem, Ji); - if (check_flag(&flag, "ARKStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetJacFn(arkstep_mem, Ji); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } // Specify linearly implicit RHS, with non-time-dependent Jacobian - flag = ARKStepSetLinear(arkstep_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(arkstep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } // Specify implicit predictor method - flag = ARKStepSetPredictorMethod(arkstep_mem, prob_opts.p_type); - if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } + flag = ARKodeSetPredictorMethod(arkstep_mem, prob_opts.p_type); + if (check_flag(&flag, "ARKodeSetPredictorMethod", 1)) { return 1; } } // Create mass matrix and linear solver (if necessary) @@ -536,11 +536,11 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, int time_dep = 0; if (prob_data.m_type == mass_matrix_type::time_dependent) { time_dep = 1; } - flag = ARKStepSetMassLinearSolver(arkstep_mem, MLS, M, time_dep); - if (check_flag(&flag, "ARKStepSetMassLinearSolver", 1)) { return 1; } + flag = ARKodeSetMassLinearSolver(arkstep_mem, MLS, M, time_dep); + if (check_flag(&flag, "ARKodeSetMassLinearSolver", 1)) { return 1; } - flag = ARKStepSetMassFn(arkstep_mem, MassMatrix); - if (check_flag(&flag, "ARKStepSetMassFn", 1)) { return 1; } + flag = ARKodeSetMassFn(arkstep_mem, MassMatrix); + if (check_flag(&flag, "ARKodeSetMassFn", 1)) { return 1; } } // -------------- @@ -557,8 +557,8 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, std::cout << "--------------------" << std::endl; // Advance in time - flag = ARKStepEvolve(arkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(arkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } // Update output time t_out += prob_opts.h; @@ -592,11 +592,11 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, std::cout << "Dense Output" << std::endl; sunrealtype h_last; - flag = ARKStepGetLastStep(arkstep_mem, &h_last); - if (check_flag(&flag, "ARKStepGetLastStep", 1)) { return 1; } + flag = ARKodeGetLastStep(arkstep_mem, &h_last); + if (check_flag(&flag, "ARKodeGetLastStep", 1)) { return 1; } - flag = ARKStepGetDky(arkstep_mem, t_ret - h_last / TWO, 0, y); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkstep_mem, t_ret - h_last / TWO, 0, y); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } // Stiffly accurate (and FSAL) methods do not require an additional RHS // evaluation to get the new RHS value at the end of a step for dense @@ -652,8 +652,8 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, if (numfails == 0) { // Advance in time - flag = ARKStepEvolve(arkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(arkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } // Update output time t_out += prob_opts.h; @@ -675,7 +675,7 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Clean up // -------- - ARKStepFree(&arkstep_mem); + ARKodeFree(&arkstep_mem); SUNLinSolFree(LS); SUNMatDestroy(A); SUNLinSolFree(MLS); @@ -746,8 +746,8 @@ int expected_rhs_evals(ProblemOptions& prob_opts, int stages, int order, // Get number of steps and nonlinear solver iterations long int nst = 0; - flag = ARKStepGetNumSteps(arkstep_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeGetNumSteps(arkstep_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } long int nni = 0; long int extra_fe_evals = 0; @@ -755,8 +755,8 @@ int expected_rhs_evals(ProblemOptions& prob_opts, int stages, int order, if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { - flag = ARKStepGetNumNonlinSolvIters(arkstep_mem, &nni); - if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(arkstep_mem, &nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } } // Expected number of explicit functions evaluations @@ -829,8 +829,8 @@ int check_rhs_evals(rk_type r_type, void* arkstep_mem, long int nfe_expected, int flag = 0; long int nst; - flag = ARKStepGetNumSteps(arkstep_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeGetNumSteps(arkstep_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } long int nfe, nfi; flag = ARKStepGetNumRhsEvals(arkstep_mem, &nfe, &nfi); diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_erk.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_erk.cpp index 9338d33550..a97e27ecd8 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_erk.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_erk.cpp @@ -234,22 +234,22 @@ int run_tests(ARKodeButcherTable Be, ProblemData& prob_data, if (check_flag((void*)erkstep_mem, "ERKStepCreate", 0)) { return 1; } // Set user data - flag = ERKStepSetUserData(erkstep_mem, &prob_data); - if (check_flag(&flag, "ERKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(erkstep_mem, &prob_data); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Specify tolerances - flag = ERKStepSStolerances(erkstep_mem, prob_opts.reltol, prob_opts.abstol); - if (check_flag(&flag, "ERKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(erkstep_mem, prob_opts.reltol, prob_opts.abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Specify fixed time step size - flag = ERKStepSetFixedStep(erkstep_mem, prob_opts.h); - if (check_flag(&flag, "ERKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(erkstep_mem, prob_opts.h); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Lagrange interpolant (removes additional RHS evaluation with DIRK methods) if (prob_opts.i_type == interp_type::lagrange) { - flag = ERKStepSetInterpolantType(erkstep_mem, ARK_INTERP_LAGRANGE); - if (check_flag(&flag, "ERKStepSetInterpolantType", 1)) { return 1; } + flag = ARKodeSetInterpolantType(erkstep_mem, ARK_INTERP_LAGRANGE); + if (check_flag(&flag, "ARKodeSetInterpolantType", 1)) { return 1; } } // Attach Butcher tables @@ -270,8 +270,8 @@ int run_tests(ARKodeButcherTable Be, ProblemData& prob_data, std::cout << "--------------------" << std::endl; // Advance in time - flag = ERKStepEvolve(erkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); - if (check_flag(&flag, "ERKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(erkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } // Update output time t_out += prob_opts.h; @@ -302,11 +302,11 @@ int run_tests(ARKodeButcherTable Be, ProblemData& prob_data, std::cout << "Dense Output" << std::endl; sunrealtype h_last; - flag = ERKStepGetLastStep(erkstep_mem, &h_last); - if (check_flag(&flag, "ERKStepGetLastStep", 1)) { return 1; } + flag = ARKodeGetLastStep(erkstep_mem, &h_last); + if (check_flag(&flag, "ARKodeGetLastStep", 1)) { return 1; } - flag = ERKStepGetDky(erkstep_mem, t_ret - h_last / TWO, 0, y); - if (check_flag(&flag, "ERKStepGetDky", 1)) { return 1; } + flag = ARKodeGetDky(erkstep_mem, t_ret - h_last / TWO, 0, y); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } // Stiffly accurate (and FSAL) methods do not require an additional RHS // evaluation to get the new RHS value at the end of a step for dense @@ -342,8 +342,8 @@ int run_tests(ARKodeButcherTable Be, ProblemData& prob_data, if (numfails == 0) { // Advance in time - flag = ERKStepEvolve(erkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); - if (check_flag(&flag, "ERKStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(erkstep_mem, t_out, y, &t_ret, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } // Update output time t_out += prob_opts.h; @@ -362,7 +362,7 @@ int run_tests(ARKodeButcherTable Be, ProblemData& prob_data, // Clean up // -------- - ERKStepFree(&erkstep_mem); + ARKodeFree(&erkstep_mem); N_VDestroy(y); return numfails; @@ -409,8 +409,8 @@ int expected_rhs_evals(interp_type i_type, int stages, // Get number of steps and nonlinear solver iterations long int nst = 0; - flag = ERKStepGetNumSteps(erkstep_mem, &nst); - if (check_flag(&flag, "ERKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeGetNumSteps(erkstep_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } // Expected number of explicit functions evaluations nfe_expected = 0; @@ -445,8 +445,8 @@ int check_rhs_evals(void* erkstep_mem, long int nfe_expected) int flag = 0; long int nst = 0; - flag = ERKStepGetNumSteps(erkstep_mem, &nst); - if (check_flag(&flag, "ERKStepGetNumSteps", 1)) { return 1; } + flag = ARKodeGetNumSteps(erkstep_mem, &nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } long int nfe; flag = ERKStepGetNumRhsEvals(erkstep_mem, &nfe); diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp index 06546062e5..2b8211e9ec 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp @@ -173,16 +173,16 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, if (check_flag((void*)arkstep_mem, "ARKStepCreate", 0)) { return 1; } // Set user data - flag = ARKStepSetUserData(arkstep_mem, udata); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkstep_mem, udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Specify tolerances - flag = ARKStepSStolerances(arkstep_mem, reltol, abstol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkstep_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Specify fixed time step size - flag = ARKStepSetFixedStep(arkstep_mem, hf); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkstep_mem, hf); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } // Wrap ARKStep integrator as fast integrator object MRIStepInnerStepper inner_stepper = nullptr; @@ -212,30 +212,30 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, if (check_flag((void*)mristep_mem, "MRIStepCreate", 0)) { return 1; } // Set user data - flag = MRIStepSetUserData(mristep_mem, udata); - if (check_flag(&flag, "MRIStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(mristep_mem, udata); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } // Specify tolerances - flag = MRIStepSStolerances(mristep_mem, reltol, abstol); - if (check_flag(&flag, "MRIStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(mristep_mem, reltol, abstol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Specify fixed time step sizes - flag = MRIStepSetFixedStep(mristep_mem, hs); - if (check_flag(&flag, "MRIStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(mristep_mem, hs); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } if (type == MRISTEP_IMPLICIT || type == MRISTEP_IMEX) { // Attach linear solver - flag = MRIStepSetLinearSolver(mristep_mem, LS, A); - if (check_flag(&flag, "MRIStepSetLinearSolver", 1)) { return 1; } + flag = ARKodeSetLinearSolver(mristep_mem, LS, A); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } // Set Jacobian function - flag = MRIStepSetJacFn(mristep_mem, Ji); - if (check_flag(&flag, "MRIStepSetJacFn", 1)) { return 1; } + flag = ARKodeSetJacFn(mristep_mem, Ji); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) { return 1; } // Specify linearly implicit RHS, with non-time-dependent Jacobian - flag = MRIStepSetLinear(mristep_mem, 0); - if (check_flag(&flag, "MRIStepSetLinear", 1)) { return 1; } + flag = ARKodeSetLinear(mristep_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } } // ------------------------------------ @@ -338,8 +338,8 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, for (int i = 0; i < nsteps; i++) { // Advance in time - flag = MRIStepEvolve(mristep_mem, tf, y, &t, ARK_ONE_STEP); - if (check_flag(&flag, "MRIStepEvolve", 1)) { return 1; } + flag = ARKodeEvolve(mristep_mem, tf, y, &t, ARK_ONE_STEP); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } // Update output time tf += hs; @@ -353,31 +353,31 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, long int mri_nni, mri_ncfn; // nonlinear solver long int mri_nsetups, mri_nje, mri_nfeLS; // linear solver - flag = MRIStepGetNumSteps(mristep_mem, &mri_nst); - if (check_flag(&flag, "MRIStepGetNumSteps", 1)) { return 1; } + flag = ARKodeGetNumSteps(mristep_mem, &mri_nst); + if (check_flag(&flag, "ARKodeGetNumSteps", 1)) { return 1; } flag = MRIStepGetNumRhsEvals(mristep_mem, &mri_nfse, &mri_nfsi); if (check_flag(&flag, "MRIStepGetNumRhsEvals", 1)) { return 1; } if (type == MRISTEP_IMPLICIT || type == MRISTEP_IMEX) { - flag = MRIStepGetNumNonlinSolvIters(mristep_mem, &mri_nni); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvIters", 1)) { return 1; } + flag = ARKodeGetNumNonlinSolvIters(mristep_mem, &mri_nni); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } - flag = MRIStepGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); - if (check_flag(&flag, "MRIStepGetNumNonlinSolvConvFails", 1)) + flag = ARKodeGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } - flag = MRIStepGetNumLinSolvSetups(mristep_mem, &mri_nsetups); - if (check_flag(&flag, "MRIStepGetNumLinSolvSetups", 1)) { return 1; } + flag = ARKodeGetNumLinSolvSetups(mristep_mem, &mri_nsetups); + if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } - flag = MRIStepGetNumJacEvals(mristep_mem, &mri_nje); - if (check_flag(&flag, "MRIStepGetNumJacEvals", 1)) { return 1; } + flag = ARKodeGetNumJacEvals(mristep_mem, &mri_nje); + if (check_flag(&flag, "ARKodeGetNumJacEvals", 1)) { return 1; } - flag = MRIStepGetNumLinRhsEvals(mristep_mem, &mri_nfeLS); - check_flag(&flag, "MRIStepGetNumLinRhsEvals", 1); + flag = ARKodeGetNumLinRhsEvals(mristep_mem, &mri_nfeLS); + check_flag(&flag, "ARKodeGetNumLinRhsEvals", 1); } sunrealtype pow = udata->lambda_f; @@ -488,8 +488,8 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, // Clean up MRIStepInnerStepper_Free(&inner_stepper); - MRIStepFree(&mristep_mem); - ARKStepFree(&arkstep_mem); + ARKodeFree(&mristep_mem); + ARKodeFree(&arkstep_mem); if (type == MRISTEP_IMPLICIT || type == MRISTEP_IMEX) { SUNLinSolFree(LS); diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_getjac.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_getjac.cpp index 7dee98545f..7b3598451d 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_getjac.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_getjac.cpp @@ -214,8 +214,8 @@ int main(int argc, char* argv[]) void* arkode_mem = ARKStepCreate(nullptr, f, ZERO, y, sunctx); if (check_ptr(arkode_mem, "ARKStepCreate")) { return 1; } - flag = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_flag(flag, "ARKStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } SUNMatrix A = SUNDenseMatrix(2, 2, sunctx); if (check_ptr(A, "SUNDenseMatrix")) { return 1; } @@ -223,35 +223,35 @@ int main(int argc, char* argv[]) SUNLinearSolver LS = SUNLinSol_Dense(y, A, sunctx); if (check_ptr(LS, "SUNLinSol_Dense")) { return 1; } - 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; } sunrealtype udata[4] = {-TWO, HALF, HALF, -ONE}; - flag = ARKStepSetUserData(arkode_mem, udata); - if (check_flag(flag, "ARKStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(arkode_mem, udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // Initial time and fist output time sunrealtype tret = ZERO; sunrealtype tout = tret + SUN_RCONST(0.1); // Advance one step in time - flag = ARKStepEvolve(arkode_mem, tout, y, &tret, ARK_ONE_STEP); - if (check_flag(flag, "ARKStep")) { return 1; } + flag = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_ONE_STEP); + if (check_flag(flag, "ARKode")) { return 1; } // Get the internal finite difference approximation to J SUNMatrix Jdq; - flag = ARKStepGetJac(arkode_mem, &Jdq); - if (check_flag(flag, "ARKStepGetJac")) { return 1; } + flag = ARKodeGetJac(arkode_mem, &Jdq); + if (check_flag(flag, "ARKodeGetJac")) { return 1; } // Get the step and time at which the approximation was computed long int nst_Jdq; - flag = ARKStepGetJacNumSteps(arkode_mem, &nst_Jdq); - if (check_flag(flag, "ARKStepGetJacNumSteps")) { return 1; } + flag = ARKodeGetJacNumSteps(arkode_mem, &nst_Jdq); + if (check_flag(flag, "ARKodeGetJacNumSteps")) { return 1; } sunrealtype t_Jdq; - flag = ARKStepGetJacTime(arkode_mem, &t_Jdq); - if (check_flag(flag, "ARKStepGetJacTime")) { return 1; } + flag = ARKodeGetJacTime(arkode_mem, &t_Jdq); + if (check_flag(flag, "ARKodeGetJacTime")) { return 1; } // Compute the true Jacobian SUNMatrix Jtrue = SUNDenseMatrix(2, 2, sunctx); @@ -302,7 +302,7 @@ int main(int argc, char* argv[]) SUNMatDestroy(A); SUNMatDestroy(Jtrue); SUNLinSolFree(LS); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); return result; } diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_getjac_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_getjac_mri.cpp index 4ad57a55e4..af9168d5fd 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_getjac_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_getjac_mri.cpp @@ -233,11 +233,11 @@ int main(int argc, char* argv[]) void* arkode_mem = MRIStepCreate(nullptr, f, ZERO, y, inner_stepper, sunctx); if (check_ptr(arkode_mem, "MRIStepCreate")) { return 1; } - flag = MRIStepSStolerances(arkode_mem, rtol, atol); - if (check_flag(flag, "MRIStepSStolerances")) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_flag(flag, "ARKodeSStolerances")) { return 1; } - flag = MRIStepSetFixedStep(arkode_mem, SUN_RCONST(1.0e-5)); - if (check_flag(flag, "MRIStepSetFixedStep")) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, SUN_RCONST(1.0e-5)); + if (check_flag(flag, "ARKodeSetFixedStep")) { return 1; } SUNMatrix A = SUNDenseMatrix(2, 2, sunctx); if (check_ptr(A, "SUNDenseMatrix")) { return 1; } @@ -245,35 +245,35 @@ int main(int argc, char* argv[]) SUNLinearSolver LS = SUNLinSol_Dense(y, A, sunctx); if (check_ptr(LS, "SUNLinSol_Dense")) { return 1; } - 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; } sunrealtype udata[4] = {-TWO, HALF, HALF, -ONE}; - flag = MRIStepSetUserData(arkode_mem, udata); - if (check_flag(flag, "MRIStepSetUserData")) { return 1; } + flag = ARKodeSetUserData(arkode_mem, udata); + if (check_flag(flag, "ARKodeSetUserData")) { return 1; } // Initial time and fist output time sunrealtype tret = ZERO; sunrealtype tout = tret + SUN_RCONST(0.1); // Advance one step in time - flag = MRIStepEvolve(arkode_mem, tout, y, &tret, ARK_ONE_STEP); - if (check_flag(flag, "MRIStep")) { return 1; } + flag = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_ONE_STEP); + if (check_flag(flag, "ARKode")) { return 1; } // Get the internal finite difference approximation to J SUNMatrix Jdq; - flag = MRIStepGetJac(arkode_mem, &Jdq); - if (check_flag(flag, "MRIStepGetJac")) { return 1; } + flag = ARKodeGetJac(arkode_mem, &Jdq); + if (check_flag(flag, "ARKodeGetJac")) { return 1; } // Get the step and time at which the approximation was computed long int nst_Jdq; - flag = MRIStepGetJacNumSteps(arkode_mem, &nst_Jdq); - if (check_flag(flag, "MRIStepGetJacNumSteps")) { return 1; } + flag = ARKodeGetJacNumSteps(arkode_mem, &nst_Jdq); + if (check_flag(flag, "ARKodeGetJacNumSteps")) { return 1; } sunrealtype t_Jdq; - flag = MRIStepGetJacTime(arkode_mem, &t_Jdq); - if (check_flag(flag, "MRIStepGetJacTime")) { return 1; } + flag = ARKodeGetJacTime(arkode_mem, &t_Jdq); + if (check_flag(flag, "ARKodeGetJacTime")) { return 1; } // Compute the true Jacobian SUNMatrix Jtrue = SUNDenseMatrix(2, 2, sunctx); @@ -325,8 +325,8 @@ int main(int argc, char* argv[]) SUNMatDestroy(Jtrue); SUNLinSolFree(LS); MRIStepInnerStepper_Free(&inner_stepper); - ARKStepFree(&inner_arkode_mem); - MRIStepFree(&arkode_mem); + ARKodeFree(&inner_arkode_mem); + ARKodeFree(&arkode_mem); return result; } diff --git a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c index 6ea963f176..7fdb34daf2 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c +++ b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c @@ -212,43 +212,43 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Specify tolerances */ - 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; } /* Set stop time */ - 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; } /* Set max steps before output */ - flag = ARKStepSetMaxNumSteps(arkode_mem, mxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, mxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Set forcing */ flag = arkStep_SetInnerForcing(arkode_mem, tshift, tscale, forcing, order + 1); if (check_flag(&flag, "arkStep_SetInnerForcing", 1)) { return 1; } /* Integrate the problem */ - flag = ARKStepEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); + flag = ARKodeEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); /* check for errors */ if (flag < 0) { - fprintf(stderr, "ARKStep failure, flag = %d\n", flag); + fprintf(stderr, "ARKodeEvolve failure, flag = %d\n", flag); return 1; } /* get some integrator stats */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); printf("Explicit stats:\n"); printf("Steps = %li (attempted = %li)\n\n", nst, nst_a); /* Free integrator memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /* print solution */ @@ -272,55 +272,55 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Specify tolerances */ - 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; } /* Set stop time */ - 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; } /* Set max steps before output */ - flag = ARKStepSetMaxNumSteps(arkode_mem, mxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, mxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Attach matrix and 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; } /* Set Jacobian routine */ - 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; } /* 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; } /* Set forcing */ flag = arkStep_SetInnerForcing(arkode_mem, tshift, tscale, forcing, order + 1); if (check_flag(&flag, "arkStep_SetInnerForcing", 1)) { return 1; } /* Integrate the problem */ - flag = ARKStepEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); + flag = ARKodeEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); /* check for errors */ if (flag < 0) { - fprintf(stderr, "ARKStep failure, flag = %d\n", flag); + fprintf(stderr, "ARKodeEvolve failure, flag = %d\n", flag); return 1; } /* get some integrator stats */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); printf("Implicit stats:\n"); printf("Steps = %li (attempted = %li)\n\n", nst, nst_a); /* Free integrator memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /* print solution */ @@ -344,55 +344,55 @@ int main(int argc, char* argv[]) if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } /* Specify tolerances */ - 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; } /* Set stop time */ - 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; } /* Set max steps before output */ - flag = ARKStepSetMaxNumSteps(arkode_mem, mxsteps); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, mxsteps); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Attach matrix and 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; } /* Set Jacobian routine */ - 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; } /* 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; } /* Set forcing */ flag = arkStep_SetInnerForcing(arkode_mem, tshift, tscale, forcing, order + 1); if (check_flag(&flag, "arkStep_SetInnerForcing", 1)) { return 1; } /* Integrate the problem */ - flag = ARKStepEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); + flag = ARKodeEvolve(arkode_mem, Tf, y, &tret, ARK_NORMAL); /* check for errors */ if (flag < 0) { - fprintf(stderr, "ARKStep failure, flag = %d\n", flag); + fprintf(stderr, "ARKodeEvolve failure, flag = %d\n", flag); return 1; } /* get some integrator stats */ - flag = ARKStepGetNumSteps(arkode_mem, &nst); - check_flag(&flag, "ARKStepGetNumSteps", 1); + flag = ARKodeGetNumSteps(arkode_mem, &nst); + check_flag(&flag, "ARKodeGetNumSteps", 1); - flag = ARKStepGetNumStepAttempts(arkode_mem, &nst_a); - check_flag(&flag, "ARKStepGetNumStepAttempts", 1); + flag = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); + check_flag(&flag, "ARKodeGetNumStepAttempts", 1); printf("IMEX stats:\n"); printf("Steps = %li (attempted = %li)\n\n", nst, nst_a); /* Free integrator memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /* print solution */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c index 1f57ea41fd..25c5de6982 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c +++ b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c @@ -73,18 +73,18 @@ int main(int argc, char* argv[]) } /* Set user data */ - retval = ARKStepSetUserData(arkode_mem, &udata_in); + retval = ARKodeSetUserData(arkode_mem, &udata_in); if (retval) { - fprintf(stderr, "ARKStepSetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeSetUserData returned %i\n", retval); return 1; } /* Get user data */ - retval = ARKStepGetUserData(arkode_mem, &udata_out); + retval = ARKodeGetUserData(arkode_mem, &udata_out); if (retval) { - fprintf(stderr, "ARKStepGetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeGetUserData returned %i\n", retval); return 1; } @@ -104,7 +104,7 @@ int main(int argc, char* argv[]) udata_out = NULL; /* Free integrator memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* ------------ * * Test ERKStep * @@ -119,18 +119,18 @@ int main(int argc, char* argv[]) } /* Set user data */ - retval = ERKStepSetUserData(arkode_mem, &udata_in); + retval = ARKodeSetUserData(arkode_mem, &udata_in); if (retval) { - fprintf(stderr, "ERKStepSetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeSetUserData returned %i\n", retval); return 1; } /* Get user data */ - retval = ERKStepGetUserData(arkode_mem, &udata_out); + retval = ARKodeGetUserData(arkode_mem, &udata_out); if (retval) { - fprintf(stderr, "ERKStepGetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeGetUserData returned %i\n", retval); return 1; } @@ -150,7 +150,7 @@ int main(int argc, char* argv[]) udata_out = NULL; /* Free integrator memory */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* ------------ * * Test MRIStep * @@ -176,23 +176,23 @@ int main(int argc, char* argv[]) arkode_mem = MRIStepCreate(f, NULL, ZERO, y, inner_stepper, sunctx); if (!arkode_mem) { - fprintf(stderr, "ARKStepCreate returned NULL\n"); + fprintf(stderr, "MRIStepCreate returned NULL\n"); return 1; } /* Set user data */ - retval = MRIStepSetUserData(arkode_mem, &udata_in); + retval = ARKodeSetUserData(arkode_mem, &udata_in); if (retval) { - fprintf(stderr, "ARKStepSetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeSetUserData returned %i\n", retval); return 1; } /* Get user data */ - retval = MRIStepGetUserData(arkode_mem, &udata_out); + retval = ARKodeGetUserData(arkode_mem, &udata_out); if (retval) { - fprintf(stderr, "ARKStepGetUserData returned %i\n", retval); + fprintf(stderr, "ARKodeGetUserData returned %i\n", retval); return 1; } @@ -212,8 +212,8 @@ int main(int argc, char* argv[]) udata_out = NULL; /* Free integrator memory */ - MRIStepFree(&arkode_mem); - ARKStepFree(&arkode_inner_mem); + ARKodeFree(&arkode_mem); + ARKodeFree(&arkode_inner_mem); MRIStepInnerStepper_Free(&inner_stepper); /* Clean up */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c b/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c index 315f819089..f79566aa6f 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c +++ b/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c @@ -96,10 +96,10 @@ int main(int argc, char* argv[]) arkode_mem = MRIStepCreate(ode_slow_rhs, NULL, ZERO, y, fast_mem, sunctx); if (!arkode_mem) { return 1; } - flag = MRIStepSetFixedStep(arkode_mem, SUN_RCONST(0.01)); + flag = ARKodeSetFixedStep(arkode_mem, SUN_RCONST(0.01)); if (flag) { return 1; } - flag = MRIStepSetInterpolantType(arkode_mem, ARK_INTERP_HERMITE); + flag = ARKodeSetInterpolantType(arkode_mem, ARK_INTERP_HERMITE); if (flag) { return 1; } /* --------------- @@ -107,8 +107,8 @@ int main(int argc, char* argv[]) * --------------- */ /* Evolve should return a failure when using Hermite interpolation */ - arkode_flag = MRIStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); - printf("MRIStepEvolve returned %i\n", arkode_flag); + arkode_flag = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + printf("ARKodeEvolve returned %i\n", arkode_flag); if (arkode_flag != ARK_RHSFUNC_FAIL) { return 1; } /* ----------------------- @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) flag = MRIStepReInit(arkode_mem, ode_slow_rhs, NULL, ZERO, y); if (flag) { return 1; } - flag = MRIStepSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); + flag = ARKodeSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); if (flag) { return 1; } /* --------------- @@ -128,8 +128,8 @@ int main(int argc, char* argv[]) * --------------- */ /* Evolve should succeed when using Lagrange interpolation */ - arkode_flag = MRIStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); - printf("MRIStepEvolve returned %i\n", arkode_flag); + arkode_flag = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + printf("ARKodeEvolve returned %i\n", arkode_flag); if (arkode_flag != ARK_SUCCESS) { return 1; } /* -------- @@ -137,7 +137,7 @@ int main(int argc, char* argv[]) * -------- */ MRIStepInnerStepper_Free(&fast_mem); - MRIStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); N_VDestroy(y); SUNContext_Free(&sunctx); diff --git a/test/unit_tests/arkode/C_serial/ark_test_interp.c b/test/unit_tests/arkode/C_serial/ark_test_interp.c index 88d0636954..00eff80a35 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_interp.c +++ b/test/unit_tests/arkode/C_serial/ark_test_interp.c @@ -206,46 +206,46 @@ int main(int argc, char* argv[]) if (check_flag(arkode_mem, "ARKStepCreate", 0)) { return 1; } /* pass lambda to RHS routine */ - flag = ARKStepSetUserData(arkode_mem, &lambda); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, &lambda); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } /* select Hermite interpolation module */ - flag = ARKStepSetInterpolantType(arkode_mem, ARK_INTERP_HERMITE); - if (check_flag(&flag, "ARKStepSetInterpolantType", 1)) { return 1; } + flag = ARKodeSetInterpolantType(arkode_mem, ARK_INTERP_HERMITE); + if (check_flag(&flag, "ARKodeSetInterpolantType", 1)) { return 1; } /* set dense output polynomial degree */ - flag = ARKStepSetInterpolantDegree(arkode_mem, ideg); - if (check_flag(&flag, "ARKStepSetInterpolantDegree", 1)) { return 1; } + flag = ARKodeSetInterpolantDegree(arkode_mem, ideg); + if (check_flag(&flag, "ARKodeSetInterpolantDegree", 1)) { return 1; } /* set fixed time-stepping with desired time step size */ - flag = ARKStepSetFixedStep(arkode_mem, hvals[ih]); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, hvals[ih]); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } /* set solver tolerances */ - flag = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* indicate linearity of problem */ - 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 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; } /* increase maximum number of time steps */ - flag = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* set RK order to highest available value */ - flag = ARKStepSetOrder(arkode_mem, 5); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, 5); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } /* evolve to Tf to prepare interpolation structure */ - flag = ARKStepSetStopTime(arkode_mem, Tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } - flag = ARKStepEvolve(arkode_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, Tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } + flag = ARKodeEvolve(arkode_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } /* loop over 100 evenly-spaced values within interior of preceding step to accumulate errors */ @@ -254,19 +254,19 @@ int main(int argc, char* argv[]) /* set test time */ t_test = t - hvals[ih] + (itest + 1) * hvals[ih] / (nttest + 2); - /* call ARKStepGetDky to evaluate solution and derivatives at t_test */ - flag = ARKStepGetDky(arkode_mem, t_test, 0, ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 1, dytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 2, d2ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 3, d3ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 4, d4ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 5, d5ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } + /* call ARKodeGetDky to evaluate solution and derivatives at t_test */ + flag = ARKodeGetDky(arkode_mem, t_test, 0, ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 1, dytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 2, d2ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 3, d3ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 4, d4ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 5, d5ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } /* set error values */ /* y */ @@ -318,8 +318,8 @@ int main(int argc, char* argv[]) } /* end itest loop */ - /* free ARKStep memory (to prepare for next call) */ - ARKStepFree(&arkode_mem); + /* free ARKode memory (to prepare for next call) */ + ARKodeFree(&arkode_mem); arkode_mem = NULL; } /* end ih loop */ @@ -444,46 +444,46 @@ int main(int argc, char* argv[]) if (check_flag(arkode_mem, "ARKStepCreate", 0)) { return 1; } /* pass lambda to RHS routine */ - flag = ARKStepSetUserData(arkode_mem, &lambda); - if (check_flag(&flag, "ARKStepSetUserData", 1)) { return 1; } + flag = ARKodeSetUserData(arkode_mem, &lambda); + if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } /* select Lagrange interpolation module */ - flag = ARKStepSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); - if (check_flag(&flag, "ARKStepSetInterpolantType", 1)) { return 1; } + flag = ARKodeSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); + if (check_flag(&flag, "ARKodeSetInterpolantType", 1)) { return 1; } /* set dense output polynomial degree */ - flag = ARKStepSetInterpolantDegree(arkode_mem, ideg); - if (check_flag(&flag, "ARKStepSetInterpolantDegree", 1)) { return 1; } + flag = ARKodeSetInterpolantDegree(arkode_mem, ideg); + if (check_flag(&flag, "ARKodeSetInterpolantDegree", 1)) { return 1; } /* set fixed time-stepping with desired time step size */ - flag = ARKStepSetFixedStep(arkode_mem, hvals[ih]); - if (check_flag(&flag, "ARKStepSetFixedStep", 1)) { return 1; } + flag = ARKodeSetFixedStep(arkode_mem, hvals[ih]); + if (check_flag(&flag, "ARKodeSetFixedStep", 1)) { return 1; } /* set solver tolerances */ - flag = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_flag(&flag, "ARKStepSStolerances", 1)) { return 1; } + flag = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } /* indicate linearity of problem */ - 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 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; } /* increase maximum number of time steps */ - flag = ARKStepSetMaxNumSteps(arkode_mem, 100000); - if (check_flag(&flag, "ARKStepSetMaxNumSteps", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 100000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* set RK order to highest available value */ - flag = ARKStepSetOrder(arkode_mem, 5); - if (check_flag(&flag, "ARKStepSetOrder", 1)) { return 1; } + flag = ARKodeSetOrder(arkode_mem, 5); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } /* evolve to Tf to prepare interpolation structure */ - flag = ARKStepSetStopTime(arkode_mem, Tf); - if (check_flag(&flag, "ARKStepSetStopTime", 1)) { return 1; } - flag = ARKStepEvolve(arkode_mem, Tf, y, &t, ARK_NORMAL); - if (check_flag(&flag, "ARKStepEvolve", 1)) { return 1; } + flag = ARKodeSetStopTime(arkode_mem, Tf); + if (check_flag(&flag, "ARKodeSetStopTime", 1)) { return 1; } + flag = ARKodeEvolve(arkode_mem, Tf, y, &t, ARK_NORMAL); + if (check_flag(&flag, "ARKodeEvolve", 1)) { return 1; } /* loop over 100 evenly-spaced values within interior of this step to accumulate errors */ for (itest = 0; itest < nttest; itest++) @@ -491,13 +491,13 @@ int main(int argc, char* argv[]) /* set test time */ t_test = t - hvals[ih] + (itest + 1) * hvals[ih] / (nttest + 2); - /* call ARKStepGetDky to evaluate solution and derivatives at t_test */ - flag = ARKStepGetDky(arkode_mem, t_test, 0, ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 1, dytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } - flag = ARKStepGetDky(arkode_mem, t_test, 2, d2ytest); - if (check_flag(&flag, "ARKStepGetDky", 1)) { return 1; } + /* call ARKodeGetDky to evaluate solution and derivatives at t_test */ + flag = ARKodeGetDky(arkode_mem, t_test, 0, ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 1, dytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } + flag = ARKodeGetDky(arkode_mem, t_test, 2, d2ytest); + if (check_flag(&flag, "ARKodeGetDky", 1)) { return 1; } /* set error values */ /* y */ @@ -525,8 +525,8 @@ int main(int argc, char* argv[]) } /* end itest loop */ - /* free ARKStep memory (to prepare for next call) */ - ARKStepFree(&arkode_mem); + /* free ARKode memory (to prepare for next call) */ + ARKodeFree(&arkode_mem); arkode_mem = NULL; } /* end ih loop */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_reset.c b/test/unit_tests/arkode/C_serial/ark_test_reset.c index 529c2879cd..445850399f 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_reset.c +++ b/test/unit_tests/arkode/C_serial/ark_test_reset.c @@ -11,8 +11,7 @@ * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End *--------------------------------------------------------------- - * Routine to test that ARKStepReset, ERKStepReset and - * MRIStepReset function correctly. + * Routine to test that ARKodeReset functions correctly. * * This runs the same test problem as in * examples/arkode/C_serial/ark_analytic.c: @@ -107,196 +106,199 @@ int main(void) if (check_retval((void*)LS, "SUNLinSol_Dense", 0)) { return 1; } /******* Part I: ERKStep *******/ + printf("Testing ERKStep:\n"); /* Set initial condition, and construct stepper */ t = T0; N_VConst(ytrue(t), y); arkode_mem = ERKStepCreate(f, t, y, ctx); if (check_retval((void*)arkode_mem, "ERKStepCreate", 0)) { return 1; } - retval = ERKStepSetUserData(arkode_mem, (void*)&lambda); - if (check_retval(&retval, "ERKStepSetUserData", 1)) { return 1; } - retval = ERKStepSStolerances(arkode_mem, rtol, atol); - if (check_retval(&retval, "ERKStepSStolerances", 1)) { return 1; } - retval = ERKStepSetMaxNumSteps(arkode_mem, 1000); - check_retval(&retval, "ERKStepSetMaxNumSteps", 1); + retval = ARKodeSetUserData(arkode_mem, (void*)&lambda); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 1000); + check_retval(&retval, "ARKodeSetMaxNumSteps", 1); /* Initially evolve to dTout, and check result */ - retval = ERKStepSetStopTime(arkode_mem, t + dTout); - check_retval(&retval, "ERKStepSetStopTime", 1); - retval = ERKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { return 1; } + retval = ARKodeSetStopTime(arkode_mem, t + dTout); + check_retval(&retval, "ARKodeSetStopTime", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Initial ERKStepEvolve had insufficient accuracy\n"); + printf(" Initial ARKodeEvolve had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Initial ERKStepEvolve call successful\n"); } + else { printf(" Initial ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = ERKStepReset(arkode_mem, t, y); - check_retval(&retval, "ERKStepReset", 1); - retval = ERKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Second ERKStepEvolve call had insufficient accuracy\n"); + printf(" Second ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Second ERKStepEvolve call successful\n"); } + else { printf(" Second ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at 3*dTout, evolve to 4*dTout and check result */ t = T0 + SUN_RCONST(3.0) * dTout; N_VConst(ytrue(t), y); - retval = ERKStepReset(arkode_mem, t, y); - check_retval(&retval, "ERKStepReset", 1); - retval = ERKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Third ERKStepEvolve call had insufficient accuracy\n"); + printf(" Third ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Third ERKStepEvolve call successful\n"); } + else { printf(" Third ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = ERKStepReset(arkode_mem, t, y); - check_retval(&retval, "ERKStepReset", 1); - retval = ERKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ERKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Fourth ERKStepEvolve call had insufficient accuracy\n"); + printf(" Fourth ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Fourth ERKStepEvolve call successful\n"); } + else { printf(" Fourth ARKodeEvolve call successful\n"); } /* Free ERKStep memory structure */ - ERKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /******* Part II: ARKStep *******/ + printf("Testing ARKStep:\n"); /* Set initial condition, and construct stepper */ t = T0; N_VConst(ytrue(t), y); arkode_mem = ARKStepCreate(NULL, f, t, y, ctx); if (check_retval((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } - retval = ARKStepSetUserData(arkode_mem, (void*)&lambda); - if (check_retval(&retval, "ARKStepSetUserData", 1)) { return 1; } - retval = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } - retval = ARKStepSetLinearSolver(arkode_mem, LS, A); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) { return 1; } - retval = ARKStepSetJacFn(arkode_mem, Jac); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) { return 1; } - retval = ARKStepSetLinear(arkode_mem, 0); - if (check_retval(&retval, "ARKStepSetLinear", 1)) { return 1; } - retval = ARKStepSetMaxNumSteps(arkode_mem, 100); - check_retval(&retval, "ARKStepSetMaxNumSteps", 1); + retval = ARKodeSetUserData(arkode_mem, (void*)&lambda); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } + retval = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } + retval = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(arkode_mem, Jac); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSetLinear(arkode_mem, 0); + if (check_retval(&retval, "ARKodeSetLinear", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 100); + check_retval(&retval, "ARKodeSetMaxNumSteps", 1); /* Initially evolve to dTout, and check result */ - retval = ARKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { return 1; } + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Initial ARKStepEvolve had insufficient accuracy\n"); + printf(" Initial ARKodeEvolve had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Initial ARKStepEvolve call successful\n"); } + else { printf(" Initial ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = ARKStepReset(arkode_mem, t, y); - check_retval(&retval, "ARKStepReset", 1); - retval = ARKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Second ARKStepEvolve call had insufficient accuracy\n"); + printf(" Second ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Second ARKStepEvolve call successful\n"); } + else { printf(" Second ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at 3*dTout, evolve to 4*dTout and check result */ t = T0 + SUN_RCONST(3.0) * dTout; N_VConst(ytrue(t), y); - retval = ARKStepReset(arkode_mem, t, y); - check_retval(&retval, "ARKStepReset", 1); - retval = ARKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Third ARKStepEvolve call had insufficient accuracy\n"); + printf(" Third ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Third ARKStepEvolve call successful\n"); } + else { printf(" Third ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = ARKStepReset(arkode_mem, t, y); - check_retval(&retval, "ARKStepReset", 1); - retval = ARKStepEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "ARKStepEvolve", 1)) { return 1; } + retval = ARKodeReset(arkode_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(arkode_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Fourth ARKStepEvolve call had insufficient accuracy\n"); + printf(" Fourth ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Fourth ARKStepEvolve call successful\n"); } + else { printf(" Fourth ARKodeEvolve call successful\n"); } /* Free ARKStep memory structure */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /******* Part III: MRIStep *******/ + printf("Testing MRIStep:\n"); /* Set initial condition, and construct stepper */ t = T0; N_VConst(ytrue(t), y); arkode_mem = ARKStepCreate(f0, NULL, t, y, ctx); if (check_retval((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } - retval = ARKStepSStolerances(arkode_mem, rtol, atol); - if (check_retval(&retval, "ARKStepSStolerances", 1)) { return 1; } - retval = ARKStepSetMaxNumSteps(arkode_mem, 100); - check_retval(&retval, "ARKStepSetMaxNumSteps", 1); + retval = ARKodeSStolerances(arkode_mem, rtol, atol); + if (check_retval(&retval, "ARKodeSStolerances", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(arkode_mem, 100); + check_retval(&retval, "ARKodeSetMaxNumSteps", 1); retval = ARKStepCreateMRIStepInnerStepper(arkode_mem, &inner_stepper); if (check_retval(&retval, "ARKStepCreateMRIStepInnerStepper", 1)) { @@ -304,91 +306,91 @@ int main(void) } mristep_mem = MRIStepCreate(NULL, f, t, y, inner_stepper, ctx); if (check_retval((void*)mristep_mem, "MRIStepCreate", 0)) { return 1; } - retval = MRIStepSetUserData(mristep_mem, (void*)&lambda); - if (check_retval(&retval, "MRIStepSetUserData", 1)) { return 1; } - retval = MRIStepSetLinearSolver(mristep_mem, LS, A); - if (check_retval(&retval, "MRIStepSetLinearSolver", 1)) { return 1; } - retval = MRIStepSetJacFn(mristep_mem, Jac); - if (check_retval(&retval, "MRIStepSetJacFn", 1)) { return 1; } - retval = MRIStepSetLinear(mristep_mem, 0); - if (check_retval(&retval, "MRIStepSetLinear", 1)) { return 1; } - retval = MRIStepSetMaxNumSteps(mristep_mem, 100); - check_retval(&retval, "MRIStepSetMaxNumSteps", 1); - retval = MRIStepSetFixedStep(mristep_mem, dTout * SUN_RCONST(0.105)); - check_retval(&retval, "MRIStepSetFixedStep", 1); + retval = ARKodeSetUserData(mristep_mem, (void*)&lambda); + if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } + retval = ARKodeSetLinearSolver(mristep_mem, LS, A); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { return 1; } + retval = ARKodeSetJacFn(mristep_mem, Jac); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) { return 1; } + retval = ARKodeSetLinear(mristep_mem, 0); + if (check_retval(&retval, "ARKodeSetLinear", 1)) { return 1; } + retval = ARKodeSetMaxNumSteps(mristep_mem, 100); + check_retval(&retval, "ARKodeSetMaxNumSteps", 1); + retval = ARKodeSetFixedStep(mristep_mem, dTout * SUN_RCONST(0.105)); + check_retval(&retval, "ARKodeSetFixedStep", 1); /* Initially evolve to dTout, and check result */ - retval = MRIStepEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { return 1; } + retval = ARKodeEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Initial MRIStepEvolve had insufficient accuracy\n"); + printf(" Initial ARKodeEvolve had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Initial MRIStepEvolve call successful\n"); } + else { printf(" Initial ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = MRIStepReset(mristep_mem, t, y); - check_retval(&retval, "MRIStepReset", 1); - retval = MRIStepEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { return 1; } + retval = ARKodeReset(mristep_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Second MRIStepEvolve call had insufficient accuracy\n"); + printf(" Second ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Second MRIStepEvolve call successful\n"); } + else { printf(" Second ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at 3*dTout, evolve to 4*dTout and check result */ t = T0 + SUN_RCONST(3.0) * dTout; N_VConst(ytrue(t), y); - retval = MRIStepReset(mristep_mem, t, y); - check_retval(&retval, "MRIStepReset", 1); - retval = MRIStepEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { return 1; } + retval = ARKodeReset(mristep_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Third MRIStepEvolve call had insufficient accuracy\n"); + printf(" Third ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Third MRIStepEvolve call successful\n"); } + else { printf(" Third ARKodeEvolve call successful\n"); } /* Reset state to analytical solution at dTout, evolve to 2*dTout and check result */ t = T0 + dTout; N_VConst(ytrue(t), y); - retval = MRIStepReset(mristep_mem, t, y); - check_retval(&retval, "MRIStepReset", 1); - retval = MRIStepEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); - if (check_retval(&retval, "MRIStepEvolve", 1)) { return 1; } + retval = ARKodeReset(mristep_mem, t, y); + check_retval(&retval, "ARKodeReset", 1); + retval = ARKodeEvolve(mristep_mem, t + dTout, y, &t, ARK_NORMAL); + if (check_retval(&retval, "ARKodeEvolve", 1)) { return 1; } if (check_ans(y, t, SUN_RCONST(0.001), SUN_RCONST(0.000001))) { - printf(" Fourth MRIStepEvolve call had insufficient accuracy\n"); + printf(" Fourth ARKodeEvolve call had insufficient accuracy\n"); printf(" t = %" GSYM "\n", t); printf(" y = %" GSYM "\n", NV_Ith_S(y, 0)); printf(" ytrue = %" GSYM "\n", ytrue(t)); printf(" |y-ytrue| = %" GSYM "\n", SUNRabs(ytrue(t) - NV_Ith_S(y, 0))); return 1; } - else { printf(" Fourth MRIStepEvolve call successful\n"); } + else { printf(" Fourth ARKodeEvolve call successful\n"); } /* Free MRIStep and ARKStep memory structures */ - MRIStepFree(&mristep_mem); + ARKodeFree(&mristep_mem); MRIStepInnerStepper_Free(&inner_stepper); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); arkode_mem = NULL; /* Clean up and return with success */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_tstop.c b/test/unit_tests/arkode/C_serial/ark_test_tstop.c index 7e952e8a42..7498e251bb 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_tstop.c +++ b/test/unit_tests/arkode/C_serial/ark_test_tstop.c @@ -92,7 +92,7 @@ int main(int argc, char* argv[]) arkode_mem = ARKStepCreate(NULL, ode_rhs, ZERO, y, sunctx); if (!arkode_mem) { return 1; } - flag = ARKStepSStolerances(arkode_mem, SUN_RCONST(1.0e-4), SUN_RCONST(1.0e-8)); + flag = ARKodeSStolerances(arkode_mem, SUN_RCONST(1.0e-4), SUN_RCONST(1.0e-8)); if (flag) { return 1; } A = SUNDenseMatrix(1, 1, sunctx); @@ -101,16 +101,16 @@ int main(int argc, char* argv[]) LS = SUNLinSol_Dense(y, A, sunctx); if (!LS) { return 1; } - flag = ARKStepSetLinearSolver(arkode_mem, LS, A); + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); if (flag) { return 1; } - flag = ARKStepSetJacFn(arkode_mem, ode_jac); + flag = ARKodeSetJacFn(arkode_mem, ode_jac); if (flag) { return 1; } - flag = ARKStepSetOrder(arkode_mem, 2); + flag = ARKodeSetOrder(arkode_mem, 2); if (flag) { return 1; } - flag = ARKStepSetStopTime(arkode_mem, tstop); + flag = ARKodeSetStopTime(arkode_mem, tstop); if (flag) { return 1; } /* --------------- @@ -123,14 +123,14 @@ int main(int argc, char* argv[]) for (i = 1; i <= 6; i++) { - arkode_flag = ARKStepEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); + arkode_flag = ARKodeEvolve(arkode_mem, tout, y, &tret, ARK_NORMAL); if (arkode_flag < 0) { flag = 1; break; } - flag = ARKStepGetCurrentTime(arkode_mem, &tcur); + flag = ARKodeGetCurrentTime(arkode_mem, &tcur); if (flag) { break; } printf("%i: tout = %" GSYM ", tstop = %" GSYM ", tret = %" GSYM @@ -157,7 +157,7 @@ int main(int argc, char* argv[]) /* Update stop time */ tstop += dt_tstop; - flag = ARKStepSetStopTime(arkode_mem, tstop); + flag = ARKodeSetStopTime(arkode_mem, tstop); if (flag) { break; } } @@ -173,7 +173,7 @@ int main(int argc, char* argv[]) /* Update stop time */ tstop += dt_tstop; - flag = ARKStepSetStopTime(arkode_mem, tstop); + flag = ARKodeSetStopTime(arkode_mem, tstop); if (flag) { break; } } @@ -217,7 +217,7 @@ int main(int argc, char* argv[]) * Clean up * -------- */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); N_VDestroy(y); SUNMatDestroy(A); SUNLinSolFree(LS); diff --git a/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp b/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp index 44bfcc9c5c..96099d427f 100644 --- a/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp +++ b/test/unit_tests/arkode/gtest/test_arkode_error_handling.cpp @@ -45,7 +45,7 @@ class ARKodeErrConditionTest : public testing::Test ~ARKodeErrConditionTest() { N_VDestroy(v); - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); } void* arkode_mem; @@ -70,7 +70,7 @@ TEST_F(ARKodeErrConditionTest, ErrorIsPrinted) { SUNLogger_SetErrorFilename(logger, errfile.c_str()); // negative reltol is illegal - ARKStepSStolerances(arkode_mem, /* reltol= */ -1e-4, /* abstol= */ 1e-4); + ARKodeSStolerances(arkode_mem, /* reltol= */ -1e-4, /* abstol= */ 1e-4); std::string output = dumpstderr(sunctx, errfile); EXPECT_THAT(output, testing::AllOf(testing::StartsWith("[ERROR]"), testing::HasSubstr("[rank 0]"), From fbdead5f546367615d011b03eeb6d8f1e720d2bd Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 19 Apr 2024 15:37:11 -0500 Subject: [PATCH 05/39] Updated new ark_test_mass.c test to use new ARKODE API --- .../arkode/C_serial/ark_test_mass.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/unit_tests/arkode/C_serial/ark_test_mass.c b/test/unit_tests/arkode/C_serial/ark_test_mass.c index 586028cd1c..c011d11209 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_mass.c +++ b/test/unit_tests/arkode/C_serial/ark_test_mass.c @@ -131,57 +131,57 @@ int solve(const char* im, const char* ex, int steps, sunbooleantype time_dep, retval = ARKStepSetTableName(arkode_mem, im, ex); if (check_retval(&retval, "ARKStepSetTableNum", 1)) return 1; - retval = ARKStepSetUserData(arkode_mem, &time_dep); - if (check_retval(&retval, "ARKStepSetUserData", 1)) return 1; + retval = ARKodeSetUserData(arkode_mem, &time_dep); + if (check_retval(&retval, "ARKodeSetUserData", 1)) return 1; /* Specify a time step so no extra mass evaluations occur from initial step * size procedure */ - retval = ARKStepSetInitStep(arkode_mem, 0.01); - if (check_retval(&retval, "ARKStepSetInitStep", 1)) return 1; + retval = ARKodeSetInitStep(arkode_mem, 0.01); + if (check_retval(&retval, "ARKodeSetInitStep", 1)) return 1; /* Use Lagrange interpolation because Hermite may need addition mass matrix * solves to compute the interpolant */ - retval = ARKStepSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); - if (check_retval(&retval, "ARKStepSetInterpolantType", 1)) return 1; + retval = ARKodeSetInterpolantType(arkode_mem, ARK_INTERP_LAGRANGE); + if (check_retval(&retval, "ARKodeSetInterpolantType", 1)) return 1; /* Configure the solvers */ jacobian_ls = SUNLinSol_Dense(y, jacobian_mat, sunctx); if (check_retval(jacobian_ls, "SUNLinSol_Dense", 0)) return 1; - retval = ARKStepSetLinearSolver(arkode_mem, jacobian_ls, jacobian_mat); - if (check_retval(&retval, "ARKStepSetLinearSolver", 1)) return 1; + retval = ARKodeSetLinearSolver(arkode_mem, jacobian_ls, jacobian_mat); + if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) return 1; mass_ls = SUNLinSol_Dense(y, mass_mat, sunctx); if (check_retval(mass_ls, "SUNLinSol_Dense", 0)) return 1; - retval = ARKStepSetMassLinearSolver(arkode_mem, mass_ls, mass_mat, time_dep); - if (check_retval(&retval, "ARKStepSetMassLinearSolver", 0)) return 1; + retval = ARKodeSetMassLinearSolver(arkode_mem, mass_ls, mass_mat, time_dep); + if (check_retval(&retval, "ARKodeSetMassLinearSolver", 0)) return 1; nls = SUNNonlinSol_Newton(y, sunctx); if (check_retval(nls, "SUNNonlinSol_Newton", 0)) return 1; - retval = ARKStepSetDeduceImplicitRhs(arkode_mem, deduce_implicit_rhs); - if (check_retval(&retval, "ARKStepSetDeduceImplicitRhs", 1)) return 1; + retval = ARKodeSetDeduceImplicitRhs(arkode_mem, deduce_implicit_rhs); + if (check_retval(&retval, "ARKodeSetDeduceImplicitRhs", 1)) return 1; /* Let ARKODE estimate the Jacobian with finite differences */ - retval = ARKStepSetJacFn(arkode_mem, NULL); - if (check_retval(&retval, "ARKStepSetJacFn", 1)) return 1; + retval = ARKodeSetJacFn(arkode_mem, NULL); + if (check_retval(&retval, "ARKodeSetJacFn", 1)) return 1; - retval = ARKStepSetMassFn(arkode_mem, mass); - if (check_retval(&retval, "ARKStepSetMassFn", 1)) return 1; + retval = ARKodeSetMassFn(arkode_mem, mass); + if (check_retval(&retval, "ARKodeSetMassFn", 1)) return 1; /* Take time step(s) */ for (s = 0; s < steps; s++) { - retval = ARKStepEvolve(arkode_mem, t, y, &t, ARK_ONE_STEP); - if (check_retval(&retval, "ARKStepEvolve", 1)) return 1; + retval = ARKodeEvolve(arkode_mem, t, y, &t, ARK_ONE_STEP); + if (check_retval(&retval, "ARKodeEvolve", 1)) return 1; } - retval = ARKStepGetNumMassSolves(arkode_mem, &actual_mass_solves); - if (check_retval(&retval, "ARKStepGetNumMassSolves", 1)) return 1; + retval = ARKodeGetNumMassSolves(arkode_mem, &actual_mass_solves); + if (check_retval(&retval, "ARKodeGetNumMassSolves", 1)) return 1; /* Free integrator memory */ - ARKStepFree(&arkode_mem); + ARKodeFree(&arkode_mem); /* Clean up */ N_VDestroy(y); From 37f5611fae308abae9c12017d9bdb1a007e48c88 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 19 Apr 2024 16:20:03 -0500 Subject: [PATCH 06/39] Updated signature of ARKTimeStepFree function pointer to only require a input --- src/arkode/arkode.c | 4 ++-- src/arkode/arkode_arkstep.c | 6 +++--- src/arkode/arkode_arkstep_impl.h | 2 +- src/arkode/arkode_erkstep.c | 6 +++--- src/arkode/arkode_erkstep_impl.h | 2 +- src/arkode/arkode_impl.h | 2 +- src/arkode/arkode_mristep.c | 6 +++--- src/arkode/arkode_mristep_impl.h | 2 +- src/arkode/arkode_sprkstep.c | 6 +++--- src/arkode/arkode_sprkstep_impl.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index b445a809d8..c2c1091e93 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -233,7 +233,7 @@ ARKodeMem arkCreate(SUNContext sunctx) all time-stepping heuristics prior to calling ARKodeResize remain valid after the call. If instead the dynamics should be re-calibrated, the ARKODE memory structure should be deleted - with a call to *StepFree, and re-created with a call to + with a call to ARKodeFree, and re-created with a call to *StepCreate. To aid in the vector-resize operation, the user can supply a @@ -1361,7 +1361,7 @@ void ARKodeFree(void** arkode_mem) /* free the time-stepper module memory (if provided) */ if (ark_mem->step_free) { - ark_mem->step_free(arkode_mem); + ark_mem->step_free(*arkode_mem); } /* free vector storage */ diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 9070940bc4..087d679192 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -476,7 +476,7 @@ int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /*--------------------------------------------------------------- arkStep_Free frees all ARKStep memory. ---------------------------------------------------------------*/ -void arkStep_Free(void** arkode_mem) +void arkStep_Free(void* arkode_mem) { int j; sunindextype Bliw, Blrw; @@ -484,10 +484,10 @@ void arkStep_Free(void** arkode_mem) ARKodeARKStepMem step_mem; /* nothing to do if arkode_mem is already NULL */ - if (*arkode_mem == NULL) { return; } + if (arkode_mem == NULL) { return; } /* conditional frees on non-NULL ARKStep module */ - ark_mem = (ARKodeMem)(*arkode_mem); + ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeARKStepMem)ark_mem->step_mem; diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index 44a94bb327..edca35e890 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -218,7 +218,7 @@ int arkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); int arkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -void arkStep_Free(void** arkode_mem); +void arkStep_Free(void* arkode_mem); void arkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 98cbaf4636..e89cda6303 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -249,7 +249,7 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) /*--------------------------------------------------------------- erkStep_Free frees all ERKStep memory. ---------------------------------------------------------------*/ -void erkStep_Free(void** arkode_mem) +void erkStep_Free(void* arkode_mem) { int j; sunindextype Bliw, Blrw; @@ -257,10 +257,10 @@ void erkStep_Free(void** arkode_mem) ARKodeERKStepMem step_mem; /* nothing to do if arkode_mem is already NULL */ - if (*arkode_mem == NULL) { return; } + if (arkode_mem == NULL) { return; } /* conditional frees on non-NULL ERKStep module */ - ark_mem = (ARKodeMem)(*arkode_mem); + ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeERKStepMem)ark_mem->step_mem; diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index c4b83e1fe0..629ea9f6f6 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -80,7 +80,7 @@ int erkStep_WriteParameters(void* arkode_mem, FILE* fp); int erkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); int erkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -void erkStep_Free(void** arkode_mem); +void erkStep_Free(void* arkode_mem); void erkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index ddeb0110d8..39404e1af6 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -197,7 +197,7 @@ typedef int (*ARKTimestepResize)(void* arkode_mem, N_Vector ynew, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); typedef int (*ARKTimestepReset)(void* arkode_mem, sunrealtype tR, N_Vector yR); -typedef void (*ARKTimestepFree)(void** arkode_mem); +typedef void (*ARKTimestepFree)(void* arkode_mem); typedef void (*ARKTimestepPrintMem)(void* arkode_mem, FILE* outfile); typedef int (*ARKTimestepSetDefaults)(void* arkode_mem); typedef int (*ARKTimestepComputeState)(void* arkode_mem, N_Vector zcor, N_Vector z); diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 208c02f3cc..9b4ecd67c2 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -521,17 +521,17 @@ int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /*--------------------------------------------------------------- mriStep_Free frees all MRIStep memory. ---------------------------------------------------------------*/ -void mriStep_Free(void** arkode_mem) +void mriStep_Free(void* arkode_mem) { sunindextype Cliw, Clrw; ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; /* nothing to do if arkode_mem is already NULL */ - if (*arkode_mem == NULL) { return; } + if (arkode_mem == NULL) { return; } /* conditional frees on non-NULL MRIStep module */ - ark_mem = (ARKodeMem)(*arkode_mem); + ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeMRIStepMem)ark_mem->step_mem; diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index 706f49e12c..4db2c5f9ee 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -231,7 +231,7 @@ int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); int mriStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -void mriStep_Free(void** arkode_mem); +void mriStep_Free(void* arkode_mem); void mriStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index 14c545323d..360316017e 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -308,16 +308,16 @@ int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) /*--------------------------------------------------------------- sprkStep_Free frees all SPRKStep memory. ---------------------------------------------------------------*/ -void sprkStep_Free(void** arkode_mem) +void sprkStep_Free(void* arkode_mem) { ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; /* nothing to do if arkode_mem is already NULL */ - if (*arkode_mem == NULL) { return; } + if (arkode_mem == NULL) { return; } /* conditional frees on non-NULL SPRKStep module */ - ark_mem = (ARKodeMem)(*arkode_mem); + ark_mem = (ARKodeMem)(arkode_mem); if (ark_mem->step_mem != NULL) { step_mem = (ARKodeSPRKStepMem)ark_mem->step_mem; diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 7f536b74f2..48250ea92e 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -80,7 +80,7 @@ int sprkStep_WriteParameters(void* arkode_mem, FILE* fp); int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -void sprkStep_Free(void** arkode_mem); +void sprkStep_Free(void* arkode_mem); void sprkStep_PrintMem(void* arkode_mem, FILE* outfile); /* Internal utility routines */ From 7f7e00734ae6bc32f771d946c627fdb77d355240 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sun, 21 Apr 2024 21:54:00 -0500 Subject: [PATCH 07/39] Ran clang-format on all ARKODE files, examples, tests, and benchmarks --- .../kokkos/arkode_driver.cpp | 32 +--- .../advection_reaction_3D/kokkos/rhs3D.hpp | 4 +- .../raja/arkode_driver.cpp | 32 +--- .../arkode/CXX_parallel/ark_brusselator1D.h | 2 +- .../ark_brusselator1D_task_local_nls.cpp | 2 +- .../CXX_parallel/ark_diffusion_reaction_p.cpp | 3 +- examples/arkode/CXX_parallel/ark_heat2D_p.cpp | 8 +- .../arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp | 10 +- .../CXX_parhyp/ark_heat2D_hypre_pfmg.cpp | 8 +- .../CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp | 2 +- .../arkode/CXX_serial/ark_analytic_sys.cpp | 10 +- examples/arkode/CXX_serial/ark_heat2D.cpp | 8 +- examples/arkode/CXX_serial/ark_kpr_Mt.cpp | 14 +- .../ark_brusselator1D_FEM_sludist.cpp | 7 +- .../ark_heat2D_hypre_pfmg_xbraid.cpp | 8 +- .../arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp | 8 +- .../arkode/CXX_xbraid/ark_heat2D_xbraid.cpp | 8 +- .../C_manyvector/ark_brusselator1D_manyvec.c | 10 +- .../arkode/C_openmp/ark_brusselator1D_omp.c | 16 +- examples/arkode/C_openmp/ark_heat1D_omp.c | 12 +- .../C_openmpdev/ark_analytic_nonlin_ompdev.c | 6 +- .../C_openmpdev/ark_heat1D_adapt_ompdev.c | 6 +- .../arkode/C_openmpdev/ark_heat1D_ompdev.c | 17 +- .../ark_brusselator1D_task_local_nls.c | 6 +- .../arkode/C_parallel/ark_diurnal_kry_bbd_p.c | 2 +- .../arkode/C_parallel/ark_diurnal_kry_p.c | 2 +- examples/arkode/C_parhyp/ark_diurnal_kry_ph.c | 2 +- .../arkode/C_serial/ark_KrylovDemo_prec.c | 2 +- examples/arkode/C_serial/ark_analytic.c | 10 +- examples/arkode/C_serial/ark_analytic_mels.c | 11 +- .../arkode/C_serial/ark_analytic_nonlin.c | 6 +- examples/arkode/C_serial/ark_brusselator.c | 33 ++-- examples/arkode/C_serial/ark_brusselator1D.c | 14 +- .../C_serial/ark_brusselator1D_FEM_slu.c | 9 +- .../C_serial/ark_brusselator1D_imexmri.c | 2 +- .../arkode/C_serial/ark_brusselator1D_klu.c | 24 +-- .../arkode/C_serial/ark_brusselator_1D_mri.c | 2 +- examples/arkode/C_serial/ark_brusselator_fp.c | 14 +- .../arkode/C_serial/ark_brusselator_mri.c | 14 +- examples/arkode/C_serial/ark_heat1D.c | 12 +- examples/arkode/C_serial/ark_heat1D_adapt.c | 8 +- examples/arkode/C_serial/ark_kepler.c | 2 +- .../C_serial/ark_reaction_diffusion_mri.c | 2 +- examples/arkode/C_serial/ark_robertson.c | 10 +- .../C_serial/ark_robertson_constraints.c | 12 +- examples/arkode/C_serial/ark_robertson_root.c | 15 +- include/arkode/arkode.h | 29 ++- include/arkode/arkode_arkstep.h | 40 ++--- include/arkode/arkode_erkstep.h | 17 +- include/arkode/arkode_ls.h | 1 - include/arkode/arkode_mristep.h | 11 +- include/arkode/arkode_sprkstep.h | 3 +- src/arkode/arkode.c | 27 +-- src/arkode/arkode_adapt_impl.h | 2 +- src/arkode/arkode_arkstep.c | 90 +++++----- src/arkode/arkode_arkstep_impl.h | 2 +- src/arkode/arkode_arkstep_io.c | 12 +- src/arkode/arkode_bandpre.c | 3 +- src/arkode/arkode_bandpre_impl.h | 2 +- src/arkode/arkode_bbdpre_impl.h | 2 +- src/arkode/arkode_butcher_dirk.c | 3 +- src/arkode/arkode_butcher_erk.c | 3 +- src/arkode/arkode_erkstep.c | 26 +-- src/arkode/arkode_erkstep_impl.h | 2 +- src/arkode/arkode_erkstep_io.c | 15 +- src/arkode/arkode_impl.h | 36 ++-- src/arkode/arkode_io.c | 118 ++++++------ src/arkode/arkode_ls.c | 168 +++++++++--------- src/arkode/arkode_ls_impl.h | 5 +- src/arkode/arkode_mri_tables.c | 3 +- src/arkode/arkode_mristep.c | 76 ++++---- src/arkode/arkode_mristep_impl.h | 2 +- src/arkode/arkode_mristep_io.c | 14 +- src/arkode/arkode_root.c | 2 +- src/arkode/arkode_root_impl.h | 2 +- src/arkode/arkode_sprkstep.c | 20 +-- src/arkode/arkode_sprkstep_impl.h | 2 +- src/arkode/arkode_sprkstep_io.c | 9 +- .../CXX_serial/ark_test_dahlquist_mri.cpp | 5 +- 79 files changed, 563 insertions(+), 636 deletions(-) diff --git a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp index 10a9ff1751..b5fab73efb 100644 --- a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp @@ -31,7 +31,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -}* TaskLocalNewton_Content; +} * TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) @@ -76,17 +76,11 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) /* Attach user data */ retval = ARKodeSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); @@ -270,17 +264,11 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) /* Attach user data */ retval = ARKodeSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); @@ -479,10 +467,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); @@ -493,10 +478,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) /* Set fixed step size */ retval = ARKodeSetFixedStep(arkode_mem, 1e-5); - if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) { return 1; } /* Output initial condition */ if (uopt->nout > 0) diff --git a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp index 0dee917835..1cb742528d 100644 --- a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp @@ -413,7 +413,7 @@ static int SolveReactionLinSys(N_Vector y, N_Vector x, N_Vector b, Bview(i, j, k, 1) * (A0 * A8 - scratch_9) + A5 * scratch_8 - A8 * scratch_10); Xview(i, j, k, - 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + + 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + scratch_13 * (Bview(i, j, k, 1) - scratch_10 * scratch_11)) / (-A8 + scratch_11 * scratch_9 + scratch_13 * (A5 - scratch_11 * scratch_7)); @@ -505,7 +505,7 @@ static int SolveReactionLinSysRes(N_Vector y, N_Vector x, N_Vector b, Bview(i, j, k, 1) * (A0 * A8 - scratch_9) + A5 * scratch_8 - A8 * scratch_10); Xview(i, j, k, - 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + + 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + scratch_13 * (Bview(i, j, k, 1) - scratch_10 * scratch_11)) / (-A8 + scratch_11 * scratch_9 + scratch_13 * (A5 - scratch_11 * scratch_7)); diff --git a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp index 10a9ff1751..b5fab73efb 100644 --- a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp @@ -31,7 +31,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -}* TaskLocalNewton_Content; +} * TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) @@ -76,17 +76,11 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) /* Attach user data */ retval = ARKodeSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); @@ -270,17 +264,11 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) /* Attach user data */ retval = ARKodeSetUserData(arkode_mem, (void*)udata); - if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetUserData*", 1, udata->myid)) { return 1; } /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 100000); @@ -479,10 +467,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) /* Specify tolerances */ retval = ARKodeSStolerances(arkode_mem, uopt->rtol, uopt->atol); - if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSStolerances", 1, udata->myid)) { return 1; } /* Increase the max number of steps allowed between outputs */ retval = ARKodeSetMaxNumSteps(arkode_mem, 1000000); @@ -493,10 +478,7 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) /* Set fixed step size */ retval = ARKodeSetFixedStep(arkode_mem, 1e-5); - if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) - { - return 1; - } + if (check_retval(&retval, "ARKodeSetFixedStep", 1, udata->myid)) { return 1; } /* Output initial condition */ if (uopt->nout > 0) diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D.h b/examples/arkode/CXX_parallel/ark_brusselator1D.h index b95390bc4a..790306fde8 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D.h +++ b/examples/arkode/CXX_parallel/ark_brusselator1D.h @@ -195,7 +195,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -}* TaskLocalNewton_Content; +} * TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) 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 4b98b4de78..8bee143d0b 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp +++ b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp @@ -912,7 +912,7 @@ int TaskLocalNlsResidual(N_Vector ycor, N_Vector F, void* arkode_mem) void* user_data; retval = ARKodeGetNonlinearSystemData(arkode_mem, &tcur, &zpred, &z, &Fi, - &gamma, &sdata, &user_data); + &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 bdaf48ef3d..63108a9bd2 100644 --- a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp +++ b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp @@ -1007,8 +1007,7 @@ static int SetupMRI(SUNContext ctx, UserData* udata, N_Vector y, if (check_flag((void*)inner_arkode_mem, "ARKStepCreate", 0)) { return 1; } // Specify tolerances - flag = ARKodeSStolerances(inner_arkode_mem, udata->rtol_fast, - udata->atol_fast); + flag = ARKodeSStolerances(inner_arkode_mem, udata->rtol_fast, udata->atol_fast); if (check_flag(&flag, "ARKodeSStolerances", 1)) { return 1; } // Attach user data diff --git a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp index 804ed9c2c7..a44d27022d 100644 --- a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp +++ b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp @@ -560,10 +560,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; (void)SUNAdaptController_Destroy(C); // Free timestep adaptivity controller SUNContext_Free(&ctx); // Free context diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp index 40d8e81923..f3cb4a54fa 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp @@ -614,11 +614,11 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - SUNMatDestroy(A); // Free matrix - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + SUNMatDestroy(A); // Free matrix + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; (void)SUNAdaptController_Destroy(C); // Free time adaptivity controller SUNContext_Free(&ctx); // Free context diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp index aa70f1caa3..3b16818670 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp @@ -597,10 +597,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; (void)SUNAdaptController_Destroy(C); // Free timestep adaptivity controller SUNContext_Free(&ctx); // Free context 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 56118e882d..3f1d1d8b35 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp @@ -613,7 +613,7 @@ int main(int argc, char* argv[]) 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 diff --git a/examples/arkode/CXX_serial/ark_analytic_sys.cpp b/examples/arkode/CXX_serial/ark_analytic_sys.cpp index 1dcae7c878..e0a668f025 100644 --- a/examples/arkode/CXX_serial/ark_analytic_sys.cpp +++ b/examples/arkode/CXX_serial/ark_analytic_sys.cpp @@ -181,7 +181,7 @@ int main() // Linear solver interface flag = ARKodeSetLinearSolver(arkode_mem, LS, - A); // Attach matrix and linear solver + 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; } @@ -262,10 +262,10 @@ int main() cout << " Total number of error test failures = " << netf << "\n\n"; // Clean up and return with successful completion - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - SUNMatDestroy(A); // Free A matrix - N_VDestroy(y); // Free y vector + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + SUNMatDestroy(A); // Free A matrix + N_VDestroy(y); // Free y vector if (logger) { SUNLogger_Destroy(&logger); // Free logger diff --git a/examples/arkode/CXX_serial/ark_heat2D.cpp b/examples/arkode/CXX_serial/ark_heat2D.cpp index 887e59a782..d0da950bd6 100644 --- a/examples/arkode/CXX_serial/ark_heat2D.cpp +++ b/examples/arkode/CXX_serial/ark_heat2D.cpp @@ -465,10 +465,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; (void)SUNAdaptController_Destroy(C); // Free time adaptivity controller SUNContext_Free(&ctx); // Free context diff --git a/examples/arkode/CXX_serial/ark_kpr_Mt.cpp b/examples/arkode/CXX_serial/ark_kpr_Mt.cpp index 431082a467..74de1a344d 100644 --- a/examples/arkode/CXX_serial/ark_kpr_Mt.cpp +++ b/examples/arkode/CXX_serial/ark_kpr_Mt.cpp @@ -334,13 +334,13 @@ int main(int argc, char* argv[]) } // Clean up and return - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // free system linear solver - SUNLinSolFree(MLS); // free mass linear solver - SUNNonlinSolFree(NLS); // free nonlinear solver - SUNMatDestroy(A); // free system matrix - SUNMatDestroy(M); // free mass matrix - N_VDestroy(y); // Free y vector + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // free system linear solver + SUNLinSolFree(MLS); // free mass linear solver + SUNNonlinSolFree(NLS); // free nonlinear solver + SUNMatDestroy(A); // free system matrix + SUNMatDestroy(M); // free mass matrix + N_VDestroy(y); // Free y vector return 0; } diff --git a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp index 72cfefb4a1..3e29ddaf50 100644 --- a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp +++ b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp @@ -124,7 +124,7 @@ typedef struct sunrealtype ep; /* stiffness parameter */ N_Vector tmp; /* temporary vector */ SUNMatrix R; /* temporary storage */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -536,8 +536,7 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - retval = ARKodeEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ + 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); @@ -614,7 +613,7 @@ int main(int argc, char* argv[]) N_VDestroy(vmask); N_VDestroy(wmask); ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solvers */ + SUNLinSolFree(LS); /* Free linear solvers */ SUNLinSolFree(MLS); SUNMatDestroy(A); /* Free matrices */ SUNMatDestroy(M); 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 d883a73ed8..f10509ed43 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp @@ -701,10 +701,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; braid_Destroy(core); // Free braid memory ARKBraid_Free(&app); // Free interface memory diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp index 55253433fb..8db37df9d0 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp @@ -648,10 +648,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; braid_Destroy(core); // Free braid memory ARKBraid_Free(&app); // Free interface memory diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp index 7f450e8217..f1f1bd23da 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp @@ -586,10 +586,10 @@ int main(int argc, char* argv[]) // Clean up and return // -------------------- - ARKodeFree(&arkode_mem); // Free integrator memory - SUNLinSolFree(LS); // Free linear solver - N_VDestroy(u); // Free vectors - FreeUserData(udata); // Free user data + ARKodeFree(&arkode_mem); // Free integrator memory + SUNLinSolFree(LS); // Free linear solver + N_VDestroy(u); // Free vectors + FreeUserData(udata); // Free user data delete udata; braid_Destroy(core); // Free braid memory ARKBraid_Free(&app); // Free interface memory diff --git a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c index 8ea29e8369..fd232b8e47 100644 --- a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c +++ b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c @@ -86,7 +86,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -329,10 +329,10 @@ int main(void) N_VDestroy(u); N_VDestroy(v); N_VDestroy(w); - free(userdata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free context */ + free(userdata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_openmp/ark_brusselator1D_omp.c b/examples/arkode/C_openmp/ark_brusselator1D_omp.c index d68067127b..f2ac2594e6 100644 --- a/examples/arkode/C_openmp/ark_brusselator1D_omp.c +++ b/examples/arkode/C_openmp/ark_brusselator1D_omp.c @@ -83,7 +83,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) /* general problem variables */ int flag; /* reusable error-checking flag */ - N_Vector y = NULL; /* empty vector for storing solution */ + N_Vector y = NULL; /* empty vector for storing solution */ N_Vector umask = NULL; /* empty mask vectors for viewing solution components */ N_Vector vmask = NULL; N_Vector wmask = NULL; @@ -344,11 +344,11 @@ int main(int argc, char* argv[]) printf(" Total number of error test failures = %li\n\n", netf); /* Clean up and return with successful completion */ - free(udata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free matrix */ - N_VDestroy(y); /* Free vectors */ + free(udata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free matrix */ + N_VDestroy(y); /* Free vectors */ N_VDestroy(umask); N_VDestroy(vmask); N_VDestroy(wmask); @@ -391,7 +391,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) vconst = dv / dx / dx; wconst = dw / dx / dx; #pragma omp parallel for default(shared) private(i, u, ul, ur, v, vl, vr, w, \ - wl, wr) schedule(static) \ + wl, wr) schedule(static) \ num_threads(udata->nthreads) for (i = 1; i < N - 1; i++) { diff --git a/examples/arkode/C_openmp/ark_heat1D_omp.c b/examples/arkode/C_openmp/ark_heat1D_omp.c index feb208ac43..fbba119471 100644 --- a/examples/arkode/C_openmp/ark_heat1D_omp.c +++ b/examples/arkode/C_openmp/ark_heat1D_omp.c @@ -68,7 +68,7 @@ typedef struct int nthreads; /* number of OpenMP threads */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -245,11 +245,11 @@ int main(int argc, char* argv[]) printf(" Total number of error test failures = %li\n", netf); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free vectors */ - free(udata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free vectors */ + free(udata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c index 123d984175..9e76e3ce9b 100644 --- a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c @@ -151,9 +151,9 @@ int main(void) printf(" Total number of error test failures = %li\n\n", netf); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + 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 02669d9e5e..0b82f9254f 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c @@ -84,7 +84,7 @@ typedef struct sunrealtype* x_dev; /* current mesh on device */ sunrealtype k; /* diffusion coefficient */ sunrealtype refine_tol; /* adaptivity tolerance */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -554,8 +554,8 @@ static int project(sunindextype Nold, sunrealtype* xold, N_Vector yold, /* loop over new mesh, finding corresponding interval within old mesh, and perform piecewise linear interpolation from yold to ynew */ iv = 0; -#pragma omp target map(to : iv) is_device_ptr(Yold, Ynew, xnew, xold) \ - device(dev) +#pragma omp target map(to \ + : iv) is_device_ptr(Yold, Ynew, xnew, xold) device(dev) #pragma omp teams distribute parallel for schedule(static, 1) { for (i = 0; i < Nnew; i++) diff --git a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c index 5d5c8d9ce9..356ff8a189 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c @@ -68,7 +68,7 @@ typedef struct sunindextype N; /* number of intervals */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -138,7 +138,7 @@ int main(void) 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 */ + 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; } @@ -241,11 +241,11 @@ int main(void) printf(" Total number of error test failures = %li\n", netf); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free vectors */ - free(udata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free vectors */ + free(udata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free context */ return 0; } @@ -285,7 +285,8 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) c2 = -SUN_RCONST(2.0) * k / dx / dx; isource = N / 2; -#pragma omp target map(to : c1, c2, isource, N, dx) is_device_ptr(Ydot, Y) \ +#pragma omp target map(to \ + : c1, c2, isource, N, dx) is_device_ptr(Ydot, Y) \ device(dev) #pragma omp teams distribute parallel for schedule(static, 1) for (i = 1; i < N - 1; i++) 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 73825d1221..a0b704b9bd 100644 --- a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c +++ b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c @@ -107,7 +107,7 @@ typedef struct FILE* VFID; FILE* WFID; char* outputdir; -}* UserOptions; +} * UserOptions; /* * User data structure @@ -160,7 +160,7 @@ typedef struct /* integrator options */ UserOptions uopt; -}* UserData; +} * UserData; /* * Definitions for a custom task local SUNNonlinearSolver @@ -173,7 +173,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -}* TaskLocalNewton_Content; +} * TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) 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 2769ced1b8..4ee688ea72 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c @@ -120,7 +120,7 @@ typedef struct int my_pe, isubx, isuby; sunindextype nvmxsub, nvmxsub2, Nlocal; MPI_Comm comm; -}* UserData; +} * UserData; /* Prototypes of private helper functions */ static void InitUserData(int my_pe, sunindextype local_N, MPI_Comm comm, diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_p.c index ade42769dc..613b64c476 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.c @@ -134,7 +134,7 @@ typedef struct sunrealtype **P[MXSUB][MYSUB], **Jbd[MXSUB][MYSUB]; sunindextype* pivot[MXSUB][MYSUB]; -}* UserData; +} * UserData; /* Private Helper Functions */ static void InitUserData(int my_pe, MPI_Comm comm, UserData data); diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index 5c90a93281..b3e250fc15 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -133,7 +133,7 @@ typedef struct sunrealtype **P[MXSUB][MYSUB], **Jbd[MXSUB][MYSUB]; sunindextype* pivot[MXSUB][MYSUB]; -}* UserData; +} * UserData; /* Private Helper Functions */ static void InitUserData(int my_pe, MPI_Comm comm, UserData data); diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec.c b/examples/arkode/C_serial/ark_KrylovDemo_prec.c index 26774ead15..8479bf5d55 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec.c +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec.c @@ -197,7 +197,7 @@ typedef struct N_Vector tmp; N_Vector rewt; void* arkode_mem; -}* WebData; +} * WebData; /* Private Helper Functions */ diff --git a/examples/arkode/C_serial/ark_analytic.c b/examples/arkode/C_serial/ark_analytic.c index 4544f6f0ad..c13bd87b15 100644 --- a/examples/arkode/C_serial/ark_analytic.c +++ b/examples/arkode/C_serial/ark_analytic.c @@ -198,11 +198,11 @@ int main(void) flag = check_ans(y, t, reltol, abstol); /* Clean up and return */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return flag; } diff --git a/examples/arkode/C_serial/ark_analytic_mels.c b/examples/arkode/C_serial/ark_analytic_mels.c index 4373a7aa3d..334323a9bf 100644 --- a/examples/arkode/C_serial/ark_analytic_mels.c +++ b/examples/arkode/C_serial/ark_analytic_mels.c @@ -131,8 +131,7 @@ int main(void) printf(" ---------------------\n"); while (Tf - t > 1.0e-15) { - retval = ARKodeEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ + 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 */ @@ -183,10 +182,10 @@ int main(void) retval = check_ans(y, t, reltol, abstol); /* Clean up and return */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free the SUNContext */ + N_VDestroy(y); /* Free y vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free the SUNContext */ return retval; } diff --git a/examples/arkode/C_serial/ark_analytic_nonlin.c b/examples/arkode/C_serial/ark_analytic_nonlin.c index e56600d3fc..1bb5f99987 100644 --- a/examples/arkode/C_serial/ark_analytic_nonlin.c +++ b/examples/arkode/C_serial/ark_analytic_nonlin.c @@ -136,9 +136,9 @@ int main(void) fclose(FID); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + 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 8702a2189e..05bc72375d 100644 --- a/examples/arkode/C_serial/ark_brusselator.c +++ b/examples/arkode/C_serial/ark_brusselator.c @@ -176,8 +176,7 @@ int main(void) 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 */ + 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 */ @@ -267,11 +266,11 @@ int main(void) printf(" Total number of failed steps from solver failure = %li\n", ncfn); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return 0; } @@ -284,12 +283,12 @@ int main(void) static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype b = rdata[1]; - sunrealtype ep = rdata[2]; - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype b = rdata[1]; + sunrealtype ep = rdata[2]; + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; @@ -304,10 +303,10 @@ static int Jac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype ep = rdata[2]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype ep = rdata[2]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the Jacobian via SUNDenseMatrix macro, SM_ELEMENT_D (see sunmatrix_dense.h) */ SM_ELEMENT_D(J, 0, 0) = -(w + 1.0) + 2.0 * u * v; diff --git a/examples/arkode/C_serial/ark_brusselator1D.c b/examples/arkode/C_serial/ark_brusselator1D.c index f8b647cde1..1af52e1907 100644 --- a/examples/arkode/C_serial/ark_brusselator1D.c +++ b/examples/arkode/C_serial/ark_brusselator1D.c @@ -76,7 +76,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -113,7 +113,7 @@ int main(void) /* general problem variables */ int flag; /* reusable error-checking flag */ - N_Vector y = NULL; /* empty vector for storing solution */ + N_Vector y = NULL; /* empty vector for storing solution */ N_Vector umask = NULL; /* empty mask vectors for viewing solution components */ N_Vector vmask = NULL; N_Vector wmask = NULL; @@ -325,11 +325,11 @@ int main(void) N_VDestroy(umask); N_VDestroy(vmask); N_VDestroy(wmask); - free(udata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + free(udata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c index 327a4c66e7..e62954bff0 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c @@ -122,7 +122,7 @@ typedef struct sunrealtype ep; /* stiffness parameter */ N_Vector tmp; /* temporary vector */ SUNMatrix R; /* temporary storage */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -361,8 +361,7 @@ int main(int argc, char* argv[]) printf(" ----------------------------------------------\n"); for (iout = 0; iout < Nt; iout++) { - retval = ARKodeEvolve(arkode_mem, tout, y, &t, - ARK_NORMAL); /* call integrator */ + 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); @@ -442,8 +441,8 @@ int main(int argc, char* argv[]) N_VDestroy(udata->tmp); free(udata->x); free(udata); - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solvers */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solvers */ SUNLinSolFree(MLS); SUNMatDestroy(A); /* Free matrices */ SUNMatDestroy(M); diff --git a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c index c1245a4f4e..4d8688cfdc 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c +++ b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c @@ -107,7 +107,7 @@ typedef struct sunrealtype av; /* advection coeff for v */ sunrealtype aw; /* advection coeff for w */ sunrealtype ep; /* stiffness parameter */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_brusselator1D_klu.c b/examples/arkode/C_serial/ark_brusselator1D_klu.c index 98dc04533d..3601e2a830 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_klu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_klu.c @@ -87,7 +87,7 @@ typedef struct sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ SUNMatrix R; /* temporary storage */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -272,12 +272,12 @@ int main(void) for (iout = 0; iout < Nt; iout++) { 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); - v = SUNRsqrt(v * v / N); - w = N_VWL2Norm(y, wmask); - w = SUNRsqrt(w * w / N); + u = N_VWL2Norm(y, umask); + u = SUNRsqrt(u * u / N); + v = N_VWL2Norm(y, vmask); + v = SUNRsqrt(v * v / N); + w = N_VWL2Norm(y, wmask); + w = SUNRsqrt(w * w / N); printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", t, u, v, w); if (flag >= 0) @@ -337,12 +337,12 @@ 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); - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_serial/ark_brusselator_1D_mri.c b/examples/arkode/C_serial/ark_brusselator_1D_mri.c index ba858f7a0e..623692bb58 100644 --- a/examples/arkode/C_serial/ark_brusselator_1D_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_1D_mri.c @@ -89,7 +89,7 @@ typedef struct sunrealtype b; /* steady-state value of w */ sunrealtype c; /* advection coefficient */ sunrealtype ep; /* stiffness parameter */ -}* UserData; +} * UserData; /* user-provided functions called by the integrator */ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_brusselator_fp.c b/examples/arkode/C_serial/ark_brusselator_fp.c index f3e2664f07..6841e10647 100644 --- a/examples/arkode/C_serial/ark_brusselator_fp.c +++ b/examples/arkode/C_serial/ark_brusselator_fp.c @@ -279,9 +279,9 @@ int main(int argc, char* argv[]) static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype b = rdata[1]; /* access data entries */ - sunrealtype ep = rdata[2]; - sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ + sunrealtype b = rdata[1]; /* access data entries */ + sunrealtype ep = rdata[2]; + sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ /* fill in the RHS function */ NV_Ith_S(ydot, 0) = 0.0; @@ -295,10 +295,10 @@ static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; diff --git a/examples/arkode/C_serial/ark_brusselator_mri.c b/examples/arkode/C_serial/ark_brusselator_mri.c index 0b636fd3a7..d5e5ecd529 100644 --- a/examples/arkode/C_serial/ark_brusselator_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_mri.c @@ -251,9 +251,9 @@ int main(void) static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype b = rdata[1]; /* access data entries */ - sunrealtype ep = rdata[2]; - sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ + sunrealtype b = rdata[1]; /* access data entries */ + sunrealtype ep = rdata[2]; + sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ /* fill in the RHS function */ NV_Ith_S(ydot, 0) = 0.0; @@ -268,10 +268,10 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; diff --git a/examples/arkode/C_serial/ark_heat1D.c b/examples/arkode/C_serial/ark_heat1D.c index ef0458f113..60427653d0 100644 --- a/examples/arkode/C_serial/ark_heat1D.c +++ b/examples/arkode/C_serial/ark_heat1D.c @@ -60,7 +60,7 @@ typedef struct sunindextype N; /* number of intervals */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -230,11 +230,11 @@ int main(void) printf(" Total number of error test failures = %li\n", netf); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free vectors */ - free(udata); /* Free user data */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free vectors */ + free(udata); /* Free user data */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_serial/ark_heat1D_adapt.c b/examples/arkode/C_serial/ark_heat1D_adapt.c index 45a8ff63fb..677bfe53b1 100644 --- a/examples/arkode/C_serial/ark_heat1D_adapt.c +++ b/examples/arkode/C_serial/ark_heat1D_adapt.c @@ -75,7 +75,7 @@ typedef struct sunrealtype* x; /* current mesh */ sunrealtype k; /* diffusion coefficient */ sunrealtype refine_tol; /* adaptivity tolerance */ -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -290,9 +290,9 @@ int main(void) N_VDestroy(y); /* Free vectors */ free(udata->x); /* Free user data */ free(udata); - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNContext_Free(&ctx); /* Free context */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/examples/arkode/C_serial/ark_kepler.c b/examples/arkode/C_serial/ark_kepler.c index f298389049..4eb720cd13 100644 --- a/examples/arkode/C_serial/ark_kepler.c +++ b/examples/arkode/C_serial/ark_kepler.c @@ -82,7 +82,7 @@ typedef struct { sunrealtype ecc; -}* UserData; +} * UserData; typedef struct { diff --git a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c index 65a4ca73bf..7a3129d9d5 100644 --- a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c +++ b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c @@ -66,7 +66,7 @@ typedef struct sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ sunrealtype lam; -}* UserData; +} * UserData; /* User-supplied Functions Called by the Solver */ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_robertson.c b/examples/arkode/C_serial/ark_robertson.c index 2456ef7da8..833861243d 100644 --- a/examples/arkode/C_serial/ark_robertson.c +++ b/examples/arkode/C_serial/ark_robertson.c @@ -200,11 +200,11 @@ int main(void) flag = check_ans(y, t, reltol, abstol); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return flag; } diff --git a/examples/arkode/C_serial/ark_robertson_constraints.c b/examples/arkode/C_serial/ark_robertson_constraints.c index bc4f2d9345..8c247dbf28 100644 --- a/examples/arkode/C_serial/ark_robertson_constraints.c +++ b/examples/arkode/C_serial/ark_robertson_constraints.c @@ -239,12 +239,12 @@ int main(void) flag = check_ans(y, t, reltol, abstol); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - N_VDestroy(constraints); /* Free constraints vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + N_VDestroy(constraints); /* Free constraints vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return flag; } diff --git a/examples/arkode/C_serial/ark_robertson_root.c b/examples/arkode/C_serial/ark_robertson_root.c index 1b2c7864aa..a4aa8fb066 100644 --- a/examples/arkode/C_serial/ark_robertson_root.c +++ b/examples/arkode/C_serial/ark_robertson_root.c @@ -139,7 +139,8 @@ int main(void) 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 */ + 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; } @@ -245,12 +246,12 @@ int main(void) printf(" Total number of failed steps from solver failure = %li\n", ncfn); /* Clean up and return with successful completion */ - N_VDestroy(y); /* Free y vector */ - N_VDestroy(atols); /* Free atols vector */ - ARKodeFree(&arkode_mem); /* Free integrator memory */ - SUNLinSolFree(LS); /* Free linear solver */ - SUNMatDestroy(A); /* Free A matrix */ - SUNContext_Free(&ctx); /* Free context */ + N_VDestroy(y); /* Free y vector */ + N_VDestroy(atols); /* Free atols vector */ + ARKodeFree(&arkode_mem); /* Free integrator memory */ + SUNLinSolFree(LS); /* Free linear solver */ + SUNMatDestroy(A); /* Free A matrix */ + SUNContext_Free(&ctx); /* Free context */ return 0; } diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index 8ee70255f2..ace964d2ac 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -195,8 +195,8 @@ typedef enum /* Resize and Reset functions */ SUNDIALS_EXPORT int ARKodeResize(void* arkode_mem, N_Vector ynew, - sunrealtype hscale, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); + sunrealtype hscale, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); SUNDIALS_EXPORT int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ @@ -239,10 +239,8 @@ SUNDIALS_EXPORT int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); SUNDIALS_EXPORT int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min); SUNDIALS_EXPORT int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); -SUNDIALS_EXPORT int ARKodeSetMaxFirstGrowth(void* arkode_mem, - sunrealtype etamx1); -SUNDIALS_EXPORT int ARKodeSetMaxEFailGrowth(void* arkode_mem, - sunrealtype etamxf); +SUNDIALS_EXPORT int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); +SUNDIALS_EXPORT int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); SUNDIALS_EXPORT int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef); SUNDIALS_EXPORT int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); SUNDIALS_EXPORT int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); @@ -269,7 +267,8 @@ SUNDIALS_EXPORT int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop); SUNDIALS_EXPORT int ARKodeClearStopTime(void* arkode_mem); SUNDIALS_EXPORT int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed); SUNDIALS_EXPORT int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails); -SUNDIALS_EXPORT int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_EXPORT int ARKodeSetUseCompensatedSums(void* arkode_mem, + sunbooleantype onoff); SUNDIALS_EXPORT int ARKodeSetUserData(void* arkode_mem, void* user_data); @@ -361,8 +360,7 @@ SUNDIALS_EXPORT int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails); SUNDIALS_EXPORT int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); -SUNDIALS_EXPORT int ARKodeGetNumJtimesEvals(void* arkode_mem, - long int* njvevals); +SUNDIALS_EXPORT int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals); SUNDIALS_EXPORT int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); SUNDIALS_EXPORT int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag); @@ -396,19 +394,15 @@ SUNDIALS_EXPORT void ARKodePrintMem(void* arkode_mem, FILE* outfile); SUNDIALS_EXPORT int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); SUNDIALS_EXPORT int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); -SUNDIALS_EXPORT int ARKodeSetRelaxLowerBound(void* arkode_mem, - sunrealtype lower); +SUNDIALS_EXPORT int ARKodeSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); SUNDIALS_EXPORT int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails); SUNDIALS_EXPORT int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters); -SUNDIALS_EXPORT int ARKodeSetRelaxSolver(void* arkode_mem, - ARKRelaxSolver solver); +SUNDIALS_EXPORT int ARKodeSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); SUNDIALS_EXPORT int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); SUNDIALS_EXPORT int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol); -SUNDIALS_EXPORT int ARKodeSetRelaxUpperBound(void* arkode_mem, - sunrealtype upper); -SUNDIALS_EXPORT int ARKodeGetNumRelaxFnEvals(void* arkode_mem, - long int* r_evals); +SUNDIALS_EXPORT int ARKodeSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); +SUNDIALS_EXPORT int ARKodeGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); SUNDIALS_EXPORT int ARKodeGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); SUNDIALS_EXPORT int ARKodeGetNumRelaxFails(void* arkode_mem, @@ -420,7 +414,6 @@ SUNDIALS_EXPORT int ARKodeGetNumRelaxSolveFails(void* arkode_mem, SUNDIALS_EXPORT int ARKodeGetNumRelaxSolveIters(void* arkode_mem, long int* iters); - #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 75b5dbbbca..0406ca44f3 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -69,9 +69,8 @@ SUNDIALS_EXPORT void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, SUNContext sunctx); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") -int ARKStepResize(void* arkode_mem, N_Vector ynew, - sunrealtype hscale, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); +int ARKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); SUNDIALS_EXPORT int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0); @@ -81,8 +80,7 @@ int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") -int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, - sunrealtype abstol); +int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") @@ -98,12 +96,10 @@ int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun); /* Linear solver set functions */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") -int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, - SUNMatrix A); +int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLinearSolver instead") -int ARKStepSetMassLinearSolver(void* arkode_mem, - SUNLinearSolver LS, SUNMatrix M, - sunbooleantype time_dep); +int ARKStepSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, + SUNMatrix M, sunbooleantype time_dep); /* Rootfinding initialization */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") @@ -157,8 +153,7 @@ int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") -int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, - sunrealtype ub); +int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ARKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, sunrealtype adapt_params[3]); @@ -183,8 +178,7 @@ int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") int ARKStepSetPredictorMethod(void* arkode_mem, int method); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") -int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, - void* estab_data); +int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") @@ -225,7 +219,7 @@ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") int ARKStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") -int ARKStepSetPostprocessStepFn(void* arkode_mem,ARKPostProcessFn ProcessStep); +int ARKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") int ARKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") @@ -330,8 +324,7 @@ int ARKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") int ARKStepGetUserData(void* arkode_mem, void** user_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") -int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, - SUNOutputFormat fmt); +int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") char* ARKStepGetReturnFlagName(long int flag); @@ -346,16 +339,15 @@ SUNDIALS_EXPORT int ARKStepGetTimestepperStats( long int* step_attempts, long int* nfe_evals, long int* nfi_evals, long int* nlinsetups, long int* netfails); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") -int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); +int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, + sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); /* Nonlinear solver optional output functions */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") -int ARKStepGetNonlinearSystemData( void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, - N_Vector* Fi, sunrealtype* gamma, - N_Vector* sdata, void** user_data); +int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index ee7464a525..7781de0600 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -61,11 +61,9 @@ int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); /* Tolerance input functions */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") -int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, - sunrealtype abstol); +int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") -int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, - N_Vector abstol); +int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); @@ -103,8 +101,7 @@ int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepSetFiARKodeBounds instead") -int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, - sunrealtype ub); +int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") int ERKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, int pq, sunrealtype adapt_params[3]); @@ -117,8 +114,7 @@ int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") -int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, - void* estab_data); +int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") @@ -219,9 +215,8 @@ SUNDIALS_EXPORT int ERKStepGetTimestepperStats( void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nfevals, long int* netfails); SUNDIALS_DEPRECATED_EXPORT_MSG("use ERKStepARKodeStats instead") -int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); +int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, + sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); /* Free function */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") diff --git a/include/arkode/arkode_ls.h b/include/arkode/arkode_ls.h index 3afa02f6b2..ce5a6928fa 100644 --- a/include/arkode/arkode_ls.h +++ b/include/arkode/arkode_ls.h @@ -123,7 +123,6 @@ SUNDIALS_EXPORT int ARKodeSetMassTimes(void* arkode_mem, void* mtimes_data); SUNDIALS_EXPORT int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); - #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index b1cfdff60a..84c18d42c4 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -305,10 +305,10 @@ SUNDIALS_EXPORT int MRIStepWriteCoupling(void* arkode_mem, FILE* fp); /* Nonlinear solver optional output functions */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") -int MRIStepGetNonlinearSystemData( void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, - N_Vector* F, sunrealtype* gamma, - N_Vector* sdata, void** user_data); +int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* F, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") @@ -327,7 +327,8 @@ int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J); SUNDIALS_DEPRECATED_EXPORT_MSG("use MRIStepGetJacARKodes instead") int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinWorkSpace instead") -int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS); +int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, + long int* leniwLS); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index 602579d921..f3e8f333b2 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -83,7 +83,8 @@ int SPRKStepSetUserData(void* arkode_mem, void* user_data); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") int SPRKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") -int SPRKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); +int SPRKStepSetPostprocessStageFn(void* arkode_mem, + ARKPostProcessFn ProcessStage); /* Integrate the ODE over an interval in t */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index c2c1091e93..b723026a1c 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -402,10 +402,7 @@ int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR) } /* Call stepper routine to perform remaining reset operations (if provided) */ - if (ark_mem->step_reset) - { - return (ark_mem->step_reset(arkode_mem, tR, yR)); - } + if (ark_mem->step_reset) { return (ark_mem->step_reset(arkode_mem, tR, yR)); } return (ARK_SUCCESS); } @@ -614,8 +611,8 @@ int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -679,8 +676,8 @@ int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -764,8 +761,8 @@ int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1359,10 +1356,7 @@ void ARKodeFree(void** arkode_mem) ark_mem = (ARKodeMem)(*arkode_mem); /* free the time-stepper module memory (if provided) */ - if (ark_mem->step_free) - { - ark_mem->step_free(*arkode_mem); - } + if (ark_mem->step_free) { ark_mem->step_free(*arkode_mem); } /* free vector storage */ arkFreeVectors(ark_mem); @@ -1741,10 +1735,7 @@ void ARKodePrintMem(void* arkode_mem, FILE* outfile) #endif /* Call stepper PrintMem function (if provided) */ - if (ark_mem->step_printmem) - { - ark_mem->step_printmem(arkode_mem, outfile); - } + if (ark_mem->step_printmem) { ark_mem->step_printmem(arkode_mem, outfile); } } /*--------------------------------------------------------------- diff --git a/src/arkode/arkode_adapt_impl.h b/src/arkode/arkode_adapt_impl.h index 9f96027ca4..b050c175c8 100644 --- a/src/arkode/arkode_adapt_impl.h +++ b/src/arkode/arkode_adapt_impl.h @@ -100,7 +100,7 @@ typedef struct ARKodeHAdaptMemRec long int nst_acc; /* num accuracy-limited internal steps */ long int nst_exp; /* num stability-limited internal steps */ -}* ARKodeHAdaptMem; +} * ARKodeHAdaptMem; /*=============================================================== ARKODE Time Step Adaptivity Routines diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 087d679192..2c3e936965 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -95,52 +95,52 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, memset(step_mem, 0, sizeof(struct ARKodeARKStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_attachlinsol = arkStep_AttachLinsol; - ark_mem->step_attachmasssol = arkStep_AttachMasssol; - ark_mem->step_disablelsetup = arkStep_DisableLSetup; - ark_mem->step_disablemsetup = arkStep_DisableMSetup; - ark_mem->step_getlinmem = arkStep_GetLmem; - ark_mem->step_getmassmem = arkStep_GetMassMem; - ark_mem->step_getimplicitrhs = arkStep_GetImplicitRHS; - ark_mem->step_mmult = NULL; - ark_mem->step_getgammas = arkStep_GetGammas; - ark_mem->step_init = arkStep_Init; - ark_mem->step_fullrhs = arkStep_FullRHS; - ark_mem->step = arkStep_TakeStep_Z; - ark_mem->step_setuserdata = arkStep_SetUserData; - ark_mem->step_printallstats = arkStep_PrintAllStats; - ark_mem->step_writeparameters = arkStep_WriteParameters; - ark_mem->step_resize = arkStep_Resize; - ark_mem->step_free = arkStep_Free; - ark_mem->step_printmem = arkStep_PrintMem; - ark_mem->step_setdefaults = arkStep_SetDefaults; - ark_mem->step_computestate = arkStep_ComputeState; - ark_mem->step_setrelaxfn = arkStep_SetRelaxFn; - ark_mem->step_setorder = arkStep_SetOrder; - ark_mem->step_setnonlinearsolver = arkStep_SetNonlinearSolver; - ark_mem->step_setlinear = arkStep_SetLinear; - ark_mem->step_setnonlinear = arkStep_SetNonlinear; - ark_mem->step_setnlsrhsfn = arkStep_SetNlsRhsFn; - ark_mem->step_setdeduceimplicitrhs = arkStep_SetDeduceImplicitRhs; - ark_mem->step_setnonlincrdown = arkStep_SetNonlinCRDown; - ark_mem->step_setnonlinrdiv = arkStep_SetNonlinRDiv; - ark_mem->step_setdeltagammamax = arkStep_SetDeltaGammaMax; - ark_mem->step_setlsetupfrequency = arkStep_SetLSetupFrequency; - ark_mem->step_setpredictormethod = arkStep_SetPredictorMethod; - ark_mem->step_setmaxnonliniters = arkStep_SetMaxNonlinIters; - ark_mem->step_setnonlinconvcoef = arkStep_SetNonlinConvCoef; - ark_mem->step_setstagepredictfn = arkStep_SetStagePredictFn; - ark_mem->step_getnumlinsolvsetups = arkStep_GetNumLinSolvSetups; - ark_mem->step_getcurrentgamma = arkStep_GetCurrentGamma; - ark_mem->step_getnonlinearsystemdata = arkStep_GetNonlinearSystemData; - ark_mem->step_getnumnonlinsolviters = arkStep_GetNumNonlinSolvIters; + ark_mem->step_attachlinsol = arkStep_AttachLinsol; + ark_mem->step_attachmasssol = arkStep_AttachMasssol; + ark_mem->step_disablelsetup = arkStep_DisableLSetup; + ark_mem->step_disablemsetup = arkStep_DisableMSetup; + ark_mem->step_getlinmem = arkStep_GetLmem; + ark_mem->step_getmassmem = arkStep_GetMassMem; + ark_mem->step_getimplicitrhs = arkStep_GetImplicitRHS; + ark_mem->step_mmult = NULL; + ark_mem->step_getgammas = arkStep_GetGammas; + ark_mem->step_init = arkStep_Init; + ark_mem->step_fullrhs = arkStep_FullRHS; + ark_mem->step = arkStep_TakeStep_Z; + ark_mem->step_setuserdata = arkStep_SetUserData; + ark_mem->step_printallstats = arkStep_PrintAllStats; + ark_mem->step_writeparameters = arkStep_WriteParameters; + ark_mem->step_resize = arkStep_Resize; + ark_mem->step_free = arkStep_Free; + ark_mem->step_printmem = arkStep_PrintMem; + ark_mem->step_setdefaults = arkStep_SetDefaults; + ark_mem->step_computestate = arkStep_ComputeState; + ark_mem->step_setrelaxfn = arkStep_SetRelaxFn; + ark_mem->step_setorder = arkStep_SetOrder; + ark_mem->step_setnonlinearsolver = arkStep_SetNonlinearSolver; + ark_mem->step_setlinear = arkStep_SetLinear; + ark_mem->step_setnonlinear = arkStep_SetNonlinear; + ark_mem->step_setnlsrhsfn = arkStep_SetNlsRhsFn; + ark_mem->step_setdeduceimplicitrhs = arkStep_SetDeduceImplicitRhs; + ark_mem->step_setnonlincrdown = arkStep_SetNonlinCRDown; + ark_mem->step_setnonlinrdiv = arkStep_SetNonlinRDiv; + ark_mem->step_setdeltagammamax = arkStep_SetDeltaGammaMax; + ark_mem->step_setlsetupfrequency = arkStep_SetLSetupFrequency; + ark_mem->step_setpredictormethod = arkStep_SetPredictorMethod; + ark_mem->step_setmaxnonliniters = arkStep_SetMaxNonlinIters; + ark_mem->step_setnonlinconvcoef = arkStep_SetNonlinConvCoef; + ark_mem->step_setstagepredictfn = arkStep_SetStagePredictFn; + ark_mem->step_getnumlinsolvsetups = arkStep_GetNumLinSolvSetups; + ark_mem->step_getcurrentgamma = arkStep_GetCurrentGamma; + ark_mem->step_getnonlinearsystemdata = arkStep_GetNonlinearSystemData; + ark_mem->step_getnumnonlinsolviters = arkStep_GetNumNonlinSolvIters; ark_mem->step_getnumnonlinsolvconvfails = arkStep_GetNumNonlinSolvConvFails; - ark_mem->step_getnonlinsolvstats = arkStep_GetNonlinSolvStats; - ark_mem->step_supports_adaptive = SUNTRUE; - ark_mem->step_supports_algebraic = SUNTRUE; - ark_mem->step_supports_massmatrix = SUNTRUE; - ark_mem->step_supports_relaxation = SUNTRUE; - ark_mem->step_mem = (void*)step_mem; + ark_mem->step_getnonlinsolvstats = arkStep_GetNonlinSolvStats; + ark_mem->step_supports_adaptive = SUNTRUE; + ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_supports_massmatrix = SUNTRUE; + ark_mem->step_supports_relaxation = SUNTRUE; + ark_mem->step_mem = (void*)step_mem; /* Set default values for optional inputs */ retval = arkStep_SetDefaults((void*)ark_mem); diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index edca35e890..19ad7fbb89 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -159,7 +159,7 @@ typedef struct ARKodeARKStepMemRec sunrealtype* stage_times; /* workspace for applying forcing */ sunrealtype* stage_coefs; /* workspace for applying forcing */ -}* ARKodeARKStepMem; +} * ARKodeARKStepMem; /*=============================================================== ARK time step module private function prototypes diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 5195f08caa..8739ceff6a 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -58,10 +58,7 @@ int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) return (ARKodeGetDky(arkode_mem, t, k, dky)); } -void ARKStepFree(void** arkode_mem) -{ - ARKodeFree(arkode_mem); -} +void ARKStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); } void ARKStepPrintMem(void* arkode_mem, FILE* outfile) { @@ -532,8 +529,8 @@ int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, sunrealtype* gamma, N_Vector* sdata, void** user_data) { - return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, - gamma, sdata, user_data)); + return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, gamma, + sdata, user_data)); } int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails) @@ -582,7 +579,6 @@ int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, return (ARKodeGetNonlinSolvStats(arkode_mem, nniters, nnfails)); } - /*--------------------------------------------------------------- These wrappers for ARKLs module 'get' routines all are documented in arkode_arkstep.h. @@ -814,7 +810,6 @@ int ARKStepWriteParameters(void* arkode_mem, FILE* fp) return (ARKodeWriteParameters(arkode_mem, fp)); } - /*=============================================================== DEPRECATED ARKStep optional input/output functions ===============================================================*/ @@ -878,7 +873,6 @@ int arkStep_SetUserData(void* arkode_mem, void* user_data) return (ARK_SUCCESS); } - /*--------------------------------------------------------------- arkStep_SetDefaults: diff --git a/src/arkode/arkode_bandpre.c b/src/arkode/arkode_bandpre.c index ab559527d6..c54566cc54 100644 --- a/src/arkode/arkode_bandpre.c +++ b/src/arkode/arkode_bandpre.c @@ -187,7 +187,8 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, arkls_mem->pfree = ARKBandPrecFree; /* Attach preconditioner solve and setup functions */ - retval = ARKodeSetPreconditioner(arkode_mem, ARKBandPrecSetup, ARKBandPrecSolve); + retval = ARKodeSetPreconditioner(arkode_mem, ARKBandPrecSetup, + ARKBandPrecSolve); return (retval); } diff --git a/src/arkode/arkode_bandpre_impl.h b/src/arkode/arkode_bandpre_impl.h index bd3b506eaa..13d4948311 100644 --- a/src/arkode/arkode_bandpre_impl.h +++ b/src/arkode/arkode_bandpre_impl.h @@ -48,7 +48,7 @@ typedef struct ARKBandPrecDataRec /* Pointer to arkode_mem */ void* arkode_mem; -}* ARKBandPrecData; +} * ARKBandPrecData; /*--------------------------------------------------------------- ARKBANDPRE error messages diff --git a/src/arkode/arkode_bbdpre_impl.h b/src/arkode/arkode_bbdpre_impl.h index b34e78530c..e80009214f 100644 --- a/src/arkode/arkode_bbdpre_impl.h +++ b/src/arkode/arkode_bbdpre_impl.h @@ -57,7 +57,7 @@ typedef struct ARKBBDPrecDataRec /* pointer to arkode_mem */ void* arkode_mem; -}* ARKBBDPrecData; +} * ARKBBDPrecData; /*--------------------------------------------------------------- ARKBBDPRE error messages diff --git a/src/arkode/arkode_butcher_dirk.c b/src/arkode/arkode_butcher_dirk.c index 54026e7ae2..4940dd75ee 100644 --- a/src/arkode/arkode_butcher_dirk.c +++ b/src/arkode/arkode_butcher_dirk.c @@ -33,7 +33,8 @@ ARKodeButcherTable ARKodeButcherTable_LoadDIRK(ARKODE_DIRKTableID imethod) switch (imethod) { #define ARK_BUTCHER_TABLE(name, coeff) \ - case name: coeff break; + case name: \ + coeff break; #include "arkode_butcher_dirk.def" #undef ARK_BUTCHER_TABLE diff --git a/src/arkode/arkode_butcher_erk.c b/src/arkode/arkode_butcher_erk.c index e15aa6b8b0..42c81b5509 100644 --- a/src/arkode/arkode_butcher_erk.c +++ b/src/arkode/arkode_butcher_erk.c @@ -33,7 +33,8 @@ ARKodeButcherTable ARKodeButcherTable_LoadERK(ARKODE_ERKTableID emethod) switch (emethod) { #define ARK_BUTCHER_TABLE(name, coeff) \ - case name: coeff break; + case name: \ + coeff break; #include "arkode_butcher_erk.def" #undef ARK_BUTCHER_TABLE diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index e89cda6303..7031764f55 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -91,20 +91,20 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) memset(step_mem, 0, sizeof(struct ARKodeERKStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_init = erkStep_Init; - ark_mem->step_fullrhs = erkStep_FullRHS; - ark_mem->step = erkStep_TakeStep; - ark_mem->step_printallstats = erkStep_PrintAllStats; - ark_mem->step_writeparameters = erkStep_WriteParameters; - ark_mem->step_resize = erkStep_Resize; - ark_mem->step_free = erkStep_Free; - ark_mem->step_printmem = erkStep_PrintMem; - ark_mem->step_setdefaults = erkStep_SetDefaults; - ark_mem->step_setrelaxfn = erkStep_SetRelaxFn; - ark_mem->step_setorder = erkStep_SetOrder; - ark_mem->step_supports_adaptive = SUNTRUE; + ark_mem->step_init = erkStep_Init; + ark_mem->step_fullrhs = erkStep_FullRHS; + ark_mem->step = erkStep_TakeStep; + ark_mem->step_printallstats = erkStep_PrintAllStats; + ark_mem->step_writeparameters = erkStep_WriteParameters; + ark_mem->step_resize = erkStep_Resize; + ark_mem->step_free = erkStep_Free; + ark_mem->step_printmem = erkStep_PrintMem; + ark_mem->step_setdefaults = erkStep_SetDefaults; + ark_mem->step_setrelaxfn = erkStep_SetRelaxFn; + ark_mem->step_setorder = erkStep_SetOrder; + ark_mem->step_supports_adaptive = SUNTRUE; ark_mem->step_supports_relaxation = SUNTRUE; - ark_mem->step_mem = (void*)step_mem; + ark_mem->step_mem = (void*)step_mem; /* Set default values for optional inputs */ retval = erkStep_SetDefaults((void*)ark_mem); diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index 629ea9f6f6..44ccd4b518 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -61,7 +61,7 @@ typedef struct ARKodeERKStepMemRec sunrealtype* cvals; N_Vector* Xvecs; -}* ARKodeERKStepMem; +} * ARKodeERKStepMem; /*=============================================================== ERK time step module private function prototypes diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 2c5cd72ed4..34fea4bccf 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -57,10 +57,7 @@ int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) return (ARKodeGetDky(arkode_mem, t, k, dky)); } -void ERKStepFree(void** arkode_mem) -{ - ARKodeFree(arkode_mem); -} +void ERKStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); } void ERKStepPrintMem(void* arkode_mem, FILE* outfile) { @@ -248,7 +245,6 @@ int ERKStepSetOrder(void* arkode_mem, int ord) return (ARKodeSetOrder(arkode_mem, ord)); } - /*=============================================================== ERKStep Optional output functions (wrappers for generic ARKODE utility routines). All are documented in arkode_io.c. @@ -446,7 +442,6 @@ int ERKStepWriteParameters(void* arkode_mem, FILE* fp) return (ARKodeWriteParameters(arkode_mem, fp)); } - /*=============================================================== DEPRECATED ERKStep optional input/output functions ===============================================================*/ @@ -539,10 +534,10 @@ int erkStep_SetDefaults(void* arkode_mem) /* Set default values for integrator optional inputs (overwrite some adaptivity params for ERKStep use) */ - step_mem->q = Q_DEFAULT; /* method order */ - step_mem->p = 0; /* embedding order */ - step_mem->stages = 0; /* no stages */ - step_mem->B = NULL; /* no Butcher table */ + step_mem->q = Q_DEFAULT; /* method order */ + step_mem->p = 0; /* embedding order */ + step_mem->stages = 0; /* no stages */ + step_mem->B = NULL; /* no Butcher table */ ark_mem->hadapt_mem->etamxf = SUN_RCONST(0.3); /* max change on error-failed step */ ark_mem->hadapt_mem->safety = SUN_RCONST(0.99); /* step adaptivity safety factor */ ark_mem->hadapt_mem->growth = SUN_RCONST(25.0); /* step adaptivity growth factor */ diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 39404e1af6..1d95c78a85 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -200,30 +200,38 @@ typedef int (*ARKTimestepReset)(void* arkode_mem, sunrealtype tR, N_Vector yR); typedef void (*ARKTimestepFree)(void* arkode_mem); typedef void (*ARKTimestepPrintMem)(void* arkode_mem, FILE* outfile); typedef int (*ARKTimestepSetDefaults)(void* arkode_mem); -typedef int (*ARKTimestepComputeState)(void* arkode_mem, N_Vector zcor, N_Vector z); -typedef int (*ARKTimestepSetRelaxFn)(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +typedef int (*ARKTimestepComputeState)(void* arkode_mem, N_Vector zcor, + N_Vector z); +typedef int (*ARKTimestepSetRelaxFn)(void* arkode_mem, ARKRelaxFn rfn, + ARKRelaxJacFn rjac); typedef int (*ARKTimestepSetOrder)(void* arkode_mem, int maxord); -typedef int (*ARKTimestepSetNonlinearSolver)(void* arkode_mem, SUNNonlinearSolver NLS); +typedef int (*ARKTimestepSetNonlinearSolver)(void* arkode_mem, + SUNNonlinearSolver NLS); typedef int (*ARKTimestepSetLinear)(void* arkode_mem, int timedepend); typedef int (*ARKTimestepSetNonlinear)(void* arkode_mem); typedef int (*ARKTimestepSetNlsRhsFn)(void* arkode_mem, ARKRhsFn nls_fi); -typedef int (*ARKTimestepSetDeduceImplicitRhs)(void* arkode_mem, sunbooleantype deduce); +typedef int (*ARKTimestepSetDeduceImplicitRhs)(void* arkode_mem, + sunbooleantype deduce); typedef int (*ARKTimestepSetNonlinCRDown)(void* arkode_mem, sunrealtype crdown); typedef int (*ARKTimestepSetNonlinRDiv)(void* arkode_mem, sunrealtype rdiv); typedef int (*ARKTimestepSetDeltaGammaMax)(void* arkode_mem, sunrealtype dgmax); typedef int (*ARKTimestepSetLSetupFrequency)(void* arkode_mem, int msbp); typedef int (*ARKTimestepSetPredictorMethod)(void* arkode_mem, int method); typedef int (*ARKTimestepSetMaxNonlinIters)(void* arkode_mem, int maxcor); -typedef int (*ARKTimestepSetNonlinConvCoef)(void* arkode_mem, sunrealtype nlscoef); -typedef int (*ARKTimestepSetStagePredictFn)(void* arkode_mem, ARKStagePredictFn PredictStage); -typedef int (*ARKTimestepGetNumLinSolvSetups)(void* arkode_mem, long int* nlinsetups); +typedef int (*ARKTimestepSetNonlinConvCoef)(void* arkode_mem, + sunrealtype nlscoef); +typedef int (*ARKTimestepSetStagePredictFn)(void* arkode_mem, + ARKStagePredictFn PredictStage); +typedef int (*ARKTimestepGetNumLinSolvSetups)(void* arkode_mem, + long int* nlinsetups); typedef int (*ARKTimestepGetCurrentGamma)(void* arkode_mem, sunrealtype* gamma); -typedef int (*ARKTimestepGetNonlinearSystemData)(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, - N_Vector* Fi, sunrealtype* gamma, - N_Vector* sdata, void** user_data); -typedef int (*ARKTimestepGetNumNonlinSolvIters)(void* arkode_mem, long int* nniters); -typedef int (*ARKTimestepGetNumNonlinSolvConvFails)(void* arkode_mem, long int* nnfails); +typedef int (*ARKTimestepGetNonlinearSystemData)( + void* arkode_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, + N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); +typedef int (*ARKTimestepGetNumNonlinSolvIters)(void* arkode_mem, + long int* nniters); +typedef int (*ARKTimestepGetNumNonlinSolvConvFails)(void* arkode_mem, + long int* nnfails); typedef int (*ARKTimestepGetNonlinSolvStats)(void* arkode_mem, long int* nniters, long int* nnfails); @@ -295,7 +303,7 @@ typedef struct ARKodeMassMemRec int msolve_type; /* mass matrix interface type: 0=iterative; 1=direct; 2=custom */ -}* ARKodeMassMem; +} * ARKodeMassMem; /*--------------------------------------------------------------- Types : struct ARKodeMemRec, ARKodeMem diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 8de1341496..a4775b70a8 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -748,8 +748,8 @@ int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -843,8 +843,8 @@ int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -905,8 +905,8 @@ int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -951,8 +951,8 @@ int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1084,8 +1084,8 @@ int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed) /* ensure that when hfixed=0, the time step module supports adaptivity */ if ((hfixed == ZERO) && (!ark_mem->step_supports_adaptive)) { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "temporal adaptivity is not supported by this time step module"); + arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "temporal adaptivity is not supported by this time step module"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1269,8 +1269,8 @@ int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive && (constraints != NULL)) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1335,8 +1335,8 @@ int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1660,8 +1660,8 @@ int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1700,8 +1700,8 @@ int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1729,8 +1729,8 @@ int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1767,8 +1767,8 @@ int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1809,8 +1809,8 @@ int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1840,8 +1840,8 @@ int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1870,8 +1870,8 @@ int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1908,8 +1908,8 @@ int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1938,8 +1938,8 @@ int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1968,8 +1968,8 @@ int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -1998,8 +1998,8 @@ int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2028,8 +2028,8 @@ int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2069,8 +2069,8 @@ int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2101,8 +2101,8 @@ int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -2387,8 +2387,8 @@ int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -2519,8 +2519,8 @@ int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2547,8 +2547,8 @@ int ARKodeGetNumExpSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2575,8 +2575,8 @@ int ARKodeGetNumAccSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2603,8 +2603,8 @@ int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_ILL_INPUT); } @@ -2649,9 +2649,9 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) compute the nonlinear system function. ---------------------------------------------------------------*/ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, N_Vector* Fi, - sunrealtype* gamma, N_Vector* sdata, - void** user_data) + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data) { ARKodeMem ark_mem; if (arkode_mem == NULL) @@ -2665,8 +2665,8 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinearsystemdata) { - return (ark_mem->step_getnonlinearsystemdata(arkode_mem, tcur, zpred, z, - Fi, gamma, sdata, user_data)); + return (ark_mem->step_getnonlinearsystemdata(arkode_mem, tcur, zpred, z, Fi, + gamma, sdata, user_data)); } else { @@ -2784,8 +2784,8 @@ int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 8178fd7de2..b3c2c90c60 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -66,8 +66,8 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -328,8 +328,8 @@ int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -556,11 +556,11 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } - + /* return with failure if jac cannot be used */ if ((jac != NULL) && (arkls_mem->A == NULL)) { @@ -607,8 +607,8 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -650,8 +650,8 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -679,8 +679,8 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -722,8 +722,8 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -750,8 +750,8 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -784,8 +784,8 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -835,8 +835,8 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -894,8 +894,8 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -938,8 +938,8 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1011,8 +1011,8 @@ int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1034,8 +1034,8 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1057,8 +1057,8 @@ int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1086,8 +1086,8 @@ int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1147,8 +1147,8 @@ int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1175,8 +1175,8 @@ int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1202,8 +1202,8 @@ int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1229,8 +1229,8 @@ int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1256,8 +1256,8 @@ int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1283,8 +1283,8 @@ int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1310,8 +1310,8 @@ int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1337,8 +1337,8 @@ int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1364,8 +1364,8 @@ int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1391,8 +1391,8 @@ int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_ILL_INPUT); } @@ -1447,8 +1447,8 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1476,8 +1476,8 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1522,8 +1522,8 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1573,8 +1573,8 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1652,8 +1652,8 @@ int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1714,8 +1714,8 @@ int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1737,12 +1737,12 @@ int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) /* access ARKLsMassMem structure */ retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } - + /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1768,8 +1768,8 @@ int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1795,8 +1795,8 @@ int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1822,8 +1822,8 @@ int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1849,8 +1849,8 @@ int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1876,8 +1876,8 @@ int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1902,8 +1902,8 @@ int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1929,8 +1929,8 @@ int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1956,8 +1956,8 @@ int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_ls_impl.h b/src/arkode/arkode_ls_impl.h index 968c654bb9..a519e0b153 100644 --- a/src/arkode/arkode_ls_impl.h +++ b/src/arkode/arkode_ls_impl.h @@ -124,7 +124,7 @@ typedef struct ARKLsMemRec int last_flag; /* last error flag returned by any function */ -}* ARKLsMem; +} * ARKLsMem; /*--------------------------------------------------------------- Types: ARKLsMassMemRec, ARKLsMassMem @@ -184,7 +184,7 @@ typedef struct ARKLsMassMemRec int last_flag; /* last error flag returned by any function */ -}* ARKLsMassMem; +} * ARKLsMassMem; /*--------------------------------------------------------------- Prototypes of internal functions @@ -263,7 +263,6 @@ int arkLSSetMassUserData(void* arkode_mem, void* user_data); int arkLSGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); - /*--------------------------------------------------------------- Error Messages ---------------------------------------------------------------*/ diff --git a/src/arkode/arkode_mri_tables.c b/src/arkode/arkode_mri_tables.c index fa6dd9b256..a6b72a128d 100644 --- a/src/arkode/arkode_mri_tables.c +++ b/src/arkode/arkode_mri_tables.c @@ -37,7 +37,8 @@ MRIStepCoupling MRIStepCoupling_LoadTable(ARKODE_MRITableID method) switch (method) { #define ARK_MRI_TABLE(name, coeff) \ - case name: coeff break; + case name: \ + coeff break; #include "arkode_mri_tables.def" #undef ARK_MRI_TABLE diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 9b4ecd67c2..3bc477e217 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -105,45 +105,45 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, memset(step_mem, 0, sizeof(struct ARKodeMRIStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_attachlinsol = mriStep_AttachLinsol; - ark_mem->step_disablelsetup = mriStep_DisableLSetup; - ark_mem->step_getlinmem = mriStep_GetLmem; - ark_mem->step_getimplicitrhs = mriStep_GetImplicitRHS; - ark_mem->step_getgammas = mriStep_GetGammas; - ark_mem->step_init = mriStep_Init; - ark_mem->step_fullrhs = mriStep_FullRHS; - ark_mem->step = mriStep_TakeStep; - ark_mem->step_setuserdata = mriStep_SetUserData; - ark_mem->step_printallstats = mriStep_PrintAllStats; - ark_mem->step_writeparameters = mriStep_WriteParameters; - ark_mem->step_resize = mriStep_Resize; - ark_mem->step_reset = mriStep_Reset; - ark_mem->step_free = mriStep_Free; - ark_mem->step_printmem = mriStep_PrintMem; - ark_mem->step_setdefaults = mriStep_SetDefaults; - ark_mem->step_computestate = mriStep_ComputeState; - ark_mem->step_setorder = mriStep_SetOrder; - ark_mem->step_setnonlinearsolver = mriStep_SetNonlinearSolver; - ark_mem->step_setlinear = mriStep_SetLinear; - ark_mem->step_setnonlinear = mriStep_SetNonlinear; - ark_mem->step_setnlsrhsfn = mriStep_SetNlsRhsFn; - ark_mem->step_setdeduceimplicitrhs = mriStep_SetDeduceImplicitRhs; - ark_mem->step_setnonlincrdown = mriStep_SetNonlinCRDown; - ark_mem->step_setnonlinrdiv = mriStep_SetNonlinRDiv; - ark_mem->step_setdeltagammamax = mriStep_SetDeltaGammaMax; - ark_mem->step_setlsetupfrequency = mriStep_SetLSetupFrequency; - ark_mem->step_setpredictormethod = mriStep_SetPredictorMethod; - ark_mem->step_setmaxnonliniters = mriStep_SetMaxNonlinIters; - ark_mem->step_setnonlinconvcoef = mriStep_SetNonlinConvCoef; - ark_mem->step_setstagepredictfn = mriStep_SetStagePredictFn; - ark_mem->step_getnumlinsolvsetups = mriStep_GetNumLinSolvSetups; - ark_mem->step_getcurrentgamma = mriStep_GetCurrentGamma; - ark_mem->step_getnonlinearsystemdata = mriStep_GetNonlinearSystemData; - ark_mem->step_getnumnonlinsolviters = mriStep_GetNumNonlinSolvIters; + ark_mem->step_attachlinsol = mriStep_AttachLinsol; + ark_mem->step_disablelsetup = mriStep_DisableLSetup; + ark_mem->step_getlinmem = mriStep_GetLmem; + ark_mem->step_getimplicitrhs = mriStep_GetImplicitRHS; + ark_mem->step_getgammas = mriStep_GetGammas; + ark_mem->step_init = mriStep_Init; + ark_mem->step_fullrhs = mriStep_FullRHS; + ark_mem->step = mriStep_TakeStep; + ark_mem->step_setuserdata = mriStep_SetUserData; + ark_mem->step_printallstats = mriStep_PrintAllStats; + ark_mem->step_writeparameters = mriStep_WriteParameters; + ark_mem->step_resize = mriStep_Resize; + ark_mem->step_reset = mriStep_Reset; + ark_mem->step_free = mriStep_Free; + ark_mem->step_printmem = mriStep_PrintMem; + ark_mem->step_setdefaults = mriStep_SetDefaults; + ark_mem->step_computestate = mriStep_ComputeState; + ark_mem->step_setorder = mriStep_SetOrder; + ark_mem->step_setnonlinearsolver = mriStep_SetNonlinearSolver; + ark_mem->step_setlinear = mriStep_SetLinear; + ark_mem->step_setnonlinear = mriStep_SetNonlinear; + ark_mem->step_setnlsrhsfn = mriStep_SetNlsRhsFn; + ark_mem->step_setdeduceimplicitrhs = mriStep_SetDeduceImplicitRhs; + ark_mem->step_setnonlincrdown = mriStep_SetNonlinCRDown; + ark_mem->step_setnonlinrdiv = mriStep_SetNonlinRDiv; + ark_mem->step_setdeltagammamax = mriStep_SetDeltaGammaMax; + ark_mem->step_setlsetupfrequency = mriStep_SetLSetupFrequency; + ark_mem->step_setpredictormethod = mriStep_SetPredictorMethod; + ark_mem->step_setmaxnonliniters = mriStep_SetMaxNonlinIters; + ark_mem->step_setnonlinconvcoef = mriStep_SetNonlinConvCoef; + ark_mem->step_setstagepredictfn = mriStep_SetStagePredictFn; + ark_mem->step_getnumlinsolvsetups = mriStep_GetNumLinSolvSetups; + ark_mem->step_getcurrentgamma = mriStep_GetCurrentGamma; + ark_mem->step_getnonlinearsystemdata = mriStep_GetNonlinearSystemData; + ark_mem->step_getnumnonlinsolviters = mriStep_GetNumNonlinSolvIters; ark_mem->step_getnumnonlinsolvconvfails = mriStep_GetNumNonlinSolvConvFails; - ark_mem->step_getnonlinsolvstats = mriStep_GetNonlinSolvStats; - ark_mem->step_supports_algebraic = SUNTRUE; - ark_mem->step_mem = (void*)step_mem; + ark_mem->step_getnonlinsolvstats = mriStep_GetNonlinSolvStats; + ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_mem = (void*)step_mem; /* Set default values for optional inputs */ retval = mriStep_SetDefaults((void*)ark_mem); diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index 4db2c5f9ee..a230997f1d 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -138,7 +138,7 @@ typedef struct ARKodeMRIStepMemRec sunrealtype* cvals; N_Vector* Xvecs; -}* ARKodeMRIStepMem; +} * ARKodeMRIStepMem; /*=============================================================== MRI innter time stepper data structure diff --git a/src/arkode/arkode_mristep_io.c b/src/arkode/arkode_mristep_io.c index eeedc65a48..e7267cfe02 100644 --- a/src/arkode/arkode_mristep_io.c +++ b/src/arkode/arkode_mristep_io.c @@ -54,10 +54,7 @@ int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) return (ARKodeGetDky(arkode_mem, t, k, dky)); } -void MRIStepFree(void** arkode_mem) -{ - ARKodeFree(arkode_mem); -} +void MRIStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); } void MRIStepPrintMem(void* arkode_mem, FILE* outfile) { @@ -340,8 +337,8 @@ int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, sunrealtype* gamma, N_Vector* sdata, void** user_data) { - return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, - gamma, sdata, user_data)); + return (ARKodeGetNonlinearSystemData(arkode_mem, tcur, zpred, z, Fi, gamma, + sdata, user_data)); } int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails) @@ -1268,7 +1265,10 @@ int mriStep_WriteParameters(void* arkode_mem, FILE* fp) { fprintf(fp, " ImEx slow time scale\n"); } - else if (step_mem->implicit_rhs) { fprintf(fp, " Implicit slow time scale\n"); } + else if (step_mem->implicit_rhs) + { + fprintf(fp, " Implicit slow time scale\n"); + } else { fprintf(fp, " Explicit slow time scale\n"); } if (step_mem->implicit_rhs) diff --git a/src/arkode/arkode_root.c b/src/arkode/arkode_root.c index f60334c658..3ea456cc32 100644 --- a/src/arkode/arkode_root.c +++ b/src/arkode/arkode_root.c @@ -47,7 +47,7 @@ int ARKodeRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; - nrt = (nrtfn < 0) ? 0 : nrtfn; + nrt = (nrtfn < 0) ? 0 : nrtfn; /* Ensure that stepper provides fullrhs function */ if (nrt > 0) diff --git a/src/arkode/arkode_root_impl.h b/src/arkode/arkode_root_impl.h index 6b4d66704b..43a57b5d96 100644 --- a/src/arkode/arkode_root_impl.h +++ b/src/arkode/arkode_root_impl.h @@ -67,7 +67,7 @@ typedef struct ARKodeRootMemRec int mxgnull; /* num. warning messages about possible g==0 */ void* root_data; /* pointer to user_data */ -}* ARKodeRootMem; +} * ARKodeRootMem; /*=============================================================== ARKODE Root-finding Routines diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index 360316017e..1672835360 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -116,16 +116,16 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, } } else { step_mem->yerr = NULL; } - ark_mem->step_init = sprkStep_Init; - ark_mem->step_fullrhs = sprkStep_FullRHS; - ark_mem->step = sprkStep_TakeStep; - ark_mem->step_printallstats = sprkStep_PrintAllStats; + ark_mem->step_init = sprkStep_Init; + ark_mem->step_fullrhs = sprkStep_FullRHS; + ark_mem->step = sprkStep_TakeStep; + ark_mem->step_printallstats = sprkStep_PrintAllStats; ark_mem->step_writeparameters = sprkStep_WriteParameters; - ark_mem->step_resize = sprkStep_Resize; - ark_mem->step_free = sprkStep_Free; - ark_mem->step_setdefaults = sprkStep_SetDefaults; - ark_mem->step_setorder = sprkStep_SetOrder; - ark_mem->step_mem = (void*)step_mem; + ark_mem->step_resize = sprkStep_Resize; + ark_mem->step_free = sprkStep_Free; + ark_mem->step_setdefaults = sprkStep_SetDefaults; + ark_mem->step_setorder = sprkStep_SetOrder; + ark_mem->step_mem = (void*)step_mem; /* Set default values for optional inputs */ retval = sprkStep_SetDefaults((void*)ark_mem); @@ -193,7 +193,7 @@ int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, /* Resize the local vectors */ if (!arkResizeVec(ark_mem, resize, resize_data, lrw_diff, liw_diff, y0, - &step_mem->sdata)) + &step_mem->sdata)) { arkProcessError(ark_mem, ARK_MEM_FAIL, __LINE__, __func__, __FILE__, "Unable to resize vector"); diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 48250ea92e..506b592bae 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -60,7 +60,7 @@ typedef struct ARKodeSPRKStepMemRec long int nf2; /* number of calls to f2 */ int istage; -}* ARKodeSPRKStepMem; +} * ARKodeSPRKStepMem; /*=============================================================== SPRK time step module private function prototypes diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index 042e3a9f32..ac8d979bfd 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -54,10 +54,7 @@ int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) return (ARKodeGetDky(arkode_mem, t, k, dky)); } -void SPRKStepFree(void** arkode_mem) -{ - ARKodeFree(arkode_mem); -} +void SPRKStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); } void SPRKStepPrintMem(void* arkode_mem, FILE* outfile) { @@ -252,7 +249,7 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) if (onoff) { - retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNTRUE); + retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNTRUE); ark_mem->step = sprkStep_TakeStep_Compensated; if (!step_mem->yerr) { @@ -264,7 +261,7 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) } else { - retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNFALSE); + retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNFALSE); ark_mem->step = sprkStep_TakeStep; } diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp index 2b8211e9ec..579e76ddef 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp @@ -365,10 +365,7 @@ int run_tests(MRISTEP_METHOD_TYPE type, sunrealtype t0, int nsteps, if (check_flag(&flag, "ARKodeGetNumNonlinSolvIters", 1)) { return 1; } flag = ARKodeGetNumNonlinSolvConvFails(mristep_mem, &mri_ncfn); - if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) - { - return 1; - } + if (check_flag(&flag, "ARKodeGetNumNonlinSolvConvFails", 1)) { return 1; } flag = ARKodeGetNumLinSolvSetups(mristep_mem, &mri_nsetups); if (check_flag(&flag, "ARKodeGetNumLinSolvSetups", 1)) { return 1; } From 32b5260b29783db0883b10290539522eeef6d3da Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sun, 21 Apr 2024 22:13:56 -0500 Subject: [PATCH 08/39] re-ran clang-format after reinstalling version 17 --- .../kokkos/arkode_driver.cpp | 2 +- .../advection_reaction_3D/kokkos/rhs3D.hpp | 4 ++-- .../raja/arkode_driver.cpp | 2 +- .../arkode/CXX_parallel/ark_brusselator1D.h | 2 +- .../ark_brusselator1D_FEM_sludist.cpp | 2 +- .../C_manyvector/ark_brusselator1D_manyvec.c | 2 +- .../arkode/C_openmp/ark_brusselator1D_omp.c | 6 +++--- examples/arkode/C_openmp/ark_heat1D_omp.c | 2 +- .../C_openmpdev/ark_heat1D_adapt_ompdev.c | 6 +++--- .../arkode/C_openmpdev/ark_heat1D_ompdev.c | 5 ++--- .../ark_brusselator1D_task_local_nls.c | 6 +++--- .../arkode/C_parallel/ark_diurnal_kry_bbd_p.c | 2 +- .../arkode/C_parallel/ark_diurnal_kry_p.c | 2 +- examples/arkode/C_parhyp/ark_diurnal_kry_ph.c | 2 +- .../arkode/C_serial/ark_KrylovDemo_prec.c | 2 +- examples/arkode/C_serial/ark_brusselator.c | 20 +++++++++---------- examples/arkode/C_serial/ark_brusselator1D.c | 4 ++-- .../C_serial/ark_brusselator1D_FEM_slu.c | 2 +- .../C_serial/ark_brusselator1D_imexmri.c | 2 +- .../arkode/C_serial/ark_brusselator1D_klu.c | 14 ++++++------- .../arkode/C_serial/ark_brusselator_1D_mri.c | 2 +- examples/arkode/C_serial/ark_brusselator_fp.c | 14 ++++++------- .../arkode/C_serial/ark_brusselator_mri.c | 14 ++++++------- examples/arkode/C_serial/ark_heat1D.c | 2 +- examples/arkode/C_serial/ark_heat1D_adapt.c | 2 +- examples/arkode/C_serial/ark_kepler.c | 2 +- .../C_serial/ark_reaction_diffusion_mri.c | 2 +- src/arkode/arkode_adapt_impl.h | 2 +- src/arkode/arkode_arkstep_impl.h | 2 +- src/arkode/arkode_bandpre_impl.h | 2 +- src/arkode/arkode_bbdpre_impl.h | 2 +- src/arkode/arkode_butcher_dirk.c | 3 +-- src/arkode/arkode_butcher_erk.c | 3 +-- src/arkode/arkode_erkstep_impl.h | 2 +- src/arkode/arkode_erkstep_io.c | 8 ++++---- src/arkode/arkode_impl.h | 2 +- src/arkode/arkode_ls_impl.h | 4 ++-- src/arkode/arkode_mri_tables.c | 3 +-- src/arkode/arkode_mristep_impl.h | 2 +- src/arkode/arkode_root_impl.h | 2 +- src/arkode/arkode_sprkstep_impl.h | 2 +- 41 files changed, 81 insertions(+), 85 deletions(-) diff --git a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp index b5fab73efb..49dcc6d8cf 100644 --- a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp @@ -31,7 +31,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -} * TaskLocalNewton_Content; +}* TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) diff --git a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp index 1cb742528d..0dee917835 100644 --- a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp @@ -413,7 +413,7 @@ static int SolveReactionLinSys(N_Vector y, N_Vector x, N_Vector b, Bview(i, j, k, 1) * (A0 * A8 - scratch_9) + A5 * scratch_8 - A8 * scratch_10); Xview(i, j, k, - 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + + 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + scratch_13 * (Bview(i, j, k, 1) - scratch_10 * scratch_11)) / (-A8 + scratch_11 * scratch_9 + scratch_13 * (A5 - scratch_11 * scratch_7)); @@ -505,7 +505,7 @@ static int SolveReactionLinSysRes(N_Vector y, N_Vector x, N_Vector b, Bview(i, j, k, 1) * (A0 * A8 - scratch_9) + A5 * scratch_8 - A8 * scratch_10); Xview(i, j, k, - 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + + 2) = (-Bview(i, j, k, 2) + scratch_11 * scratch_8 + scratch_13 * (Bview(i, j, k, 1) - scratch_10 * scratch_11)) / (-A8 + scratch_11 * scratch_9 + scratch_13 * (A5 - scratch_11 * scratch_7)); diff --git a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp index b5fab73efb..49dcc6d8cf 100644 --- a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp @@ -31,7 +31,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -} * TaskLocalNewton_Content; +}* TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D.h b/examples/arkode/CXX_parallel/ark_brusselator1D.h index 790306fde8..b95390bc4a 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D.h +++ b/examples/arkode/CXX_parallel/ark_brusselator1D.h @@ -195,7 +195,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -} * TaskLocalNewton_Content; +}* TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) diff --git a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp index 3e29ddaf50..b41e69e82b 100644 --- a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp +++ b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp @@ -124,7 +124,7 @@ typedef struct sunrealtype ep; /* stiffness parameter */ N_Vector tmp; /* temporary vector */ SUNMatrix R; /* temporary storage */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c index fd232b8e47..dca37e62d8 100644 --- a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c +++ b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c @@ -86,7 +86,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_openmp/ark_brusselator1D_omp.c b/examples/arkode/C_openmp/ark_brusselator1D_omp.c index f2ac2594e6..2dde9c37ee 100644 --- a/examples/arkode/C_openmp/ark_brusselator1D_omp.c +++ b/examples/arkode/C_openmp/ark_brusselator1D_omp.c @@ -83,7 +83,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) /* general problem variables */ int flag; /* reusable error-checking flag */ - N_Vector y = NULL; /* empty vector for storing solution */ + N_Vector y = NULL; /* empty vector for storing solution */ N_Vector umask = NULL; /* empty mask vectors for viewing solution components */ N_Vector vmask = NULL; N_Vector wmask = NULL; @@ -391,7 +391,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) vconst = dv / dx / dx; wconst = dw / dx / dx; #pragma omp parallel for default(shared) private(i, u, ul, ur, v, vl, vr, w, \ - wl, wr) schedule(static) \ + wl, wr) schedule(static) \ num_threads(udata->nthreads) for (i = 1; i < N - 1; i++) { diff --git a/examples/arkode/C_openmp/ark_heat1D_omp.c b/examples/arkode/C_openmp/ark_heat1D_omp.c index fbba119471..74bc2bb27e 100644 --- a/examples/arkode/C_openmp/ark_heat1D_omp.c +++ b/examples/arkode/C_openmp/ark_heat1D_omp.c @@ -68,7 +68,7 @@ typedef struct int nthreads; /* number of OpenMP threads */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c index 0b82f9254f..02669d9e5e 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c @@ -84,7 +84,7 @@ typedef struct sunrealtype* x_dev; /* current mesh on device */ sunrealtype k; /* diffusion coefficient */ sunrealtype refine_tol; /* adaptivity tolerance */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -554,8 +554,8 @@ static int project(sunindextype Nold, sunrealtype* xold, N_Vector yold, /* loop over new mesh, finding corresponding interval within old mesh, and perform piecewise linear interpolation from yold to ynew */ iv = 0; -#pragma omp target map(to \ - : iv) is_device_ptr(Yold, Ynew, xnew, xold) device(dev) +#pragma omp target map(to : iv) is_device_ptr(Yold, Ynew, xnew, xold) \ + device(dev) #pragma omp teams distribute parallel for schedule(static, 1) { for (i = 0; i < Nnew; i++) diff --git a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c index 356ff8a189..3e252f2f49 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c @@ -68,7 +68,7 @@ typedef struct sunindextype N; /* number of intervals */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -285,8 +285,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) c2 = -SUN_RCONST(2.0) * k / dx / dx; isource = N / 2; -#pragma omp target map(to \ - : c1, c2, isource, N, dx) is_device_ptr(Ydot, Y) \ +#pragma omp target map(to : c1, c2, isource, N, dx) is_device_ptr(Ydot, Y) \ device(dev) #pragma omp teams distribute parallel for schedule(static, 1) for (i = 1; i < N - 1; i++) 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 a0b704b9bd..73825d1221 100644 --- a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c +++ b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c @@ -107,7 +107,7 @@ typedef struct FILE* VFID; FILE* WFID; char* outputdir; -} * UserOptions; +}* UserOptions; /* * User data structure @@ -160,7 +160,7 @@ typedef struct /* integrator options */ UserOptions uopt; -} * UserData; +}* UserData; /* * Definitions for a custom task local SUNNonlinearSolver @@ -173,7 +173,7 @@ typedef struct long int ncnf; MPI_Comm comm; SUNNonlinearSolver local_nls; -} * TaskLocalNewton_Content; +}* TaskLocalNewton_Content; /* Content accessor macors */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) 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 4ee688ea72..2769ced1b8 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c @@ -120,7 +120,7 @@ typedef struct int my_pe, isubx, isuby; sunindextype nvmxsub, nvmxsub2, Nlocal; MPI_Comm comm; -} * UserData; +}* UserData; /* Prototypes of private helper functions */ static void InitUserData(int my_pe, sunindextype local_N, MPI_Comm comm, diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_p.c index 613b64c476..ade42769dc 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.c @@ -134,7 +134,7 @@ typedef struct sunrealtype **P[MXSUB][MYSUB], **Jbd[MXSUB][MYSUB]; sunindextype* pivot[MXSUB][MYSUB]; -} * UserData; +}* UserData; /* Private Helper Functions */ static void InitUserData(int my_pe, MPI_Comm comm, UserData data); diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index b3e250fc15..5c90a93281 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -133,7 +133,7 @@ typedef struct sunrealtype **P[MXSUB][MYSUB], **Jbd[MXSUB][MYSUB]; sunindextype* pivot[MXSUB][MYSUB]; -} * UserData; +}* UserData; /* Private Helper Functions */ static void InitUserData(int my_pe, MPI_Comm comm, UserData data); diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec.c b/examples/arkode/C_serial/ark_KrylovDemo_prec.c index 8479bf5d55..26774ead15 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec.c +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec.c @@ -197,7 +197,7 @@ typedef struct N_Vector tmp; N_Vector rewt; void* arkode_mem; -} * WebData; +}* WebData; /* Private Helper Functions */ diff --git a/examples/arkode/C_serial/ark_brusselator.c b/examples/arkode/C_serial/ark_brusselator.c index 05bc72375d..927c3e57da 100644 --- a/examples/arkode/C_serial/ark_brusselator.c +++ b/examples/arkode/C_serial/ark_brusselator.c @@ -283,12 +283,12 @@ int main(void) static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype b = rdata[1]; - sunrealtype ep = rdata[2]; - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype b = rdata[1]; + sunrealtype ep = rdata[2]; + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; @@ -303,10 +303,10 @@ static int Jac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype ep = rdata[2]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype ep = rdata[2]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the Jacobian via SUNDenseMatrix macro, SM_ELEMENT_D (see sunmatrix_dense.h) */ SM_ELEMENT_D(J, 0, 0) = -(w + 1.0) + 2.0 * u * v; diff --git a/examples/arkode/C_serial/ark_brusselator1D.c b/examples/arkode/C_serial/ark_brusselator1D.c index 1af52e1907..6857fab6d0 100644 --- a/examples/arkode/C_serial/ark_brusselator1D.c +++ b/examples/arkode/C_serial/ark_brusselator1D.c @@ -76,7 +76,7 @@ typedef struct sunrealtype dv; /* diffusion coeff for v */ sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -113,7 +113,7 @@ int main(void) /* general problem variables */ int flag; /* reusable error-checking flag */ - N_Vector y = NULL; /* empty vector for storing solution */ + N_Vector y = NULL; /* empty vector for storing solution */ N_Vector umask = NULL; /* empty mask vectors for viewing solution components */ N_Vector vmask = NULL; N_Vector wmask = NULL; diff --git a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c index e62954bff0..09dcea4b6b 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c @@ -122,7 +122,7 @@ typedef struct sunrealtype ep; /* stiffness parameter */ N_Vector tmp; /* temporary vector */ SUNMatrix R; /* temporary storage */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c index 4d8688cfdc..c1245a4f4e 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c +++ b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c @@ -107,7 +107,7 @@ typedef struct sunrealtype av; /* advection coeff for v */ sunrealtype aw; /* advection coeff for w */ sunrealtype ep; /* stiffness parameter */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_brusselator1D_klu.c b/examples/arkode/C_serial/ark_brusselator1D_klu.c index 3601e2a830..07d151ac8c 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_klu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_klu.c @@ -87,7 +87,7 @@ typedef struct sunrealtype dw; /* diffusion coeff for w */ sunrealtype ep; /* stiffness parameter */ SUNMatrix R; /* temporary storage */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); @@ -272,12 +272,12 @@ int main(void) for (iout = 0; iout < Nt; iout++) { 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); - v = SUNRsqrt(v * v / N); - w = N_VWL2Norm(y, wmask); - w = SUNRsqrt(w * w / N); + u = N_VWL2Norm(y, umask); + u = SUNRsqrt(u * u / N); + v = N_VWL2Norm(y, vmask); + v = SUNRsqrt(v * v / N); + w = N_VWL2Norm(y, wmask); + w = SUNRsqrt(w * w / N); printf(" %10.6" FSYM " %10.6" FSYM " %10.6" FSYM " %10.6" FSYM "\n", t, u, v, w); if (flag >= 0) diff --git a/examples/arkode/C_serial/ark_brusselator_1D_mri.c b/examples/arkode/C_serial/ark_brusselator_1D_mri.c index 623692bb58..ba858f7a0e 100644 --- a/examples/arkode/C_serial/ark_brusselator_1D_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_1D_mri.c @@ -89,7 +89,7 @@ typedef struct sunrealtype b; /* steady-state value of w */ sunrealtype c; /* advection coefficient */ sunrealtype ep; /* stiffness parameter */ -} * UserData; +}* UserData; /* user-provided functions called by the integrator */ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_brusselator_fp.c b/examples/arkode/C_serial/ark_brusselator_fp.c index 6841e10647..f3e2664f07 100644 --- a/examples/arkode/C_serial/ark_brusselator_fp.c +++ b/examples/arkode/C_serial/ark_brusselator_fp.c @@ -279,9 +279,9 @@ int main(int argc, char* argv[]) static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype b = rdata[1]; /* access data entries */ - sunrealtype ep = rdata[2]; - sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ + sunrealtype b = rdata[1]; /* access data entries */ + sunrealtype ep = rdata[2]; + sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ /* fill in the RHS function */ NV_Ith_S(ydot, 0) = 0.0; @@ -295,10 +295,10 @@ static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; diff --git a/examples/arkode/C_serial/ark_brusselator_mri.c b/examples/arkode/C_serial/ark_brusselator_mri.c index d5e5ecd529..0b636fd3a7 100644 --- a/examples/arkode/C_serial/ark_brusselator_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_mri.c @@ -251,9 +251,9 @@ int main(void) static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype b = rdata[1]; /* access data entries */ - sunrealtype ep = rdata[2]; - sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ + sunrealtype b = rdata[1]; /* access data entries */ + sunrealtype ep = rdata[2]; + sunrealtype w = NV_Ith_S(y, 2); /* access solution values */ /* fill in the RHS function */ NV_Ith_S(ydot, 0) = 0.0; @@ -268,10 +268,10 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype a = rdata[0]; /* access data entries */ - sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ - sunrealtype v = NV_Ith_S(y, 1); - sunrealtype w = NV_Ith_S(y, 2); + sunrealtype a = rdata[0]; /* access data entries */ + sunrealtype u = NV_Ith_S(y, 0); /* access solution values */ + sunrealtype v = NV_Ith_S(y, 1); + sunrealtype w = NV_Ith_S(y, 2); /* fill in the RHS function */ NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u; diff --git a/examples/arkode/C_serial/ark_heat1D.c b/examples/arkode/C_serial/ark_heat1D.c index 60427653d0..e47c614ac8 100644 --- a/examples/arkode/C_serial/ark_heat1D.c +++ b/examples/arkode/C_serial/ark_heat1D.c @@ -60,7 +60,7 @@ typedef struct sunindextype N; /* number of intervals */ sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_heat1D_adapt.c b/examples/arkode/C_serial/ark_heat1D_adapt.c index 677bfe53b1..415b878d8a 100644 --- a/examples/arkode/C_serial/ark_heat1D_adapt.c +++ b/examples/arkode/C_serial/ark_heat1D_adapt.c @@ -75,7 +75,7 @@ typedef struct sunrealtype* x; /* current mesh */ sunrealtype k; /* diffusion coefficient */ sunrealtype refine_tol; /* adaptivity tolerance */ -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/examples/arkode/C_serial/ark_kepler.c b/examples/arkode/C_serial/ark_kepler.c index 4eb720cd13..f298389049 100644 --- a/examples/arkode/C_serial/ark_kepler.c +++ b/examples/arkode/C_serial/ark_kepler.c @@ -82,7 +82,7 @@ typedef struct { sunrealtype ecc; -} * UserData; +}* UserData; typedef struct { diff --git a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c index 7a3129d9d5..65a4ca73bf 100644 --- a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c +++ b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c @@ -66,7 +66,7 @@ typedef struct sunrealtype dx; /* mesh spacing */ sunrealtype k; /* diffusion coefficient */ sunrealtype lam; -} * UserData; +}* UserData; /* User-supplied Functions Called by the Solver */ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); diff --git a/src/arkode/arkode_adapt_impl.h b/src/arkode/arkode_adapt_impl.h index b050c175c8..9f96027ca4 100644 --- a/src/arkode/arkode_adapt_impl.h +++ b/src/arkode/arkode_adapt_impl.h @@ -100,7 +100,7 @@ typedef struct ARKodeHAdaptMemRec long int nst_acc; /* num accuracy-limited internal steps */ long int nst_exp; /* num stability-limited internal steps */ -} * ARKodeHAdaptMem; +}* ARKodeHAdaptMem; /*=============================================================== ARKODE Time Step Adaptivity Routines diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index 19ad7fbb89..edca35e890 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -159,7 +159,7 @@ typedef struct ARKodeARKStepMemRec sunrealtype* stage_times; /* workspace for applying forcing */ sunrealtype* stage_coefs; /* workspace for applying forcing */ -} * ARKodeARKStepMem; +}* ARKodeARKStepMem; /*=============================================================== ARK time step module private function prototypes diff --git a/src/arkode/arkode_bandpre_impl.h b/src/arkode/arkode_bandpre_impl.h index 13d4948311..bd3b506eaa 100644 --- a/src/arkode/arkode_bandpre_impl.h +++ b/src/arkode/arkode_bandpre_impl.h @@ -48,7 +48,7 @@ typedef struct ARKBandPrecDataRec /* Pointer to arkode_mem */ void* arkode_mem; -} * ARKBandPrecData; +}* ARKBandPrecData; /*--------------------------------------------------------------- ARKBANDPRE error messages diff --git a/src/arkode/arkode_bbdpre_impl.h b/src/arkode/arkode_bbdpre_impl.h index e80009214f..b34e78530c 100644 --- a/src/arkode/arkode_bbdpre_impl.h +++ b/src/arkode/arkode_bbdpre_impl.h @@ -57,7 +57,7 @@ typedef struct ARKBBDPrecDataRec /* pointer to arkode_mem */ void* arkode_mem; -} * ARKBBDPrecData; +}* ARKBBDPrecData; /*--------------------------------------------------------------- ARKBBDPRE error messages diff --git a/src/arkode/arkode_butcher_dirk.c b/src/arkode/arkode_butcher_dirk.c index 4940dd75ee..54026e7ae2 100644 --- a/src/arkode/arkode_butcher_dirk.c +++ b/src/arkode/arkode_butcher_dirk.c @@ -33,8 +33,7 @@ ARKodeButcherTable ARKodeButcherTable_LoadDIRK(ARKODE_DIRKTableID imethod) switch (imethod) { #define ARK_BUTCHER_TABLE(name, coeff) \ - case name: \ - coeff break; + case name: coeff break; #include "arkode_butcher_dirk.def" #undef ARK_BUTCHER_TABLE diff --git a/src/arkode/arkode_butcher_erk.c b/src/arkode/arkode_butcher_erk.c index 42c81b5509..e15aa6b8b0 100644 --- a/src/arkode/arkode_butcher_erk.c +++ b/src/arkode/arkode_butcher_erk.c @@ -33,8 +33,7 @@ ARKodeButcherTable ARKodeButcherTable_LoadERK(ARKODE_ERKTableID emethod) switch (emethod) { #define ARK_BUTCHER_TABLE(name, coeff) \ - case name: \ - coeff break; + case name: coeff break; #include "arkode_butcher_erk.def" #undef ARK_BUTCHER_TABLE diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index 44ccd4b518..629ea9f6f6 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -61,7 +61,7 @@ typedef struct ARKodeERKStepMemRec sunrealtype* cvals; N_Vector* Xvecs; -} * ARKodeERKStepMem; +}* ARKodeERKStepMem; /*=============================================================== ERK time step module private function prototypes diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 34fea4bccf..151f37270a 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -534,10 +534,10 @@ int erkStep_SetDefaults(void* arkode_mem) /* Set default values for integrator optional inputs (overwrite some adaptivity params for ERKStep use) */ - step_mem->q = Q_DEFAULT; /* method order */ - step_mem->p = 0; /* embedding order */ - step_mem->stages = 0; /* no stages */ - step_mem->B = NULL; /* no Butcher table */ + step_mem->q = Q_DEFAULT; /* method order */ + step_mem->p = 0; /* embedding order */ + step_mem->stages = 0; /* no stages */ + step_mem->B = NULL; /* no Butcher table */ ark_mem->hadapt_mem->etamxf = SUN_RCONST(0.3); /* max change on error-failed step */ ark_mem->hadapt_mem->safety = SUN_RCONST(0.99); /* step adaptivity safety factor */ ark_mem->hadapt_mem->growth = SUN_RCONST(25.0); /* step adaptivity growth factor */ diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 1d95c78a85..3cecc4b9f0 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -303,7 +303,7 @@ typedef struct ARKodeMassMemRec int msolve_type; /* mass matrix interface type: 0=iterative; 1=direct; 2=custom */ -} * ARKodeMassMem; +}* ARKodeMassMem; /*--------------------------------------------------------------- Types : struct ARKodeMemRec, ARKodeMem diff --git a/src/arkode/arkode_ls_impl.h b/src/arkode/arkode_ls_impl.h index a519e0b153..c13797391e 100644 --- a/src/arkode/arkode_ls_impl.h +++ b/src/arkode/arkode_ls_impl.h @@ -124,7 +124,7 @@ typedef struct ARKLsMemRec int last_flag; /* last error flag returned by any function */ -} * ARKLsMem; +}* ARKLsMem; /*--------------------------------------------------------------- Types: ARKLsMassMemRec, ARKLsMassMem @@ -184,7 +184,7 @@ typedef struct ARKLsMassMemRec int last_flag; /* last error flag returned by any function */ -} * ARKLsMassMem; +}* ARKLsMassMem; /*--------------------------------------------------------------- Prototypes of internal functions diff --git a/src/arkode/arkode_mri_tables.c b/src/arkode/arkode_mri_tables.c index a6b72a128d..fa6dd9b256 100644 --- a/src/arkode/arkode_mri_tables.c +++ b/src/arkode/arkode_mri_tables.c @@ -37,8 +37,7 @@ MRIStepCoupling MRIStepCoupling_LoadTable(ARKODE_MRITableID method) switch (method) { #define ARK_MRI_TABLE(name, coeff) \ - case name: \ - coeff break; + case name: coeff break; #include "arkode_mri_tables.def" #undef ARK_MRI_TABLE diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index a230997f1d..4db2c5f9ee 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -138,7 +138,7 @@ typedef struct ARKodeMRIStepMemRec sunrealtype* cvals; N_Vector* Xvecs; -} * ARKodeMRIStepMem; +}* ARKodeMRIStepMem; /*=============================================================== MRI innter time stepper data structure diff --git a/src/arkode/arkode_root_impl.h b/src/arkode/arkode_root_impl.h index 43a57b5d96..6b4d66704b 100644 --- a/src/arkode/arkode_root_impl.h +++ b/src/arkode/arkode_root_impl.h @@ -67,7 +67,7 @@ typedef struct ARKodeRootMemRec int mxgnull; /* num. warning messages about possible g==0 */ void* root_data; /* pointer to user_data */ -} * ARKodeRootMem; +}* ARKodeRootMem; /*=============================================================== ARKODE Root-finding Routines diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 506b592bae..48250ea92e 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -60,7 +60,7 @@ typedef struct ARKodeSPRKStepMemRec long int nf2; /* number of calls to f2 */ int istage; -} * ARKodeSPRKStepMem; +}* ARKodeSPRKStepMem; /*=============================================================== SPRK time step module private function prototypes From ddfcc33f7da305242048c4eb8971b70865f0db6a Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 22 Apr 2024 09:03:38 -0500 Subject: [PATCH 09/39] Fixed workspace lengths in .out files --- examples/arkode/C_serial/ark_KrylovDemo_prec.out | 8 ++++---- examples/arkode/C_serial/ark_KrylovDemo_prec_1.out | 8 ++++---- examples/arkode/C_serial/ark_KrylovDemo_prec_2.out | 8 ++++---- test/answers | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec.out b/examples/arkode/C_serial/ark_KrylovDemo_prec.out index 79d7c4a86f..e60c62304f 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec.out +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec.out @@ -419,7 +419,7 @@ Species 6 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 131 + ARKStep integer workspace length = 143 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -488,7 +488,7 @@ t = 1.00e+01 nst = 190 nfe = 0 nfi = 3030 nni = 2072 hu = 1.57e+00 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 136 + ARKStep integer workspace length = 148 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -557,7 +557,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 141 + ARKStep integer workspace length = 153 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 @@ -626,7 +626,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 146 + ARKStep integer workspace length = 158 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec_1.out b/examples/arkode/C_serial/ark_KrylovDemo_prec_1.out index 79d7c4a86f..e60c62304f 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec_1.out +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec_1.out @@ -419,7 +419,7 @@ Species 6 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 131 + ARKStep integer workspace length = 143 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -488,7 +488,7 @@ t = 1.00e+01 nst = 190 nfe = 0 nfi = 3030 nni = 2072 hu = 1.57e+00 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 136 + ARKStep integer workspace length = 148 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -557,7 +557,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 141 + ARKStep integer workspace length = 153 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 @@ -626,7 +626,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 146 + ARKStep integer workspace length = 158 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec_2.out b/examples/arkode/C_serial/ark_KrylovDemo_prec_2.out index 79d7c4a86f..e60c62304f 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec_2.out +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec_2.out @@ -419,7 +419,7 @@ Species 6 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 131 + ARKStep integer workspace length = 143 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -488,7 +488,7 @@ t = 1.00e+01 nst = 190 nfe = 0 nfi = 3030 nni = 2072 hu = 1.57e+00 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 136 + ARKStep integer workspace length = 148 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 190 @@ -557,7 +557,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 141 + ARKStep integer workspace length = 153 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 @@ -626,7 +626,7 @@ t = 1.00e+01 nst = 349 nfe = 0 nfi = 5589 nni = 3826 hu = 2.80e-01 Final statistics for this run: ARKStep real workspace length = 3558 - ARKStep integer workspace length = 146 + ARKStep integer workspace length = 158 ARKLS real workspace length = 2647 ARKLS integer workspace length = 42 Number of steps = 349 diff --git a/test/answers b/test/answers index 1ab057ec30..91127b12f3 160000 --- a/test/answers +++ b/test/answers @@ -1 +1 @@ -Subproject commit 1ab057ec30477fd531d4cc16c6b9bb0cd55ebd45 +Subproject commit 91127b12f327b11301c62d4732f9c94c1dd1b03e From 05290be09b576a50ff96f1a3c5ea1ee08cd072d3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Wed, 24 Apr 2024 12:33:51 -0500 Subject: [PATCH 10/39] Initial pass at updated ARKODE documentation --- doc/arkode/guide/source/Constants.rst | 3 + doc/arkode/guide/source/Introduction.rst | 12 +- doc/arkode/guide/source/Mathematics.rst | 46 +- doc/arkode/guide/source/Organization.rst | 34 +- .../Usage/ARKStep_c_interface/Relaxation.rst | 86 +- .../ARKStep_c_interface/User_callable.rst | 1411 ++---- .../Usage/ARKStep_c_interface/XBraid.rst | 547 +- .../Usage/ARKStep_c_interface/index.rst | 40 +- .../Usage/ERKStep_c_interface/Relaxation.rst | 83 +- .../Usage/ERKStep_c_interface/Skeleton.rst | 146 - .../ERKStep_c_interface/User_callable.rst | 776 +-- .../Usage/ERKStep_c_interface/index.rst | 24 +- .../Usage/MRIStep_c_interface/Skeleton.rst | 249 +- .../MRIStep_c_interface/User_callable.rst | 1430 ++---- .../Usage/MRIStep_c_interface/index.rst | 22 +- .../Preconditioners.rst | 410 +- doc/arkode/guide/source/Usage/Relaxation.rst | 359 ++ .../Usage/SPRKStep_c_interface/Skeleton.rst | 143 - .../SPRKStep_c_interface/User_callable.rst | 358 +- .../Usage/SPRKStep_c_interface/index.rst | 24 +- .../{ARKStep_c_interface => }/Skeleton.rst | 92 +- .../guide/source/Usage/User_callable.rst | 4386 +++++++++++++++++ .../guide/source/Usage/User_supplied.rst | 932 ++-- doc/arkode/guide/source/Usage/index.rst | 65 +- doc/arkode/guide/source/index.rst | 2 +- include/arkode/arkode.h | 1 - include/arkode/arkode_sprkstep.h | 4 +- include/arkode/arkode_xbraid.h | 10 +- src/arkode/arkode_arkstep_io.c | 2 +- src/arkode/arkode_io.c | 19 - src/arkode/fmod/farkode_mod.c | 14 - src/arkode/fmod/farkode_mod.f90 | 26 - src/arkode/xbraid/arkode_xbraid.c | 20 +- 33 files changed, 7216 insertions(+), 4560 deletions(-) delete mode 100644 doc/arkode/guide/source/Usage/ERKStep_c_interface/Skeleton.rst rename doc/arkode/guide/source/Usage/{ARKStep_c_interface => }/Preconditioners.rst (62%) create mode 100644 doc/arkode/guide/source/Usage/Relaxation.rst delete mode 100644 doc/arkode/guide/source/Usage/SPRKStep_c_interface/Skeleton.rst rename doc/arkode/guide/source/Usage/{ARKStep_c_interface => }/Skeleton.rst (73%) create mode 100644 doc/arkode/guide/source/Usage/User_callable.rst diff --git a/doc/arkode/guide/source/Constants.rst b/doc/arkode/guide/source/Constants.rst index c4cad94a8d..69affcfaa9 100644 --- a/doc/arkode/guide/source/Constants.rst +++ b/doc/arkode/guide/source/Constants.rst @@ -470,6 +470,9 @@ contains the ARKODE output constants. +-------------------------------------+------+------------------------------------------------------------+ | :index:`ARK_CONTROLLER_ERR` | -47 | An error with a SUNAdaptController object was encountered. | +-------------------------------------+------+------------------------------------------------------------+ + | :index:`ARK_STEPPER_UNSUPPORTED` | -48 | An operation was not supported by the current | + | | | time-stepping module. | + +-------------------------------------+------+------------------------------------------------------------+ | :index:`ARK_UNRECOGNIZED_ERROR` | -99 | An unknown error was encountered. | +-------------------------------------+------+------------------------------------------------------------+ | | diff --git a/doc/arkode/guide/source/Introduction.rst b/doc/arkode/guide/source/Introduction.rst index 6461cbf0d6..a8e4d53d20 100644 --- a/doc/arkode/guide/source/Introduction.rst +++ b/doc/arkode/guide/source/Introduction.rst @@ -153,12 +153,12 @@ The structure of this document is as follows: ARKODE is :ref:`organized `. * The largest section follows, providing a full account of how to use - ARKODE's time-stepping modules, :ref:`ARKStep `, - :ref:`ERKStep `, and :ref:`MRIStep `, - within C and C++ applications. This section then includes additional - information on how to use ARKODE from applications written in - :ref:`Fortran `, as well as information on how to - leverage :ref:`GPU accelerators within ARKODE `. + ARKODE within C and C++ applications, including any instructions that are + specific to a given time-stepping modules, :ref:`ARKStep `, + :ref:`ERKStep `, or :ref:`MRIStep `. + This section then includes additional information on how to use ARKODE from + applications written in :ref:`Fortran `, as well as information + on how to leverage :ref:`GPU accelerators within ARKODE `. * A much smaller section follows, describing ARKODE's :ref:`Butcher table structure `, that is used by diff --git a/doc/arkode/guide/source/Mathematics.rst b/doc/arkode/guide/source/Mathematics.rst index 8da6d2735a..ddbd7c4122 100644 --- a/doc/arkode/guide/source/Mathematics.rst +++ b/doc/arkode/guide/source/Mathematics.rst @@ -70,8 +70,8 @@ discussion of our choice of norms for measuring errors within various components of the solver. We then discuss the nonlinear and linear solver strategies used by -ARKODE's time-stepping modules for solving implicit algebraic systems -that arise in computing each stage and/or step: +ARKODE for solving implicit algebraic systems that arise in computing each +stage and/or step: :ref:`nonlinear solvers `, :ref:`linear solvers `, :ref:`preconditioners `, @@ -109,7 +109,7 @@ The choice of step size :math:`h_n` is determined by the time-stepping method (based on user-provided inputs, typically accuracy requirements). However, users may place minimum/maximum bounds on :math:`h_n` if desired. -ARKODE's time stepping modules may be run in a variety of "modes": +ARKODE may be run in a variety of "modes": * **NORMAL** -- The solver will take internal steps until it has just overtaken a user-specified output time, :math:`t_\text{out}`, in the @@ -151,7 +151,7 @@ may be used. Interpolation =============== -As mentioned above, the time-stepping modules in ARKODE support +As mentioned above, the ARKODE supports interpolation of solutions :math:`y(t_\text{out})` and derivatives :math:`y^{(d)}(t_\text{out})`, where :math:`t_\text{out}` occurs within a completed time step from :math:`t_{n-1} \to t_n`. @@ -162,13 +162,12 @@ ARKODE currently supports construction of polynomial interpolants :math:`p_q(t)` of polynomial degree up to :math:`q=5`, although users may select interpolants of lower degree. -ARKODE provides two complementary interpolation approaches, -both of which are accessible from any of the -time-stepping modules: "Hermite" and "Lagrange". The former approach +ARKODE provides two complementary interpolation approaches: +"Hermite" and "Lagrange". The former approach has been included with ARKODE since its inception, and is more -suitable for non-stiff problems; the latter is a new approach that is -designed to provide increased accuracy when integrating stiff problems. -Both are described in detail below. +suitable for non-stiff problems; the latter is a more recent approach +that is designed to provide increased accuracy when integrating stiff +problems. Both are described in detail below. .. _ARKODE.Mathematics.Interpolation.Hermite: @@ -565,7 +564,8 @@ form is used to compute a time step: #. Using compensated summation, set :math:`p_n = p_{n-1} + \Delta p_n, q_n = q_{n-1} + \Delta q_n` Since temporal error based adaptive time-stepping is known to ruin the -conservation property :cite:p:`HaWa:06`, SPRKStep employs a fixed time-step size. +conservation property :cite:p:`HaWa:06`, SPRKStep requires that ARKODE be run +using a fixed time-step size. .. However, it is possible for a user to provide a .. problem-specific adaptivity controller such as the one described in :cite:p:`HaSo:05`. @@ -1014,11 +1014,8 @@ information. In this mode, all internal time step adaptivity is disabled: Fixed-step mode is currently required for the slow time scale in the MRIStep module. -Additional information on this mode is provided in the sections -:ref:`ARKStep Optional Inputs `, -:ref:`ERKStep Optional Inputs `, -:ref:`SPRKStep Optional Inputs `, and -:ref:`MRIStep Optional Inputs `. +Additional information on this mode is provided in the section +:ref:`ARKODE Optional Inputs `. .. _ARKODE.Mathematics.AlgebraicSolvers: @@ -1140,8 +1137,7 @@ Consider, for example, :eq:`ARKODE_Residual_MeqI` which implies :label: ARKODE_Implicit_Stage_Eval when :math:`z_i` is the exact root, and similar relations hold for non-identity -mass matrices. This optimization can be enabled by -:c:func:`ARKStepSetDeduceImplicitRhs` and :c:func:`MRIStepSetDeduceImplicitRhs` +mass matrices. This optimization can be enabled by :c:func:`ARKodeSetDeduceImplicitRhs` with the second argument in either function set to SUNTRUE. Another factor to consider when using this option is the amplification of errors from the nonlinear solver to the stages. In :eq:`ARKODE_Implicit_Stage_Eval`, nonlinear @@ -1948,10 +1944,9 @@ step (but zero linear solves with the system Jacobian). Rootfinding =============== -All of the time-stepping modules in ARKODE also support a rootfinding -feature. This means that, while integrating the IVP :eq:`ARKODE_IVP`, these -can also find the roots of a set of user-defined functions -:math:`g_i(t,y)` that depend on :math:`t` and the solution vector +ARKODE also supports a rootfinding feature, in that while integrating the +IVP :eq:`ARKODE_IVP`, these can also find the roots of a set of user-defined +functions :math:`g_i(t,y)` that depend on :math:`t` and the solution vector :math:`y = y(t)`. The number of these root functions is arbitrary, and if more than one :math:`g_i` is found to have a root in any given interval, the various root locations are found and reported in the @@ -2065,8 +2060,8 @@ factor of 0.9 to cover the strict inequality case). If a step fails to satisfy the constraints 10 times (a value which may be modified by the user) within a step attempt, or fails with the minimum step size, then the integration is halted and an error is returned. In this case the user may need to employ other -strategies as discussed in :numref:`ARKODE.Usage.ARKStep.Tolerances` and -:numref:`ARKODE.Usage.ERKStep.Tolerances` to satisfy the inequality constraints. +strategies as discussed in :numref:`ARKODE.Usage.Tolerances` to satisfy the +inequality constraints. .. _ARKODE.Mathematics.Relaxation: @@ -2130,5 +2125,4 @@ relaxation application and the step will is repeated with the step size reduced by :math:`\eta_\text{rf}`. For more information on utilizing relaxation Runge--Kutta methods, see -:numref:`ARKODE.Usage.ERKStep.Relaxation` and -:numref:`ARKODE.Usage.ARKStep.Relaxation`. +:numref:`ARKODE.Usage.Relaxation`. diff --git a/doc/arkode/guide/source/Organization.rst b/doc/arkode/guide/source/Organization.rst index 8ab599ff2d..204ed9a999 100644 --- a/doc/arkode/guide/source/Organization.rst +++ b/doc/arkode/guide/source/Organization.rst @@ -25,29 +25,29 @@ knowledge of this structure is not necessary for its use. The overall organization of the ARKODE package is shown in :numref:`ARKODE.Organization.ARKODE.Figure`. The central integration modules, implemented in the files ``arkode.h``, ``arkode_impl.h``, ``arkode_butcher.h``, -``arkode.c``, ``arkode_arkstep.c`` , ``arkode_erkstep.c``, ``arkode_mristep.h``, -and ``arkode_butcher.c``, deal with the evaluation of integration stages, the -nonlinear solvers, estimation of the local truncation error, selection of step -size, and interpolation to user output points, among other issues. ARKODE -supports SUNNonlinearSolver modules in either root-finding or fixed-point form -(see section :numref:`SUNNonlinSol`) for any nonlinearly implicit problems that -arise in computing each internal stage. When using Newton-based nonlinear -solvers, or when using a non-identity mass matrix :math:`M\ne I`, ARKODE has -flexibility in the choice of method used to solve the linear sub-systems that -arise. Therefore, for any user problem invoking the Newton solvers, or any user -problem with :math:`M\ne I`, one (or more) of the linear system solver modules -should be specified by the user; this/these are then invoked as needed during -the integration process. +``arkode.c``, ``arkode_arkstep.c`` , ``arkode_erkstep.c``, ``arkode_mristep.c``, +``arkode_sprkstep.c``, and ``arkode_butcher.c``, deal with the evaluation of +integration stages, the nonlinear solvers, estimation of the local truncation +error, selection of step size, and interpolation to user output points, among +other issues. ARKODE supports SUNNonlinearSolver modules in either root-finding +or fixed-point form (see section :numref:`SUNNonlinSol`) for any nonlinearly +implicit problems that arise in computing each internal stage. When using +Newton-based nonlinear solvers, or when using a non-identity mass matrix +:math:`M\ne I`, ARKODE has flexibility in the choice of method used to solve the +linear sub-systems that arise. Therefore, for any user problem invoking the +Newton solvers, or any user problem with :math:`M\ne I`, one (or more) of the +linear system solver modules should be specified by the user; this/these are +then invoked as needed during the integration process. .. _ARKODE.Organization.ARKODE.Figure: .. figure:: /figs/arkode/arkorg.png :align: center *ARKODE organization*: Overall structure of the ARKODE package. - Modules specific to ARKODE are the timesteppers (ARKODE), linear solver - interfaces (ARKLS), nonlinear solver interfaces (ARKNLS), and preconditioners - (ARKBANDPRE and ARKBBDPRE); all other items correspond to generic SUNDIALS - vector, matrix, and solver modules. + Modules specific to ARKODE are the core infrastructure and timesteppers + (ARKODE), linear solver interfaces (ARKLS), nonlinear solver interfaces + (ARKNLS), and preconditioners (ARKBANDPRE and ARKBBDPRE); all other items + correspond to generic SUNDIALS vector, matrix, and solver modules. For solving these linear systems, ARKODE's linear solver interface supports both direct and iterative linear solvers adhering to the diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Relaxation.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/Relaxation.rst index 38e66f0e36..3a2d7611db 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Relaxation.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/Relaxation.rst @@ -17,15 +17,12 @@ Relaxation Methods ================== -This section describes user-callable functions for applying relaxation methods -with ARKStep. For more information on relaxation Runge--Kutta methods see -:numref:`ARKODE.Mathematics.Relaxation`. +This section describes ARKStep-specific user-callable functions for applying +relaxation methods with ARKStep. All of these routines have been deprecated in +favor of :ref:`shared ARKODE-level routines `, but +this documentation will be retained for as long as these functions are present +in the library. -.. note:: - - Relaxation support as not been evaluated with non-identity mass matrices. - While this usage mode is supported, feedback from users who explore this - combination would be appreciated. Enabling or Disabling Relaxation -------------------------------- @@ -72,6 +69,11 @@ Enabling or Disabling Relaxation .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxFn` instead. + + Optional Input Functions ------------------------ @@ -96,6 +98,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxEtaFail` instead. + + .. c:function:: int ARKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) Sets the smallest acceptable value for the relaxation parameter. @@ -117,6 +124,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxLowerBound` instead. + + .. c:function:: int ARKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) Sets the largest acceptable value for the relaxation parameter. @@ -138,6 +150,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxUpperBound` instead. + + .. c:function:: int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails) Sets the maximum number of times applying relaxation can fail within a step @@ -157,6 +174,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxMaxFails` instead. + + .. c:function:: int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters) Sets the maximum number of nonlinear iterations allowed when solving for the @@ -180,6 +202,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxMaxIters` instead. + + .. c:function:: int ARKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) Sets the nonlinear solver method used to compute the relaxation parameter. @@ -198,6 +225,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxSolver` instead. + + .. c:function:: int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) Sets the nonlinear solver residual tolerance to use when solving @@ -223,6 +255,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxResTol` instead. + + .. c:function:: int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) Sets the nonlinear solver relative and absolute tolerance on changes in @@ -249,6 +286,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxTol` instead. + + Optional Output Functions ------------------------- @@ -269,6 +311,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxFnEvals` instead. + + .. c:function:: int ARKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) Get the number of times the user's relaxation Jacobian was evaluated. @@ -283,6 +330,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxJacEvals` instead. + + .. c:function:: int ARKStepGetNumRelaxFails(void* arkode_mem, long int* fails) Get the total number of times applying relaxation failed. @@ -302,6 +354,10 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxFails` instead. + .. c:function:: int ARKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails) @@ -318,6 +374,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxBoundFails` instead. + + .. c:function:: int ARKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails) Get the number of times the relaxation parameter nonlinear solver failed. @@ -332,6 +393,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxSolveFails` instead. + + .. c:function:: int ARKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters) Get the number of relaxation parameter nonlinear solver iterations. @@ -345,3 +411,7 @@ about the performance of the relaxation method. ``NULL`` .. versionadded:: 5.6.0 + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxSolveIters` instead. diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index 4da2461e96..c5669a6880 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -17,21 +17,13 @@ ARKStep User-callable functions ================================ -This section describes the functions that are called by the user to -setup and then solve an IVP using the ARKStep time-stepping -module. Some of these are required; however, starting with -:numref:`ARKODE.Usage.ARKStep.OptionalInputs`, the functions listed involve -optional inputs/outputs or restarting, and those paragraphs may be -skipped for a casual use of ARKODE's ARKStep module. In any case, -refer to the preceding section, :numref:`ARKODE.Usage.ARKStep.Skeleton`, -for the correct order of these calls. - -On an error, each user-callable function returns a negative value (or -``NULL`` if the function returns a pointer) and sends an error message -to the error handler routine, which prints the message to ``stderr`` -by default. However, the user can set a file as error output or can -provide their own error handler function (see -:numref:`ARKODE.Usage.ARKStep.OptionalInputs` for details). +This section describes the ARKStep-specific functions that may be called +by the user to setup and then solve an IVP using the ARKStep time-stepping +module. The large majority of these routines merely wrap :ref:`underlying +ARKODE functions `, and will be deprecated in an +upcoming release -- each of these are clearly marked below. However, some +of these user-callable functions are specific to ARKStep, and are explained +below. @@ -73,6 +65,9 @@ ARKStep initialization and deallocation functions **Return value:** None + .. deprecated:: x.y.z + + Use :c:func:`ARKodeFree` instead. .. _ARKODE.Usage.ARKStep.Tolerances: @@ -80,39 +75,6 @@ ARKStep initialization and deallocation functions ARKStep tolerance specification functions ------------------------------------------------------ -These functions specify the integration tolerances. One of them -**should** be called before the first call to -:c:func:`ARKStepEvolve()`; otherwise default values of ``reltol = -1e-4`` and ``abstol = 1e-9`` will be used, which may be entirely -incorrect for a specific problem. - -The integration tolerances ``reltol`` and ``abstol`` define a vector -of error weights, ``ewt``. In the case of -:c:func:`ARKStepSStolerances()`, this vector has components - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol); - -whereas in the case of :c:func:`ARKStepSVtolerances()` the vector components -are given by - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol[i]); - -This vector is used in all error and convergence tests, which use a -weighted RMS norm on all error-like vectors :math:`v`: - -.. math:: - \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; ewt_i)^2 \right)^{1/2}, - -where :math:`N` is the problem dimension. - -Alternatively, the user may supply a custom function to supply the -``ewt`` vector, through a call to :c:func:`ARKStepWFtolerances()`. - - .. c:function:: int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) @@ -129,6 +91,9 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSStolerances` instead. .. c:function:: int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) @@ -149,6 +114,9 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSVtolerances` instead. .. c:function:: int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) @@ -166,44 +134,9 @@ Alternatively, the user may supply a custom function to supply the * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module + .. deprecated:: x.y.z - -Moreover, for problems involving a non-identity mass matrix -:math:`M \ne I`, the units of the solution vector :math:`y` may differ -from the units of the IVP, posed for the vector :math:`My`. When this -occurs, iterative solvers for the Newton linear systems and the mass -matrix linear systems may require a different set of tolerances. -Since the relative tolerance is dimensionless, but the absolute -tolerance encodes a measure of what is "small" in the units of the -respective quantity, a user may optionally define absolute tolerances -in the equation units. In this case, ARKStep defines a vector of residual -weights, ``rwt`` for measuring convergence of these iterative solvers. -In the case of :c:func:`ARKStepResStolerance()`, this vector has components - -.. code-block:: c - - rwt[i] = 1.0/(reltol*abs(My[i]) + rabstol); - -whereas in the case of :c:func:`ARKStepResVtolerance()` the vector components -are given by - -.. code-block:: c - - rwt[i] = 1.0/(reltol*abs(My[i]) + rabstol[i]); - -This residual weight vector is used in all iterative solver -convergence tests, which similarly use a weighted RMS norm on all -residual-like vectors :math:`v`: - -.. math:: - \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; rwt_i)^2 \right)^{1/2}, - -where :math:`N` is the problem dimension. - -As with the error weight vector, the user may supply a custom function -to supply the ``rwt`` vector, through a call to -:c:func:`ARKStepResFtolerance()`. Further information on all three of -these functions is provided below. + Use :c:func:`ARKodeWFtolerances` instead. @@ -221,6 +154,9 @@ these functions is provided below. * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeResStolerance` instead. .. c:function:: int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol) @@ -238,6 +174,9 @@ these functions is provided below. * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeResVtolerance` instead. .. c:function:: int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun) @@ -255,117 +194,9 @@ these functions is provided below. * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` * *ARK_NO_MALLOC* if the ARKStep memory was not allocated by the time-stepping module + .. deprecated:: x.y.z - -General advice on the choice of tolerances -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For many users, the appropriate choices for tolerance values in -``reltol``, ``abstol``, and ``rabstol`` are a concern. The following pieces -of advice are relevant. - -(1) The scalar relative tolerance ``reltol`` is to be set to control - relative errors. So a value of :math:`10^{-4}` means that errors - are controlled to .01%. We do not recommend using ``reltol`` larger - than :math:`10^{-3}`. On the other hand, ``reltol`` should not be so - small that it is comparable to the unit roundoff of the machine - arithmetic (generally around :math:`10^{-15}` for double-precision). - -(2) The absolute tolerances ``abstol`` (whether scalar or vector) need - to be set to control absolute errors when any components of the - solution vector :math:`y` may be so small that pure relative error - control is meaningless. For example, if :math:`y_i` starts at some - nonzero value, but in time decays to zero, then pure relative - error control on :math:`y_i` makes no sense (and is overly costly) - after :math:`y_i` is below some noise level. Then ``abstol`` (if - scalar) or ``abstol[i]`` (if a vector) needs to be set to that - noise level. If the different components have different noise - levels, then ``abstol`` should be a vector. For example, see the - example problem ``ark_robertson.c``, and the discussion - of it in the ARKODE Examples Documentation :cite:p:`arkode_ex`. In that - problem, the three components vary between 0 and 1, and have - different noise levels; hence the ``atols`` vector therein. It is - impossible to give any general advice on ``abstol`` values, - because the appropriate noise levels are completely - problem-dependent. The user or modeler hopefully has some idea as - to what those noise levels are. - -(3) The residual absolute tolerances ``rabstol`` (whether scalar or - vector) follow a similar explanation as for ``abstol``, except - that these should be set to the noise level of the equation - components, i.e. the noise level of :math:`My`. For problems in - which :math:`M=I`, it is recommended that ``rabstol`` be left - unset, which will default to the already-supplied ``abstol`` - values. - -(4) Finally, it is important to pick all the tolerance values - conservatively, because they control the error committed on each - individual step. The final (global) errors are an accumulation of - those per-step errors, where that accumulation factor is - problem-dependent. A general rule of thumb is to reduce the - tolerances by a factor of 10 from the actual desired limits on - errors. So if you want .01% relative accuracy (globally), a good - choice for ``reltol`` is :math:`10^{-5}`. In any case, it is - a good idea to do a few experiments with the tolerances to see how - the computed solution values vary as tolerances are reduced. - - - -Advice on controlling nonphysical negative values -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In many applications, some components in the true solution are always -positive or non-negative, though at times very small. In the -numerical solution, however, small negative (nonphysical) values -can then occur. In most cases, these values are harmless, and simply -need to be controlled, not eliminated, but in other cases any value -that violates a constraint may cause a simulation to halt. For both of -these scenarios the following pieces of advice are relevant. - -(1) The best way to control the size of unwanted negative computed - values is with tighter absolute tolerances. Again this requires - some knowledge of the noise level of these components, which may - or may not be different for different components. Some - experimentation may be needed. - -(2) If output plots or tables are being generated, and it is important - to avoid having negative numbers appear there (for the sake of - avoiding a long explanation of them, if nothing else), then - eliminate them, but only in the context of the output medium. Then - the internal values carried by the solver are unaffected. Remember - that a small negative value in :math:`y` returned by ARKStep, with - magnitude comparable to ``abstol`` or less, is equivalent to zero - as far as the computation is concerned. - -(3) The user's right-hand side routines :math:`f^E` and :math:`f^I` - should never change a negative value in the solution vector :math:`y` - to a non-negative value in attempt to "fix" this problem, - since this can lead to numerical instability. If the :math:`f^E` - or :math:`f^I` routines cannot tolerate a zero or negative value - (e.g. because there is a square root or log), then the offending - value should be changed to zero or a tiny positive number in a - temporary variable (not in the input :math:`y` vector) for the - purposes of computing :math:`f^E(t, y)` or :math:`f^I(t, y)`. - -(4) ARKStep supports component-wise constraints on solution components, - :math:`y_i < 0`, :math:`y_i \le 0`, , :math:`y_i > 0`, or - :math:`y_i \ge 0`, through the user-callable function - :c:func:`ARKStepSetConstraints`. At each internal time step, if any - constraint is violated then ARKStep will attempt a smaller time step - that should not violate this constraint. This reduced step size is - chosen such that the step size is the largest possible but where the - solution component satisfies the constraint. - -(5) Positivity and non-negativity constraints on components can also be - enforced by use of the recoverable error return feature in the - user-supplied right-hand side functions, :math:`f^E` and - :math:`f^I`. When a recoverable error is encountered, ARKStep will - retry the step with a smaller step size, which typically - alleviates the problem. However, since this reduced step size is - chosen without knowledge of the solution constraint, it may be - overly conservative. Thus this option involves some additional - overhead cost, and should only be exercised if the above recommendations - are unsuccessful. + Use :c:func:`ARKodeResFtolerance` instead. @@ -374,74 +205,6 @@ these scenarios the following pieces of advice are relevant. Linear solver interface functions ------------------------------------------- -As previously explained, the Newton iterations used in solving -implicit systems within ARKStep require the solution of linear -systems of the form - -.. math:: - \mathcal{A}\left(z_i^{(m)}\right) \delta^{(m+1)} = -G\left(z_i^{(m)}\right) - -where - -.. math:: - \mathcal{A} \approx M - \gamma J, \qquad J = \frac{\partial f^I}{\partial y}. - -ARKODE's ARKLS linear solver interface supports all valid -``SUNLinearSolver`` modules for this task. - -Matrix-based ``SUNLinearSolver`` modules utilize ``SUNMatrix`` objects -to store the approximate Jacobian matrix :math:`J`, the Newton matrix -:math:`\mathcal{A}`, the mass matrix :math:`M`, and, when using direct -solvers, the factorizations used throughout the solution process. - -Matrix-free ``SUNLinearSolver`` modules instead use iterative methods -to solve the Newton systems of equations, and only require the -*action* of the matrix on a vector, :math:`\mathcal{A}v`. With most -of these methods, preconditioning can be done on the left only, on the -right only, on both the left and the right, or not at all. The -exceptions to this rule are SPFGMR that supports right preconditioning -only and PCG that performs symmetric preconditioning. For the -specification of a preconditioner, see the iterative linear solver -portions of :numref:`ARKODE.Usage.ARKStep.OptionalInputs` and -:numref:`ARKODE.Usage.UserSupplied`. - -If preconditioning is done, user-supplied functions should be used to -define left and right preconditioner matrices :math:`P_1` and -:math:`P_2` (either of which could be the identity matrix), such that -the product :math:`P_{1}P_{2}` approximates the Newton matrix -:math:`\mathcal{A} = M - \gamma J`. - -To specify a generic linear solver for ARKStep to use for the Newton -systems, after the call to :c:func:`ARKStepCreate` but before any -calls to :c:func:`ARKStepEvolve()`, the user's program must create the -appropriate ``SUNLinearSolver`` object and call the function -:c:func:`ARKStepSetLinearSolver()`, as documented below. To create -the ``SUNLinearSolver`` object, the user may call one of the -SUNDIALS-packaged SUNLinSol module constructor routines via a call of -the form - -.. code:: c - - SUNLinearSolver LS = SUNLinSol_*(...); - -The current list of SUNDIALS-packaged SUNLinSol modules, and their -constructor routines, may be found in chapter :numref:`SUNLinSol`. -Alternately, a user-supplied ``SUNLinearSolver`` module may be created -and used. Specific information on how to create such user-provided -modules may be found in :numref:`SUNLinSol.API.Custom`. - -Once this solver object has been constructed, the user should attach -it to ARKStep via a call to :c:func:`ARKStepSetLinearSolver()`. The -first argument passed to this function is the ARKStep memory pointer -returned by :c:func:`ARKStepCreate`; the second argument is the -``SUNLinearSolver`` object created above. The third argument is an -optional ``SUNMatrix`` object to accompany matrix-based -``SUNLinearSolver`` inputs (for matrix-free linear solvers, the third -argument should be ``NULL``). A call to this function initializes the -ARKLS linear solver interface, linking it to the ARKStep integrator, -and allows the user to specify additional parameters and routines -pertinent to their choice of linear solver. - .. c:function:: int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix J) This function specifies the ``SUNLinearSolver`` object that ARKStep @@ -484,8 +247,9 @@ pertinent to their choice of linear solver. insufficient to store :math:`\mathcal{A}` then it will need to be resized internally by ARKStep. + .. deprecated:: x.y.z - + Use :c:func:`ARKodeSetLinearSolver` instead. @@ -494,57 +258,6 @@ pertinent to their choice of linear solver. Mass matrix solver specification functions ------------------------------------------- -As discussed in :numref:`ARKODE.Mathematics.MassSolve`, if the ODE -system involves a non-identity mass matrix :math:`M\ne I`, then ARKStep -must solve linear systems of the form - -.. math:: - M x = b. - -ARKODE's ARKLS mass-matrix linear solver interface supports all valid -``SUNLinearSolver`` modules for this task. For iterative linear -solvers, user-supplied preconditioning can be applied. For the -specification of a preconditioner, see the iterative linear solver -portions of :numref:`ARKODE.Usage.ARKStep.OptionalInputs` and -:numref:`ARKODE.Usage.UserSupplied`. If preconditioning is to be -performed, user-supplied functions should be used to define left and -right preconditioner matrices :math:`P_1` and :math:`P_2` (either of -which could be the identity matrix), such that the product -:math:`P_{1}P_{2}` approximates the mass matrix :math:`M`. - -To specify a generic linear solver for ARKStep to use for mass matrix -systems, after the call to :c:func:`ARKStepCreate` but before any -calls to :c:func:`ARKStepEvolve()`, the user's program must create the -appropriate ``SUNLinearSolver`` object and call the function -:c:func:`ARKStepSetMassLinearSolver()`, as documented below. The -first argument passed to this function is the ARKStep memory -pointer returned by :c:func:`ARKStepCreate`; the second argument is -the desired ``SUNLinearSolver`` object to use for solving mass matrix -systems. The third object is a template ``SUNMatrix`` to use with the -provided ``SUNLinearSolver`` (if applicable). The fourth input is a -flag to indicate whether the mass matrix is time-dependent, -i.e. :math:`M = M(t)`, or not. A call to this function initializes the -ARKLS mass matrix linear solver interface, linking this to the main -ARKStep integrator, and allows the user to specify additional -parameters and routines pertinent to their choice of linear solver. - -Note: if the user program includes linear solvers for *both* the -Newton and mass matrix systems, these must have the same type: - -* If both are matrix-based, then they must utilize the same - ``SUNMatrix`` type, since these will be added when forming the - Newton system matrix :math:`\mathcal{A}`. In this case, both the - Newton and mass matrix linear solver interfaces can use the same - ``SUNLinearSolver`` object, although different solver objects - (e.g. with different solver parameters) are also allowed. - -* If both are matrix-free, then the Newton and mass matrix - ``SUNLinearSolver`` objects must be different. These may even use - different solver algorithms (SPGMR, SPBCGS, etc.), if desired. - For example, if the mass matrix is symmetric but the Jacobian is not, - then PCG may be used for the mass matrix systems and SPGMR for the - Newton systems. - .. c:function:: int ARKStepSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, sunbooleantype time_dep) @@ -596,7 +309,9 @@ Newton and mass matrix systems, these must have the same type: mass-matrix-times-vector product routine (see :c:type:`ARKLsMassTimesVecFn` and :c:func:`ARKStepSetMassTimes()`). + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetMassLinearSolver` instead. .. _ARKODE.Usage.ARKStep.NonlinearSolvers: @@ -604,23 +319,6 @@ Newton and mass matrix systems, these must have the same type: Nonlinear solver interface functions ------------------------------------------- -When changing the nonlinear solver in ARKStep, after the -call to :c:func:`ARKStepCreate` but before any calls to -:c:func:`ARKStepEvolve()`, the user's program must create the -appropriate ``SUNNonlinearSolver`` object and call -:c:func:`ARKStepSetNonlinearSolver()`, as documented below. If any -calls to :c:func:`ARKStepEvolve()` have been made, then ARKStep will -need to be reinitialized by calling :c:func:`ARKStepReInit()` to -ensure that the nonlinear solver is initialized correctly before any -subsequent calls to :c:func:`ARKStepEvolve()`. - -The first argument passed to the routine -:c:func:`ARKStepSetNonlinearSolver()` is the ARKStep memory pointer -returned by :c:func:`ARKStepCreate`; the second argument passed -to this function is the desired ``SUNNonlinearSolver`` object to use for -solving the nonlinear system for each implicit stage. A call to this -function attaches the nonlinear solver to the main ARKStep integrator. - .. c:function:: int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) @@ -643,7 +341,9 @@ function attaches the nonlinear solver to the main ARKStep integrator. default; a call to this routine replaces that module with the supplied *NLS* object. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetNonlinearSolver` instead. .. _ARKODE.Usage.ARKStep.RootFinding: @@ -651,15 +351,6 @@ function attaches the nonlinear solver to the main ARKStep integrator. Rootfinding initialization function -------------------------------------- -As described in :numref:`ARKODE.Mathematics.Rootfinding`, while -solving the IVP, ARKODE's time-stepping modules have the capability to -find the roots of a set of user-defined functions. To activate the -root-finding algorithm, call the following function. This is normally -called only once, prior to the first call to -:c:func:`ARKStepEvolve()`, but if the rootfinding problem is to be -changed during the solution, :c:func:`ARKStepRootInit()` can also be -called prior to a continuation call to :c:func:`ARKStepEvolve()`. - .. c:function:: int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) @@ -689,7 +380,9 @@ called prior to a continuation call to :c:func:`ARKStepEvolve()`. problem but the prior one did, then call *ARKStepRootInit* with *nrtfn = 0*. + .. deprecated:: x.y.z + Use :c:func:`ARKodeRootInit` instead. .. _ARKODE.Usage.ARKStep.Integration: @@ -697,12 +390,6 @@ called prior to a continuation call to :c:func:`ARKStepEvolve()`. ARKStep solver function ------------------------- -This is the central step in the solution process -- the call to perform -the integration of the IVP. The input argument *itask* specifies one of two -modes as to where ARKStep is to return a solution. These modes are modified if -the user has set a stop time (with a call to the optional input function -:c:func:`ARKStepSetStopTime()`) or has requested rootfinding. - .. c:function:: int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype *tret, int itask) @@ -812,7 +499,9 @@ the user has set a stop time (with a call to the optional input function On all other error returns, *tret* and *yout* are left unchanged from those provided to the routine. + .. deprecated:: x.y.z + Use :c:func:`ARKodeEvolve` instead. .. _ARKODE.Usage.ARKStep.OptionalInputs: @@ -820,68 +509,12 @@ the user has set a stop time (with a call to the optional input function Optional input functions ------------------------- -There are numerous optional input parameters that control the behavior -of ARKStep, each of which may be modified from its default value through -calling an appropriate input function. The following tables list all -optional input functions, grouped by which aspect of ARKStep they control. -Detailed information on the calling syntax and arguments for each -function are then provided following each table. - -The optional inputs are grouped into the following categories: - -* General ARKStep options (:ref:`ARKODE.Usage.ARKStep.ARKStepInputTable`), -* IVP method solver options (:ref:`ARKODE.Usage.ARKStep.ARKStepMethodInputTable`), -* Step adaptivity solver options (:ref:`ARKODE.Usage.ARKStep.ARKStepAdaptivityInputTable`), -* Implicit stage solver options (:ref:`ARKODE.Usage.ARKStep.ARKStepSolverInputTable`), -* Linear solver interface options (:ref:`ARKODE.Usage.ARKStep.ARKLsInputs`), and -* Rootfinding options (:ref:`ARKODE.Usage.ARKStep.ARKStepRootfindingInputTable`). - -For the most casual use of ARKStep, relying on the default set of -solver parameters, the reader can skip to section on user-supplied -functions, :numref:`ARKODE.Usage.UserSupplied`. - -We note that, on an error return, all of the optional input functions send an -error message to the error handler function. All error return values are -negative, so a test on the return arguments for negative values will catch all -errors. Finally, a call to an ``ARKStepSet***`` function can generally be made -from the user's calling program at any time and, if successful, takes effect -immediately. ``ARKStepSet***`` functions that cannot be called at any time note -this in the "**Notes**:" section of the function documentation. - - .. _ARKODE.Usage.ARKStep.ARKStepInputTable: Optional inputs for ARKStep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. cssclass:: table-bordered - -================================================ ======================================= ======================= -Optional input Function name Default -================================================ ======================================= ======================= -Return ARKStep parameters to their defaults :c:func:`ARKStepSetDefaults` internal -Set dense output interpolation type :c:func:`ARKStepSetInterpolantType` ``ARK_INTERP_HERMITE`` -Set dense output polynomial degree :c:func:`ARKStepSetInterpolantDegree` 5 -Supply a pointer to a diagnostics output file :c:func:`ARKStepSetDiagnostics` ``NULL`` -Disable time step adaptivity (fixed-step mode) :c:func:`ARKStepSetFixedStep` disabled -Supply an initial step size to attempt :c:func:`ARKStepSetInitStep` estimated -Maximum no. of warnings for :math:`t_n+h = t_n` :c:func:`ARKStepSetMaxHnilWarns` 10 -Maximum no. of internal steps before *tout* :c:func:`ARKStepSetMaxNumSteps` 500 -Maximum absolute step size :c:func:`ARKStepSetMaxStep` :math:`\infty` -Minimum absolute step size :c:func:`ARKStepSetMinStep` 0.0 -Set a value for :math:`t_{stop}` :c:func:`ARKStepSetStopTime` undefined -Interpolate at :math:`t_{stop}` :c:func:`ARKStepSetInterpolateStopTime` ``SUNFALSE`` -Disable the stop time :c:func:`ARKStepClearStopTime` N/A -Supply a pointer for user data :c:func:`ARKStepSetUserData` ``NULL`` -Maximum no. of ARKStep error test failures :c:func:`ARKStepSetMaxErrTestFails` 7 -Set 'optimal' adaptivity params. for a method :c:func:`ARKStepSetOptimalParams` internal -Set inequality constraints on solution :c:func:`ARKStepSetConstraints` ``NULL`` -Set max number of constraint failures :c:func:`ARKStepSetMaxNumConstrFails` 10 -================================================ ======================================= ======================= - - - .. c:function:: int ARKStepSetDefaults(void* arkode_mem) @@ -903,6 +536,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst Also leaves alone any data structures or options related to root-finding (those can be reset using :c:func:`ARKStepRootInit()`). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDefaults` instead. .. c:function:: int ARKStepSetInterpolantType(void* arkode_mem, int itype) @@ -937,6 +573,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst If this routine is not called, the Hermite interpolation module will be used. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantType` instead. .. c:function:: int ARKStepSetInterpolantDegree(void* arkode_mem, int degree) @@ -979,14 +618,16 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst obtained by the integrator are returned at the ends of the time interval. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantDegree` instead. .. c:function:: int ARKStepSetDenseOrder(void* arkode_mem, int dord) - *This function is deprecated, and will be removed in a future release. - Users should transition to calling* :c:func:`ARKStepSetInterpolantDegree()` - *instead.* + .. deprecated:: 5.2.0 + Use :c:func:`ARKodeSetInterpolantDegree` instead. .. c:function:: int ARKStepSetDiagnostics(void* arkode_mem, FILE* diagfp) @@ -1073,7 +714,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst routines will provide no useful information to the solver, and at worst they may interfere with the desired fixed step size. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetFixedStep` instead. @@ -1101,7 +744,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst This routine will also reset the step size and error history. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetInitStep` instead. .. c:function:: int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil) @@ -1125,7 +770,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst A negative value indicates that no warning messages should be issued. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetMaxHnilWarns` instead. .. c:function:: int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) @@ -1149,6 +796,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst Passing *mxsteps* < 0 disables the test (not recommended). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNumSteps` instead. .. c:function:: int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax) @@ -1167,6 +817,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst **Notes:** Pass *hmax* :math:`\le 0.0` to set the default value of :math:`\infty`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxStep` instead. .. c:function:: int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin) @@ -1185,6 +838,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst **Notes:** Pass *hmin* :math:`\le 0.0` to set the default value of 0. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMinStep` instead. .. c:function:: int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop) @@ -1212,6 +868,10 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst :c:func:`ARKStepReset` will remain active but can be disabled by calling :c:func:`ARKStepClearStopTime`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStopTime` instead. + .. c:function:: int ARKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) @@ -1229,6 +889,10 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolateStopTime` instead. + .. c:function:: int ARKStepClearStopTime(void* arkode_mem) @@ -1247,6 +911,10 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst .. versionadded:: 5.5.1 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeClearStopTime` instead. + .. c:function:: int ARKStepSetUserData(void* arkode_mem, void* user_data) @@ -1271,6 +939,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst this function must be made *before* any calls to :c:func:`ARKStepSetLinearSolver()` and/or :c:func:`ARKStepSetMassLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetUserData` instead. .. c:function:: int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef) @@ -1291,6 +962,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst The default value is 7; set *maxnef* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxErrTestFails` instead. .. c:function:: int ARKStepSetOptimalParams(void* arkode_mem) @@ -1358,6 +1032,10 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst and :c:func:`ARKStepSetFixedStep()` are incompatible, and should not be used simultaneously. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetConstraints` instead. + .. c:function:: int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) @@ -1376,6 +1054,9 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst Passing *maxfails* <= 0 results in ARKStep using the default value (10). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNumConstrFails` instead. .. _ARKODE.Usage.ARKStep.ARKStepMethodInputTable: @@ -1424,6 +1105,9 @@ Set additive RK tables via their names :c:func:`ARKStepSetTableName()` int ARKStep memory block, it cannot be changed after the first call to :c:func:`ARKStepEvolve()`, unless :c:func:`ARKStepReInit()` is called. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetOrder` instead. .. c:function:: int ARKStepSetImEx(void* arkode_mem) @@ -1542,6 +1226,8 @@ Set additive RK tables via their names :c:func:`ARKStepSetTableName()` int :c:func:`ARKStepSetFixedStep()` to enable fixed-step mode and set the desired time step size. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. @@ -1581,6 +1267,9 @@ Set additive RK tables via their names :c:func:`ARKStepSetTableName()` int In all cases, error-checking is performed to ensure that the tables exist. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. + @@ -1621,6 +1310,9 @@ Set additive RK tables via their names :c:func:`ARKStepSetTableName()` int In all cases, error-checking is performed to ensure that the tables exist. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. + @@ -1629,34 +1321,6 @@ Set additive RK tables via their names :c:func:`ARKStepSetTableName()` int Optional inputs for time step adaptivity ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The mathematical explanation of ARKODE's time step adaptivity -algorithm, including how each of the parameters below is used within -the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. - - -.. cssclass:: table-bordered - -========================================================= ========================================== ======== -Optional input Function name Default -========================================================= ========================================== ======== -Provide a :c:type:`SUNAdaptController` for ARKStep to use :c:func:`ARKStepSetAdaptController()` PID -Set a custom time step adaptivity function :c:func:`ARKStepSetAdaptivityFn()` internal -Choose an existing time step adaptivity method :c:func:`ARKStepSetAdaptivityMethod()` 0 -Adjust the method order used in the controller :c:func:`ERKStepSetAdaptivityAdjustment()` -1 -Explicit stability safety factor :c:func:`ARKStepSetCFLFraction()` 0.5 -Time step error bias factor :c:func:`ARKStepSetErrorBias()` 1.5 -Bounds determining no change in step size :c:func:`ARKStepSetFixedStepBounds()` 1.0 1.5 -Maximum step growth factor on convergence fail :c:func:`ARKStepSetMaxCFailGrowth()` 0.25 -Maximum step growth factor on error test fail :c:func:`ARKStepSetMaxEFailGrowth()` 0.3 -Maximum first step growth factor :c:func:`ARKStepSetMaxFirstGrowth()` 10000.0 -Maximum allowed general step growth factor :c:func:`ARKStepSetMaxGrowth()` 20.0 -Minimum allowed step reduction factor on error test fail :c:func:`ARKStepSetMinReduction()` 0.1 -Time step safety factor :c:func:`ARKStepSetSafetyFactor()` 0.96 -Error fails before MaxEFailGrowth takes effect :c:func:`ARKStepSetSmallNumEFails()` 2 -Explicit stability function :c:func:`ARKStepSetStabilityFn()` none -========================================================= ========================================== ======== - - .. c:function:: int ARKStepSetAdaptController(void* arkode_mem, SUNAdaptController C) @@ -1673,6 +1337,10 @@ Explicit stability function :c:func:`ARKStepSetS .. versionadded:: 5.7.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetAdaptController` instead. + .. c:function:: int ARKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) @@ -1767,6 +1435,12 @@ Explicit stability function :c:func:`ARKStepSetS .. versionadded:: 5.7.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetAdaptivityAdjustment` instead. + + + .. c:function:: int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) Specifies the fraction of the estimated explicitly stable step to use. @@ -1784,6 +1458,9 @@ Explicit stability function :c:func:`ARKStepSetS Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetCFLFraction` instead. .. c:function:: int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias) @@ -1830,6 +1507,9 @@ Explicit stability function :c:func:`ARKStepSetS **Notes:** Any interval *not* containing 1.0 will imply a reset to the default values. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetFixedStepBounds` instead. .. c:function:: int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) @@ -1851,6 +1531,9 @@ Explicit stability function :c:func:`ARKStepSetS **Notes:** Any value outside the interval :math:`(0,1]` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxCFailGrowth` instead. .. c:function:: int ARKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) @@ -1870,6 +1553,9 @@ Explicit stability function :c:func:`ARKStepSetS **Notes:** Any value outside the interval :math:`(0,1]` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxEFailGrowth` instead. .. c:function:: int ARKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) @@ -1890,6 +1576,9 @@ Explicit stability function :c:func:`ARKStepSetS **Notes:** Any value :math:`\le 1.0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxFirstGrowth` instead. .. c:function:: int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) @@ -1910,6 +1599,9 @@ Explicit stability function :c:func:`ARKStepSetS Any value :math:`\le 1.0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxGrowth` instead. .. c:function:: int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min) @@ -1932,6 +1624,9 @@ Explicit stability function :c:func:`ARKStepSetS Any value outside the interval :math:`(0,1)` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMinReduction` instead. .. c:function:: int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety) @@ -1952,6 +1647,9 @@ Explicit stability function :c:func:`ARKStepSetS Any value :math:`\le 0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetSafetyFactor` instead. .. c:function:: int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef) @@ -1972,6 +1670,9 @@ Explicit stability function :c:func:`ARKStepSetS **Notes:** Any value :math:`\le 0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetSmallNumEFails` instead. .. c:function:: int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) @@ -1998,6 +1699,9 @@ Explicit stability function :c:func:`ARKStepSetS be quite useful for problems where the explicit right-hand side function :math:`f^E(t,y)` contains stiff terms. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStabilityFn` instead. @@ -2006,32 +1710,6 @@ Explicit stability function :c:func:`ARKStepSetS Optional inputs for implicit stage solves ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The mathematical explanation for the nonlinear solver strategies used -by ARKStep, including how each of the parameters below is used within -the code, is provided in :numref:`ARKODE.Mathematics.Nonlinear`. - - -.. cssclass:: table-bordered - -========================================================= ========================================= ============ -Optional input Function name Default -========================================================= ========================================= ============ -Specify that :math:`f^I` is linearly implicit :c:func:`ARKStepSetLinear()` ``SUNFALSE`` -Specify that :math:`f^I` is nonlinearly implicit :c:func:`ARKStepSetNonlinear()` ``SUNTRUE`` -Implicit predictor method :c:func:`ARKStepSetPredictorMethod()` 0 -User-provided implicit stage predictor :c:func:`ARKStepSetStagePredictFn()` ``NULL`` -RHS function for nonlinear system evaluations :c:func:`ARKStepSetNlsRhsFn()` ``NULL`` -Maximum number of nonlinear iterations :c:func:`ARKStepSetMaxNonlinIters()` 3 -Coefficient in the nonlinear convergence test :c:func:`ARKStepSetNonlinConvCoef()` 0.1 -Nonlinear convergence rate constant :c:func:`ARKStepSetNonlinCRDown()` 0.3 -Nonlinear residual divergence ratio :c:func:`ARKStepSetNonlinRDiv()` 2.3 -Maximum number of convergence failures :c:func:`ARKStepSetMaxConvFails()` 10 -Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDeduceImplicitRhs` ``SUNFALSE`` -========================================================= ========================================= ============ - - - - .. c:function:: int ARKStepSetLinear(void* arkode_mem, int timedepend) @@ -2061,6 +1739,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe stage. Thus one must balance the relative costs of such recomputation against the benefits of requiring only a single Newton linear solve. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinear` instead. .. c:function:: int ARKStepSetNonlinear(void* arkode_mem) @@ -2082,6 +1763,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe :c:func:`ARKStepSetDeltaGammaMax()` to reset the step size ratio threshold to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinear` instead. .. c:function:: int ARKStepSetPredictorMethod(void* arkode_mem, int method) @@ -2127,6 +1811,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe instead default to the trivial predictor (*method* 0). **Both of these options have been deprecated, and will be removed from a future release.** + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetPredictorMethod` instead. .. c:function:: int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) @@ -2147,6 +1834,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe See :numref:`ARKODE.Usage.StagePredictFn` for more information on this user-supplied routine. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStagePredictFn` instead. .. c:function:: int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) @@ -2172,6 +1862,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe When using a non-default nonlinear solver, this function must be called *after* :c:func:`ARKStepSetNonlinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNlsRhsFn` instead. .. c:function:: int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor) @@ -2193,6 +1886,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe The default value is 3; set *maxcor* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNonlinIters` instead. .. c:function:: int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) @@ -2213,6 +1909,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe The default value is 0.1; set *nlscoef* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinConvCoef` instead. .. c:function:: int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) @@ -2231,6 +1930,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinCRDown` instead. .. c:function:: int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) @@ -2251,6 +1953,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinRDiv` instead. .. c:function:: int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf) @@ -2279,6 +1984,9 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe convergence failure still occurs, the time step size is reduced by the factor *etacf* (set within :c:func:`ARKStepSetMaxCFailGrowth()`). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxConvFails` instead. .. c:function:: int ARKStepSetDeduceImplicitRhs(void *arkode_mem, sunbooleantype deduce) @@ -2299,6 +2007,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe .. versionadded:: 5.2.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDeduceImplicitRhs` instead. + .. _ARKODE.Usage.ARKStep.ARKLsInputs: @@ -2306,81 +2018,13 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`ARKStepSetDe Linear solver interface optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The mathematical explanation of the linear solver methods -available to ARKStep is provided in :numref:`ARKODE.Mathematics.Linear`. We group -the user-callable routines into four categories: general routines concerning -the update frequency for matrices and/or preconditioners, optional inputs for -matrix-based linear solvers, optional inputs for matrix-free linear solvers, -and optional inputs for iterative linear solvers. We note that the -matrix-based and matrix-free groups are mutually exclusive, whereas the -"iterative" tag can apply to either case. - - .. _ARKODE.Usage.ARKStep.ARKLsInputs.General: -.. index:: - single: optional input; generic linear solver interface (ARKStep) Optional inputs for the ARKLS linear solver interface """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -As discussed in :numref:`ARKODE.Mathematics.Linear.Setup`, ARKODE -strives to reuse matrix and preconditioner data for as many solves as -possible to amortize the high costs of matrix construction and -factorization. To that end, ARKStep provides user-callable -routines to modify this behavior. Recall that the -Newton system matrices that arise within an implicit stage solve are -:math:`\mathcal{A}(t,z) \approx M(t) - \gamma J(t,z)`, where the -implicit right-hand side function has Jacobian matrix -:math:`J(t,z) = \frac{\partial f^I(t,z)}{\partial z}`. - -The matrix or preconditioner for :math:`\mathcal{A}` can only be -updated within a call to the linear solver "setup" routine. In -general, the frequency with which the linear solver setup routine is -called may be controlled with the *msbp* argument to -:c:func:`ARKStepSetLSetupFrequency()`. When this occurs, the -validity of :math:`\mathcal{A}` for successive time steps -intimately depends on whether the corresponding :math:`\gamma` and -:math:`J` inputs remain valid. - -At each call to the linear solver setup routine the decision to update -:math:`\mathcal{A}` with a new value of :math:`\gamma`, and to reuse -or reevaluate Jacobian information, depends on several factors including: - -* the success or failure of previous solve attempts, -* the success or failure of the previous time step attempts, -* the change in :math:`\gamma` from the value used when constructing :math:`\mathcal{A}`, and -* the number of steps since Jacobian information was last evaluated. - -Jacobian information is considered out-of-date when :math:`msbj` or more steps -have been completed since the last update, in which case it will be recomputed during the next -linear solver setup call. The value of :math:`msbj` is controlled with the -``msbj`` argument to :c:func:`ARKStepSetJacEvalFrequency()`. - -For linear-solvers with user-supplied preconditioning the above factors are used -to determine whether to recommend updating the Jacobian information in the -preconditioner (i.e., whether to set *jok* to ``SUNFALSE`` in calling the -user-supplied :c:type:`ARKLsPrecSetupFn()`). For matrix-based linear solvers -these factors determine whether the matrix :math:`J(t,y) = \frac{\partial f^I(t,y)}{\partial y}` -should be updated (either with an internal finite difference approximation or -a call to the user-supplied :c:type:`ARKLsJacFn`); if not then the previous -value is reused and the system matrix :math:`\mathcal{A}(t,y) \approx M(t) - \gamma J(t,y)` -is recomputed using the current :math:`\gamma` value. - - - -.. _ARKODE.Usage.ARKStep.ARKLsInputs.General.Table: -.. table:: Optional inputs for the ARKLS linear solver interface - - ============================================= ========================================= ============ - Optional input Function name Default - ============================================= ========================================= ============ - Max change in step signaling new :math:`J` :c:func:`ARKStepSetDeltaGammaMax()` 0.2 - Linear solver setup frequency :c:func:`ARKStepSetLSetupFrequency()` 20 - Jacobian / preconditioner update frequency :c:func:`ARKStepSetJacEvalFrequency()` 51 - ============================================= ========================================= ============ - .. c:function:: int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) @@ -2401,9 +2045,11 @@ is recomputed using the current :math:`\gamma` value. **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDeltaGammaMax` instead. + -.. index:: - single: optional input; linear solver setup frequency (ARKStep) .. c:function:: int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp) @@ -2425,10 +2071,10 @@ is recomputed using the current :math:`\gamma` value. step. If **msbp** is 0, the default value of 20 will be used. A negative value forces a linear solver step at each implicit stage. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLSetupFrequency` instead. -.. index:: - single: optional input; Jacobian update frequency (ARKStep) - single: optional input; preconditioner update frequency (ARKStep) .. c:function:: int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj) @@ -2462,7 +2108,9 @@ is recomputed using the current :math:`\gamma` value. This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`ARKStepSetLinearSolver()`. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetJacEvalFrequency` instead. @@ -2473,59 +2121,6 @@ is recomputed using the current :math:`\gamma` value. Optional inputs for matrix-based ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -========================================= =========================================== ============= -Optional input Function name Default -========================================= =========================================== ============= -Jacobian function :c:func:`ARKStepSetJacFn()` ``DQ`` -Linear system function :c:func:`ARKStepSetLinSysFn()` internal -Mass matrix function :c:func:`ARKStepSetMassFn()` none -Enable or disable linear solution scaling :c:func:`ARKStepSetLinearSolutionScaling()` on -========================================= =========================================== ============= - -When using matrix-based linear solver modules, the ARKLS solver interface needs -a function to compute an approximation to the Jacobian matrix :math:`J(t,y)` or -the linear system :math:`\mathcal{A}(t,y) = M(t) - \gamma J(t,y)`. - -For :math:`J(t,y)`, the ARKLS interface is packaged with a routine that can approximate -:math:`J` if the user has selected either the :ref:`SUNMATRIX_DENSE ` or -:ref:`SUNMATRIX_BAND ` objects. Alternatively, -the user can supply a custom Jacobian function of type :c:func:`ARKLsJacFn()` -- this is -*required* when the user selects other matrix formats. To specify a user-supplied -Jacobian function, ARKStep provides the function :c:func:`ARKStepSetJacFn()`. - -Alternatively, a function of type :c:func:`ARKLsLinSysFn()` can be provided to -evaluate the matrix :math:`\mathcal{A}(t,y)`. By default, ARKLS uses an -internal linear system function leveraging the SUNMATRIX API to form the matrix -:math:`\mathcal{A}(t,y)` by combining the matrices :math:`M(t)` and :math:`J(t,y)`. -To specify a user-supplied linear system function instead, ARKStep provides the function -:c:func:`ARKStepSetLinSysFn()`. - -If the ODE system involves a non-identity mass matrix, :math:`M\ne I`, matrix-based linear -solver modules require a function to compute an approximation to the mass matrix :math:`M(t)`. -There is no default difference quotient approximation (for any matrix type), so this -routine must be supplied by the user. This function must be of type -:c:func:`ARKLsMassFn()`, and should be set using the function -:c:func:`ARKStepSetMassFn()`. - -In either case (:math:`J(t,y)` versus :math:`\mathcal{A}(t,y)` is supplied) the matrix -information will be updated infrequently to reduce matrix construction and, with direct -solvers, factorization costs. As a result the value of :math:`\gamma` may not be current -and a scaling factor is applied to the solution of the linear system to account for -the lagged value of :math:`\gamma`. See :numref:`SUNLinSol.Lagged_matrix` for more details. -The function :c:func:`ARKStepSetLinearSolutionScaling()` can be used to disable this -scaling when necessary, e.g., when providing a custom linear solver that updates the -matrix using the current :math:`\gamma` as part of the solve. - -The ARKLS interface passes the user data pointer to the Jacobian, linear -system, and mass matrix functions. This allows the user to create an arbitrary -structure with relevant problem data and access it during the execution of the -user-supplied Jacobian, linear system or mass matrix functions, without using global -data in the program. The user data pointer may be specified through -:c:func:`ARKStepSetUserData()`. - - .. c:function:: int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac) @@ -2555,6 +2150,10 @@ data in the program. The user data pointer may be specified through The function type :c:func:`ARKLsJacFn()` is described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetJacFn` instead. + .. c:function:: int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) @@ -2582,6 +2181,10 @@ data in the program. The user data pointer may be specified through The function type :c:func:`ARKLsLinSysFn()` is described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinSysFn` instead. + .. c:function:: int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass) @@ -2609,6 +2212,10 @@ data in the program. The user data pointer may be specified through The function type :c:func:`ARKLsMassFn()` is described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMassFn` instead. + .. c:function:: int ARKStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) @@ -2630,47 +2237,16 @@ data in the program. The user data pointer may be specified through Linear solution scaling is enabled by default when a matrix-based linear solver is attached. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinearSolutionScaling` instead. + .. _ARKODE.Usage.ARKStep.ARKLsInputs.MatrixFree: Optional inputs for matrix-free ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -================================================== ========================================= ================== -Optional input Function name Default -================================================== ========================================= ================== -:math:`Jv` functions (*jtimes* and *jtsetup*) :c:func:`ARKStepSetJacTimes()` DQ, none -:math:`Jv` DQ rhs function (*jtimesRhsFn*) :c:func:`ARKStepSetJacTimesRhsFn()` fi -:math:`Mv` functions (*mtimes* and *mtsetup*) :c:func:`ARKStepSetMassTimes()` none, none -================================================== ========================================= ================== - - -As described in :numref:`ARKODE.Mathematics.Linear`, when solving -the Newton linear systems with matrix-free methods, the ARKLS -interface requires a *jtimes* function to compute an approximation to -the product between the Jacobian matrix -:math:`J(t,y)` and a vector :math:`v`. The user can supply a custom -Jacobian-times-vector approximation function, or use the default -internal difference quotient function that comes with the ARKLS -interface. - -A user-defined Jacobian-vector function must be of type -:c:type:`ARKLsJacTimesVecFn` and can be specified through a call -to :c:func:`ARKStepSetJacTimes()` (see :numref:`ARKODE.Usage.UserSupplied` -for specification details). As with the -user-supplied preconditioner functions, the evaluation and -processing of any Jacobian-related data needed by the user's -Jacobian-times-vector function is done in the optional user-supplied -function of type :c:type:`ARKLsJacTimesSetupFn` (see -:numref:`ARKODE.Usage.UserSupplied` for specification details). As with -the preconditioner functions, a pointer to the user-defined -data structure, *user_data*, specified through -:c:func:`ARKStepSetUserData()` (or a ``NULL`` pointer otherwise) is -passed to the Jacobian-times-vector setup and product functions each -time they are called. - .. c:function:: int ARKStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsJacTimesVecFn jtimes) @@ -2705,19 +2281,10 @@ time they are called. :c:type:`ARKLsJacTimesVecFn` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetJacTimes` instead. -When using the internal difference quotient the user may optionally supply -an alternative implicit right-hand side function for use in the Jacobian-vector -product approximation by calling :c:func:`ARKStepSetJacTimesRhsFn()`. The -alternative implicit right-hand side function should compute a suitable (and -differentiable) approximation to the :math:`f^I` function provided to -:c:func:`ARKStepCreate`. For example, as done in :cite:p:`dorr2010numerical`, -the alternative function may use lagged values when evaluating a nonlinearity -in :math:`f^I` to avoid differencing a potentially non-differentiable factor. -We note that in many instances this same :math:`f^I` routine would also have -been desirable for the nonlinear solver, in which case the user should specify -this through calls to *both* :c:func:`ARKStepSetJacTimesRhsFn()` and -:c:func:`ARKStepSetNlsRhsFn()`. .. c:function:: int ARKStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) @@ -2744,21 +2311,9 @@ this through calls to *both* :c:func:`ARKStepSetJacTimesRhsFn()` and This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`ARKStepSetLinearSolver()`. + .. deprecated:: x.y.z - -Similarly, if a problem involves a non-identity mass matrix, -:math:`M\ne I`, then matrix-free solvers require a *mtimes* function -to compute an approximation to the product between the mass matrix -:math:`M(t)` and a vector :math:`v`. This function must be -user-supplied since there is no default value, it must be -of type :c:func:`ARKLsMassTimesVecFn()`, and can be specified -through a call to the :c:func:`ARKStepSetMassTimes()` routine. -Similarly to the user-supplied preconditioner functions, any evaluation -and processing of any mass matrix-related data needed by the user's -mass-matrix-times-vector function may be done in an optional user-supplied -function of type :c:type:`ARKLsMassTimesSetupFn` (see -:numref:`ARKODE.Usage.UserSupplied` for specification details). - + Use :c:func:`ARKodeSetJacTimesRhsFn` instead. .. c:function:: int ARKStepSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, ARKLsMassTimesVecFn mtimes, void* mtimes_data) @@ -2797,6 +2352,9 @@ function of type :c:type:`ARKLsMassTimesSetupFn` (see :c:type:`ARKLsMassTimesVecFn` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMassTimes` instead. @@ -2805,51 +2363,6 @@ function of type :c:type:`ARKLsMassTimesSetupFn` (see Optional inputs for iterative ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -==================================================== ========================================= ================== -Optional input Function name Default -==================================================== ========================================= ================== -Newton preconditioning functions :c:func:`ARKStepSetPreconditioner()` ``NULL``, ``NULL`` -Mass matrix preconditioning functions :c:func:`ARKStepSetMassPreconditioner()` ``NULL``, ``NULL`` -Newton linear and nonlinear tolerance ratio :c:func:`ARKStepSetEpsLin()` 0.05 -Mass matrix linear and nonlinear tolerance ratio :c:func:`ARKStepSetMassEpsLin()` 0.05 -Newton linear solve tolerance conversion factor :c:func:`ARKStepSetLSNormFactor()` vector length -Mass matrix linear solve tolerance conversion factor :c:func:`ARKStepSetMassLSNormFactor()` vector length -==================================================== ========================================= ================== - - -As described in :numref:`ARKODE.Mathematics.Linear`, when using -an iterative linear solver the user may supply a preconditioning -operator to aid in solution of the system. This operator consists of -two user-supplied functions, *psetup* and *psolve*, that are supplied -to ARKStep using either the function -:c:func:`ARKStepSetPreconditioner()` (for preconditioning the -Newton system), or the function -:c:func:`ARKStepSetMassPreconditioner()` (for preconditioning the -mass matrix system). The *psetup* function supplied to these routines -should handle evaluation and preprocessing of any Jacobian or -mass-matrix data needed by the user's preconditioner solve function, -*psolve*. The user data pointer received through -:c:func:`ARKStepSetUserData()` (or a pointer to ``NULL`` if user data -was not specified) is passed to the *psetup* and *psolve* functions. -This allows the user to create an arbitrary -structure with relevant problem data and access it during the -execution of the user-supplied preconditioner functions without using -global data in the program. If preconditioning is supplied for both -the Newton and mass matrix linear systems, it is expected that the -user will supply different *psetup* and *psolve* function for each. - -Also, as described in :numref:`ARKODE.Mathematics.Error.Linear`, the -ARKLS interface requires that iterative linear solvers stop when -the norm of the preconditioned residual satisfies - -.. math:: - \|r\| \le \frac{\epsilon_L \epsilon}{10} - -where the default :math:`\epsilon_L = 0.05` may be modified by -the user through the :c:func:`ARKStepSetEpsLin()` function. - .. c:function:: int ARKStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, ARKLsPrecSolveFn psolve) @@ -2882,6 +2395,10 @@ the user through the :c:func:`ARKStepSetEpsLin()` function. :c:func:`ARKLsPrecSolveFn()` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetPreconditioner` instead. + .. c:function:: int ARKStepSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, ARKLsMassPrecSolveFn psolve) @@ -2914,6 +2431,9 @@ the user through the :c:func:`ARKStepSetEpsLin()` function. :c:func:`ARKLsMassPrecSolveFn()` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMassPreconditioner` instead. .. c:function:: int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac) @@ -2940,6 +2460,9 @@ the user through the :c:func:`ARKStepSetEpsLin()` function. interface has been initialized through a call to :c:func:`ARKStepSetLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetEpsLin` instead. .. c:function:: int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) @@ -2966,20 +2489,9 @@ the user through the :c:func:`ARKStepSetEpsLin()` function. Passing a value *eplifac* :math:`\le 0` indicates to use the default value of 0.05. + .. deprecated:: x.y.z -Since iterative linear solver libraries typically consider linear residual -tolerances using the :math:`L_2` norm, whereas ARKODE focuses on errors -measured in the WRMS norm :eq:`ARKODE_WRMS_NORM`, the ARKLS interface internally -converts between these quantities when interfacing with linear solvers, - -.. math:: - \text{tol}_{L2} = \text{\em nrmfac}\; \text{tol}_{WRMS}. - :label: ARKODE_NRMFAC - -Prior to the introduction of :c:func:`N_VGetLength` in SUNDIALS v5.0.0 the -value of :math:`nrmfac` was computed using the vector dot product. Now, the -functions :c:func:`ARKStepSetLSNormFactor()` and :c:func:`ARKStepSetMassLSNormFactor()` -allow for additional user control over these conversion factors. + Use :c:func:`ARKodeSetMassEpsLin` instead. .. c:function:: int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) @@ -3009,6 +2521,9 @@ allow for additional user control over these conversion factors. This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`ARKStepSetLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLSNormFactor` instead. .. c:function:: int ARKStepSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) @@ -3038,31 +2553,15 @@ allow for additional user control over these conversion factors. This function must be called *after* the ARKLS mass matrix solver interface has been initialized through a call to :c:func:`ARKStepSetMassLinearSolver()`. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetMassLSNormFactor` instead. -.. _ARKODE.Usage.ARKStep.ARKStepRootfindingInputTable: - Rootfinding optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following functions can be called to set optional inputs to -control the rootfinding algorithm, the mathematics of which are -described in :numref:`ARKODE.Mathematics.Rootfinding`. - - -.. cssclass:: table-bordered - -====================================== ======================================== ================== -Optional input Function name Default -====================================== ======================================== ================== -Direction of zero-crossings to monitor :c:func:`ARKStepSetRootDirection()` both -Disable inactive root warnings :c:func:`ARKStepSetNoInactiveRootWarn()` enabled -====================================== ======================================== ================== - - - .. c:function:: int ARKStepSetRootDirection(void* arkode_mem, int* rootdir) Specifies the direction of zero-crossings to be located and returned. @@ -3085,6 +2584,9 @@ Disable inactive root warnings :c:func:`ARKStepSetNoInactiveRootWarn()` **Notes:** The default behavior is to monitor for both zero-crossing directions. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRootDirection` instead. .. c:function:: int ARKStepSetNoInactiveRootWarn(void* arkode_mem) @@ -3108,7 +2610,9 @@ Disable inactive root warnings :c:func:`ARKStepSetNoInactiveRootWarn()` first step), ARKStep will issue a warning which can be disabled with this optional input function. + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetNoInactiveRootWarn` instead. @@ -3117,19 +2621,6 @@ Disable inactive root warnings :c:func:`ARKStepSetNoInactiveRootWarn()` Interpolated output function -------------------------------- -An optional function :c:func:`ARKStepGetDky()` is available to obtain -additional values of solution-related quantities. This function -should only be called after a successful return from -:c:func:`ARKStepEvolve()`, as it provides interpolated values either of -:math:`y` or of its derivatives (up to the 5th derivative) -interpolated to any value of :math:`t` in the last internal step taken -by :c:func:`ARKStepEvolve()`. Internally, this "dense output" or -"continuous extension" algorithm is identical to the algorithm used for -the maximum order implicit predictors, described in -:numref:`ARKODE.Mathematics.Predictors.Max`, except that derivatives of the -polynomial model may be evaluated upon request. - - .. c:function:: int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) @@ -3168,6 +2659,9 @@ polynomial model may be evaluated upon request. functions :c:func:`ARKStepGetCurrentTime()` and :c:func:`ARKStepGetLastStep()`, respectively. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetDky` instead. @@ -3176,101 +2670,11 @@ polynomial model may be evaluated upon request. Optional output functions ------------------------------ -ARKStep provides an extensive set of functions that can be used to -obtain solver performance information. We organize these into groups: - -#. General ARKStep output routines are in - :numref:`ARKODE.Usage.ARKStep.ARKStepMainOutputs`, -#. ARKStep implicit solver output routines are in - :numref:`ARKODE.Usage.ARKStep.ARKStepImplicitSolverOutputs`, -#. Output routines regarding root-finding results are in - :numref:`ARKODE.Usage.ARKStep.ARKStepRootOutputs`, -#. Linear solver output routines are in - :numref:`ARKODE.Usage.ARKStep.ARKLsOutputs` and -#. General usability routines (e.g. to print the current ARKStep - parameters, or output the current Butcher table(s)) are in - :numref:`ARKODE.Usage.ARKStep.ARKStepExtraOutputs`. - -Following each table, we elaborate on each function. - -Some of the optional outputs, especially the various counters, can be -very useful in determining the efficiency of various methods inside -ARKStep. For example: - -* The counters *nsteps*, *nfe_evals* and *nfi_evals* - provide a rough measure of the overall cost of a given run, and can - be compared between runs with different solver options to suggest - which set of options is the most efficient. - -* The ratio *nniters/nsteps* measures the performance of the - nonlinear iteration in solving the nonlinear systems at each stage, - providing a measure of the degree of nonlinearity in the problem. - Typical values of this for a Newton solver on a general problem - range from 1.1 to 1.8. - -* When using a Newton nonlinear solver, the ratio *njevals/nniters* - (when using a direct linear solver), and the ratio - *nliters/nniters* (when using an iterative linear solver) can - indicate the quality of the approximate Jacobian or preconditioner being - used. For example, if this ratio is larger for a user-supplied - Jacobian or Jacobian-vector product routine than for the - difference-quotient routine, it can indicate that the user-supplied - Jacobian is inaccurate. - -* The ratio *expsteps/accsteps* can measure the quality of the ImEx - splitting used, since a higher-quality splitting will be dominated - by accuracy-limited steps, and hence a lower ratio. - -* The ratio *nsteps/step_attempts* can measure the quality of the - time step adaptivity algorithm, since a poor algorithm will result - in more failed steps, and hence a lower ratio. - -It is therefore recommended that users retrieve and output these -statistics following each run, and take some time to investigate -alternate solver options that will be more optimal for their -particular problem of interest. - - - .. _ARKODE.Usage.ARKStep.ARKStepMainOutputs: Main solver optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. cssclass:: table-bordered - -===================================================== ============================================ -Optional output Function name -===================================================== ============================================ -Size of ARKStep real and integer workspaces :c:func:`ARKStepGetWorkSpace()` -Cumulative number of internal steps :c:func:`ARKStepGetNumSteps()` -Actual initial time step size used :c:func:`ARKStepGetActualInitStep()` -Step size used for the last successful step :c:func:`ARKStepGetLastStep()` -Step size to be attempted on the next step :c:func:`ARKStepGetCurrentStep()` -Current internal time reached by the solver :c:func:`ARKStepGetCurrentTime()` -Current internal solution reached by the solver :c:func:`ARKStepGetCurrentState()` -Current :math:`\gamma` value used by the solver :c:func:`ARKStepGetCurrentGamma()` -Suggested factor for tolerance scaling :c:func:`ARKStepGetTolScaleFactor()` -Error weight vector for state variables :c:func:`ARKStepGetErrWeights()` -Residual weight vector :c:func:`ARKStepGetResWeights()` -Single accessor to many statistics at once :c:func:`ARKStepGetStepStats()` -Print all statistics :c:func:`ARKStepPrintAllStats` -Name of constant associated with a return flag :c:func:`ARKStepGetReturnFlagName()` -No. of explicit stability-limited steps :c:func:`ARKStepGetNumExpSteps()` -No. of accuracy-limited steps :c:func:`ARKStepGetNumAccSteps()` -No. of attempted steps :c:func:`ARKStepGetNumStepAttempts()` -No. of calls to *fe* and *fi* functions :c:func:`ARKStepGetNumRhsEvals()` -No. of local error test failures that have occurred :c:func:`ARKStepGetNumErrTestFails()` -No. of failed steps due to a nonlinear solver failure :c:func:`ARKStepGetNumStepSolveFails()` -Current ERK and DIRK Butcher tables :c:func:`ARKStepGetCurrentButcherTables()` -Estimated local truncation error vector :c:func:`ARKStepGetEstLocalErrors()` -Single accessor to many statistics at once :c:func:`ARKStepGetTimestepperStats()` -Number of constraint test failures :c:func:`ARKStepGetNumConstrFails()` -Retrieve a pointer for user data :c:func:`ARKStepGetUserData` -===================================================== ============================================ - - - .. c:function:: int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) @@ -3285,6 +2689,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetWorkSpace` instead. .. c:function:: int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps) @@ -3300,6 +2707,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumSteps` instead. .. c:function:: int ARKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused) @@ -3323,6 +2733,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa local error test condition, or to ensure convergence of the nonlinear solver. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetActualInitStep` instead. .. c:function:: int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) @@ -3338,6 +2751,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLastStep` instead. .. c:function:: int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) @@ -3352,6 +2768,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentStep` instead. .. c:function:: int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) @@ -3366,6 +2785,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentTime` instead. .. c:function:: int ARKStepGetCurrentState(void *arkode_mem, N_Vector *ycur) @@ -3385,6 +2807,10 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa as altering values of *ycur* may lead to undesirable behavior, depending on the particular use case and on when this routine is called. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentState` instead. + .. c:function:: int ARKStepGetCurrentGamma(void *arkode_mem, sunrealtype *gamma) @@ -3399,6 +2825,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentGamma` instead. .. c:function:: int ARKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac) @@ -3415,6 +2844,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetTolScaleFactor` instead. .. c:function:: int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight) @@ -3433,6 +2865,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa The user must allocate space for *eweight*, that will be filled in by this function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetErrWeights` instead. .. c:function:: int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight) @@ -3451,6 +2886,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa The user must allocate space for *rweight*, that will be filled in by this function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetResWeights` instead. .. c:function:: int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) @@ -3469,6 +2907,10 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetStepStats` instead. + .. c:function:: int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) @@ -3497,8 +2939,12 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa .. versionadded:: 5.2.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodePrintAllStats` instead. + -.. c:function:: char *ARKStepGetReturnFlagName(long int flag) +.. c:function:: char* ARKStepGetReturnFlagName(long int flag) Returns the name of the ARKStep constant corresponding to *flag*. See :ref:`ARKODE.Constants`. @@ -3510,7 +2956,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa The return value is a string containing the name of the corresponding constant. + .. deprecated:: x.y.z + Use :c:func:`ARKodeGetReturnFlagName` instead. @@ -3527,6 +2975,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumExpSteps` instead. .. c:function:: int ARKStepGetNumAccSteps(void* arkode_mem, long int* accsteps) @@ -3542,6 +2993,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumAccSteps` instead. .. c:function:: int ARKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts) @@ -3556,6 +3010,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumStepAttempts` instead. .. c:function:: int ARKStepGetNumRhsEvals(void* arkode_mem, long int* nfe_evals, long int* nfi_evals) @@ -3591,6 +3048,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumErrTestFails` instead. .. c:function:: int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* ncnf) @@ -3605,6 +3065,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumStepSolveFails` instead. .. c:function:: int ARKStepGetCurrentButcherTables(void* arkode_mem, ARKodeButcherTable *Bi, ARKodeButcherTable *Be) @@ -3670,6 +3133,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetEstLocalErrors` instead. .. c:function:: int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nfe_evals, long int* nfi_evals, long int* nlinsetups, long int* netfails) @@ -3704,6 +3170,9 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumConstrFails` instead. .. c:function:: int ARKStepGetUserData(void* arkode_mem, void** user_data) @@ -3721,26 +3190,16 @@ Retrieve a pointer for user data :c:func:`ARKStepGetUserDa .. versionadded:: 5.3.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetUserData` instead. + .. _ARKODE.Usage.ARKStep.ARKStepImplicitSolverOutputs: Implicit solver optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. cssclass:: table-bordered - -=================================================== ============================================ -Optional output Function name -=================================================== ============================================ -No. of calls to linear solver setup function :c:func:`ARKStepGetNumLinSolvSetups()` -No. of nonlinear solver iterations :c:func:`ARKStepGetNumNonlinSolvIters()` -No. of nonlinear solver convergence failures :c:func:`ARKStepGetNumNonlinSolvConvFails()` -Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSolvStats()` -=================================================== ============================================ - - - - .. c:function:: int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) Returns the number of calls made to the linear solver's @@ -3758,6 +3217,10 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSo solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinSolvSetups` instead. + .. c:function:: int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) @@ -3777,6 +3240,9 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSo solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumNonlinSolvIters` instead. .. c:function:: int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nncfails) @@ -3796,6 +3262,9 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSo solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumNonlinSolvConvFails` instead. .. c:function:: int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, long int* nncfails) @@ -3816,6 +3285,9 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSo solver object; the counters are reset whenever a new nonlinear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNonlinSolvStats` instead. @@ -3824,17 +3296,6 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKStepGetNonlinSo Rootfinding optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. cssclass:: table-bordered - -=================================================== ========================================== -Optional output Function name -=================================================== ========================================== -Array showing roots found :c:func:`ARKStepGetRootInfo()` -No. of calls to user root function :c:func:`ARKStepGetNumGEvals()` -=================================================== ========================================== - - - .. c:function:: int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound) Returns an array showing which functions were found to @@ -3862,6 +3323,9 @@ No. of calls to user root function :c:func:`ARKStepGetNumGEval zero-crossing. A value of +1 indicates that :math:`g_i` is increasing, while a value of -1 indicates a decreasing :math:`g_i`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetRootInfo` instead. .. c:function:: int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals) @@ -3877,7 +3341,9 @@ No. of calls to user root function :c:func:`ARKStepGetNumGEval * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + Use :c:func:`ARKodeGetNumGEvals` instead. .. _ARKODE.Usage.ARKStep.ARKLsOutputs: @@ -3885,47 +3351,6 @@ No. of calls to user root function :c:func:`ARKStepGetNumGEval Linear solver interface optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A variety of optional outputs are available from the ARKLS interface, -as listed in the following table and elaborated below. We note that -where the name of an output would otherwise conflict with the -name of an optional output from the main solver, a suffix LS (for -Linear Solver) or MLS (for Mass Linear Solver) has been added here -(e.g. *lenrwLS*). - - - -.. cssclass:: table-bordered - -================================================================= ======================================== -Optional output Function name -================================================================= ======================================== -Stored Jacobian of the ODE RHS function :c:func:`ARKStepGetJac` -Time at which the Jacobian was evaluated :c:func:`ARKStepGetJacTime` -Step number at which the Jacobian was evaluated :c:func:`ARKStepGetJacNumSteps` -Size of real and integer workspaces :c:func:`ARKStepGetLinWorkSpace()` -No. of Jacobian evaluations :c:func:`ARKStepGetNumJacEvals()` -No. of preconditioner evaluations :c:func:`ARKStepGetNumPrecEvals()` -No. of preconditioner solves :c:func:`ARKStepGetNumPrecSolves()` -No. of linear iterations :c:func:`ARKStepGetNumLinIters()` -No. of linear convergence failures :c:func:`ARKStepGetNumLinConvFails()` -No. of Jacobian-vector setup evaluations :c:func:`ARKStepGetNumJTSetupEvals()` -No. of Jacobian-vector product evaluations :c:func:`ARKStepGetNumJtimesEvals()` -No. of *fi* calls for finite diff. :math:`J` or :math:`Jv` evals. :c:func:`ARKStepGetNumLinRhsEvals()` -Last return from a linear solver function :c:func:`ARKStepGetLastLinFlag()` -Name of constant associated with a return flag :c:func:`ARKStepGetLinReturnFlagName()` -Size of real and integer mass matrix solver workspaces :c:func:`ARKStepGetMassWorkSpace()` -No. of mass matrix solver setups (incl. :math:`M` evals.) :c:func:`ARKStepGetNumMassSetups()` -No. of mass matrix multiply setups :c:func:`ARKStepGetNumMassMultSetups()` -No. of mass matrix multiplies :c:func:`ARKStepGetNumMassMult()` -No. of mass matrix solves :c:func:`ARKStepGetNumMassSolves()` -No. of mass matrix preconditioner evaluations :c:func:`ARKStepGetNumMassPrecEvals()` -No. of mass matrix preconditioner solves :c:func:`ARKStepGetNumMassPrecSolves()` -No. of mass matrix linear iterations :c:func:`ARKStepGetNumMassIters()` -No. of mass matrix solver convergence failures :c:func:`ARKStepGetNumMassConvFails()` -No. of mass-matrix-vector setup evaluations :c:func:`ARKStepGetNumMTSetups()` -Last return from a mass matrix solver function :c:func:`ARKStepGetLastMassFlag()` -================================================================= ======================================== - .. c:function:: int ARKStepGetJac(void* arkode_mem, SUNMatrix* J) Returns the internally stored copy of the Jacobian matrix of the ODE @@ -3943,6 +3368,11 @@ Last return from a mass matrix solver function :c:func:`ARKS This function is provided for debugging purposes and the values in the returned matrix should not be altered. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJac` instead. + + .. c:function:: int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J) Returns the time at which the internally stored copy of the Jacobian matrix @@ -3955,6 +3385,11 @@ Last return from a mass matrix solver function :c:func:`ARKS :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL`` :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJacTime` instead. + + .. c:function:: int ARKStepGetJacNumSteps(void* arkode_mem, long int* nst_J) Returns the value of the internal step counter at which the internally stored copy of the @@ -3967,6 +3402,11 @@ Last return from a mass matrix solver function :c:func:`ARKS :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL`` :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJacNumSteps` instead. + + .. c:function:: int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS) Returns the real and integer workspace used by the ARKLS linear solver interface. @@ -3991,6 +3431,10 @@ Last return from a mass matrix solver function :c:func:`ARKS In a parallel setting, the above values are global (i.e. summed over all processors). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLinWorkSpace` instead. + .. c:function:: int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals) @@ -4009,6 +3453,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJacEvals` instead. + .. c:function:: int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals) @@ -4029,6 +3477,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumPrecEvals` instead. + .. c:function:: int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves) @@ -4048,6 +3500,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumPrecSolves` instead. + .. c:function:: int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters) @@ -4066,6 +3522,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinIters` instead. + .. c:function:: int ARKStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails) @@ -4084,6 +3544,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinConvFails` instead. + .. c:function:: int ARKStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetup) @@ -4103,6 +3567,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJTSetupEvals` instead. + .. c:function:: int ARKStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals) @@ -4122,6 +3590,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJtimesEvals` instead. + .. c:function:: int ARKStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) @@ -4147,6 +3619,10 @@ Last return from a mass matrix solver function :c:func:`ARKS solver object; the counter is reset whenever a new linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinRhsEvals` instead. + .. c:function:: int ARKStepGetLastLinFlag(void* arkode_mem, long int* lsflag) @@ -4198,8 +3674,12 @@ Last return from a mass matrix solver function :c:func:`ARKS *SUN_ERR_EXT_FAIL*, indicating an unrecoverable failure in an external iterative linear solver package. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLastLinFlag` instead. -.. c:function:: char *ARKStepGetLinReturnFlagName(long int lsflag) + +.. c:function:: char* ARKStepGetLinReturnFlagName(long int lsflag) Returns the name of the ARKLS constant corresponding to *lsflag*. @@ -4211,6 +3691,9 @@ Last return from a mass matrix solver function :c:func:`ARKS ``SUNLINSOL_BAND`` modules, then if 1 :math:`\le` `lsflag` :math:`\le n` (LU factorization failed), this routine returns "NONE". + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLinReturnFlagName` instead. @@ -4238,6 +3721,10 @@ Last return from a mass matrix solver function :c:func:`ARKS In a parallel setting, the above values are global (i.e. summed over all processors). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetMassWorkSpace` instead. + .. c:function:: int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups) @@ -4259,6 +3746,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassSetups` instead. + .. c:function:: int ARKStepGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) @@ -4279,6 +3770,11 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassMultSetups` instead. + + .. c:function:: int ARKStepGetNumMassMult(void* arkode_mem, long int* nmmults) Returns the number of calls made to the ARKLS mass matrix 'matvec' @@ -4299,6 +3795,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassMult` instead. + .. c:function:: int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves) @@ -4318,6 +3818,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassSolves` instead. + .. c:function:: int ARKStepGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals) @@ -4338,6 +3842,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassPrecEvals` instead. + .. c:function:: int ARKStepGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves) @@ -4358,6 +3866,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassPrecSolves` instead. + .. c:function:: int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters) @@ -4377,6 +3889,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassIters` instead. + .. c:function:: int ARKStepGetNumMassConvFails(void* arkode_mem, long int* nmcfails) @@ -4396,6 +3912,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMassConvFails` instead. + .. c:function:: int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetup) @@ -4416,6 +3936,10 @@ Last return from a mass matrix solver function :c:func:`ARKS linear solver module is "attached" to ARKStep, or when ARKStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumMTSetups` instead. + .. c:function:: int ARKStepGetLastMassFlag(void* arkode_mem, long int* mlsflag) @@ -4436,7 +3960,9 @@ Last return from a mass matrix solver function :c:func:`ARKS will match those described above for the function :c:func:`ARKStepGetLastLinFlag()`. + .. deprecated:: x.y.z + Use :c:func:`ARKodeGetLastMassFlag` instead. @@ -4445,24 +3971,6 @@ Last return from a mass matrix solver function :c:func:`ARKS General usability functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following optional routines may be called by a user to inquire -about existing solver parameters or write the current Butcher table(s). While -neither of these would typically be called during the course of solving an -initial value problem, they may be useful for users wishing to better -understand ARKStep and/or specific Runge--Kutta methods. - - -.. cssclass:: table-bordered - -===================================== =================================== -Optional routine Function name -===================================== =================================== -Output all ARKStep solver parameters :c:func:`ARKStepWriteParameters()` -Output the current Butcher table(s) :c:func:`ARKStepWriteButcher()` -===================================== =================================== - - - .. c:function:: int ARKStepWriteParameters(void* arkode_mem, FILE *fp) @@ -4484,6 +3992,10 @@ Output the current Butcher table(s) :c:func:`ARKStepWriteButcher()` for this pointer, since parameters for all processes would be identical. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeWriteParameters` instead. + .. c:function:: int ARKStepWriteButcher(void* arkode_mem, FILE *fp) @@ -4604,44 +4116,6 @@ vector. ARKStep reset function ---------------------- -To reset the ARKStep module to a particular state :math:`(t_R,y(t_R))` for the -continued solution of a problem, where a prior -call to :c:func:`ARKStepCreate` has been made, the user must call the function -:c:func:`ARKStepReset()`. Like :c:func:`ARKStepReInit()` this routine retains -the current settings for all ARKStep module options and performs no memory -allocations but, unlike :c:func:`ARKStepReInit()`, this routine performs only a -*subset* of the input checking and initializations that are done in -:c:func:`ARKStepCreate`. In particular this routine retains all internal -counter values and the step size/error history and does not reinitialize the -linear and/or nonlinear solver but it does indicate that a linear solver setup -is necessary in the next step. Like :c:func:`ARKStepReInit()`, a call to -:c:func:`ARKStepReset()` will delete any previously-set *tstop* value specified -via a call to :c:func:`ARKStepSetStopTime()`. Following a successful call to -:c:func:`ARKStepReset()`, call :c:func:`ARKStepEvolve()` again to continue -solving the problem. By default the next call to :c:func:`ARKStepEvolve()` will -use the step size computed by ARKStep prior to calling :c:func:`ARKStepReset()`. -To set a different step size or have ARKStep estimate a new step size use -:c:func:`ARKStepSetInitStep()`. - -One important use of the :c:func:`ARKStepReset()` function is in the -treating of jump discontinuities in the RHS functions. Except in cases -of fairly small jumps, it is usually more efficient to stop at each -point of discontinuity and restart the integrator with a readjusted -ODE model, using a call to :c:func:`ARKStepReset()`. To stop when -the location of the discontinuity is known, simply make that location -a value of ``tout``. To stop when the location of the discontinuity -is determined by the solution, use the rootfinding feature. In either -case, it is critical that the RHS functions *not* incorporate the -discontinuity, but rather have a smooth extension over the -discontinuity, so that the step across it (and subsequent rootfinding, -if used) can be done efficiently. Then use a switch within the RHS -functions (communicated through ``user_data``) that can be flipped -between the stopping of the integration and the restart, so that the -restarted problem uses the new values (which have jumped). Similar -comments apply if there is to be a jump in the dependent variable -vector. - - .. c:function:: int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) Resets the current ARKStep time-stepper module state to the provided @@ -4670,6 +4144,9 @@ vector. If an error occurred, :c:func:`ARKStepReset()` also sends an error message to the error handler function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeReset` instead. @@ -4678,36 +4155,6 @@ vector. ARKStep system resize function ------------------------------------- -For simulations involving changes to the number of equations and -unknowns in the ODE system (e.g. when using spatially-adaptive -PDE simulations under a method-of-lines approach), the ARKStep -integrator may be "resized" between integration steps, through calls -to the :c:func:`ARKStepResize()` function. This function modifies -ARKStep's internal memory structures to use the new problem size, -without destruction of the temporal adaptivity heuristics. It is -assumed that the dynamical time scales before and after the vector -resize will be comparable, so that all time-stepping heuristics prior -to calling :c:func:`ARKStepResize()` remain valid after the call. If -instead the dynamics should be recomputed from scratch, the ARKStep -memory structure should be deleted with a call to -:c:func:`ARKStepFree()`, and recreated with a calls to -:c:func:`ARKStepCreate`. - -To aid in the vector resize operation, the user can supply a vector -resize function that will take as input a vector with the previous -size, and transform it in-place to return a corresponding vector of -the new size. If this function (of type :c:func:`ARKVecResizeFn()`) -is not supplied (i.e., is set to ``NULL``), then all existing vectors -internal to ARKStep will be destroyed and re-cloned from the new input -vector. - -In the case that the dynamical time scale should be modified slightly -from the previous time scale, an input *hscale* is allowed, that will -rescale the upcoming time step by the specified factor. If a value -*hscale* :math:`\le 0` is specified, the default of 1.0 will be used. - - - .. c:function:: int ARKStepResize(void* arkode_mem, N_Vector yR, sunrealtype hscale, sunrealtype tR, ARKVecResizeFn resize, void* resize_data) Re-sizes ARKStep with a different state vector but with comparable @@ -4775,6 +4222,10 @@ rescale the upcoming time step by the specified factor. If a value **Example codes:** * ``examples/arkode/C_serial/ark_heat1D_adapt.c`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeResize` instead. + .. _ARKStep_CInterface.MRIStepInterface: diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst index ffc80e5901..34bc5257c6 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst @@ -17,13 +17,13 @@ Multigrid Reduction in Time with XBraid ======================================= -The prior sections discuss using ARKStep in a traditional sequential +The prior sections discuss using ARKODE in a traditional sequential time integration setting i.e., the solution is advanced from one time to the next where all parallelism resides within the evaluation of a step e.g., the computation of the right-hand side, (non)linear solves, vector operations etc. For example, when discretizing a partial differential equation using a method of lines approach the spatially-discretized equations comprise a large set -of ordinary differential equations that can be evolved with ARKStep. In this +of ordinary differential equations that can be evolved with ARKODE. In this case the parallelization lies in decomposing the spatial domain unknowns across distributed computational nodes. Considering the strong scaling case at a given spatial resolution, as the problem is spread across greater numbers of @@ -54,9 +54,9 @@ multilevel algorithm. The XBraid library :cite:p:`xbraid` implements the MGRIT algorithm in a non-intrusive manner, enabling the reuse of existing software for sequential -time integration. The following sections describe the ARKStep + XBraid interface -and the steps necessary to modify an existing code that already uses ARKStep to -also use XBraid. +time integration. The following sections describe the ARKODE + XBraid interface +and the steps necessary to modify an existing code that already uses ARKODE's +ARKStep time-stepping module to also use XBraid. @@ -65,7 +65,7 @@ also use XBraid. SUNBraid Interface ------------------ -Interfacing ARKStep with XBraid requires defining two data structures. The +Interfacing ARKODE with XBraid requires defining two data structures. The first is the XBraid application data structure that contains the data necessary for carrying out a time step and is passed to every interface function (much like the user data pointer in SUNDIALS packages). For this structure the @@ -79,9 +79,9 @@ operations (e.g., computing vector sums or norms) as well as functions to initialize the problem state, access the current solution, and take a time step. The ARKBraid interface, built on the SUNBraidApp and SUNBraidVector structures, -provides all the functionaly needed combine ARKStep and XBraid for +provides all the functionaly needed combine ARKODE and XBraid for parallel-in-time integration. As such, only a minimal number of changes are -necessary to update an exsting code that uses ARKStep to also use XBraid. +necessary to update an exsting code that uses ARKODE to also use XBraid. @@ -156,19 +156,17 @@ example usage of the function. This function returns a vector to use as a template for creating new vectors with :c:func:`N_VClone()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *y* -- output, the template vector. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param y: output, the template vector. - **Return value:** - If this function is not implemented by the SUNBraidApp - implementation (i.e., the function pointer is ``NULL``) then this function - will return *SUNBRAID_OPNULL*. Otherwise the return value depends on the - particular SUNBraidApp implementation. Users are encouraged to utilize the - return codes defined in ``sundials/sundials_xbraid.h`` and listed in - :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. + :return: If this function is not implemented by the SUNBraidApp + implementation (i.e., the function pointer is ``NULL``) then this function + will return *SUNBRAID_OPNULL*. Otherwise the return value depends on the + particular SUNBraidApp implementation. Users are encouraged to utilize the + return codes defined in ``sundials/sundials_xbraid.h`` and listed in + :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. - **Usage:** + .. admonition:: Usage .. code-block:: C @@ -192,14 +190,12 @@ instance. This function creates a new SUNBraidApp instance with the content and operations initialized to ``NULL``. - **Arguments:** - * *app* -- output, an empty SUNBraidApp instance (XBraid app structure). + :param app: output, an empty SUNBraidApp instance (XBraid app structure). - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ALLOCFAIL* if a memory allocation failed. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation failed. - **Usage:** + .. admonition:: Usage .. code-block:: C @@ -213,13 +209,11 @@ instance. This function destroys an empty SUNBraidApp instance. - **Arguments:** - * *app* -- input, an empty SUNBraidApp instance (XBraid app structure). + :param app: input, an empty SUNBraidApp instance (XBraid app structure). - **Return value:** - * *SUNBRAID_SUCCESS* if successful. + :retval SUNBRAID_SUCCESS: if successful. - **Usage:** + .. admonition:: Usage .. code-block:: C @@ -263,16 +257,14 @@ utility functions are provided. This function creates a new SUNBraidVector wrapping the N_Vector y. - **Arguments:** - * *y* -- input, the N_Vector to wrap. - * *u* -- output, the SUNBraidVector wrapping *y*. + :param y: input, the N_Vector to wrap. + :param u: output, the SUNBraidVector wrapping *y*. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *y* is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if a memory allocation fails. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *y* is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation fails. - **Usage:** + .. admonition:: Usage .. code-block:: C @@ -292,16 +284,14 @@ utility functions are provided. This function retrieves the wrapped N_Vector from the SUNBraidVector. - **Arguments:** - * *u* -- input, the SUNBraidVector wrapping *y*. - * *y* -- output, the wrapped N_Vector. + :param u: input, the SUNBraidVector wrapping *y*. + :param y: output, the wrapped N_Vector. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *u* is ``NULL``. - * *SUNBRAID_MEMFAIL* if *y* is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *u* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if *y* is ``NULL``. - **Usage:** + .. admonition:: Usage .. code-block:: C @@ -321,16 +311,14 @@ N_Vector operations. values of the input vector *u* into the output vector *v_ptr* using :c:func:`N_VClone()` and :c:func:`N_VScale()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *u* -- input, the SUNBraidVector to clone. - * *v_ptr* -- output, the new SUNBraidVector. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param u: input, the SUNBraidVector to clone. + :param v_ptr: output, the new SUNBraidVector. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *u* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the N_Vector *y* wrapped by *u* is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if a memory allocation fails. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *u* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the N_Vector *y* wrapped by *u* is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation fails. @@ -339,12 +327,10 @@ N_Vector operations. This function destroys the SUNBraidVector and the wrapped N_Vector using :c:func:`N_VDestroy()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *u* -- input, the SUNBraidVector to destroy. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param u: input, the SUNBraidVector to destroy. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. + :retval SUNBRAID_SUCCESS: if successful. @@ -353,17 +339,15 @@ N_Vector operations. This function computes the vector sum :math:`\alpha x + \beta y \rightarrow y` using :c:func:`N_VLinearSum()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *alpha* -- input, the constant :math:`\alpha`. - * *x* -- input, the vector :math:`x`. - * *beta* -- input, the constant :math:`\beta`. - * *y* -- input/output, the vector :math:`y`. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param alpha: input, the constant :math:`\alpha`. + :param x: input, the vector :math:`x`. + :param beta: input, the constant :math:`\beta`. + :param y: input/output, the vector :math:`y`. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *x* or *y* is ``NULL``. - * *SUNBRAID_MEMFAIL* if either of the wrapped N_Vectors are ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *x* or *y* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if either of the wrapped N_Vectors are ``NULL``. @@ -372,15 +356,13 @@ N_Vector operations. This function computes the 2-norm of the vector *u* using :c:func:`N_VDotProd()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *u* -- input, the vector *u*. - * *norm_ptr* -- output, the L2 norm of *u*. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param u: input, the vector *u*. + :param norm_ptr: output, the L2 norm of *u*. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *u* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the wrapped N_Vector is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *u* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the wrapped N_Vector is ``NULL``. @@ -389,16 +371,14 @@ N_Vector operations. This function returns the buffer size for messages to exchange vector data using :c:func:`SUNBraidApp_GetVecTmpl` and :c:func:`N_VBufSize()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *size_ptr* -- output, the buffer size. - * *bstatus* -- input, a status object to query for information on the message - type. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param size_ptr: output, the buffer size. + :param bstatus: input, a status object to query for information on the message + type. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * An error flag from :c:func:`SUNBraidApp_GetVecTmpl` or - :c:func:`N_VBufSize()`. + :retval SUNBRAID_SUCCESS: if successful + :retval otherwise: an error flag from :c:func:`SUNBraidApp_GetVecTmpl` + or :c:func:`N_VBufSize()`. @@ -407,17 +387,15 @@ N_Vector operations. This function packs the message buffer for exchanging vector data using :c:func:`N_VBufPack()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *u* -- input, the vector to pack into the exchange buffer. - * *buffer* -- output, the packed exchange buffer to pack. - * *bstatus* -- input, a status object to query for information on the message - type. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param u: input, the vector to pack into the exchange buffer. + :param buffer: output, the packed exchange buffer to pack. + :param bstatus: input, a status object to query for information on the message + type. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *u* is ``NULL``. - * An error flag from :c:func:`N_VBufPack()`. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *u* is ``NULL``. + :retval otherwise: An error flag from :c:func:`N_VBufPack()`. @@ -427,19 +405,17 @@ N_Vector operations. SUNBraidVector with the buffer data using :c:func:`N_VBufUnpack()`, :c:func:`SUNBraidApp_GetVecTmpl`, and :c:func:`N_VClone()`. - **Arguments:** - * *app* -- input, a SUNBraidApp instance (XBraid app structure). - * *buffer* -- input, the exchange buffer to unpack. - * *u_ptr* -- output, a new SUNBraidVector containing the buffer data. - * *bstatus* -- input, a status object to query for information on the message - type. + :param app: input, a SUNBraidApp instance (XBraid app structure). + :param buffer: input, the exchange buffer to unpack. + :param u_ptr: output, a new SUNBraidVector containing the buffer data. + :param bstatus: input, a status object to query for information on the message + type. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *buffer* is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if a memory allocation fails. - * An error flag from :c:func:`SUNBraidApp_GetVecTmpl` and - :c:func:`N_VBufUnpack()`. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *buffer* is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation fails. + :retval otherwise: an error flag from :c:func:`SUNBraidApp_GetVecTmpl` and + :c:func:`N_VBufUnpack()`. @@ -480,9 +456,9 @@ ARKBraid Interface ------------------ This section describes the ARKBraid implementation of a SUNBraidApp for using -the ARKStep integration module with XBraid. The following section +the ARKODE's ARKStep time-stepping module with XBraid. The following section :numref:`ARKODE.Usage.ARKStep.ARKBraid_InitDealloc` describes routines for creating, -initializing, and destroying the ARKStep + XBraid interface, routines for +initializing, and destroying the ARKODE + XBraid interface, routines for setting optional inputs, and routines for retrieving data from an ARKBraid instance. As noted above, interfacing with XBraid requires providing functions to initialize the problem state, access the current solution, and take a time @@ -490,7 +466,7 @@ step. The default ARKBraid functions for each of these actions are defined in :n user-defined if desired. A skeleton of the user's main or calling program for using the ARKBraid interface is given in :numref:`ARKODE.Usage.ARKStep.ARKBraid_Skeleton`. Finally, for advanced users that -wish to create their own SUNBraidApp implementation using ARKStep, +wish to create their own SUNBraidApp implementation using ARKODE, :numref:`ARKODE.Usage.ARKStep.ARKBraid_Utility` describes some helpful functions available to the user. @@ -515,20 +491,19 @@ if an error occurred. The possible return codes are given in private ARKBraid interface structure, and attaches the necessary SUNBraidOps implementations. - **Arguments:** - * *arkode_mem* -- input, a pointer to an ARKStep memory structure. - * *app* -- output, an ARKBraid instance (XBraid app structure). + :param arkode_mem: input, a pointer to an ARKODE memory structure. + :param app: output, an ARKBraid instance (XBraid app structure). - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* *arkode_mem* is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if a memory allocation failed. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: *arkode_mem* is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation failed. .. warning:: The ARKBraid interface is ARKStep-specific. Although one could eventually - construct an XBraid interface to either ERKStep or MRIStep, those are not - supported by this implementation. + construct an XBraid interface to other of ARKODE time-stepping modules + (e.g., ERKStep or MRIStep), those are not currently supported by this + implementation. @@ -538,21 +513,19 @@ if an error occurred. The possible return codes are given in XBraid core memory structure and initializes XBraid with the ARKBraid and SUNBraidVector interface functions. - **Arguments:** - * *comm_w* -- input, the global MPI communicator for space and time. - * *comm_t* -- input, the MPI communicator for the time dimension. - * *tstart* -- input, the initial time value. - * *tstop* -- input, the final time value. - * *ntime* -- input, the initial number of grid points in time. - * *app* -- input, an ARKBraid instance. - * *core* -- output, the XBraid core memory structure. - - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if either MPI communicator is ``MPI_COMM_NULL``, - if *ntime* < 2, or if *app* or its content is ``NULL``. - * *SUNBRAID_BRAIDFAIL* if the ``braid_Init()`` call fails. The XBraid return - value can be retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. + :param comm_w: input, the global MPI communicator for space and time. + :param comm_t: input, the MPI communicator for the time dimension. + :param tstart: input, the initial time value. + :param tstop: input, the final time value. + :param ntime: input, the initial number of grid points in time. + :param app: input, an ARKBraid instance. + :param core: output, the XBraid core memory structure. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if either MPI communicator is ``MPI_COMM_NULL``, + if *ntime* < 2, or if *app* or its content is ``NULL``. + :retval SUNBRAID_BRAIDFAIL: if the ``braid_Init()`` call fails. The XBraid return + value can be retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. .. note:: @@ -572,11 +545,9 @@ if an error occurred. The possible return codes are given in This function deallocates an ARKBraid instance. - **Arguments:** - * *app* -- input, a pointer to an ARKBraid instance. + :param app: input, a pointer to an ARKBraid instance. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. + :retval SUNBRAID_SUCCESS: if successful. @@ -599,15 +570,13 @@ error occurred. The possible return codes are given in This function sets the step function provided to XBraid (default :c:func:`ARKBraid_Step()`). - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *step* -- input, an XBraid step function. If *step* is ``NULL``, the - default function will be used. + :param app: input, an ARKBraid instance. + :param step: input, an XBraid step function. If *step* is ``NULL``, the + default function will be used. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. .. note:: @@ -620,15 +589,13 @@ error occurred. The possible return codes are given in This function sets the vector initialization function provided to XBraid (default :c:func:`ARKBraid_Init()`). - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *init* -- input, an XBraid vector initialization function. If *init* is - ``NULL``, the default function will be used. + :param app: input, an ARKBraid instance. + :param init: input, an XBraid vector initialization function. If *init* is + ``NULL``, the default function will be used. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. .. note:: @@ -641,15 +608,13 @@ error occurred. The possible return codes are given in This function sets the spatial norm function provided to XBraid (default :c:func:`SUNBraidVector_SpatialNorm()`). - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *snorm* -- input, an XBraid spatial norm function. If *snorm* is ``NULL``, - the default function will be used. + :param app: input, an ARKBraid instance. + :param snorm: input, an XBraid spatial norm function. If *snorm* is ``NULL``, + the default function will be used. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. .. note:: @@ -662,15 +627,13 @@ error occurred. The possible return codes are given in This function sets the user access function provided to XBraid (default :c:func:`ARKBraid_Access()`). - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *init* -- input, an XBraid user access function. If *access* is ``NULL``, - the default function will be used. + :param app: input, an ARKBraid instance. + :param init: input, an XBraid user access function. If *access* is ``NULL``, + the default function will be used. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. .. note:: @@ -693,18 +656,30 @@ error occurred. The possible return codes are given in .. c:function:: int ARKBraid_GetVecTmpl(braid_App app, N_Vector *tmpl) - This function returns a vector from the ARKStep memory to use as a template + This function returns a vector from the ARKODE memory to use as a template for creating new vectors with :c:func:`N_VClone()` i.e., this is the ARKBraid implementation of :c:func:`SUNBraidApp_GetVecTmpl()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *tmpl* -- output, a template vector. + :param app: input, an ARKBraid instance. + :param tmpl: output, a template vector. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKODE memory is ``NULL``. + + + +.. c:function:: int ARKBraid_GetARKodeMem(braid_App app, void **arkode_mem) + + This function returns the ARKODE memory structure pointer attached with + :c:func:`ARKBraid_Create()`. + + :param app: input, an ARKBraid instance. + :param arkode_mem: output, a pointer to the ARKODE memory structure. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or ARKStep memory is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKODE memory is ``NULL``. @@ -713,30 +688,29 @@ error occurred. The possible return codes are given in This function returns the ARKStep memory structure pointer attached with :c:func:`ARKBraid_Create()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *arkode_mem* -- output, a pointer to the ARKStep memory structure. + :param app: input, an ARKBraid instance. + :param arkode_mem: output, a pointer to the ARKStep memory structure. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKStep memory is ``NULL``. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or ARKStep memory is ``NULL``. + .. deprecated:: x.y.z + Use :c:func:`ARKBraid_GetARKodeMem` instead. .. c:function:: int ARKBraid_GetUserData(braid_App app, void **user_data) This function returns the user data pointer attached with - :c:func:`ARKStepSetUserData()`. + :c:func:`ARKodeSetUserData()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *user_data* -- output, a pointer to the user data structure. + :param app: input, an ARKBraid instance. + :param user_data: output, a pointer to the user data structure. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or ARKStep memory is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKODE memory is ``NULL``. @@ -745,14 +719,26 @@ error occurred. The possible return codes are given in This function returns the return value from the most recent XBraid function call. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *last_flag* -- output, the XBraid return value. + :param app: input, an ARKBraid instance. + :param last_flag: output, the XBraid return value. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. + + + +.. c:function:: int ARKBraid_GetLastARKodeFlag(braid_App app, int *last_flag) + + This function returns the return value from the most recent ARKODE function + call. + + :param app: input, an ARKBraid instance. + :param last_flag: output, the ARKODE return value. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. @@ -761,14 +747,16 @@ error occurred. The possible return codes are given in This function returns the return value from the most recent ARKStep function call. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *last_flag* -- output, the ARKStep return value. + :param app: input, an ARKBraid instance. + :param last_flag: output, the ARKStep return value. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content is ``NULL``. + + .. deprecated:: x.y.z - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content is ``NULL``. + Use :c:func:`ARKBraid_GetLastARKodeFlag` instead. .. c:function:: int ARKBraid_GetSolution(braid_App app, sunrealtype *tout, N_Vector yout) @@ -776,22 +764,20 @@ error occurred. The possible return codes are given in This function returns final time and state stored with the default access function :c:func:`ARKBraid_Access()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *last_flag* -- output, the ARKStep return value. + :param app: input, an ARKBraid instance. + :param last_flag: output, the ARKODE return value. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or the stored vector is ``NULL``. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or the stored vector is ``NULL``. .. warning:: If providing a non-default access function the final time and state are not stored within the ARKBraid structure and this function will return an error. In this case the user should allocate space to store any desired - output within the user data pointer attached to ARKStep with - :c:func:`ARKStepSetUserData()`. This user data pointer can be retrieved + output within the user data pointer attached to ARKODE with + :c:func:`ARKodeSetUserData()`. This user data pointer can be retrieved from the ARKBraid structure with :c:func:`ARKBraid_GetUserData()`. @@ -819,23 +805,21 @@ in :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. the ARStep memory structure provided to :c:func:`ARKBraid_Create()`. A user-defined step function may be set with :c:func:`ARKBraid_SetStepFn()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *ustop* -- input, *u* vector at the new time *tstop*. - * *fstop* -- input, the right-hand side vector at the new time *tstop*. - * *u* - input/output, on input the vector at the start time and on return the - vector at the new time. - * *status* -- input, a status object to query for information about *u* and - to steer XBraid e.g., for temporal refinement. - - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or ARKStep memory is ``NULL``. - * *SUNBRAID_BRAIDFAIL* if an XBraid function fails. The return value can be - retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. - * *SUNBRAID_SUNFAIL* if a SUNDIALS function fails. The return value can be - retrieved with :c:func:`ARKBraid_GetLastARKStepFlag()`. + :param app: input, an ARKBraid instance. + :param ustop: input, *u* vector at the new time *tstop*. + :param fstop: input, the right-hand side vector at the new time *tstop*. + :param u: input/output, on input the vector at the start time and on return the + vector at the new time. + :param status: input, a status object to query for information about *u* and + to steer XBraid e.g., for temporal refinement. + + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKODE memory is ``NULL``. + :retval SUNBRAID_BRAIDFAIL: if an XBraid function fails. The return value can be + retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. + :retval SUNBRAID_SUNFAIL: if a SUNDIALS function fails. The return value can be + retrieved with :c:func:`ARKBraid_GetLastARKStepFlag()`. .. note:: @@ -854,16 +838,14 @@ in :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. provided to :c:func:`ARKStepCreate`. A user-defined init function may be set with :c:func:`ARKBraid_SetInitFn()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *t* -- input, the initialization time for the output vector. - * *u_ptr* -- output, the new and initialized SUNBraidVector. + :param app: input, an ARKBraid instance. + :param t: input, the initialization time for the output vector. + :param u_ptr: output, the new and initialized SUNBraidVector. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if *app* is ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content or ARKStep memory is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if a memory allocation failed. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if *app* is ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content or ARKODE memory is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if a memory allocation failed. .. note:: @@ -883,19 +865,17 @@ in :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. :c:func:`ARKBraid_GetSolution()`. A user-defined access function may be set with :c:func:`ARKBraid_SetAccessFn()`. - **Arguments:** - * *app* -- input, an ARKBraid instance. - * *u* -- input, the vector to be accessed. - * *status* -- input, a status object to query for information about *u*. + :param app: input, an ARKBraid instance. + :param u: input, the vector to be accessed. + :param status: input, a status object to query for information about *u*. - **Return value:** - * *SUNBRAID_SUCCESS* if successful. - * *SUNBRAID_ILLINPUT* if any of the inputs are ``NULL``. - * *SUNBRAID_MEMFAIL* if the *app* content, the wrapped N_Vector, or the - ARKStep memory is ``NULL``. - * *SUNBRAID_ALLOCFAIL* if allocating storage for the final solution fails. - * *SUNBRAID_BRAIDFAIL* if an XBraid function fails. The return value can be - retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. + :retval SUNBRAID_SUCCESS: if successful. + :retval SUNBRAID_ILLINPUT: if any of the inputs are ``NULL``. + :retval SUNBRAID_MEMFAIL: if the *app* content, the wrapped N_Vector, or the + ARKODE memory is ``NULL``. + :retval SUNBRAID_ALLOCFAIL: if allocating storage for the final solution fails. + :retval SUNBRAID_BRAIDFAIL: if an XBraid function fails. The return value can be + retrieved with :c:func:`ARKBraid_GetLastBraidFlag()`. @@ -910,9 +890,10 @@ interace, the user's program must include the header file ``arkode/arkode_xbraid.h`` which declares the needed function prototypes. The following is a skeleton of the user's main program (or calling program) for -the integration of an ODE IVP using ARKStep with XBraid for parallel-in-time -integration. Most steps are unchanged from the skeleton program presented in -:numref:`ARKODE.Usage.ARKStep.Skeleton`. New or updated steps are **bold**. +the integration of an ODE IVP using ARKODE's ARKStep time-stepping module with +XBraid for parallel-in-time integration. Most steps are unchanged from the +skeleton program presented in :numref:`ARKODE.Usage.Skeleton`. New or updated +steps are **bold**. #. **Initialize MPI** @@ -991,7 +972,7 @@ integration. Most steps are unchanged from the skeleton program presented in Advanced ARKBraid Utility Functions ----------------------------------- -This section describes utility functions utilized in the ARKStep + XBraid +This section describes utility functions utilized in the ARKODE + XBraid interfacing. These functions are used internally by the above ARKBraid interface functions but are exposed to the user to assist in advanced usage of ARKODE and XBraid that requries defining a custom SUNBraidApp implementation. @@ -1001,27 +982,25 @@ ARKODE and XBraid that requries defining a custom SUNBraidApp implementation. .. c:function:: int ARKBraid_TakeStep(void *arkode_mem, sunrealtype tstart, sunrealtype tstop, N_Vector y, int *ark_flag) This function advances the vector *y* from *tstart* to *tstop* using a - single ARKStep time step with step size *h = tstop - start*. - - **Arguments:** - * *arkode_mem* -- input, the ARKStep memory structure pointer. - * *tstart* -- input, the step start time. - * *tstop* -- input, the step stop time. - * *y* -- input/output, on input the solution a *tstop* and on return, the - solution at time *tstop* if the step was successful (*ark_flag* - :math:`\geq 0`) or the solution at time *tstart* if the step failed - (*ark_flag* < 0). - * *ark_flag* -- output, the step status flag. If *ark_flag* is: - - :math:`= 0` then the step succeeded and, if applicable, met the - requested temporal accuracy. - - :math:`> 0` then the step succeeded but failed to meet the requested - temporal accuracy. - - :math:`< 0` then the step failed e.g., a solver failure occurred. - - **Return value:** - If all ARKStep function calls are successful the return - value is *ARK_SUCCESS*, otherwise the return value is the error flag - returned from the function that failed. + single ARKODE time step with step size *h = tstop - start*. + + :param arkode_mem: input, the ARKODE memory structure pointer. + :param tstart: input, the step start time. + :param tstop: input, the step stop time. + :param y: input/output, on input the solution a *tstop* and on return, the + solution at time *tstop* if the step was successful (*ark_flag* + :math:`\geq 0`) or the solution at time *tstart* if the step failed + (*ark_flag* < 0). + :param ark_flag: output, the step status flag. If *ark_flag* is: + + :math:`= 0` then the step succeeded and, if applicable, met the + requested temporal accuracy. + + :math:`> 0` then the step succeeded but failed to meet the requested + temporal accuracy. + + :math:`< 0` then the step failed e.g., a solver failure occurred. + + :return: If all ARKODE function calls are successful the return + value is *ARK_SUCCESS*, otherwise the return value is the error flag + returned from the function that failed. diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/index.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/index.rst index b7ba4f3b02..3edc8baf51 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/index.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/index.rst @@ -18,47 +18,15 @@ Using the ARKStep time-stepping module ====================================== -This chapter is concerned with the use of the ARKStep time-stepping +This section is concerned with the use of the ARKStep time-stepping module for the solution of initial value problems (IVPs) in a C or C++ -language setting. The following sections discuss the header files and -the layout of the user's main program, and provide descriptions of the -ARKStep user-callable functions and user-supplied functions. - -The example programs located in the source code ``examples/arkode`` -folder, including those described in the companion document :cite:p:`arkode_ex`, -may be helpful as templates for new codes. - -Users with applications written in Fortran should see the chapter -:numref:`SUNDIALS.Fortran`, which describes the Fortran/C interface -module for ARKStep, and may look to the Fortran example programs also -provided in the ARKODE ``examples`` directory. - -The user should be aware that not all SUNLINSOL, SUNMATRIX, and -preconditioning modules are compatible with all NVECTOR -implementations. Details on compatibility are given in the -documentation for each SUNMATRIX (see :numref:`SUNMatrix`) and each -SUNLINSOL module (see :numref:`SUNLinSol`). For example, NVECTOR_PARALLEL -is not compatible with the dense, banded, or sparse SUNMATRIX types, -or with the corresponding dense, banded, or sparse SUNLINSOL modules. -Please check :numref:`SUNMatrix` and :numref:`SUNLinSol` to -verify compatibility between these modules. In addition to that -documentation, we note that the ARKBANDPRE preconditioning module is -only compatible with the NVECTOR_SERIAL, NVECTOR_OPENMP or -NVECTOR_PTHREADS vector implementations, and the preconditioner module -ARKBBDPRE can only be used with NVECTOR_PARALLEL. - -ARKStep uses various input and output constants from the shared ARKODE -infrastructure. These are defined as needed in this chapter, but for -convenience the full list is provided separately in :numref:`ARKODE.Constants`. - -The relevant information on using ARKStep's C and C++ interfaces is -detailed in the following subsections. +language setting. Usage of ARKStep follows that of the rest of ARKODE, +and so in this section we primarily focus on those usage aspects that +are specific to ARKStep. .. toctree:: :maxdepth: 1 - Skeleton User_callable Relaxation - Preconditioners XBraid diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/Relaxation.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/Relaxation.rst index 605a5493ea..72af9b9c82 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/Relaxation.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/Relaxation.rst @@ -17,9 +17,11 @@ Relaxation Methods ================== -This section describes user-callable functions for applying relaxation methods -with ERKStep. For more information on relaxation Runge--Kutta methods see -:numref:`ARKODE.Mathematics.Relaxation`. +This section describes ERKStep-specific user-callable functions for applying +relaxation methods with ERKStep. All of these routines have been deprecated in +favor of :ref:`shared ARKODE-level routines `, but +this documentation will be retained for as long as these functions are present + Enabling or Disabling Relaxation -------------------------------- @@ -61,6 +63,11 @@ Enabling or Disabling Relaxation .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxFn` instead. + + Optional Input Functions ------------------------ @@ -85,6 +92,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxEtaFail` instead. + + .. c:function:: int ERKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) Sets the smallest acceptable value for the relaxation parameter. @@ -106,6 +118,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxLowerBound` instead. + + .. c:function:: int ERKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) Sets the largest acceptable value for the relaxation parameter. @@ -127,6 +144,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxUpperBound` instead. + + .. c:function:: int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails) Sets the maximum number of times applying relaxation can fail within a step @@ -146,6 +168,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxMaxFails` instead. + + .. c:function:: int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters) Sets the maximum number of nonlinear iterations allowed when solving for the @@ -169,6 +196,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxMaxIters` instead. + + .. c:function:: int ERKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) Sets the nonlinear solver method used to compute the relaxation parameter. @@ -187,6 +219,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxSolver` instead. + + .. c:function:: int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) Sets the nonlinear solver residual tolerance to use when solving @@ -211,6 +248,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxResTol` instead. + + .. c:function:: int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) Sets the nonlinear solver relative and absolute tolerance on changes in @@ -238,6 +280,11 @@ relaxation. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRelaxTol` instead. + + Optional Output Functions ------------------------- @@ -258,6 +305,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxFnEvals` instead. + + .. c:function:: int ERKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) Get the number of times the user's relaxation Jacobian was evaluated. @@ -272,6 +324,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxJacEvals` instead. + + .. c:function:: int ERKStepGetNumRelaxFails(void* arkode_mem, long int* fails) Get the total number of times applying relaxation failed. @@ -291,6 +348,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxFails` instead. + + .. c:function:: int ERKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails) @@ -307,6 +369,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxBoundFails` instead. + + .. c:function:: int ERKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails) Get the number of times the relaxation parameter nonlinear solver failed. @@ -321,6 +388,11 @@ about the performance of the relaxation method. .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxSolveFails` instead. + + .. c:function:: int ERKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters) Get the number of relaxation parameter nonlinear solver iterations. @@ -334,3 +406,8 @@ about the performance of the relaxation method. ``NULL`` .. versionadded:: 5.6.0 + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumRelaxSolveIters` instead. + diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/Skeleton.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/Skeleton.rst deleted file mode 100644 index 308cff4b50..0000000000 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/Skeleton.rst +++ /dev/null @@ -1,146 +0,0 @@ -.. ---------------------------------------------------------------- - Programmer(s): Daniel R. Reynolds @ SMU - ---------------------------------------------------------------- - SUNDIALS Copyright Start - Copyright (c) 2002-2024, Lawrence Livermore National Security - and Southern Methodist University. - All rights reserved. - - See the top-level LICENSE and NOTICE files for details. - - SPDX-License-Identifier: BSD-3-Clause - SUNDIALS Copyright End - ---------------------------------------------------------------- - -.. _ARKODE.Usage.ERKStep.Skeleton: - -A skeleton of the user's main program -============================================ - -The following is a skeleton of the user's main program (or calling -program) for the integration of an ODE IVP using the ERKStep module. -Most of the steps are independent of the NVECTOR implementation used. -For the steps that are not, refer to :numref:`NVectors` for -the specific name of the function to be called or macro to be -referenced. - -.. index:: User main program - -#. Initialize parallel or multi-threaded environment, if appropriate. - - For example, call ``MPI_Init`` to initialize MPI if used, or set - ``num_threads``, the number of threads to use within the threaded - vector functions, if used. - -#. Create the SUNDIALS simulation context object. - - Call :c:func:`SUNContext_Create` to allocate the ``SUNContext`` object. - -#. Set problem dimensions, etc. - - This generally includes the problem size, ``N``, and may include - the local vector length ``Nlocal``. - - .. note:: - - The variables ``N`` and ``Nlocal`` should be of type - ``sunindextype``. - -#. Set vector of initial values - - To set the vector ``y0`` of initial values, use the appropriate - functions defined by the particular NVECTOR implementation. - - For native SUNDIALS vector implementations (except the CUDA and - RAJA based ones), use a call of the form - - .. code-block:: c - - y0 = N_VMake_***(..., ydata); - - if the ``sunrealtype`` array ``ydata`` containing the initial values of - :math:`y` already exists. Otherwise, create a new vector by making - a call of the form - - .. code-block:: c - - y0 = N_VNew_***(...); - - and then set its elements by accessing the underlying data where it - is located with a call of the form - - .. code-block:: c - - ydata = N_VGetArrayPointer_***(y0); - - For details on each of SUNDIALS' provided vector implementations, see - the corresponding sections in :numref:`NVectors` for details. - -#. Create ERKStep object - - Call ``arkode_mem = ERKStepCreate(...)`` to create the ERKStep memory - block. :c:func:`ERKStepCreate` returns a ``void*`` pointer to - this memory structure. See :numref:`ARKODE.Usage.ERKStep.Initialization` for - details. - -#. Specify integration tolerances - - Call :c:func:`ERKStepSStolerances()` or - :c:func:`ERKStepSVtolerances()` to specify either a scalar relative - tolerance and scalar absolute tolerance, or a scalar relative - tolerance and a vector of absolute tolerances, - respectively. Alternatively, call :c:func:`ERKStepWFtolerances()` - to specify a function which sets directly the weights used in - evaluating WRMS vector norms. See :numref:`ARKODE.Usage.ERKStep.Tolerances` - for details. - -#. Set optional inputs - - Call ``ERKStepSet*`` functions to change any optional inputs that - control the behavior of ERKStep from their default values. See - :numref:`ARKODE.Usage.ERKStep.OptionalInputs` for details. - -#. Specify rootfinding problem - - Optionally, call :c:func:`ERKStepRootInit()` to initialize a rootfinding - problem to be solved during the integration of the ODE system. See - :numref:`ARKODE.Usage.ERKStep.RootFinding` for general details, and - :numref:`ARKODE.Usage.ERKStep.OptionalInputs` for relevant optional - input calls. - -#. Advance solution in time - - For each point at which output is desired, call - - .. code-block:: c - - ier = ERKStepEvolve(arkode_mem, tout, yout, &tret, itask); - - Here, ``itask`` specifies the return mode. The vector ``yout`` - (which can be the same as the vector ``y0`` above) will contain - :math:`y(t_\text{out})`. See :numref:`ARKODE.Usage.ERKStep.Integration` - for details. - -#. Get optional outputs - - Call ``ERKStepGet*`` functions to obtain optional output. See - :numref:`ARKODE.Usage.ERKStep.OptionalOutputs` for details. - -#. Deallocate memory for solution vector - - Upon completion of the integration, deallocate memory for the - vector ``y`` (or ``yout``) by calling the NVECTOR destructor - function: - - .. code-block:: c - - N_VDestroy(y); - -#. Free solver memory - - Call :c:func:`ERKStepFree()` to free the memory allocated for - the ERKStep module. - -#. Finalize MPI, if used - - Call ``MPI_Finalize`` to terminate MPI. diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index 16bfba3761..a0728f1ada 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -17,21 +17,13 @@ ERKStep User-callable functions ================================== -This section describes the functions that are called by the -user to setup and then solve an IVP using the ERKStep time-stepping -module. Some of these are required; however, starting with -:numref:`ARKODE.Usage.ERKStep.OptionalInputs`, the functions listed involve -optional inputs/outputs or restarting, and those paragraphs may be -skipped for a casual use of ARKODE's ERKStep module. In any case, -refer to the preceding section, :numref:`ARKODE.Usage.ERKStep.Skeleton`, -for the correct order of these calls. - -On an error, each user-callable function returns a negative value (or -``NULL`` if the function returns a pointer) and sends an error message -to the error handler routine, which prints the message to ``stderr`` -by default. However, the user can set a file as error output or can -provide their own error handler function (see -:numref:`ARKODE.Usage.ERKStep.OptionalInputs` for details). +This section describes the ERKStep-specific functions that may be called +by the user to setup and then solve an IVP using the ERKStep time-stepping +module. The large majority of these routines merely wrap :ref:`underlying +ARKODE functions `, and will be deprecated in an +upcoming release -- each of these are clearly marked below. However, some +of these user-callable functions are specific to ERKStep, and are explained +below. @@ -71,6 +63,10 @@ ERKStep initialization and deallocation functions **Return value:** None + .. deprecated:: x.y.z + + Use :c:func:`ARKodeFree` instead. + .. _ARKODE.Usage.ERKStep.Tolerances: @@ -78,40 +74,6 @@ ERKStep initialization and deallocation functions ERKStep tolerance specification functions ------------------------------------------------------ -These functions specify the integration tolerances. One of them -**should** be called before the first call to -:c:func:`ERKStepEvolve()`; otherwise default values of ``reltol = -1e-4`` and ``abstol = 1e-9`` will be used, which may be entirely -incorrect for a specific problem. - -The integration tolerances ``reltol`` and ``abstol`` define a vector -of error weights, ``ewt``. In the case of -:c:func:`ERKStepSStolerances()`, this vector has components - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol); - -whereas in the case of :c:func:`ERKStepSVtolerances()` the vector components -are given by - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol[i]); - -This vector is used in all error tests, which use a weighted RMS norm -on all error-like vectors v: - -.. math:: - \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; ewt_i)^2 \right)^{1/2}, - -where :math:`N` is the problem dimension. - -Alternatively, the user may supply a custom function to supply the -``ewt`` vector, through a call to :c:func:`ERKStepWFtolerances()`. - - - .. c:function:: int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) This function specifies scalar relative and absolute tolerances. @@ -127,6 +89,10 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the ERKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSStolerances` instead. + .. c:function:: int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) @@ -147,6 +113,10 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the ERKStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSVtolerances` instead. + .. c:function:: int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun) @@ -164,108 +134,9 @@ Alternatively, the user may supply a custom function to supply the * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` * *ARK_NO_MALLOC* if the ERKStep memory was not allocated by the time-stepping module + .. deprecated:: x.y.z - - -General advice on the choice of tolerances -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For many users, the appropriate choices for tolerance values in -``reltol`` and ``abstol`` are a concern. The following pieces -of advice are relevant. - -(1) The scalar relative tolerance ``reltol`` is to be set to control - relative errors. So a value of :math:`10^{-4}` means that errors - are controlled to .01%. We do not recommend using ``reltol`` larger - than :math:`10^{-3}`. On the other hand, ``reltol`` should not be so - small that it is comparable to the unit roundoff of the machine - arithmetic (generally around :math:`10^{-15}` for double-precision). - -(2) The absolute tolerances ``abstol`` (whether scalar or vector) need - to be set to control absolute errors when any components of the - solution vector :math:`y` may be so small that pure relative error - control is meaningless. For example, if :math:`y_i` starts at some - nonzero value, but in time decays to zero, then pure relative - error control on :math:`y_i` makes no sense (and is overly costly) - after :math:`y_i` is below some noise level. Then ``abstol`` (if - scalar) or ``abstol[i]`` (if a vector) needs to be set to that - noise level. If the different components have different noise - levels, then ``abstol`` should be a vector. For example, see the - example problem ``ark_robertson.c``, and the discussion - of it in the ARKODE Examples Documentation :cite:p:`arkode_ex`. In that - problem, the three components vary between 0 and 1, and have - different noise levels; hence the ``atols`` vector therein. It is - impossible to give any general advice on ``abstol`` values, - because the appropriate noise levels are completely - problem-dependent. The user or modeler hopefully has some idea as - to what those noise levels are. - -(3) Finally, it is important to pick all the tolerance values - conservatively, because they control the error committed on each - individual step. The final (global) errors are an accumulation of - those per-step errors, where that accumulation factor is - problem-dependent. A general rule of thumb is to reduce the - tolerances by a factor of 10 from the actual desired limits on - errors. So if you want .01% relative accuracy (globally), a good - choice for ``reltol`` is :math:`10^{-5}`. In any case, it is - a good idea to do a few experiments with the tolerances to see how - the computed solution values vary as tolerances are reduced. - - - -Advice on controlling nonphysical negative values -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In many applications, some components in the true solution are always -positive or non-negative, though at times very small. In the -numerical solution, however, small negative (nonphysical) values -can then occur. In most cases, these values are harmless, and simply -need to be controlled, not eliminated, but in other cases any value -that violates a constraint may cause a simulation to halt. For both of -these scenarios the following pieces of advice are relevant. - -(1) The best way to control the size of unwanted negative computed - values is with tighter absolute tolerances. Again this requires - some knowledge of the noise level of these components, which may - or may not be different for different components. Some - experimentation may be needed. - -(2) If output plots or tables are being generated, and it is important - to avoid having negative numbers appear there (for the sake of - avoiding a long explanation of them, if nothing else), then - eliminate them, but only in the context of the output medium. Then - the internal values carried by the solver are unaffected. Remember - that a small negative value in :math:`y` returned by ERKStep, with - magnitude comparable to ``abstol`` or less, is equivalent to zero - as far as the computation is concerned. - -(3) The user's right-hand side routine :math:`f` - should never change a negative value in the solution vector :math:`y` - to a non-negative value in attempt to "fix" this problem, - since this can lead to numerical instability. If the :math:`f` - routine cannot tolerate a zero or negative value (e.g. because - there is a square root or log), then the offending value should be - changed to zero or a tiny positive number in a temporary variable - (not in the input :math:`y` vector) for the purposes of computing - :math:`f(t, y)`. - -(4) ERKStep supports component-wise constraints on solution components, - :math:`y_i < 0`, :math:`y_i \le 0`, , :math:`y_i > 0`, or - :math:`y_i \ge 0`, through the user-callable function - :c:func:`ERKStepSetConstraints`. At each internal time step, if any - constraint is violated then ERKStep will attempt a smaller time step - that should not violate this constraint. This reduced step size is - chosen such that the step size is the largest possible but where the - solution component satisfies the constraint. - -(5) Positivity and non-negativity constraints on components can be - enforced by use of the recoverable error return feature in the - user-supplied right-hand side function, :math:`f`. When a - recoverable error is encountered, ERKStep will retry the step with - a smaller step size, which typically alleviates the problem. - However, because this option involves some additional overhead - cost, it should only be exercised if the use of absolute - tolerances to control the computed values is unsuccessful. + Use :c:func:`ARKodeWFtolerances` instead. @@ -274,16 +145,6 @@ these scenarios the following pieces of advice are relevant. Rootfinding initialization function -------------------------------------- -As described in :numref:`ARKODE.Mathematics.Rootfinding`, while -solving the IVP, ARKODE's time-stepping modules have the capability to -find the roots of a set of user-defined functions. To activate the -root-finding algorithm, call the following function. This is normally -called only once, prior to the first call to -:c:func:`ERKStepEvolve()`, but if the rootfinding problem is to be -changed during the solution, :c:func:`ERKStepRootInit()` can also be -called prior to a continuation call to :c:func:`ERKStepEvolve()`. - - .. c:function:: int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) Initializes a rootfinding problem to be solved during the @@ -312,6 +173,10 @@ called prior to a continuation call to :c:func:`ERKStepEvolve()`. problem but the prior one did, then call *ERKStepRootInit* with *nrtfn = 0*. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeRootInit` instead. + @@ -320,15 +185,6 @@ called prior to a continuation call to :c:func:`ERKStepEvolve()`. ERKStep solver function ------------------------- -This is the central step in the solution process -- the call to perform -the integration of the IVP. One of the input arguments (*itask*) -specifies one of two modes as to where ERKStep is to return a -solution. These modes are modified if the user has set a stop time -(with a call to the optional input function :c:func:`ERKStepSetStopTime()`) or -has requested rootfinding. - - - .. c:function:: int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype *tret, int itask) Integrates the ODE over an interval in :math:`t`. @@ -419,6 +275,10 @@ has requested rootfinding. On all other error returns, *tret* and *yout* are left unchanged from those provided to the routine. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeEvolve` instead. + @@ -427,85 +287,12 @@ has requested rootfinding. Optional input functions ------------------------- -There are numerous optional input parameters that control the behavior -of ERKStep, each of which may be modified from its default value through -calling an appropriate input function. The following tables list all -optional input functions, grouped by which aspect of ERKStep they control. -Detailed information on the calling syntax and arguments for each -function are then provided following each table. - -The optional inputs are grouped into the following categories: - -* General ERKStep options (:numref:`ARKODE.Usage.ERKStep.ERKStepInputTable`), - -* IVP method solver options (:numref:`ARKODE.Usage.ERKStep.ERKStepMethodInputTable`), - -* Step adaptivity solver options (:numref:`ARKODE.Usage.ERKStep.ERKStepAdaptivityInputTable`), and - -* Rootfinding options (:numref:`ARKODE.Usage.ERKStep.ERKStepRootfindingInputTable`). - -For the most casual use of ERKStep, relying on the default set of -solver parameters, the reader can skip to section on user-supplied -functions, :numref:`ARKODE.Usage.UserSupplied`. - -We note that, on an error return, all of the optional input functions send an -error message to the error handler function. All error return values are -negative, so a test on the return arguments for negative values will catch all -errors. Finally, a call to an ``ERKStepSet***`` function can generally be made -from the user's calling program at any time and, if successful, takes effect -immediately. ``ERKStepSet***`` functions that cannot be called at any time note -this in the "**Notes**:" section of the function documentation. - - .. _ARKODE.Usage.ERKStep.ERKStepInput: Optional inputs for ERKStep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.ERKStep.ERKStepInputTable: -.. table:: Optional inputs for ERKStep - - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Optional input | Function name | Default | - +====================================================+===========================================+========================+ - | Return ERKStep solver parameters to their defaults | :c:func:`ERKStepSetDefaults()` | internal | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Set dense output interpolation type | :c:func:`ERKStepSetInterpolantType()` | ``ARK_INTERP_HERMITE`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Set dense output polynomial degree | :c:func:`ERKStepSetInterpolantDegree()` | 5 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer to a diagnostics output file | :c:func:`ERKStepSetDiagnostics()` | ``NULL`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Disable time step adaptivity (fixed-step mode) | :c:func:`ERKStepSetFixedStep()` | disabled | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Supply an initial step size to attempt | :c:func:`ERKStepSetInitStep()` | estimated | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum no. of warnings for :math:`t_n+h = t_n` | :c:func:`ERKStepSetMaxHnilWarns()` | 10 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum no. of internal steps before *tout* | :c:func:`ERKStepSetMaxNumSteps()` | 500 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum absolute step size | :c:func:`ERKStepSetMaxStep()` | :math:`\infty` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Minimum absolute step size | :c:func:`ERKStepSetMinStep()` | 0.0 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Set a value for :math:`t_{stop}` | :c:func:`ERKStepSetStopTime()` | undefined | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Interpolate at :math:`t_{stop}` | :c:func:`ERKStepSetInterpolateStopTime()` | ``SUNFALSE`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Disable the stop time | :c:func:`ERKStepClearStopTime` | N/A | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer for user data | :c:func:`ERKStepSetUserData()` | ``NULL`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum no. of ERKStep error test failures | :c:func:`ERKStepSetMaxErrTestFails()` | 7 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Set inequality constraints on solution | :c:func:`ERKStepSetConstraints()` | ``NULL`` | - +----------------------------------------------------+-------------------------------------------+------------------------+ - | Set max number of constraint failures | :c:func:`ERKStepSetMaxNumConstrFails()` | 10 | - +----------------------------------------------------+-------------------------------------------+------------------------+ - - - .. c:function:: int ERKStepSetDefaults(void* arkode_mem) Resets all optional input parameters to ERKStep's original @@ -526,6 +313,10 @@ Optional inputs for ERKStep Also leaves alone any data structures or options related to root-finding (those can be reset using :c:func:`ERKStepRootInit()`). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDefaults` instead. + .. c:function:: int ERKStepSetInterpolantType(void* arkode_mem, int itype) @@ -560,6 +351,10 @@ Optional inputs for ERKStep If this routine is not called, the Hermite interpolation module will be used. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantType` instead. + .. c:function:: int ERKStepSetInterpolantDegree(void* arkode_mem, int degree) @@ -602,13 +397,17 @@ Optional inputs for ERKStep obtained by the integrator are returned at the ends of the time interval. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantDegree` instead. + .. c:function:: int ERKStepSetDenseOrder(void* arkode_mem, int dord) - *This function is deprecated, and will be removed in a future release. - Users should transition to calling* :c:func:`ERKStepSetInterpolantDegree()` - *instead.* + .. deprecated:: 5.2.0 + + Use :c:func:`ARKodeSetInterpolantDegree` instead. @@ -695,6 +494,9 @@ Optional inputs for ERKStep routines will provide no useful information to the solver, and at worst they may interfere with the desired fixed step size. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetFixedStep` instead. @@ -722,6 +524,10 @@ Optional inputs for ERKStep This routine will also reset the step size and error history. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInitStep` instead. + .. c:function:: int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil) @@ -745,6 +551,9 @@ Optional inputs for ERKStep A negative value indicates that no warning messages should be issued. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxHnilWarns` instead. @@ -769,6 +578,10 @@ Optional inputs for ERKStep Passing *mxsteps* < 0 disables the test (not recommended). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNumSteps` instead. + .. c:function:: int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax) @@ -787,6 +600,10 @@ Optional inputs for ERKStep **Notes:** Pass *hmax* :math:`\le 0.0` to set the default value of :math:`\infty`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxStep` instead. + .. c:function:: int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin) @@ -805,6 +622,10 @@ Optional inputs for ERKStep **Notes:** Pass *hmin* :math:`\le 0.0` to set the default value of 0. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMinStep` instead. + .. c:function:: int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop) @@ -832,6 +653,11 @@ Optional inputs for ERKStep :c:func:`ERKStepReset` will remain active but can be disabled by calling :c:func:`ERKStepClearStopTime`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStopTime` instead. + + .. c:function:: int ERKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) @@ -849,6 +675,11 @@ Optional inputs for ERKStep .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolateStopTime` instead. + + .. c:function:: int ERKStepClearStopTime(void* arkode_mem) @@ -867,6 +698,11 @@ Optional inputs for ERKStep .. versionadded:: 5.5.1 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeClearStopTime` instead. + + .. c:function:: int ERKStepSetUserData(void* arkode_mem, void* user_data) @@ -887,6 +723,9 @@ Optional inputs for ERKStep user-supplied functions for which it is an argument; otherwise ``NULL`` is passed. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetUserData` instead. @@ -908,6 +747,10 @@ Optional inputs for ERKStep The default value is 7; set *maxnef* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxErrTestFails` instead. + .. c:function:: int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints) @@ -952,6 +795,11 @@ Optional inputs for ERKStep and :c:func:`ERKStepSetFixedStep()` are incompatible, and should not be used simultaneously. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetConstraints` instead. + + .. c:function:: int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) @@ -970,6 +818,10 @@ Optional inputs for ERKStep Passing *maxfails* <= 0 results in ERKStep using the default value (10). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNumConstrFails` instead. + .. _ARKODE.Usage.ERKStep.ERKStepMethodInput: @@ -1015,6 +867,10 @@ Optional inputs for IVP method selection ERKStep memory block, it cannot be changed after the first call to :c:func:`ERKStepEvolve()`, unless :c:func:`ERKStepReInit()` is called. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetOrder` instead. + .. c:function:: int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B) @@ -1046,6 +902,8 @@ Optional inputs for IVP method selection :c:func:`ERKStepSetFixedStep()` to enable fixed-step mode and set the desired time step size. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. .. c:function:: int ERKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable) @@ -1066,6 +924,9 @@ Optional inputs for IVP method selection :numref:`Butcher.explicit`. Error-checking is performed to ensure that the table exists, and is not implicit. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. + .. c:function:: int ERKStepSetTableName(void* arkode_mem, const char *etable) @@ -1087,6 +948,8 @@ Optional inputs for IVP method selection to ensure that the table exists, and is not implicit. This function is case sensitive. + **Warning:** + This should not be used with :c:func:`ARKodeSetOrder`. @@ -1101,43 +964,6 @@ algorithm, including how each of the parameters below is used within the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. -.. _ARKODE.Usage.ERKStep.ERKStepAdaptivityInputTable: -.. table:: Optional inputs for time step adaptivity - - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Optional input | Function name | Default | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Provide a :c:type:`SUNAdaptController` for ERKStep to use | :c:func:`ERKStepSetAdaptController()` | PI | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Set a custom time step adaptivity function | :c:func:`ERKStepSetAdaptivityFn()` | internal | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Choose an existing time step adaptivity method | :c:func:`ERKStepSetAdaptivityMethod()` | 0 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Adjust the method order used in the controller | :c:func:`ERKStepSetAdaptivityAdjustment()` | -1 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Explicit stability safety factor | :c:func:`ERKStepSetCFLFraction()` | 0.5 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Time step error bias factor | :c:func:`ERKStepSetErrorBias()` | 1.5 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Bounds determining no change in step size | :c:func:`ERKStepSetFixedStepBounds()` | 1.0 1.5 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Maximum step growth factor on error test fail | :c:func:`ERKStepSetMaxEFailGrowth()` | 0.3 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Maximum first step growth factor | :c:func:`ERKStepSetMaxFirstGrowth()` | 10000.0 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Maximum allowed general step growth factor | :c:func:`ERKStepSetMaxGrowth()` | 20.0 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Minimum allowed step reduction factor on error test fail | :c:func:`ERKStepSetMinReduction()` | 0.1 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Time step safety factor | :c:func:`ERKStepSetSafetyFactor()` | 0.96 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Error fails before MaxEFailGrowth takes effect | :c:func:`ERKStepSetSmallNumEFails()` | 2 | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - | Explicit stability function | :c:func:`ERKStepSetStabilityFn()` | none | - +-----------------------------------------------------------+--------------------------------------------+-----------+ - - - .. c:function:: int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C) Sets a user-supplied time-step controller object. @@ -1158,6 +984,11 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. .. versionadded:: 5.7.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetAdaptController` instead. + + .. c:function:: int ERKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data) @@ -1218,7 +1049,7 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. a custom function through a call to :c:func:`ERKStepSetAdaptivityFn()`. .. versionchanged:: 5.7.0 - + Prior to version 5.7.0, any nonzero value for *pq* would result in use of the embedding order of accuracy. @@ -1249,6 +1080,12 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. .. versionadded:: 5.7.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetAdaptivityAdjustment` instead. + + + .. c:function:: int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) Specifies the fraction of the estimated explicitly stable step to use. @@ -1266,6 +1103,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetCFLFraction` instead. + .. c:function:: int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias) @@ -1313,6 +1154,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. **Notes:** Any interval *not* containing 1.0 will imply a reset to the default values. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetFixedStepBounds` instead. + .. c:function:: int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) @@ -1332,6 +1177,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. **Notes:** Any value outside the interval :math:`(0,1]` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxEFailGrowth` instead. + .. c:function:: int ERKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) @@ -1352,6 +1201,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. **Notes:** Any value :math:`\le 1.0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxFirstGrowth` instead. + .. c:function:: int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) @@ -1372,6 +1225,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. Any value :math:`\le 1.0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxGrowth` instead. + .. c:function:: int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min) @@ -1394,6 +1251,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. Any value :math:`\ge 1.0` or :math:`\le 0.0` will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMinReduction` instead. + .. c:function:: int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety) @@ -1414,6 +1275,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetSafetyFactor` instead. + .. c:function:: int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef) @@ -1434,6 +1299,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetSmallNumEFails` instead. + .. c:function:: int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) @@ -1460,6 +1329,10 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. where the right-hand side function :math:`f(t,y)` contains stiff terms. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStabilityFn` instead. + @@ -1469,24 +1342,6 @@ the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. Rootfinding optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following functions can be called to set optional inputs to -control the rootfinding algorithm, the mathematics of which are -described in :numref:`ARKODE.Mathematics.Rootfinding`. - - -.. _ARKODE.Usage.ERKStep.ERKStepRootfindingInputTable: -.. table:: Rootfinding optional input functions - - +-----------------------------------------+------------------------------------------+----------+ - | Optional input | Function name | Default | - +-----------------------------------------+------------------------------------------+----------+ - | Direction of zero-crossings to monitor | :c:func:`ERKStepSetRootDirection()` | both | - +-----------------------------------------+------------------------------------------+----------+ - | Disable inactive root warnings | :c:func:`ERKStepSetNoInactiveRootWarn()` | enabled | - +-----------------------------------------+------------------------------------------+----------+ - - - .. c:function:: int ERKStepSetRootDirection(void* arkode_mem, int* rootdir) Specifies the direction of zero-crossings to be located and returned. @@ -1509,6 +1364,10 @@ described in :numref:`ARKODE.Mathematics.Rootfinding`. **Notes:** The default behavior is to monitor for both zero-crossing directions. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRootDirection` instead. + .. c:function:: int ERKStepSetNoInactiveRootWarn(void* arkode_mem) @@ -1532,6 +1391,9 @@ described in :numref:`ARKODE.Mathematics.Rootfinding`. first step), ERKStep will issue a warning which can be disabled with this optional input function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNoInactiveRootWarn` instead. @@ -1541,20 +1403,6 @@ described in :numref:`ARKODE.Mathematics.Rootfinding`. Interpolated output function -------------------------------- -An optional function :c:func:`ERKStepGetDky()` is available to obtain -additional values of solution-related quantities. This function -should only be called after a successful return from -:c:func:`ERKStepEvolve()`, as it provides interpolated values either of -:math:`y` or of its derivatives (up to the 5th derivative) -interpolated to any value of :math:`t` in the last internal step taken -by :c:func:`ERKStepEvolve()`. Internally, this "dense output" or -"continuous extension" algorithm is identical to the algorithm used for -the maximum order implicit predictors, described in -:numref:`ARKODE.Mathematics.Predictors.Max`, except that -derivatives of the polynomial model may be evaluated upon request. - - - .. c:function:: int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) Computes the *k*-th derivative of the function @@ -1592,6 +1440,9 @@ derivatives of the polynomial model may be evaluated upon request. functions :c:func:`ERKStepGetCurrentTime()` and :c:func:`ERKStepGetLastStep()`, respectively. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetDky` instead. @@ -1600,96 +1451,12 @@ derivatives of the polynomial model may be evaluated upon request. Optional output functions ------------------------------ -ERKStep provides an extensive set of functions that can be used to -obtain solver performance information. We organize these into groups: - -#. General ERKStep output routines are in - :numref:`ARKODE.Usage.ERKStep.ERKStepMainOutputs`, - -#. Output routines regarding root-finding results are in - :numref:`ARKODE.Usage.ERKStep.ERKStepRootOutputs`, - -#. General usability routines (e.g. to print the current ERKStep - parameters, or output the current Butcher table) are in - :numref:`ARKODE.Usage.ERKStep.ERKStepExtraOutputs`. - -Following each table, we elaborate on each function. - -Some of the optional outputs, especially the various counters, can be -very useful in determining the efficiency of various methods inside -ERKStep. For example: - -* The counters *nsteps* and *nf_evals* provide a rough measure of the - overall cost of a given run, and can be compared between runs with - different solver options to suggest which set of options is the most - efficient. - -* The ratio *nsteps/step_attempts* can measure the quality of the - time step adaptivity algorithm, since a poor algorithm will result - in more failed steps, and hence a lower ratio. - -It is therefore recommended that users retrieve and output these -statistics following each run, and take some time to investigate -alternate solver options that will be more optimal for their -particular problem of interest. - - .. _ARKODE.Usage.ERKStep.ERKStepMainOutputs: Main solver optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.ERKStep.ERKStepMainOutputsTable: -.. table:: Main solver optional output functions - - +------------------------------------------------------+-------------------------------------------+ - | Optional output | Function name | - +------------------------------------------------------+-------------------------------------------+ - | Size of ERKStep real and integer workspaces | :c:func:`ERKStepGetWorkSpace()` | - +------------------------------------------------------+-------------------------------------------+ - | Cumulative number of internal steps | :c:func:`ERKStepGetNumSteps()` | - +------------------------------------------------------+-------------------------------------------+ - | Actual initial time step size used | :c:func:`ERKStepGetActualInitStep()` | - +------------------------------------------------------+-------------------------------------------+ - | Step size used for the last successful step | :c:func:`ERKStepGetLastStep()` | - +------------------------------------------------------+-------------------------------------------+ - | Step size to be attempted on the next step | :c:func:`ERKStepGetCurrentStep()` | - +------------------------------------------------------+-------------------------------------------+ - | Current internal time reached by the solver | :c:func:`ERKStepGetCurrentTime()` | - +------------------------------------------------------+-------------------------------------------+ - | Suggested factor for tolerance scaling | :c:func:`ERKStepGetTolScaleFactor()` | - +------------------------------------------------------+-------------------------------------------+ - | Error weight vector for state variables | :c:func:`ERKStepGetErrWeights()` | - +------------------------------------------------------+-------------------------------------------+ - | Single accessor to many statistics at once | :c:func:`ERKStepGetStepStats()` | - +------------------------------------------------------+-------------------------------------------+ - | Print all statistics | :c:func:`ERKStepPrintAllStats` | - +------------------------------------------------------+-------------------------------------------+ - | Name of constant associated with a return flag | :c:func:`ERKStepGetReturnFlagName()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of explicit stability-limited steps | :c:func:`ERKStepGetNumExpSteps()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of accuracy-limited steps | :c:func:`ERKStepGetNumAccSteps()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of attempted steps | :c:func:`ERKStepGetNumStepAttempts()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of calls to *f* function | :c:func:`ERKStepGetNumRhsEvals()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of local error test failures that have occurred | :c:func:`ERKStepGetNumErrTestFails()` | - +------------------------------------------------------+-------------------------------------------+ - | Current ERK Butcher table | :c:func:`ERKStepGetCurrentButcherTable()` | - +------------------------------------------------------+-------------------------------------------+ - | Estimated local truncation error vector | :c:func:`ERKStepGetEstLocalErrors()` | - +------------------------------------------------------+-------------------------------------------+ - | Single accessor to many statistics at once | :c:func:`ERKStepGetTimestepperStats()` | - +------------------------------------------------------+-------------------------------------------+ - | Number of constraint test failures | :c:func:`ERKStepGetNumConstrFails()` | - +------------------------------------------------------+-------------------------------------------+ - | Retrieve a pointer for user data | :c:func:`ERKStepGetUserData` | - +------------------------------------------------------+-------------------------------------------+ - - .. c:function:: int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) @@ -1704,6 +1471,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetWorkSpace` instead. + .. c:function:: int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps) @@ -1719,6 +1490,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumSteps` instead. + .. c:function:: int ERKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused) @@ -1741,6 +1516,10 @@ Main solver optional output functions bounds :math:`(h_{min} \le h_0 \le h_{max})`, or to satisfy the local error test condition. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetActualInitStep` instead. + .. c:function:: int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) @@ -1756,6 +1535,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLastStep` instead. + .. c:function:: int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) @@ -1770,6 +1553,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentStep` instead. + .. c:function:: int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) @@ -1784,6 +1571,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentTime` instead. + .. c:function:: int ERKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac) @@ -1800,6 +1591,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetTolScaleFactor` instead. + .. c:function:: int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight) @@ -1818,6 +1613,10 @@ Main solver optional output functions The user must allocate space for *eweight*, that will be filled in by this function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetErrWeights` instead. + .. c:function:: int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) @@ -1836,6 +1635,11 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetStepStats` instead. + + .. c:function:: int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) @@ -1863,9 +1667,13 @@ Main solver optional output functions .. versionadded:: 5.2.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodePrintAllStats` instead. -.. c:function:: char *ERKStepGetReturnFlagName(long int flag) + +.. c:function:: char* ERKStepGetReturnFlagName(long int flag) Returns the name of the ERKStep constant corresponding to *flag*. See :ref:`ARKODE.Constants`. @@ -1877,6 +1685,10 @@ Main solver optional output functions The return value is a string containing the name of the corresponding constant. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetReturnFlagName` instead. + .. c:function:: int ERKStepGetNumExpSteps(void* arkode_mem, long int* expsteps) @@ -1892,6 +1704,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumExpSteps` instead. + .. c:function:: int ERKStepGetNumAccSteps(void* arkode_mem, long int* accsteps) @@ -1907,6 +1723,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumAccSteps` instead. + .. c:function:: int ERKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts) @@ -1921,6 +1741,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumStepAttempts` instead. + .. c:function:: int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nf_evals) @@ -1951,6 +1775,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumErrTestFails` instead. + .. c:function:: int ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable *B) @@ -2014,6 +1842,10 @@ Main solver optional output functions failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetEstLocalErrors` instead. + .. c:function:: int ERKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nf_evals, long int* netfails) @@ -2046,6 +1878,10 @@ Main solver optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumConstrFails` instead. + .. c:function:: int ERKStepGetUserData(void* arkode_mem, void** user_data) @@ -2063,25 +1899,16 @@ Main solver optional output functions .. versionadded:: 5.3.0 + .. deprecated:: x.y.z -.. _ARKODE.Usage.ERKStep.ERKStepRootOutputs: - -Rootfinding optional output functions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - + Use :c:func:`ARKodeGetUserData` instead. -.. _ARKODE.Usage.ERKStep.ERKStepRootOutputsTable: -.. table:: Rootfinding optional output functions - +--------------------------------------------------+---------------------------------+ - | Optional output | Function name | - +--------------------------------------------------+---------------------------------+ - | Array showing roots found | :c:func:`ERKStepGetRootInfo()` | - +--------------------------------------------------+---------------------------------+ - | No. of calls to user root function | :c:func:`ERKStepGetNumGEvals()` | - +--------------------------------------------------+---------------------------------+ +.. _ARKODE.Usage.ERKStep.ERKStepRootOutputs: +Rootfinding optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. c:function:: int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound) @@ -2110,6 +1937,10 @@ Rootfinding optional output functions zero-crossing. A value of +1 indicates that :math:`g_i` is increasing, while a value of -1 indicates a decreasing :math:`g_i`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetRootInfo` instead. + .. c:function:: int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals) @@ -2125,6 +1956,9 @@ Rootfinding optional output functions * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the ERKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumGEvals` instead. @@ -2133,28 +1967,6 @@ Rootfinding optional output functions General usability functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following optional routines may be called by a user to inquire -about existing solver parameters, to retrieve stored Butcher tables, -write the current Butcher table, or even to test a provided Butcher -table to determine its analytical order of accuracy. While none of -these would typically be called during the course of solving an -initial value problem, these may be useful for users wishing to better -understand ERKStep and/or specific Runge--Kutta methods. - - -.. _ARKODE.Usage.ERKStep.ERKStepExtraOutputsTable: -.. table:: General usability functions - - +----------------------------------------+------------------------------------+ - | Optional routine | Function name | - +----------------------------------------+------------------------------------+ - | Output all ERKStep solver parameters | :c:func:`ERKStepWriteParameters()` | - +----------------------------------------+------------------------------------+ - | Output the current Butcher table | :c:func:`ERKStepWriteButcher()` | - +----------------------------------------+------------------------------------+ - - - .. c:function:: int ERKStepWriteParameters(void* arkode_mem, FILE *fp) @@ -2176,6 +1988,11 @@ understand ERKStep and/or specific Runge--Kutta methods. for this pointer, since parameters for all processes would be identical. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeWriteParameters` instead. + + .. c:function:: int ERKStepWriteButcher(void* arkode_mem, FILE *fp) @@ -2279,40 +2096,6 @@ vector. ERKStep reset function ---------------------- -To reset the ERKStep module to a particular state :math:`(t_R,y(t_R))` for the -continued solution of a problem, where a prior -call to :c:func:`ERKStepCreate` has been made, the user must call the function -:c:func:`ERKStepReset()`. Like :c:func:`ERKStepReInit()` this routine retains -the current settings for all ERKStep module options and performs no memory -allocations but, unlike :c:func:`ERKStepReInit()`, this routine performs only a -*subset* of the input checking and initializations that are done in -:c:func:`ERKStepCreate`. In particular this routine retains all internal -counter values and the step size/error history. Like :c:func:`ERKStepReInit()`, a call to -:c:func:`ERKStepReset()` will delete any previously-set *tstop* value specified -via a call to :c:func:`ERKStepSetStopTime()`. Following a successful call to -:c:func:`ERKStepReset()`, call :c:func:`ERKStepEvolve()` again to continue -solving the problem. By default the next call to :c:func:`ERKStepEvolve()` will -use the step size computed by ERKStep prior to calling :c:func:`ERKStepReset()`. -To set a different step size or have ERKStep estimate a new step size use -:c:func:`ERKStepSetInitStep()`. - -One important use of the :c:func:`ERKStepReset()` function is in the -treating of jump discontinuities in the RHS functions. Except in cases -of fairly small jumps, it is usually more efficient to stop at each -point of discontinuity and restart the integrator with a readjusted -ODE model, using a call to :c:func:`ERKStepReset()`. To stop when -the location of the discontinuity is known, simply make that location -a value of ``tout``. To stop when the location of the discontinuity -is determined by the solution, use the rootfinding feature. In either -case, it is critical that the RHS functions *not* incorporate the -discontinuity, but rather have a smooth extension over the -discontinuity, so that the step across it (and subsequent rootfinding, -if used) can be done efficiently. Then use a switch within the RHS -functions (communicated through ``user_data``) that can be flipped -between the stopping of the integration and the restart, so that the -restarted problem uses the new values (which have jumped). Similar -comments apply if there is to be a jump in the dependent variable -vector. .. c:function:: int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) @@ -2342,6 +2125,10 @@ vector. If an error occurred, :c:func:`ERKStepReset()` also sends an error message to the error handler function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeReset` instead. + @@ -2350,35 +2137,6 @@ vector. ERKStep system resize function ------------------------------------- -For simulations involving changes to the number of equations and -unknowns in the ODE system (e.g. when using spatially-adaptive -PDE simulations under a method-of-lines approach), the ERKStep -integrator may be "resized" between integration steps, through calls -to the :c:func:`ERKStepResize()` function. This function modifies -ERKStep's internal memory structures to use the new problem size, -without destruction of the temporal adaptivity heuristics. It is -assumed that the dynamical time scales before and after the vector -resize will be comparable, so that all time-stepping heuristics prior -to calling :c:func:`ERKStepResize()` remain valid after the call. If -instead the dynamics should be recomputed from scratch, the ERKStep -memory structure should be deleted with a call to -:c:func:`ERKStepFree()`, and recreated with a call to -:c:func:`ERKStepCreate`. - -To aid in the vector resize operation, the user can supply a vector -resize function that will take as input a vector with the previous -size, and transform it in-place to return a corresponding vector of -the new size. If this function (of type :c:func:`ARKVecResizeFn()`) -is not supplied (i.e., is set to ``NULL``), then all existing vectors -internal to ERKStep will be destroyed and re-cloned from the new input -vector. - -In the case that the dynamical time scale should be modified slightly -from the previous time scale, an input *hscale* is allowed, that will -rescale the upcoming time step by the specified factor. If a value -*hscale* :math:`\le 0` is specified, the default of 1.0 will be used. - - .. c:function:: int ERKStepResize(void* arkode_mem, N_Vector yR, sunrealtype hscale, sunrealtype tR, ARKVecResizeFn resize, void* resize_data) @@ -2413,22 +2171,6 @@ rescale the upcoming time step by the specified factor. If a value to :c:func:`ERKStepSetConstraints()` is required to re-enable constraint checking. + .. deprecated:: x.y.z -Resizing the absolute tolerance array -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If using array-valued absolute tolerances, the absolute tolerance -vector will be invalid after the call to :c:func:`ERKStepResize()`, so -the new absolute tolerance vector should be re-set **following** each -call to :c:func:`ERKStepResize()` through a new call to -:c:func:`ERKStepSVtolerances()`. - -If scalar-valued tolerances or a tolerance function was specified -through either :c:func:`ERKStepSStolerances()` or -:c:func:`ERKStepWFtolerances()`, then these will remain valid and no -further action is necessary. - - -.. note:: For an example showing usage of the similar - :c:func:`ARKStepResize()` routine, see the supplied serial C - example problem, ``ark_heat1D_adapt.c``. + Use :c:func:`ARKodeResize` instead. diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/index.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/index.rst index d4b2498243..d799e0bc86 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/index.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/index.rst @@ -18,28 +18,14 @@ Using the ERKStep time-stepping module ====================================== -This chapter is concerned with the use of the ERKStep time-stepping -module for the solution of nonstiff initial value problems (IVPs) in a -C or C++ language setting. The following sections discuss the header -files and the layout of the user's main program, and provide -descriptions of the ERKStep user-callable functions and user-supplied -functions. - -The example programs described in the companion document :cite:p:`arkode_ex` may -be helpful. Those codes may be used as templates for new codes and are -included in the ARKODE package ``examples`` subdirectory. - -ERKStep uses the input and output constants from the shared ARKODE -infrastructure. These are defined as needed in this chapter, but for -convenience the full list is provided separately in -:numref:`ARKODE.Constants`. - -The relevant information on using ERKStep's C and C++ interfaces is -detailed in the following sub-sections. +This section is concerned with the use of the ERKStep time-stepping +module for the solution of initial value problems (IVPs) in a C or C++ +language setting. Usage of ERKStep follows that of the rest of ARKODE, +and so in this section we primarily focus on those usage aspects that +are specific to ERKStep. .. toctree:: :maxdepth: 1 - Skeleton User_callable Relaxation diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst index a4a079570b..1057a0cc22 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst @@ -20,71 +20,25 @@ A skeleton of the user's main program ============================================ -The following is a skeleton of the user's main program (or calling program) for -the integration of an ODE IVP using the MRIStep module. Most of the steps are -independent of the NVECTOR, SUNMATRIX, SUNLINSOL and SUNNONLINSOL -implementations used. For the steps that are not, refer to :numref:`NVectors`, -:numref:`SUNMatrix`, :numref:`SUNLinSol`, and :numref:`SUNNonlinSol` for the -specific name of the function to be called or macro to be referenced. +While MRIStep usage generally follows the same pattern as the rest of ARKODE, since it involves the solution of both MRIStep for the slow time scale and another time integrator for the fast time scale, we summarize the differences in using MRIStep here. Steps that are unchanged from the skeleton program presented in :numref:`ARKODE.Usage.Skeleton` are *italicized*. -.. index:: User main program +.. index:: MRIStep user main program -#. Initialize parallel or multi-threaded environment, if appropriate. +#. *Initialize parallel or multi-threaded environment, if appropriate.* - For example, call ``MPI_Init`` to initialize MPI if used, or set - ``num_threads``, the number of threads to use within the threaded - vector functions, if used. +#. *Create the SUNDIALS simulation context object* -#. Create the SUNDIALS context object +#. *Set problem dimensions, etc.* - Call :c:func:`SUNContext_Create` to allocate the ``SUNContext`` object. - -#. Set problem dimensions, etc. - - This generally includes the problem size, ``N``, and may include - the local vector length ``Nlocal``. - - .. note:: - - The variables ``N`` and ``Nlocal`` should be of type - ``sunindextype``. - -#. Set vector of initial values - - To set the vector ``y0`` of initial values, use the appropriate - functions defined by the particular NVECTOR implementation. - - For native SUNDIALS vector implementations (except the CUDA and - RAJA based ones), use a call of the form - - .. code-block:: c - - y0 = N_VMake_***(..., ydata); - - if the ``sunrealtype`` array ``ydata`` containing the initial values of - :math:`y` already exists. Otherwise, create a new vector by making - a call of the form - - .. code-block:: c - - y0 = N_VNew_***(...); - - and then set its elements by accessing the underlying data where it - is located with a call of the form - - .. code-block:: c - - ydata = N_VGetArrayPointer_***(y0); - - For details on each of SUNDIALS' provided vector implementations, see - the corresponding sections in :numref:`NVectors` for details. +#. *Set vector of initial values* #. Create an inner stepper object to solve the fast (inner) IVP * If using ARKStep as the fast (inner) integrator, create the ARKStep object with :c:func:`ARKStepCreate` and configure the integrator as desired for - evolving the fast time scale. See sections :numref:`ARKODE.Usage.ARKStep.Skeleton` - and :numref:`ARKODE.Usage.ARKStep.OptionalInputs` for details on configuring + evolving the fast time scale. See sections :numref:`ARKODE.Usage.Skeleton`, + :numref:`ARKODE.Usage.OptionalInputs`, and + :numref:`ARKODE.Usage.ARKStep.OptionalInputs` for details on configuring ARKStep. Once the ARKStep object is setup, create an ``MRIStepInnerStepper`` object @@ -109,18 +63,18 @@ specific name of the function to be called or macro to be referenced. If a *user_data* pointer needs to be passed to user functions called by the fast (inner) integrator then it should be attached here by calling - :c:func:`ARKStepSetUserData()`. This *user_data* pointer will only be + :c:func:`ARKodeSetUserData()`. This *user_data* pointer will only be passed to user-supplied functions that are attached to the fast (inner) integrator. To supply a *user_data* pointer to user-supplied functions called by the slow (outer) integrator the desired pointer should be - attached by calling :c:func:`MRIStepSetUserData()` after creating the + attached by calling :c:func:`ARKodeSetUserData()` after creating the MRIStep memory below. The *user_data* pointers attached to the inner and outer integrators may be the same or different depending on what is required by the user code. Specifying a rootfinding problem for the fast integration is not supported. Rootfinding problems should be created and initialized with - the slow integrator. See the steps below and :c:func:`MRIStepRootInit()` + the slow integrator. See the steps below and :c:func:`ARKodeRootInit()` for more details. #. Create an MRIStep object for the slow (outer) integration @@ -131,192 +85,57 @@ specific name of the function to be called or macro to be referenced. #. Set the slow step size - Call :c:func:`MRIStepSetFixedStep()` to specify the slow time step - size. + Call :c:func:`ARKodeSetFixedStep()` on the MRIStep object to specify the + slow time step size. #. Create and configure implicit solvers (*as appropriate*) Specifically, if MRIStep is configured with an implicit slow right-hand side function in the prior step, then the following steps are recommended: - #. Specify integration tolerances - - Call :c:func:`MRIStepSStolerances()` or :c:func:`MRIStepSVtolerances()` to - specify either a scalar relative tolerance and scalar absolute tolerance, - or a scalar relative tolerance and a vector of absolute tolerances, - respectively. Alternatively, call :c:func:`MRIStepWFtolerances()` - to specify a function which sets directly the weights used in - evaluating WRMS vector norms. See :numref:`ARKODE.Usage.MRIStep.Tolerances` for - details. - - #. Create nonlinear solver object - - If a non-default nonlinear solver object is desired for implicit - MRI stage solves (see :numref:`ARKODE.Usage.MRIStep.NonlinearSolvers`), - then that nonlinear solver object must be created by using - the appropriate functions defined by the particular SUNNONLINSOL - implementation (e.g., ``NLS = SUNNonlinSol_***(...);`` where - ``***`` is the name of the nonlinear solver (see - :numref:`SUNNonlinSol` for details). - - For the SUNDIALS-supplied SUNNONLINSOL implementations, the - nonlinear solver object may be created using a call of the form - - .. code-block:: c - - SUNNonlinearSolver NLS = SUNNonlinSol_*(...); - - where ``*`` can be replaced with "Newton", "FixedPoint", or other - options, as discussed in the sections - :numref:`ARKODE.Usage.ARKStep.NonlinearSolvers` and :numref:`SUNNonlinSol`. - - Note: by default, MRIStep will use the Newton nonlinear solver - (see section :numref:`SUNNonlinSol.Newton`), so a custom nonlinear solver - object is only needed when using a *different* solver, or for the user - to exercise additional controls over the Newton solver. - - #. Attach nonlinear solver module - - If a nonlinear solver object was created above, then it must be - attached to MRIStep using the call (for details see - :numref:`ARKODE.Usage.MRIStep.NonlinearSolvers`): - - .. code-block:: c + #. *Specify integration tolerances* - ier = MRIStepSetNonlinearSolver(...); + #. *Create matrix object* - #. Set nonlinear solver optional inputs + #. *Create linear solver object* - Call the appropriate set functions for the selected nonlinear - solver module to change optional inputs specific to that nonlinear - solver. These *must* be called after attaching the nonlinear - solver to MRIStep, otherwise the optional inputs will be - overridden by MRIStep defaults. See :numref:`SUNNonlinSol` for more - information on optional inputs. + #. *Set linear solver optional inputs* - #. Create matrix object + #. *Attach linear solver module* - If a nonlinear solver requiring a linear solver will be used (e.g., - a Newton iteration) and if that linear solver will be matrix-based, - then a template Jacobian matrix must be created by using the - appropriate functions defined by the particular SUNMATRIX - implementation. + #. *Create nonlinear solver object* - For the SUNDIALS-supplied SUNMATRIX implementations, the - matrix object may be created using a call of the form + #. *Attach nonlinear solver module* - .. code-block:: c + #. *Set nonlinear solver optional inputs* - SUNMatrix A = SUNBandMatrix(...); +#. *Set optional inputs* - or similar for other matrix modules (see :numref:`SUNMatrix` for - further information). +#. *Specify rootfinding problem* - #. Create linear solver object +#. *Advance solution in time* - If a nonlinear solver requiring a linear solver will be used (e.g., - a Newton iteration), then the desired linear solver object(s) must be - created by using the appropriate functions defined by the particular - SUNLINSOL implementation. +#. *Get optional outputs* - For any of the SUNDIALS-supplied SUNLINSOL implementations, the - linear solver object may be created using a call of the form - - .. code-block:: c - - SUNLinearSolver LS = SUNLinSol_*(...); - - where ``*`` can be replaced with "Dense", "SPGMR", or other - options, as discussed in :numref:`SUNLinSol`. - - #. Set linear solver optional inputs - - Call ``*Set*`` functions from the selected linear solver module - to change optional inputs specific to that linear solver. See the - documentation for each SUNLINSOL module in :numref:`SUNLinSol` for details. - - #. Attach linear solver module - - If a linear solver was created above for implicit MRI stage solves, - initialize the ARKLS linear solver interface by attaching the - linear solver object (and Jacobian matrix object, if applicable) - with the call (for details see :numref:`ARKODE.Usage.MRIStep.LinearSolvers`): - - .. code-block:: c - - ier = MRIStepSetLinearSolver(...); - -#. Set optional inputs - - Call ``MRIStepSet*`` functions to change any optional inputs that - control the behavior of MRIStep from their default values. See - :numref:`ARKODE.Usage.MRIStep.OptionalInputs` for details. - -#. Specify rootfinding problem - - Optionally, call :c:func:`MRIStepRootInit()` to initialize a rootfinding - problem to be solved during the integration of the ODE system. See - :numref:`ARKODE.Usage.MRIStep.RootFinding` for general details, and - :numref:`ARKODE.Usage.MRIStep.OptionalInputs` for relevant optional input calls. - -#. Advance solution in time - - For each point at which output is desired, call - - .. code-block:: c - - ier = MRIStepEvolve(arkode_mem, tout, yout, &tret, itask); - - Here, ``itask`` specifies the return mode. The vector ``yout`` - (which can be the same as the vector ``y0`` above) will contain - :math:`y(t_\text{out})`. See :numref:`ARKODE.Usage.MRIStep.Integration` for details. - -#. Get optional outputs - - Call ``MRIStepGet*`` and/or ``ARKStepGet*`` functions to obtain optional - output from the slow or fast integrators respectively. See - :numref:`ARKODE.Usage.MRIStep.OptionalOutputs` and - :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` for details. - -#. Deallocate memory for solution vector - - Upon completion of the integration, deallocate memory for the - vector ``y`` (or ``yout``) by calling the NVECTOR destructor - function: - - .. code-block:: c - - N_VDestroy(y); +#. *Deallocate memory for solution vector* #. Free solver memory * If ARKStep was used as the fast (inner) IVP integrator, call - :c:func:`MRIStepInnerStepper_Free` and :c:func:`ARKStepFree` to free the + :c:func:`MRIStepInnerStepper_Free` and :c:func:`ARKodeFree` to free the memory allocated for the fast (inner) integrator. * If a user-defined fast (inner) integrator was supplied, free the integrator content and call :c:func:`MRIStepInnerStepper_Free` to free the ``MRIStepInnerStepper`` object. - * Call :c:func:`MRIStepFree` to free the memory allocated for the slow - integration object. - -#. Free linear solver and matrix memory (*as appropriate*) - - Call :c:func:`SUNLinSolFree()` and (possibly) - :c:func:`SUNMatDestroy()` to free any memory allocated for any - linear solver and/or matrix objects created above for either the fast or - slow integrators. - -#. Free nonlinear solver memory (*as appropriate*) + * Call :c:func:`ARKodeFree` to free the memory allocated for the MRIStep + slow integration object. - If a user-supplied ``SUNNonlinearSolver`` was provided to MRIStep, - then call :c:func:`SUNNonlinSolFree()` to free any memory allocated - for the nonlinear solver object created above. +#. *Free linear solver and matrix memory (as appropriate)* -#. **Free the SUNContext object** - Call :c:func:`SUNContext_Free` to free the memory allocated for the ``SUNContext`` object. +#. *Free nonlinear solver memory (as appropriate)* - #. Finalize MPI, if used +#. *Free the SUNContext object* - Call ``MPI_Finalize`` to terminate MPI. +#. *Finalize MPI, if used* diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst index dbb44c425c..58ceaa1bf9 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst @@ -18,21 +18,13 @@ MRIStep User-callable functions ================================== -This section describes the functions that are called by the -user to setup and then solve an IVP using the MRIStep time-stepping -module. Some of these are required; however, starting with -:numref:`ARKODE.Usage.MRIStep.OptionalInputs`, the functions listed involve -optional inputs/outputs or restarting, and those paragraphs may be -skipped for a casual use of ARKODE's MRIStep module. In any case, -refer to the preceding section, :numref:`ARKODE.Usage.MRIStep.Skeleton`, -for the correct order of these calls. - -On an error, each user-callable function returns a negative value (or -``NULL`` if the function returns a pointer) and sends an error message -to the error handler routine, which prints the message to ``stderr`` -by default. However, the user can set a file as error output or can -provide their own error handler function (see -:numref:`ARKODE.Usage.MRIStep.OptionalInputs` for details). +This section describes the MRIStep-specific functions that may be called +by the user to setup and then solve an IVP using the MRIStep time-stepping +module. The large majority of these routines merely wrap :ref:`underlying +ARKODE functions `, and will be deprecated in an +upcoming release -- each of these are clearly marked below. However, some +of these user-callable functions are specific to MRIStep, and are explained +below. @@ -111,6 +103,10 @@ MRIStep initialization and deallocation functions **Return value:** None + .. deprecated:: x.y.z + + Use :c:func:`ARKodeFree` instead. + .. _ARKODE.Usage.MRIStep.Tolerances: @@ -118,40 +114,6 @@ MRIStep initialization and deallocation functions MRIStep tolerance specification functions ------------------------------------------------------ -These functions specify the integration tolerances. One of them -**should** be called before the first call to -:c:func:`MRIStepEvolve()`; otherwise default values of ``reltol = -1e-4`` and ``abstol = 1e-9`` will be used, which may be entirely -incorrect for a specific problem. - -The integration tolerances ``reltol`` and ``abstol`` define a vector -of error weights, ``ewt``. In the case of -:c:func:`MRIStepSStolerances()`, this vector has components - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol); - -whereas in the case of :c:func:`MRIStepSVtolerances()` the vector components -are given by - -.. code-block:: c - - ewt[i] = 1.0/(reltol*abs(y[i]) + abstol[i]); - -This vector is used in all error tests, which use a weighted RMS norm -on all error-like vectors :math:`v`: - -.. math:: - \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; ewt_i)^2 \right)^{1/2}, - -where :math:`N` is the problem dimension. - -Alternatively, the user may supply a custom function to supply the -``ewt`` vector, through a call to :c:func:`MRIStepWFtolerances()`. - - - .. c:function:: int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) This function specifies scalar relative and absolute tolerances. @@ -167,6 +129,10 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the MRIStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSStolerances` instead. + .. c:function:: int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) @@ -187,6 +153,10 @@ Alternatively, the user may supply a custom function to supply the * *ARK_NO_MALLOC* if the MRIStep memory was not allocated by the time-stepping module * *ARK_ILL_INPUT* if an argument has an illegal value (e.g. a negative tolerance). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSVtolerances` instead. + .. c:function:: int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun) @@ -204,100 +174,9 @@ Alternatively, the user may supply a custom function to supply the * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` * *ARK_NO_MALLOC* if the MRIStep memory was not allocated by the time-stepping module + .. deprecated:: x.y.z - - -General advice on the choice of tolerances -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For many users, the appropriate choices for tolerance values in -``reltol`` and ``abstol`` are a concern. The following pieces -of advice are relevant. - -(1) The scalar relative tolerance ``reltol`` is to be set to control - relative errors. So a value of :math:`10^{-4}` means that errors - are controlled to .01%. We do not recommend using ``reltol`` larger - than :math:`10^{-3}`. On the other hand, ``reltol`` should not be so - small that it is comparable to the unit roundoff of the machine - arithmetic (generally around :math:`10^{-15}` for double-precision). - -(2) The absolute tolerances ``abstol`` (whether scalar or vector) need - to be set to control absolute errors when any components of the - solution vector :math:`y` may be so small that pure relative error - control is meaningless. For example, if :math:`y_i` starts at some - nonzero value, but in time decays to zero, then pure relative - error control on :math:`y_i` makes no sense (and is overly costly) - after :math:`y_i` is below some noise level. Then ``abstol`` (if - scalar) or ``abstol[i]`` (if a vector) needs to be set to that - noise level. If the different components have different noise - levels, then ``abstol`` should be a vector. For example, see the - example problem ``ark_robertson.c``, and the discussion - of it in the ARKODE Examples Documentation :cite:p:`arkode_ex`. In that - problem, the three components vary between 0 and 1, and have - different noise levels; hence the ``atols`` vector therein. It is - impossible to give any general advice on ``abstol`` values, - because the appropriate noise levels are completely - problem-dependent. The user or modeler hopefully has some idea as - to what those noise levels are. - -(3) Finally, it is important to pick all the tolerance values - conservatively, because they control the error committed on each - individual step. The final (global) errors are an accumulation of - those per-step errors, where that accumulation factor is - problem-dependent. A general rule of thumb is to reduce the - tolerances by a factor of 10 from the actual desired limits on - errors. So if you want .01% relative accuracy (globally), a good - choice for ``reltol`` is :math:`10^{-5}`. In any case, it is - a good idea to do a few experiments with the tolerances to see how - the computed solution values vary as tolerances are reduced. - - - -Advice on controlling nonphysical negative values -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In many applications, some components in the true solution are always -positive or non-negative, though at times very small. In the -numerical solution, however, small negative (nonphysical) values -can then occur. In most cases, these values are harmless, and simply -need to be controlled, not eliminated, but in other cases any value -that violates a constraint may cause a simulation to halt. For both of -these scenarios the following pieces of advice are relevant. - -(1) The best way to control the size of unwanted negative computed - values is with tighter absolute tolerances. Again this requires - some knowledge of the noise level of these components, which may - or may not be different for different components. Some - experimentation may be needed. - -(2) If output plots or tables are being generated, and it is important - to avoid having negative numbers appear there (for the sake of - avoiding a long explanation of them, if nothing else), then - eliminate them, but only in the context of the output medium. Then - the internal values carried by the solver are unaffected. Remember - that a small negative value in :math:`y` returned by MRIStep, with - magnitude comparable to ``abstol`` or less, is equivalent to zero - as far as the computation is concerned. - -(3) The user's right-hand side routine :math:`f^I` - should never change a negative value in the solution vector :math:`y` - to a non-negative value in attempt to "fix" this problem, - since this can lead to numerical instability. If the :math:`f^I` - routine cannot tolerate a zero or negative value (e.g. because - there is a square root or log), then the offending value should be - changed to zero or a tiny positive number in a temporary variable - (not in the input :math:`y` vector) for the purposes of computing - :math:`f^I(t, y)`. - -.. - (4) Positivity and non-negativity constraints on components can be - enforced by use of the recoverable error return feature in the - user-supplied right-hand side function, :math:`f^I`. When a - recoverable error is encountered, MRIStep will retry the step with - a smaller step size, which typically alleviates the problem. - However, because this option involves some additional overhead - cost, it should only be exercised if the use of absolute - tolerances to control the computed values is unsuccessful. + Use :c:func:`ARKodeWFtolerances` instead. @@ -306,74 +185,6 @@ these scenarios the following pieces of advice are relevant. Linear solver interface functions ------------------------------------------- -As previously explained, the Newton iterations used in solving -implicit systems within MRIStep require the solution of linear -systems of the form - -.. math:: - \mathcal{A}\left(z_i^{(m)}\right) \delta^{(m+1)} = -G\left(z_i^{(m)}\right) - -where - -.. math:: - \mathcal{A} \approx I - \gamma J, \qquad J = \frac{\partial f^I}{\partial y}. - -ARKODE's ARKLS linear solver interface supports all valid -``SUNLinearSolver`` modules for this task. - -Matrix-based ``SUNLinearSolver`` modules utilize ``SUNMatrix`` objects -to store the approximate Jacobian matrix :math:`J`, the Newton matrix -:math:`\mathcal{A}`, and, when using direct solvers, the factorizations -used throughout the solution process. - -Matrix-free ``SUNLinearSolver`` modules instead use iterative methods -to solve the Newton systems of equations, and only require the -*action* of the matrix on a vector, :math:`\mathcal{A}v`. With most -of these methods, preconditioning can be done on the left only, on the -right only, on both the left and the right, or not at all. The -exceptions to this rule are SPFGMR that supports right preconditioning -only and PCG that performs symmetric preconditioning. For the -specification of a preconditioner, see the iterative linear solver -portions of :numref:`ARKODE.Usage.MRIStep.OptionalInputs` and -:numref:`ARKODE.Usage.UserSupplied`. - -If preconditioning is done, user-supplied functions should be used to -define left and right preconditioner matrices :math:`P_1` and -:math:`P_2` (either of which could be the identity matrix), such that -the product :math:`P_{1}P_{2}` approximates the Newton matrix -:math:`\mathcal{A} = I - \gamma J`. - -To specify a generic linear solver for MRIStep to use for the Newton -systems, after the call to :c:func:`MRIStepCreate()` but before any -calls to :c:func:`MRIStepEvolve()`, the user's program must create the -appropriate ``SUNLinearSolver`` object and call the function -:c:func:`MRIStepSetLinearSolver()`, as documented below. To create -the ``SUNLinearSolver`` object, the user may call one of the -SUNDIALS-packaged SUNLinSol module constructor routines via a call of -the form - -.. code:: c - - SUNLinearSolver LS = SUNLinSol_*(...); - -The current list of SUNDIALS-packaged SUNLinSol modules, and their -constructor routines, may be found in chapter :numref:`SUNLinSol`. -Alternately, a user-supplied ``SUNLinearSolver`` module may be created -and used. Specific information on how to create such user-provided -modules may be found in :numref:`SUNLinSol.API.Custom`. - -Once this solver object has been constructed, the user should attach -it to MRIStep via a call to :c:func:`MRIStepSetLinearSolver()`. The -first argument passed to this function is the MRIStep memory pointer -returned by :c:func:`MRIStepCreate()`; the second argument is the -``SUNLinearSolver`` object created above. The third argument is an -optional ``SUNMatrix`` object to accompany matrix-based -``SUNLinearSolver`` inputs (for matrix-free linear solvers, the third -argument should be ``NULL``). A call to this function initializes the -ARKLS linear solver interface, linking it to the MRIStep integrator, -and allows the user to specify additional parameters and routines -pertinent to their choice of linear solver. - .. c:function:: int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix J) This function specifies the ``SUNLinearSolver`` object that MRIStep @@ -415,6 +226,10 @@ pertinent to their choice of linear solver. insufficient to store :math:`\mathcal{A}` then it will need to be resized internally by MRIStep. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinearSolver` instead. + .. _ARKODE.Usage.MRIStep.NonlinearSolvers: @@ -422,24 +237,6 @@ pertinent to their choice of linear solver. Nonlinear solver interface functions ------------------------------------------- -When changing the nonlinear solver in MRIStep, after the -call to :c:func:`MRIStepCreate()` but before any calls to -:c:func:`MRIStepEvolve()`, the user's program must create the -appropriate SUNNonlinSol object and call -:c:func:`MRIStepSetNonlinearSolver()`, as documented below. If any -calls to :c:func:`MRIStepEvolve()` have been made, then MRIStep will -need to be reinitialized by calling :c:func:`MRIStepReInit()` to -ensure that the nonlinear solver is initialized correctly before any -subsequent calls to :c:func:`MRIStepEvolve()`. - -The first argument passed to the routine -:c:func:`MRIStepSetNonlinearSolver()` is the MRIStep memory pointer -returned by :c:func:`MRIStepCreate()`; the second argument passed -to this function is the desired ``SUNNonlinearSolver`` object to use for -solving the nonlinear system for each implicit stage. A call to this -function attaches the nonlinear solver to the main MRIStep integrator. - - .. c:function:: int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) This function specifies the ``SUNNonlinearSolver`` object @@ -460,6 +257,10 @@ function attaches the nonlinear solver to the main MRIStep integrator. default; a call to this routine replaces that module with the supplied *NLS* object. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinearSolver` instead. + .. _ARKODE.Usage.MRIStep.RootFinding: @@ -467,18 +268,6 @@ function attaches the nonlinear solver to the main MRIStep integrator. Rootfinding initialization function -------------------------------------- -As described in the section :numref:`ARKODE.Mathematics.Rootfinding`, while -solving the IVP, ARKODE's time-stepping modules have the capability to -find the roots of a set of user-defined functions. In the MRIStep module root -finding is performed between slow solution time steps only (i.e., it is not -performed within the sub-stepping a fast time scales). To activate the -root-finding algorithm, call the following function. This is normally -called only once, prior to the first call to -:c:func:`MRIStepEvolve()`, but if the rootfinding problem is to be -changed during the solution, :c:func:`MRIStepRootInit()` can also be -called prior to a continuation call to :c:func:`MRIStepEvolve()`. - - .. c:function:: int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) Initializes a rootfinding problem to be solved during the @@ -509,6 +298,10 @@ called prior to a continuation call to :c:func:`MRIStepEvolve()`. Rootfinding is only supported for the slow (outer) integrator and should not be actived for the fast (inner) integrator. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeRootInit` instead. + .. _ARKODE.Usage.MRIStep.Integration: @@ -516,13 +309,6 @@ called prior to a continuation call to :c:func:`MRIStepEvolve()`. MRIStep solver function ------------------------- -This is the central step in the solution process -- the call to perform -the integration of the IVP. The input argument *itask* specifies one of two -modes as to where MRIStep is to return a solution. These modes are modified if -the user has set a stop time (with a call to the optional input function -:c:func:`MRIStepSetStopTime()`) or has requested rootfinding. - - .. c:function:: int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype *tret, int itask) Integrates the ODE over an interval in :math:`t`. @@ -621,6 +407,10 @@ the user has set a stop time (with a call to the optional input function On all other error returns, *tret* and *yout* are left unchanged from those provided to the routine. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeEvolve` instead. + .. _ARKODE.Usage.MRIStep.OptionalInputs: @@ -628,79 +418,12 @@ the user has set a stop time (with a call to the optional input function Optional input functions ------------------------- -There are numerous optional input parameters that control the behavior -of MRIStep, each of which may be modified from its default value through -calling an appropriate input function. The following tables list all -optional input functions, grouped by which aspect of MRIStep they control. -Detailed information on the calling syntax and arguments for each -function are then provided following each table. - -The optional inputs are grouped into the following categories: - -* General MRIStep options (:numref:`ARKODE.Usage.MRIStep.MRIStepInput`), - -* IVP method solver options (:numref:`ARKODE.Usage.MRIStep.MRIStepMethodInput`), - -* Implicit stage solver options (:numref:`ARKODE.Usage.MRIStep.MRIStepSolverInput`), - -* Linear solver interface options (:numref:`ARKODE.Usage.MRIStep.ARKLsInputs`), and - -* Rootfinding options (:numref:`ARKODE.Usage.MRIStep.MRIStepRootfindingInput`). - -For the most casual use of MRIStep, relying on the default set of -solver parameters, the reader can skip to the section on user-supplied -functions, :numref:`ARKODE.Usage.UserSupplied`. - -We note that, on an error return, all of the optional input functions send an -error message to the error handler function. All error return values are -negative, so a test on the return arguments for negative values will catch all -errors. Finally, a call to an ``MRIStepSet***`` function can generally be made -from the user's calling program at any time and, if successful, takes effect -immediately. ``MRIStepSet***`` functions that cannot be called at any time note -this in the "**Notes**:" section of the function documentation. - - .. _ARKODE.Usage.MRIStep.MRIStepInput: Optional inputs for MRIStep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.MRIStep.MRIStepInput.Table: -.. table:: Optional inputs for MRIStep - - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Optional input | Function name | Default | - +===============================================================+===========================================+========================+ - | Return MRIStep solver parameters to their defaults | :c:func:`MRIStepSetDefaults()` | internal | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Set dense output interpolation type | :c:func:`MRIStepSetInterpolantType()` | ``ARK_INTERP_HERMITE`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Set dense output polynomial degree | :c:func:`MRIStepSetInterpolantDegree()` | 5 | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer to a diagnostics output file | :c:func:`MRIStepSetDiagnostics()` | ``NULL`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Run with fixed-step sizes | :c:func:`MRIStepSetFixedStep()` | required | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum no. of warnings for :math:`t_n+h = t_n` | :c:func:`MRIStepSetMaxHnilWarns()` | 10 | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Maximum no. of internal steps before *tout* | :c:func:`MRIStepSetMaxNumSteps()` | 500 | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Set a value for :math:`t_{stop}` | :c:func:`MRIStepSetStopTime()` | undefined | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Interpolate at :math:`t_{stop}` | :c:func:`MRIStepSetInterpolateStopTime()` | ``SUNFALSE`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Disable the stop time | :c:func:`MRIStepClearStopTime` | N/A | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a pointer for user data | :c:func:`MRIStepSetUserData()` | ``NULL`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a function to be called prior to the inner integration | :c:func:`MRIStepSetPreInnerFn()` | ``NULL`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - | Supply a function to be called after the inner integration | :c:func:`MRIStepSetPostInnerFn()` | ``NULL`` | - +---------------------------------------------------------------+-------------------------------------------+------------------------+ - - - .. c:function:: int MRIStepSetDefaults(void* arkode_mem) @@ -719,10 +442,14 @@ Optional inputs for MRIStep * *ARK_ILL_INPUT* if an argument has an illegal value - **Notes:** This function does not change problem-defining function pointers - *fs* and *ff* or the *user_data* pointer. It also does not affect any data - structures or options related to root-finding (those can be reset using - :c:func:`MRIStepRootInit()`). + **Notes:** This function does not change problem-defining function pointers + *fs* and *ff* or the *user_data* pointer. It also does not affect any data + structures or options related to root-finding (those can be reset using + :c:func:`MRIStepRootInit()`). + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDefaults` instead. @@ -763,6 +490,10 @@ Optional inputs for MRIStep If this routine is not called, the Hermite interpolation module will be used. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantType` instead. + .. c:function:: int MRIStepSetInterpolantDegree(void* arkode_mem, int degree) @@ -810,14 +541,17 @@ Optional inputs for MRIStep When :math:`q=1`, a linear interpolant is the default to ensure values obtained by the integrator are returned at the ends of the time interval. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantDegree` instead. + .. c:function:: int MRIStepSetDenseOrder(void* arkode_mem, int dord) - *This function is deprecated, and will be removed in a future release. - Users should transition to calling* :c:func:`MRIStepSetInterpolantDegree()` - *instead.* + .. deprecated:: 5.2.0 + Use :c:func:`ARKodeSetInterpolantDegree` instead. .. c:function:: int MRIStepSetDiagnostics(void* arkode_mem, FILE* diagfp) @@ -877,35 +611,9 @@ Optional inputs for MRIStep The step sizes used by the inner (fast) stepper may be controlled through calling the appropriate "Set" routines on the inner integrator. + .. deprecated:: x.y.z - -.. - .. c:function:: int MRIStepSetInitStep(void* arkode_mem, sunrealtype hin) - - Specifies the initial time step size MRIStep should use after - initialization or re-initialization. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *hin* -- value of the initial step to be attempted :math:`(\ne 0)`. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** Pass 0.0 to use the default value. - - By default, MRIStep estimates the initial step size to be the - solution :math:`h` of the equation :math:`\left\| \frac{h^2 - \ddot{y}}{2}\right\| = 1`, where :math:`\ddot{y}` is an estimated - value of the second derivative of the solution at *t0*. - + Use :c:func:`ARKodeSetFixedStep` instead. @@ -934,6 +642,9 @@ Optional inputs for MRIStep A negative value indicates that no warning messages should be issued. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxHnilWarns` instead. @@ -962,51 +673,10 @@ Optional inputs for MRIStep Passing *mxsteps* < 0 disables the test (not recommended). + .. deprecated:: x.y.z + Use :c:func:`ARKodeSetMaxNumSteps` instead. -.. - .. c:function:: int MRIStepSetMaxStep(void* arkode_mem, sunrealtype hmax) - - Specifies the upper bound on the magnitude of the time step size. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *hmax* -- maximum absolute value of the time step size :math:`(\ge 0)`. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** Pass *hmax* :math:`\le 0.0` to set the default value of :math:`\infty`. - - - -.. - .. c:function:: int MRIStepSetMinStep(void* arkode_mem, sunrealtype hmin) - - Specifies the lower bound on the magnitude of the time step size. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *hmin* -- minimum absolute value of the time step size :math:`(\ge 0)`. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** Pass *hmin* :math:`\le 0.0` to set the default value of 0. .. c:function:: int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop) @@ -1040,6 +710,11 @@ Optional inputs for MRIStep :c:func:`MRIStepReset` will remain active but can be disabled by calling :c:func:`MRIStepClearStopTime`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStopTime` instead. + + .. c:function:: int MRIStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) @@ -1057,6 +732,11 @@ Optional inputs for MRIStep .. versionadded:: 5.6.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolateStopTime` instead. + + .. c:function:: int MRIStepClearStopTime(void* arkode_mem) @@ -1075,6 +755,11 @@ Optional inputs for MRIStep .. versionadded:: 5.5.1 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeClearStopTime` instead. + + .. c:function:: int MRIStepSetUserData(void* arkode_mem, void* user_data) @@ -1105,6 +790,11 @@ Optional inputs for MRIStep may be the same as or different from the pointer attached to the outer integrator depending on what is required by the user code. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetUserData` instead. + + .. c:function:: int MRIStepSetPreInnerFn(void* arkode_mem, MRIStepPreInnerFn prefn) @@ -1124,6 +814,7 @@ Optional inputs for MRIStep * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` + .. c:function:: int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn) Specifies the function called *after* each inner integration. @@ -1141,28 +832,6 @@ Optional inputs for MRIStep * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` -.. - .. c:function:: int MRIStepSetMaxErrTestFails(void* arkode_mem, int maxnef) - - Specifies the maximum number of error test failures - permitted in attempting one step, before returning with an error. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *maxnef* -- maximum allowed number of error test failures :math:`(>0)`. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` - - * *ARK_ILL_INPUT* if an argument has an illegal value - - **Notes:** The default value is 7; set *maxnef* :math:`\le 0` - to specify this default. @@ -1203,6 +872,11 @@ Optional inputs for IVP method selection * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetOrder` instead. + + .. c:function:: int MRIStepSetCoupling(void* arkode_mem, MRIStepCoupling C) @@ -1227,6 +901,10 @@ Optional inputs for IVP method selection For a description of the :c:type:`MRIStepCoupling` type and related functions for creating Butcher tables see :numref:`ARKODE.Usage.MRIStep.MRIStepCoupling`. + **Warning:** + + This should not be used with :c:func:`ARKodeSetOrder`. + .. _ARKODE.Usage.MRIStep.MRIStepSolverInput: @@ -1234,31 +912,6 @@ Optional inputs for IVP method selection Optional inputs for implicit stage solves ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The mathematical explanation for the nonlinear solver strategies used -by MRIStep, including how each of the parameters below is used within -the code, is provided in :numref:`ARKODE.Mathematics.Nonlinear`. - - -.. cssclass:: table-bordered - -========================================================= ========================================= ============ -Optional input Function name Default -========================================================= ========================================= ============ -Specify linearly implicit :math:`f^I` :c:func:`MRIStepSetLinear()` ``SUNFALSE`` -Specify nonlinearly implicit :math:`f^I` :c:func:`MRIStepSetNonlinear()` ``SUNTRUE`` -Implicit predictor method :c:func:`MRIStepSetPredictorMethod()` 0 -Maximum number of nonlinear iterations :c:func:`MRIStepSetMaxNonlinIters()` 3 -Coefficient in the nonlinear convergence test :c:func:`MRIStepSetNonlinConvCoef()` 0.1 -Nonlinear convergence rate constant :c:func:`MRIStepSetNonlinCRDown()` 0.3 -Nonlinear residual divergence ratio :c:func:`MRIStepSetNonlinRDiv()` 2.3 -User-provided implicit stage predictor :c:func:`MRIStepSetStagePredictFn()` ``NULL`` -RHS function for nonlinear system evaluations :c:func:`MRIStepSetNlsRhsFn()` ``NULL`` -Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDeduceImplicitRhs` ``SUNFALSE`` -========================================================= ========================================= ============ - - - - .. c:function:: int MRIStepSetLinear(void* arkode_mem, int timedepend) Specifies that the implicit slow right-hand side function, :math:`f^I(t,y)` @@ -1287,6 +940,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe The only SUNDIALS-provided SUNNonlinearSolver module that is compatible with the :c:func:`MRIStepSetLinear()` option is the Newton solver. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinear` instead. + .. c:function:: int MRIStepSetNonlinear(void* arkode_mem) @@ -1308,6 +965,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe :c:func:`MRIStepSetDeltaGammaMax()` to reset the step size ratio threshold to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinear` instead. + .. c:function:: int MRIStepSetPredictorMethod(void* arkode_mem, int method) @@ -1344,6 +1005,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **The "bootstrap" predictor (option 4 above) has been deprecated, and will be removed from a future release.** + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetPredictorMethod` instead. + .. c:function:: int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor) @@ -1364,6 +1029,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **Notes:** The default value is 3; set *maxcor* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNonlinIters` instead. + .. c:function:: int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) @@ -1382,6 +1051,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **Notes:** The default value is 0.1; set *nlscoef* :math:`\le 0` to specify this default. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinConvCoef` instead. + .. c:function:: int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) @@ -1399,6 +1072,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinCRDown` instead. + .. c:function:: int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) @@ -1418,6 +1095,10 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNonlinRDiv` instead. + .. c:function:: int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) @@ -1437,6 +1118,11 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe **Notes:** See :numref:`ARKODE.Usage.StagePredictFn` for more information on this user-supplied routine. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStagePredictFn` instead. + + .. c:function:: int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fs) @@ -1460,6 +1146,11 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe When using a non-default nonlinear solver, this function must be called *after* :c:func:`MRIStepSetNonlinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNlsRhsFn` instead. + + .. c:function:: int MRIStepSetDeduceImplicitRhs(void *arkode_mem, sunbooleantype deduce) @@ -1479,87 +1170,23 @@ Specify if :math:`f^I` is deduced after a nonlinear solve :c:func:`MRIStepSetDe .. versionadded:: 5.2.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDeduceImplicitRhs` instead. + + .. _ARKODE.Usage.MRIStep.ARKLsInputs: Linear solver interface optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The mathematical explanation of the linear solver methods -available to MRIStep is provided in :numref:`ARKODE.Mathematics.Linear`. We -group the user-callable routines into -four categories: general routines concerning the update frequency for -matrices and/or preconditioners, optional inputs for matrix-based -linear solvers, optional inputs for matrix-free linear solvers, and -optional inputs for iterative linear solvers. We note that the -matrix-based and matrix-free groups are mutually exclusive, whereas the -"iterative" tag can apply to either case. - - .. _ARKODE.Usage.MRIStep.ARKLsInputs.General: -.. index:: - single: optional input; generic linear solver interface (MRIStep) - Optional inputs for the ARKLS linear solver interface """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -As discussed in :numref:`ARKODE.Mathematics.Linear.Setup`, ARKODE -strives to reuse matrix and preconditioner data for as many solves as -possible to amortize the high costs of matrix construction and -factorization. To that end, MRIStep provides user-callable -routines to modify this behavior. Recall that the -Newton system matrices that arise within an implicit stage solve are -:math:`{\mathcal A}(t,z) \approx I - \gamma J(t,z)`, where the -implicit right-hand side function has Jacobian matrix -:math:`J(t,z) = \frac{\partial f^I(t,z)}{\partial z}`. - -The matrix or preconditioner for :math:`{\mathcal A}` can only be -updated within a call to the linear solver 'setup' routine. In -general, the frequency with which the linear solver setup routine is -called may be controlled with the *msbp* argument to -:c:func:`MRIStepSetLSetupFrequency()`. When this occurs, the -validity of :math:`{\mathcal A}` for successive time steps -intimately depends on whether the corresponding :math:`\gamma` and -:math:`J` inputs remain valid. - -At each call to the linear solver setup routine the decision to update -:math:`\mathcal{A}` with a new value of :math:`\gamma`, and to reuse -or reevaluate Jacobian information, depends on several factors including: - -* the success or failure of previous solve attempts, -* the success or failure of the previous time step attempts, -* the change in :math:`\gamma` from the value used when constructing :math:`\mathcal{A}`, and -* the number of steps since Jacobian information was last evaluated. - -The frequency with which to update Jacobian information can be controlled -with the *msbj* argument to :c:func:`MRIStepSetJacEvalFrequency()`. -We note that this is only checked *within* calls to the linear solver setup -routine, so values *msbj* :math:`<` *msbp* do not make sense. For -linear-solvers with user-supplied preconditioning the above factors are used -to determine whether to recommend updating the Jacobian information in the -preconditioner (i.e., whether to set *jok* to ``SUNFALSE`` in calling the -user-supplied :c:type:`ARKLsPrecSetupFn()`). For matrix-based linear solvers -these factors determine whether the matrix :math:`J(t,y) = \frac{\partial f^I(t,y)}{\partial y}` -should be updated (either with an internal finite difference approximation or -a call to the user-supplied :c:type:`ARKLsJacFn`); if not then the previous -value is reused and the system matrix :math:`{\mathcal A}(t,y) \approx I - \gamma J(t,y)` -is recomputed using the current :math:`\gamma` value. - - - -.. cssclass:: table-bordered - -============================================= ========================================= ============ -Optional input Function name Default -============================================= ========================================= ============ -Max change in step signaling new :math:`J` :c:func:`MRIStepSetDeltaGammaMax()` 0.2 -Linear solver setup frequency :c:func:`MRIStepSetLSetupFrequency()` 20 -Jacobian / preconditioner update frequency :c:func:`MRIStepSetJacEvalFrequency()` 51 -============================================= ========================================= ============ - - .. c:function:: int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) Specifies a scaled step size ratio tolerance, beyond which the @@ -1577,9 +1204,11 @@ Jacobian / preconditioner update frequency :c:func:`MRIStepSetJacEvalFrequen **Notes:** Any non-positive parameter will imply a reset to the default value. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDeltaGammaMax` instead. + -.. index:: - single: optional input; linear solver setup frequency (MRIStep) .. c:function:: int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp) @@ -1601,10 +1230,11 @@ Jacobian / preconditioner update frequency :c:func:`MRIStepSetJacEvalFrequen step. If **msbp** is 0, the default value of 20 will be used. A negative value forces a linear solver step at each implicit stage. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLSetupFrequency` instead. + -.. index:: - single: optional input; Jacobian update frequency (MRIStep) - single: optional input; preconditioner update frequency (MRIStep) .. c:function:: int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj) @@ -1633,8 +1263,9 @@ Jacobian / preconditioner update frequency :c:func:`MRIStepSetJacEvalFrequen This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`MRIStepSetLinearSolver()`. + .. deprecated:: x.y.z - + Use :c:func:`ARKodeSetJacEvalFrequency` instead. @@ -1644,48 +1275,6 @@ Jacobian / preconditioner update frequency :c:func:`MRIStepSetJacEvalFrequen Optional inputs for matrix-based ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -========================================= =========================================== ============= -Optional input Function name Default -========================================= =========================================== ============= -Jacobian function :c:func:`MRIStepSetJacFn()` ``DQ`` -Linear system function :c:func:`MRIStepSetLinSysFn()` internal -Enable or disable linear solution scaling :c:func:`MRIStepSetLinearSolutionScaling()` on -========================================= =========================================== ============= - -When using matrix-based linear solver modules, the ARKLS solver interface needs -a function to compute an approximation to the Jacobian matrix :math:`J(t,y)` or -the linear system :math:`I - \gamma J`. The function to evaluate the Jacobian -must be of type :c:func:`ARKLsJacFn()`. The user can supply a custom Jacobian -function, or if using a dense or banded :math:`J` can use the default internal -difference quotient approximation that comes with the ARKLS interface. At -present, we do not supply a corresponding routine to approximate Jacobian -entries in sparse matrices :math:`J`. To specify a user-supplied Jacobian -function *jac*, MRIStep provides the function :c:func:`MRIStepSetJacFn()`. -Alternatively, a function of type :c:func:`ARKLsLinSysFn()` can be provided to -evaluate the matrix :math:`I - \gamma J`. By default, ARKLS uses an -internal linear system function leveraging the SUNMATRIX API to form the matrix -:math:`I - \gamma J`. To specify a user-supplied linear system function -*linsys*, MRIStep provides the function :c:func:`MRIStepSetLinSysFn()`. In -either case the matrix information will be updated infrequently to reduce matrix -construction and, with direct solvers, factorization costs. As a result the -value of :math:`\gamma` may not be current and a scaling factor is applied to the -solution of the linear system to account for lagged value of :math:`\gamma`. See -:numref:`SUNLinSol.Lagged_matrix` for more details. The function -:c:func:`MRIStepSetLinearSolutionScaling()` can be used to disable this scaling -when necessary, e.g., when providing a custom linear solver that updates the -matrix using the current :math:`\gamma` as part of the solve. - -The ARKLS interface passes the user data pointer to the Jacobian and linear -system functions. This allows the user to create an arbitrary structure with -relevant problem data and access it during the execution of the user-supplied -Jacobian or linear system functions, without using global data in the -program. The user data pointer may be specified through -:c:func:`MRIStepSetUserData()`. - - - .. c:function:: int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac) Specifies the Jacobian approximation routine to @@ -1712,6 +1301,11 @@ program. The user data pointer may be specified through The function type :c:func:`ARKLsJacFn()` is described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetJacFn` instead. + + .. c:function:: int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) @@ -1738,6 +1332,11 @@ program. The user data pointer may be specified through The function type :c:func:`ARKLsLinSysFn()` is described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinSysFn` instead. + + .. c:function:: int MRIStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) @@ -1758,47 +1357,17 @@ program. The user data pointer may be specified through **Notes:** Linear solution scaling is enabled by default when a matrix-based linear solver is attached. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLinearSolutionScaling` instead. + + .. _ARKODE.Usage.MRIStep.ARKLsInputs.MatrixFree: Optional inputs for matrix-free ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -================================================== ========================================= ================== -Optional input Function name Default -================================================== ========================================= ================== -:math:`Jv` functions (*jtimes* and *jtsetup*) :c:func:`MRIStepSetJacTimes()` DQ, none -:math:`Jv` DQ rhs function (*jtimesRhsFn*) :c:func:`MRIStepSetJacTimesRhsFn()` fs -================================================== ========================================= ================== - - -As described in :numref:`ARKODE.Mathematics.Linear`, when solving -the Newton linear systems with matrix-free methods, the ARKLS -interface requires a *jtimes* function to compute an approximation to -the product between the Jacobian matrix -:math:`J(t,y)` and a vector :math:`v`. The user can supply a custom -Jacobian-times-vector approximation function, or use the default -internal difference quotient function that comes with the ARKLS -interface. - -A user-defined Jacobian-vector function must be of type -:c:type:`ARKLsJacTimesVecFn` and can be specified through a call -to :c:func:`MRIStepSetJacTimes()` (see -:numref:`ARKODE.Usage.UserSupplied` for specification details). As with the -user-supplied preconditioner functions, the evaluation and -processing of any Jacobian-related data needed by the user's -Jacobian-times-vector function is done in the optional user-supplied -function of type :c:type:`ARKLsJacTimesSetupFn` (see -:numref:`ARKODE.Usage.UserSupplied` for specification details). As with -the preconditioner functions, a pointer to the user-defined -data structure, *user_data*, specified through -:c:func:`MRIStepSetUserData()` (or a ``NULL`` pointer otherwise) is -passed to the Jacobian-times-vector setup and product functions each -time they are called. - - .. c:function:: int MRIStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsJacTimesVecFn jtimes) Specifies the Jacobian-times-vector setup and product functions. @@ -1831,15 +1400,9 @@ time they are called. :c:type:`ARKLsJacTimesVecFn` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z -When using the internal difference quotient the user may optionally supply -an alternative implicit right-hand side function for use in the Jacobian-vector -product approximation by calling :c:func:`MRIStepSetJacTimesRhsFn()`. The -alternative implicit right-hand side function should compute a suitable (and -differentiable) approximation to the :math:`f^I` function provided to -:c:func:`MRIStepCreate()`. For example, as done in :cite:p:`dorr2010numerical`, the alternative -function may use lagged values when evaluating a nonlinearity in :math:`f^I` to -avoid differencing a potentially non-differentiable factor. + Use :c:func:`ARKodeSetJacTimes` instead. .. c:function:: int MRIStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) @@ -1865,6 +1428,10 @@ avoid differencing a potentially non-differentiable factor. This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`MRIStepSetLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetJacTimesRhsFn` instead. + @@ -1874,44 +1441,6 @@ avoid differencing a potentially non-differentiable factor. Optional inputs for iterative ``SUNLinearSolver`` modules """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.. cssclass:: table-bordered - -=============================================== ========================================= ================== -Optional input Function name Default -=============================================== ========================================= ================== -Newton preconditioning functions :c:func:`MRIStepSetPreconditioner()` ``NULL``, ``NULL`` -Newton linear and nonlinear tolerance ratio :c:func:`MRIStepSetEpsLin()` 0.05 -Newton linear solve tolerance conversion factor :c:func:`MRIStepSetLSNormFactor()` vector length -=============================================== ========================================= ================== - - -As described in :numref:`ARKODE.Mathematics.Linear`, when using -an iterative linear solver the user may supply a preconditioning -operator to aid in solution of the system. This operator consists of -two user-supplied functions, *psetup* and *psolve*, that are supplied -to MRIStep using the function :c:func:`MRIStepSetPreconditioner()`. -The *psetup* function supplied to these routines -should handle evaluation and preprocessing of any Jacobian data -needed by the user's preconditioner solve function, -*psolve*. The user data pointer received through -:c:func:`MRIStepSetUserData()` (or a pointer to ``NULL`` if user data -was not specified) is passed to the *psetup* and *psolve* functions. -This allows the user to create an arbitrary -structure with relevant problem data and access it during the -execution of the user-supplied preconditioner functions without using -global data in the program. - -Also, as described in :numref:`ARKODE.Mathematics.Error.Linear`, the -ARKLS interface requires that iterative linear solvers stop when -the norm of the preconditioned residual satisfies - -.. math:: - \|r\| \le \frac{\epsilon_L \epsilon}{10} - -where the default :math:`\epsilon_L = 0.05`, which may be modified by -the user through the :c:func:`MRIStepSetEpsLin()` function. - - .. c:function:: int MRIStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, ARKLsPrecSolveFn psolve) Specifies the user-supplied preconditioner setup and solve functions. @@ -1942,6 +1471,11 @@ the user through the :c:func:`MRIStepSetEpsLin()` function. :c:func:`ARKLsPrecSolveFn()` are described in :numref:`ARKODE.Usage.UserSupplied`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetPreconditioner` instead. + + .. c:function:: int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac) @@ -1966,6 +1500,11 @@ the user through the :c:func:`MRIStepSetEpsLin()` function. interface has been initialized through a call to :c:func:`MRIStepSetLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetEpsLin` instead. + + .. c:function:: int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) @@ -1994,6 +1533,10 @@ the user through the :c:func:`MRIStepSetEpsLin()` function. This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`MRIStepSetLinearSolver()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetLSNormFactor` instead. + .. _ARKODE.Usage.MRIStep.MRIStepRootfindingInput: @@ -2001,22 +1544,6 @@ the user through the :c:func:`MRIStepSetEpsLin()` function. Rootfinding optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following functions can be called to set optional inputs to -control the rootfinding algorithm, the mathematics of which are -described in the section :numref:`ARKODE.Mathematics.Rootfinding`. - - -.. cssclass:: table-bordered - -====================================== ======================================== ================== -Optional input Function name Default -====================================== ======================================== ================== -Direction of zero-crossings to monitor :c:func:`MRIStepSetRootDirection()` both -Disable inactive root warnings :c:func:`MRIStepSetNoInactiveRootWarn()` enabled -====================================== ======================================== ================== - - - .. c:function:: int MRIStepSetRootDirection(void* arkode_mem, int* rootdir) Specifies the direction of zero-crossings to be located and returned. @@ -2038,6 +1565,10 @@ Disable inactive root warnings :c:func:`MRIStepSetNoInactiveRootWarn()` **Notes:** The default behavior is to monitor for both zero-crossing directions. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRootDirection` instead. + .. c:function:: int MRIStepSetNoInactiveRootWarn(void* arkode_mem) @@ -2060,6 +1591,10 @@ Disable inactive root warnings :c:func:`MRIStepSetNoInactiveRootWarn()` first step), MRIStep will issue a warning which can be disabled with this optional input function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNoInactiveRootWarn` instead. + .. _ARKODE.Usage.MRIStep.InterpolatedOutput: @@ -2067,20 +1602,6 @@ Disable inactive root warnings :c:func:`MRIStepSetNoInactiveRootWarn()` Interpolated output function -------------------------------- -An optional function :c:func:`MRIStepGetDky()` is available to obtain -additional values of solution-related quantities. This function -should only be called after a successful return from -:c:func:`MRIStepEvolve()`, as it provides interpolated values either of -:math:`y` or of its derivatives (up to the 3rd derivative) -interpolated to any value of :math:`t` in the last internal step taken -by :c:func:`MRIStepEvolve()`. Internally, this "dense output" or -"continuous extension" algorithm is identical to the algorithm used for -the maximum order implicit predictors, described in -:numref:`ARKODE.Mathematics.Predictors.Max`, except that derivatives of the -polynomial model may be evaluated upon request. - - - .. c:function:: int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) Computes the *k*-th derivative of the function @@ -2126,6 +1647,10 @@ polynomial model may be evaluated upon request. functions :c:func:`MRIStepGetCurrentTime()` and :c:func:`MRIStepGetLastStep()`, respectively. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetDky` instead. + .. _ARKODE.Usage.MRIStep.OptionalOutputs: @@ -2133,57 +1658,6 @@ polynomial model may be evaluated upon request. Optional output functions ------------------------------ -MRIStep provides an extensive set of functions that can be used to -obtain solver performance information. We organize these into groups: - -#. General MRIStep output routines are in - :numref:`ARKODE.Usage.MRIStep.MRIStepMainOutputs`, - -#. MRIStep implicit solver output routines are in - :numref:`ARKODE.Usage.MRIStep.MRIStepImplicitSolverOutputs`, - -#. Linear solver output routines are in - :numref:`ARKODE.Usage.MRIStep.ARKLsOutputs` and - -#. General usability routines (e.g. to print the current MRIStep - parameters, or output the current coupling table) are in - :numref:`ARKODE.Usage.MRIStep.MRIStepExtraOutputs`. - -#. Output routines regarding root-finding results are in - :numref:`ARKODE.Usage.MRIStep.MRIStepRootOutputs`, - -Following each table, we elaborate on each function. - -Some of the optional outputs, especially the various counters, can be -very useful in determining the efficiency of various methods inside -MRIStep. For example: - -* The number of steps and right-hand side evaluations at both the slow and fast - time scales provide a rough measure of the overall cost of a given run, and can - be compared between runs with different solver options to suggest which set of - options is the most efficient. - -* The ratio *nniters/nsteps* measures the performance of the - nonlinear iteration in solving the nonlinear systems at each implicit stage, - providing a measure of the degree of nonlinearity in the problem. - Typical values of this for a Newton solver on a general problem - range from 1.1 to 1.8. - -* When using a Newton nonlinear solver, the ratio *njevals/nniters* - (when using a direct linear solver), and the ratio - *nliters/nniters* (when using an iterative linear solver) can - indicate the quality of the approximate Jacobian or preconditioner being - used. For example, if this ratio is larger for a user-supplied - Jacobian or Jacobian-vector product routine than for the - difference-quotient routine, it can indicate that the user-supplied - Jacobian is inaccurate. - -It is therefore recommended that users retrieve and output these -statistics following each run, and take some time to investigate -alternate solver options that will be more optimal for their -particular problem of interest. - - .. _ARKODE.Usage.MRIStep.MRIStepMainOutputs: @@ -2191,56 +1665,6 @@ Main solver optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.MRIStep.MRIStepMainOutputs.Table: -.. table:: Main solver optional output functions - - +------------------------------------------------------+-------------------------------------------+ - | Optional output | Function name | - +------------------------------------------------------+-------------------------------------------+ - | Size of MRIStep real and integer workspaces | :c:func:`MRIStepGetWorkSpace()` | - +------------------------------------------------------+-------------------------------------------+ - | Cumulative number of internal steps | :c:func:`MRIStepGetNumSteps()` | - +------------------------------------------------------+-------------------------------------------+ - | Step size used for the last successful step | :c:func:`MRIStepGetLastStep()` | - +------------------------------------------------------+-------------------------------------------+ - | Current internal time reached by the solver | :c:func:`MRIStepGetCurrentTime()` | - +------------------------------------------------------+-------------------------------------------+ - | Current internal solution reached by the solver | :c:func:`MRIStepGetCurrentState()` | - +------------------------------------------------------+-------------------------------------------+ - | Current :math:`\gamma` value used by the solver | :c:func:`MRIStepGetCurrentGamma()` | - +------------------------------------------------------+-------------------------------------------+ - | Error weight vector for state variables | :c:func:`MRIStepGetErrWeights()` | - +------------------------------------------------------+-------------------------------------------+ - | Suggested factor for tolerance scaling | :c:func:`MRIStepGetTolScaleFactor()` | - +------------------------------------------------------+-------------------------------------------+ - | Print all statistics | :c:func:`MRIStepPrintAllStats` | - +------------------------------------------------------+-------------------------------------------+ - | Name of constant associated with a return flag | :c:func:`MRIStepGetReturnFlagName()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of calls to the :math:`f^E` and :math:`f^I` | :c:func:`MRIStepGetNumRhsEvals()` | - +------------------------------------------------------+-------------------------------------------+ - | No. of failed steps due to a nonlinear solver | :c:func:`MRIStepGetNumStepSolveFails()` | - | failure | | - +------------------------------------------------------+-------------------------------------------+ - | Current MRI coupling tables | :c:func:`MRIStepGetCurrentCoupling()` | - +------------------------------------------------------+-------------------------------------------+ - | Last inner stepper return value | :c:func:`MRIStepGetLastInnerStepFlag()` | - +------------------------------------------------------+-------------------------------------------+ - | Retrieve a pointer for user data | :c:func:`MRIStepGetUserData` | - +------------------------------------------------------+-------------------------------------------+ - -.. Functions not currently provided by MRIStep -.. No. of explicit stability-limited steps :c:func:`MRIStepGetNumExpSteps()` -.. No. of accuracy-limited steps :c:func:`MRIStepGetNumAccSteps()` -.. No. of attempted steps :c:func:`MRIStepGetNumStepAttempts()` -.. No. of local error test failures that have occurred :c:func:`MRIStepGetNumErrTestFails()` -.. Estimated local truncation error vector :c:func:`MRIStepGetEstLocalErrors()` -.. Single accessor to many statistics at once :c:func:`MRIStepGetTimestepperStats()` -.. Actual initial time step size used :c:func:`MRIStepGetActualInitStep()` -.. Step size to be attempted on the next step :c:func:`MRIStepGetCurrentStep()` -.. Single accessor to many statistics at once :c:func:`MRIStepGetStepStats()` - - .. c:function:: int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) Returns the MRIStep real and integer workspace sizes. @@ -2259,6 +1683,11 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetWorkSpace` instead. + + .. c:function:: int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps, long int* nfsteps) @@ -2279,23 +1708,10 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z -.. - .. c:function:: int MRIStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused) - - Returns the value of the integration step size used on the first step. - - **Arguments:** + Use :c:func:`ARKodeGetNumSteps` instead. - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *hinused* -- actual value of initial step size. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` .. c:function:: int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast) @@ -2315,23 +1731,10 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z -.. - .. c:function:: int MRIStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) + Use :c:func:`ARKodeGetLastStep` instead. - Returns the integration step size to be attempted on the next internal step. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *hcur* -- step size to be attempted on the next internal step. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` .. c:function:: int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) @@ -2350,6 +1753,10 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentTime` instead. + .. c:function:: int MRIStepGetCurrentState(void *arkode_mem, N_Vector *ycur) @@ -2371,6 +1778,10 @@ Main solver optional output functions as altering values of *ycur* may lead to undesirable behavior, depending on the particular use case and on when this routine is called. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentState` instead. + .. c:function:: int MRIStepGetCurrentGamma(void *arkode_mem, sunrealtype *gamma) @@ -2389,6 +1800,9 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentGamma` instead. .. c:function:: int MRIStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac) @@ -2409,6 +1823,10 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetTolScaleFactor` instead. + .. c:function:: int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight) @@ -2429,29 +1847,9 @@ Main solver optional output functions **Notes:** The user must allocate space for *eweight*, that will be filled in by this function. + .. deprecated:: x.y.z -.. - .. c:function:: int MRIStepGetStepStats(void* arkode_mem, long int* nssteps, long int* nfsteps, sunrealtype* hlast, sunrealtype* tcur) - - Returns many of the most useful optional outputs in a single call. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *nssteps* -- number of slow steps taken in the solver. - - * *nfsteps* -- number of fast steps taken in the solver. - - * *hlast* -- step size taken on the last internal step. - - * *tcur* -- current internal time reached. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + Use :c:func:`ARKodeGetErrWeights` instead. .. c:function:: int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) @@ -2481,8 +1879,12 @@ Main solver optional output functions .. versionadded:: 5.2.0 + .. deprecated:: x.y.z + + Use :c:func:`ARKodePrintAllStats` instead. + -.. c:function:: char *MRIStepGetReturnFlagName(long int flag) +.. c:function:: char* MRIStepGetReturnFlagName(long int flag) Returns the name of the MRIStep constant corresponding to *flag*. See :ref:`ARKODE.Constants`. @@ -2495,61 +1897,10 @@ Main solver optional output functions The return value is a string containing the name of the corresponding constant. + .. deprecated:: x.y.z -.. - .. c:function:: int MRIStepGetNumExpSteps(void* arkode_mem, long int* expsteps) - - Returns the cumulative number of stability-limited steps - taken by the solver (so far). - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *expsteps* -- number of stability-limited steps taken in the solver. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` - - -.. - .. c:function:: int MRIStepGetNumAccSteps(void* arkode_mem, long int* accsteps) - - Returns the cumulative number of accuracy-limited steps - taken by the solver (so far). - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *accsteps* -- number of accuracy-limited steps taken in the solver. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` - - -.. - .. c:function:: int MRIStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts) + Use :c:func:`ARKodeGetReturnFlagName` instead. - Returns the cumulative number of steps attempted by the solver (so far). - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *step_attempts* -- number of steps attempted by solver. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` .. c:function:: int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, long int* nfsi_evals) @@ -2572,24 +1923,6 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` -.. - .. c:function:: int MRIStepGetNumErrTestFails(void* arkode_mem, long int* netfails) - - Returns the number of local error test failures that - have occurred (so far). - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *netfails* -- number of error test failures. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` - .. c:function:: int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* ncnf) @@ -2607,6 +1940,10 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumStepSolveFails` instead. + .. c:function:: int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling *C) @@ -2645,65 +1982,6 @@ Main solver optional output functions For more details see :numref:`ARKODE.Usage.MRIStep.MRIStepCoupling`. -.. - .. c:function:: int MRIStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) - - Returns the vector of estimated local truncation errors - for the current step. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *ele* -- vector of estimated local truncation errors. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` - - **Notes:** The user must allocate space for *ele*, that will be - filled in by this function. - - The values returned in *ele* are valid only after a successful call - to :c:func:`MRIStepEvolve()` (i.e., it returned a non-negative value). - - The *ele* vector, together with the *eweight* vector from - :c:func:`MRIStepGetErrWeights()`, can be used to determine how the - various components of the system contributed to the estimated local - error test. Specifically, that error test uses the WRMS norm of a - vector whose components are the products of the components of these - two vectors. Thus, for example, if there were recent error test - failures, the components causing the failures are those with largest - values for the products, denoted loosely as ``eweight[i]*ele[i]``. - - -.. - .. c:function:: int MRIStepGetTimestepperStats(void* arkode_mem, long int* expsteps, long int* accsteps, long int* step_attempts, long int* nf_evals, long int* netfails) - - Returns many of the most useful time-stepper statistics in a single call. - - **Arguments:** - - * *arkode_mem* -- pointer to the MRIStep memory block. - - * *expsteps* -- number of stability-limited steps taken in the solver. - - * *accsteps* -- number of accuracy-limited steps taken in the solver. - - * *step_attempts* -- number of steps attempted by the solver. - - * *nf_evals* -- number of calls to the user's :math:`f(t,y)` function. - - * *netfails* -- number of error test failures. - - **Return value:** - - * *ARK_SUCCESS* if successful - - * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` - .. c:function:: int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag) Returns the last return value from the inner stepper. @@ -2720,6 +1998,7 @@ Main solver optional output functions * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. c:function:: int MRIStepGetUserData(void* arkode_mem, void** user_data) Returns the user data pointer previously set with @@ -2739,29 +2018,16 @@ Main solver optional output functions .. versionadded:: 5.3.0 + .. deprecated:: x.y.z -.. _ARKODE.Usage.MRIStep.MRIStepImplicitSolverOutputs: + Use :c:func:`ARKodeGetUserData` instead. -Implicit solver optional output functions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. _ARKODE.Usage.MRIStep.MRIStepImplicitSolverOutputs.Table: -.. table:: Implicit solver optional output functions - - +------------------------------------------------------+----------------------------------------------+ - | Optional output | Function name | - +------------------------------------------------------+----------------------------------------------+ - | No. of calls to linear solver setup function | :c:func:`MRIStepGetNumLinSolvSetups()` | - +------------------------------------------------------+----------------------------------------------+ - | No. of nonlinear solver iterations | :c:func:`MRIStepGetNumNonlinSolvIters()` | - +------------------------------------------------------+----------------------------------------------+ - | No. of nonlinear solver convergence failures | :c:func:`MRIStepGetNumNonlinSolvConvFails()` | - +------------------------------------------------------+----------------------------------------------+ - | Single accessor to all nonlinear solver statistics | :c:func:`MRIStepGetNonlinSolvStats()` | - +------------------------------------------------------+----------------------------------------------+ +.. _ARKODE.Usage.MRIStep.MRIStepImplicitSolverOutputs: +Implicit solver optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. c:function:: int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) @@ -2784,6 +2050,10 @@ Implicit solver optional output functions solver object; the counter is reset whenever a new nonlinear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinSolvSetups` instead. + .. c:function:: int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) @@ -2807,6 +2077,10 @@ Implicit solver optional output functions solver object; the counter is reset whenever a new nonlinear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumNonlinSolvIters` instead. + .. c:function:: int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nncfails) @@ -2830,6 +2104,10 @@ Implicit solver optional output functions solver object; the counter is reset whenever a new nonlinear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumNonlinSolvConvFails` instead. + .. c:function:: int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, long int* nncfails) @@ -2856,6 +2134,10 @@ Implicit solver optional output functions nonlinear solver object; the counters are reset whenever a new nonlinear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNonlinSolvStats` instead. + .. _ARKODE.Usage.MRIStep.MRIStepRootOutputs: @@ -2863,17 +2145,6 @@ Implicit solver optional output functions Rootfinding optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. cssclass:: table-bordered - -=================================================== ========================================== -Optional output Function name -=================================================== ========================================== -Array showing roots found :c:func:`MRIStepGetRootInfo()` -No. of calls to user root function :c:func:`MRIStepGetNumGEvals()` -=================================================== ========================================== - - - .. c:function:: int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound) Returns an array showing which functions were found to @@ -2900,6 +2171,10 @@ No. of calls to user root function :c:func:`MRIStepGetNumGEval zero-crossing. A value of +1 indicates that :math:`g_i` is increasing, while a value of -1 indicates a decreasing :math:`g_i`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetRootInfo` instead. + .. c:function:: int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals) @@ -2915,6 +2190,10 @@ No. of calls to user root function :c:func:`MRIStepGetNumGEval * *ARK_SUCCESS* if successful * *ARK_MEM_NULL* if the MRIStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumGEvals` instead. + .. _ARKODE.Usage.MRIStep.ARKLsOutputs: @@ -2922,48 +2201,6 @@ No. of calls to user root function :c:func:`MRIStepGetNumGEval Linear solver interface optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A variety of optional outputs are available from the ARKLS interface, as -listed in the following table and elaborated below. We note that where the -name of an output would otherwise conflict with the -name of an optional output from the main solver, a suffix LS (for -Linear Solver) has been added here (e.g. *lenrwLS*). - - -.. _ARKODE.Usage.MRIStep.ARKLsOutputs.Table: -.. table:: Linear solver interface optional output functions - - +--------------------------------------------------------------------+------------------------------------------+ - | Optional output | Function name | - +--------------------------------------------------------------------+------------------------------------------+ - | Stored Jacobian of the ODE RHS function | :c:func:`MRIStepGetJac` | - +--------------------------------------------------------------------+------------------------------------------+ - | Time at which the Jacobian was evaluated | :c:func:`MRIStepGetJacTime` | - +--------------------------------------------------------------------+------------------------------------------+ - | Step number at which the Jacobian was evaluated | :c:func:`MRIStepGetJacNumSteps` | - +--------------------------------------------------------------------+------------------------------------------+ - | Size of real and integer workspaces | :c:func:`MRIStepGetLinWorkSpace()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of Jacobian evaluations | :c:func:`MRIStepGetNumJacEvals()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of preconditioner evaluations | :c:func:`MRIStepGetNumPrecEvals()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of preconditioner solves | :c:func:`MRIStepGetNumPrecSolves()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of linear iterations | :c:func:`MRIStepGetNumLinIters()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of linear convergence failures | :c:func:`MRIStepGetNumLinConvFails()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of Jacobian-vector setup evaluations | :c:func:`MRIStepGetNumJTSetupEvals()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of Jacobian-vector product evaluations | :c:func:`MRIStepGetNumJtimesEvals()` | - +--------------------------------------------------------------------+------------------------------------------+ - | No. of *fs* calls for finite diff. :math:`J` or :math:`Jv` evals. | :c:func:`MRIStepGetNumLinRhsEvals()` | - +--------------------------------------------------------------------+------------------------------------------+ - | Last return from a linear solver function | :c:func:`MRIStepGetLastLinFlag()` | - +--------------------------------------------------------------------+------------------------------------------+ - | Name of constant associated with a return flag | :c:func:`MRIStepGetLinReturnFlagName()` | - +--------------------------------------------------------------------+------------------------------------------+ - .. c:function:: int MRIStepGetJac(void* arkode_mem, SUNMatrix* J) Returns the internally stored copy of the Jacobian matrix of the ODE @@ -2981,6 +2218,11 @@ Linear Solver) has been added here (e.g. *lenrwLS*). This function is provided for debugging purposes and the values in the returned matrix should not be altered. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJac` instead. + + .. c:function:: int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J) Returns the time at which the internally stored copy of the Jacobian matrix @@ -2993,6 +2235,11 @@ Linear Solver) has been added here (e.g. *lenrwLS*). :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL`` :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJacTime` instead. + + .. c:function:: int MRIStepGetJacNumSteps(void* arkode_mem, long int* nst_J) Returns the value of the internal step counter at which the internally stored copy of the @@ -3006,6 +2253,11 @@ Linear Solver) has been added here (e.g. *lenrwLS*). :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL`` :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetJacNumSteps` instead. + + .. c:function:: int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS) Returns the real and integer workspace used by the ARKLS linear solver interface. @@ -3035,6 +2287,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). In a parallel setting, the above values are global (i.e., summed over all processors). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLinWorkSpace` instead. + .. c:function:: int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals) @@ -3058,6 +2314,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJacEvals` instead. + .. c:function:: int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals) @@ -3083,6 +2343,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumPrecEvals` instead. + .. c:function:: int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves) @@ -3107,6 +2371,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumPrecSolves` instead. + .. c:function:: int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters) @@ -3130,6 +2398,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinIters` instead. + .. c:function:: int MRIStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails) @@ -3153,6 +2425,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinConvFails` instead. + .. c:function:: int MRIStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetup) @@ -3177,6 +2453,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJTSetupEvals` instead. + .. c:function:: int MRIStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals) @@ -3201,6 +2481,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumJtimesEvals` instead. + .. c:function:: int MRIStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) @@ -3230,6 +2514,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). solver object; the counter is reset whenever a new linear solver module is "attached" to MRIStep, or when MRIStep is resized. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumLinRhsEvals` instead. + .. c:function:: int MRIStepGetLastLinFlag(void* arkode_mem, long int* lsflag) @@ -3285,8 +2573,12 @@ Linear Solver) has been added here (e.g. *lenrwLS*). *SUN_ERR_EXT_FAIL*, indicating an unrecoverable failure in an external iterative linear solver package. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLastLinFlag` instead. + -.. c:function:: char *MRIStepGetLinReturnFlagName(long int lsflag) +.. c:function:: char* MRIStepGetLinReturnFlagName(long int lsflag) Returns the name of the ARKLS constant corresponding to *lsflag*. @@ -3299,6 +2591,10 @@ Linear Solver) has been added here (e.g. *lenrwLS*). ``SUNLINSOL_BAND`` modules, then if 1 :math:`\le` `lsflag` :math:`\le n` (LU factorization failed), this routine returns "NONE". + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLinReturnFlagName` instead. + @@ -3307,25 +2603,6 @@ Linear Solver) has been added here (e.g. *lenrwLS*). General usability functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following optional routines may be called by a user to inquire -about existing solver parameters or write the current MRI coupling table. While -neither of these would typically be called during the course of solving an -initial value problem, these may be useful for users wishing to better -understand MRIStep. - - -.. _ARKODE.Usage.MRIStep.MRIStepExtraOutputs.Table: -.. table:: General usability functions - - +-----------------------------------------------+-------------------------------------------+ - | Optional routine | Function name | - +-----------------------------------------------+-------------------------------------------+ - | Output all MRIStep solver parameters | :c:func:`MRIStepWriteParameters()` | - +-----------------------------------------------+-------------------------------------------+ - | Output the current MRI coupling table | :c:func:`MRIStepWriteCoupling()` | - +-----------------------------------------------+-------------------------------------------+ - - .. c:function:: int MRIStepWriteParameters(void* arkode_mem, FILE *fp) Outputs all MRIStep solver parameters to the provided file pointer. @@ -3349,6 +2626,10 @@ understand MRIStep. for this pointer, since parameters for all processes would be identical. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeWriteParameters` instead. + .. c:function:: int MRIStepWriteCoupling(void* arkode_mem, FILE *fp) @@ -3467,47 +2748,6 @@ vector. MRIStep reset function ---------------------- -To reset the MRIStep module to a particular state :math:`(t_R,y(t_R))` for the -continued solution of a problem, where a prior -call to :c:func:`MRIStepCreate()` has been made, the user must call the function -:c:func:`MRIStepReset()`. Like :c:func:`MRIStepReInit()` this routine retains -the current settings for all MRIStep module options and performs no memory -allocations but, unlike :c:func:`MRIStepReInit()`, this routine performs only a -*subset* of the input checking and initializations that are done in -:c:func:`MRIStepCreate()`. In particular this routine retains all internal -counter values and the step size/error history and does not reinitialize the -linear and/or nonlinear solver but it does indicate that a linear solver setup -is necessary in the next step. Like :c:func:`MRIStepReInit()`, a call to -:c:func:`MRIStepReset()` will delete any previously-set *tstop* value specified -via a call to :c:func:`MRIStepSetStopTime()`. Following a successful call to -:c:func:`MRIStepReset()`, call :c:func:`MRIStepEvolve()` again to continue -solving the problem. By default the next call to :c:func:`MRIStepEvolve()` will -use the step size computed by MRIStep prior to calling :c:func:`MRIStepReset()`. -To set a different step size use :c:func:`MRIStepSetFixedStep`. - -.. - To set a different step size or have MRIStep estimate a new step size use - :c:func:`MRIStepSetInitStep()`. - -One important use of the :c:func:`MRIStepReset()` function is in the -treating of jump discontinuities in the RHS functions. Except in cases -of fairly small jumps, it is usually more efficient to stop at each -point of discontinuity and restart the integrator with a readjusted -ODE model, using a call to :c:func:`MRIStepReset()`. To stop when -the location of the discontinuity is known, simply make that location -a value of ``tout``. To stop when the location of the discontinuity -is determined by the solution, use the rootfinding feature. In either -case, it is critical that the RHS functions *not* incorporate the -discontinuity, but rather have a smooth extension over the -discontinuity, so that the step across it (and subsequent rootfinding, -if used) can be done efficiently. Then use a switch within the RHS -functions (communicated through ``user_data``) that can be flipped -between the stopping of the integration and the restart, so that the -restarted problem uses the new values (which have jumped). Similar -comments apply if there is to be a jump in the dependent variable -vector. - - .. c:function:: int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) Resets the current MRIStep outer (slow) time-stepper module state to the @@ -3547,6 +2787,10 @@ vector. (*tR*, *yR*) arguments for the :c:type:`MRIStepInnerStepper` object that is used to evolve the MRI "fast" time scale subproblems. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeReset` instead. + .. _ARKODE.Usage.MRIStep.Resizing: @@ -3554,22 +2798,6 @@ vector. MRIStep system resize function ------------------------------------- -For simulations involving changes to the number of equations and -unknowns in the ODE system (e.g. when using spatially-adaptive -PDE simulations under a method-of-lines approach), the MRIStep -integrator may be "resized" between *slow* integration steps, through calls -to the :c:func:`MRIStepResize()` function. This function modifies -MRIStep's internal memory structures to use the new problem size. - -To aid in the vector resize operation, the user can supply a vector -resize function that will take as input a vector with the previous -size, and transform it in-place to return a corresponding vector of -the new size. If this function (of type :c:func:`ARKVecResizeFn()`) -is not supplied (i.e., is set to ``NULL``), then all existing vectors -internal to MRIStep will be destroyed and re-cloned from the new input -vector. - - .. c:function:: int MRIStepResize(void* arkode_mem, N_Vector yR, sunrealtype tR, ARKVecResizeFn resize, void* resize_data) Re-initializes MRIStep with a different state vector. @@ -3636,3 +2864,7 @@ vector. For an example showing usage of the similar :c:func:`ARKStepResize()` routine, see the supplied serial C example problem, ``ark_heat1D_adapt.c``. + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeResize` instead. diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/index.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/index.rst index d22e91746f..a1d91c144b 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/index.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/index.rst @@ -19,23 +19,11 @@ Using the MRIStep time-stepping module ========================================== -This chapter is concerned with the use of the MRIStep time-stepping module for -the solution of multirate initial value problems (IVPs) of the form -:eq:`ARKODE_IVP_two_rate` in a C or C++ language setting. The following sections -discuss the header files and the layout of the user's main program, and provide -descriptions of the MRIStep user-callable functions and user-supplied functions. - -The example programs located in the source code ``examples/arkode`` -folder, including those described in the companion document :cite:p:`arkode_ex`, -may be helpful as templates for new codes. - -MRIStep uses the input and output constants from the shared ARKODE -infrastructure. These are defined as needed in this chapter, but for -convenience the full list is provided separately in -:numref:`ARKODE.Constants`. - -The relevant information on using MRIStep's C and C++ interfaces is -detailed in the following subsections. +This section is concerned with the use of the MRIStep time-stepping +module for the solution of initial value problems (IVPs) in a C or C++ +language setting. Usage of MRIStep follows that of the rest of ARKODE, +and so in this section we primarily focus on those usage aspects that +are specific to MRIStep. .. toctree:: :maxdepth: 1 diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Preconditioners.rst b/doc/arkode/guide/source/Usage/Preconditioners.rst similarity index 62% rename from doc/arkode/guide/source/Usage/ARKStep_c_interface/Preconditioners.rst rename to doc/arkode/guide/source/Usage/Preconditioners.rst index d772f5ad4a..9e47fc4d81 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Preconditioners.rst +++ b/doc/arkode/guide/source/Usage/Preconditioners.rst @@ -12,7 +12,7 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. _ARKODE.Usage.ARKStep.PreconditionerModules: +.. _ARKODE.Usage.PreconditionerModules: Preconditioner modules ============================ @@ -20,13 +20,12 @@ Preconditioner modules The efficiency of Krylov iterative methods for the solution of linear systems can be greatly enhanced through preconditioning. For problems in which the user cannot define a more effective, problem-specific -preconditioner, ARKODE provides two internal preconditioner modules -that may be used by ARKStep: a banded preconditioner for serial and -threaded problems (ARKBANDPRE) and a band-block-diagonal -preconditioner for parallel problems (ARKBBDPRE). +preconditioner, ARKODE provides two internal preconditioner modules: +a banded preconditioner for serial and threaded problems (ARKBANDPRE) +and a band-block-diagonal preconditioner for parallel problems (ARKBBDPRE). -.. _ARKODE.Usage.ARKStep.BandPre: +.. _ARKODE.Usage.BandPre: A serial banded preconditioner module ------------------------------------------- @@ -63,29 +62,31 @@ for the integration of the ODE problem (see program must include the header file ``arkode_bandpre.h`` which declares the needed function prototypes. The following is a summary of the usage of this module. Steps that are unchanged from the -skeleton program presented in :numref:`ARKODE.Usage.ARKStep.Skeleton` are +skeleton program presented in :numref:`ARKODE.Usage.Skeleton` are *italicized*. -1. *Initialize multi-threaded environment (if appropriate)* +#. *Initialize multi-threaded environment (if appropriate)* -2. *Set problem dimensions* +#. *Create the SUNDIALS simulation context object.* -3. *Set vector of initial values* +#. *Set problem dimensions* -4. *Create ARKStep object* +#. *Set vector of initial values* -5. *Specify integration tolerances* +#. *Create ARKODE object* -6. Create iterative linear solver object +#. *Specify integration tolerances* + +#. Create iterative linear solver object When creating the iterative linear solver object, specify the type of preconditioning (``SUN_PREC_LEFT`` or ``SUN_PREC_RIGHT``) to use. -7. *Set linear solver optional inputs* +#. *Set linear solver optional inputs* -8. *Attach linear solver module* +#. *Attach linear solver module* -9. Initialize the ARKBANDPRE preconditioner module +#. Initialize the ARKBANDPRE preconditioner module Specify the upper and lower half-bandwidths (``mu`` and ``ml``, respectively) and call @@ -95,34 +96,36 @@ skeleton program presented in :numref:`ARKODE.Usage.ARKStep.Skeleton` are to allocate memory and initialize the internal preconditioner data. -10. *Set optional inputs* +#. *Create nonlinear solver object* + +#. *Attach nonlinear solver module* - Note that the user should not call - :c:func:`ARKStepSetPreconditioner()` as it will overwrite the - preconditioner setup and solve functions. +#. *Set nonlinear solver optional inputs* -11. *Create nonlinear solver object* +#. *Set optional inputs* -12. *Attach nonlinear solver module* + Note that the user should not call + :c:func:`ARKodeSetPreconditioner()` as it will overwrite the + preconditioner setup and solve functions. -13. *Set nonlinear solver optional inputs* +#. *Specify rootfinding problem* -14. *Specify rootfinding problem* +#. *Advance solution in time* -15. *Advance solution in time* +#. Get optional outputs -16. Get optional outputs + Additional optional outputs associated with ARKBANDPRE are + available by way of the two routines described below, + :c:func:`ARKBandPrecGetWorkSpace()` and + :c:func:`ARKBandPrecGetNumRhsEvals()`. - Additional optional outputs associated with ARKBANDPRE are - available by way of the two routines described below, - :c:func:`ARKBandPrecGetWorkSpace()` and - :c:func:`ARKBandPrecGetNumRhsEvals()`. +#. *Deallocate memory for solution vector* -17. *Deallocate memory for solution vector* +#. *Free solver memory* -18. *Free solver memory* +#. *Free linear solver memory* -19. *Free linear solver memory* +#. *Free nonlinear solver memory* @@ -141,20 +144,19 @@ by calling the following function: Initializes the ARKBANDPRE preconditioner and allocates required (internal) memory for it. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *N* -- problem dimension (size of ODE system). - * *mu* -- upper half-bandwidth of the Jacobian approximation. - * *ml* -- lower half-bandwidth of the Jacobian approximation. + :param arkode_mem: pointer to the ARKODE memory block. + :param N: problem dimension (size of ODE system). + :param mu: upper half-bandwidth of the Jacobian approximation. + :param ml: lower half-bandwidth of the Jacobian approximation. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_MEM_FAIL: a memory allocation request failed. - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_ILL_INPUT* if an input has an illegal value - * *ARKLS_MEM_FAIL* if a memory allocation request failed + .. note:: - **Notes:** The banded approximate Jacobian will have nonzero elements only in locations :math:`(i,j)` with *ml* :math:`\le j-i \le` *mu*. @@ -170,26 +172,25 @@ the ARKBANDPRE module: Returns the sizes of the ARKBANDPRE real and integer workspaces. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *lenrwLS* -- the number of ``sunrealtype`` values in the - ARKBANDPRE workspace. - * *leniwLS* -- the number of integer values in the ARKBANDPRE workspace. + :param arkode_mem: pointer to the ARKODE memory block. + :param lenrwLS: the number of ``sunrealtype`` values in the + ARKBANDPRE workspace. + :param leniwLS: the number of integer values in the ARKBANDPRE workspace. - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_PMEM_NULL* if the preconditioner memory is ``NULL`` + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_PMEM_NULL: the preconditioner memory was ``NULL``. + + .. note:: - **Notes:** The workspace requirements reported by this routine correspond only to memory allocated within the ARKBANDPRE module (the banded matrix approximation, banded ``SUNLinearSolver`` object, and temporary vectors). The workspaces referred to here exist in addition to those given by - the corresponding function :c:func:`ARKStepGetLinWorkSpace()`. + the corresponding function :c:func:`ARKodeGetLinWorkSpace()`. @@ -200,30 +201,29 @@ the ARKBANDPRE module: finite-difference banded Jacobian approximation used within the preconditioner setup function. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *nfevalsBP* -- number of calls to :math:`f^I`. + :param arkode_mem: pointer to the ARKODE memory block. + :param nfevalsBP: number of calls to :math:`f^I`. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_PMEM_NULL: the preconditioner memory was ``NULL``. - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_PMEM_NULL* if the preconditioner memory is ``NULL`` + .. note:: - **Notes:** The counter *nfevalsBP* is distinct from the counter *nfevalsLS* returned by the corresponding function - :c:func:`ARKStepGetNumLinRhsEvals()` and also from *nfi_evals* returned by - :c:func:`ARKStepGetNumRhsEvals()`. The total number of right-hand - side function evaluations is the sum of all three of these - counters, plus the *nfe_evals* counter for :math:`f^E` calls - returned by :c:func:`ARKStepGetNumRhsEvals()`. + :c:func:`ARKodeGetNumLinRhsEvals()` and also from the number of + evaluations returned by the time-stepping module (e.g., *nfi_evals* + returned by :c:func:`ARKStepGetNumRhsEvals()`). The total number of + right-hand side function evaluations is the sum of all three of these + counters. -.. _ARKODE.Usage.ARKStep.BBDPre: +.. _ARKODE.Usage.BBDPre: A parallel band-block-diagonal preconditioner module --------------------------------------------------------- @@ -242,9 +242,8 @@ preconditioner must be problem-specific. However, we have developed one type of preconditioner that treats a rather broad class of PDE-based problems. It has been successfully -used with CVODE for several realistic, large-scale problems :cite:p:`HiTa:98`. -It is included in a software module within the ARKODE package, and is -accessible within the ARKStep time stepping module. This +used with CVODE for several realistic, large-scale problems :cite:p:`HiTa:98`, +and is included in a software module within the ARKODE package. This preconditioning module works with the parallel vector module NVECTOR_PARALLEL and is usable with any of the Krylov iterative linear solvers through the ARKLS interface. It generates a preconditioner @@ -339,7 +338,7 @@ communication necessary to evaluate the approximate right-hand side :math:`g`. These are in addition to the user-supplied right-hand side function :math:`f^I`. Both functions take as input the same pointer *user_data* that is passed by the user to -:c:func:`ARKStepSetUserData()` and that was passed to the user's +:c:func:`ARKodeSetUserData()` and that was passed to the user's function :math:`f^I`. The user is responsible for providing space (presumably within *user_data*) for components of :math:`y` that are communicated between processes by *cfn*, and that are then used by @@ -352,22 +351,21 @@ communicated between processes by *cfn*, and that are then used by This *gloc* function computes :math:`g(t,y)`. It fills the vector *glocal* as a function of *t* and *y*. - **Arguments:** - * *Nlocal* -- the local vector length. - * *t* -- the value of the independent variable. - * *y* -- the value of the dependent variable vector on this process. - * *glocal* -- the output vector of :math:`g(t,y)` on this process. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter passed to :c:func:`ARKStepSetUserData()`. - - **Return value:** - An *ARKLocalFn* should return 0 if successful, a positive value if - a recoverable error occurred (in which case ARKStep will attempt to - correct), or a negative value if it failed unrecoverably (in which - case the integration is halted and :c:func:`ARKStepEvolve()` will return - *ARK_LSETUP_FAIL*). - - **Notes:** + :param Nlocal: the local vector length. + :param t: the value of the independent variable. + :param y: the value of the dependent variable vector on this process. + :param glocal: the output vector of :math:`g(t,y)` on this process. + :param user_data: a pointer to user data, the same as the + *user_data* parameter passed to :c:func:`ARKodeSetUserData()`. + + :return: An *ARKLocalFn* should return 0 if successful, a positive value if + a recoverable error occurred (in which case ARKODE will attempt to + correct), or a negative value if it failed unrecoverably (in which + case the integration is halted and :c:func:`ARKodeEvolve()` will return + *ARK_LSETUP_FAIL*). + + .. note:: + This function should assume that all inter-process communication of data needed to calculate *glocal* has already been done, and that this data is accessible within user data. @@ -383,21 +381,20 @@ communicated between processes by *cfn*, and that are then used by communication necessary for the execution of the *gloc* function above, using the input vector *y*. - **Arguments:** - * *Nlocal* -- the local vector length. - * *t* -- the value of the independent variable. - * *y* -- the value of the dependent variable vector on this process. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter passed to :c:func:`ARKStepSetUserData()`. - - **Return value:** - An *ARKCommFn* should return 0 if successful, a positive value if a - recoverable error occurred (in which case ARKStep will attempt to - correct), or a negative value if it failed unrecoverably (in which - case the integration is halted and :c:func:`ARKStepEvolve()` will return - *ARK_LSETUP_FAIL*). - - **Notes:** + :param Nlocal: the local vector length. + :param t: the value of the independent variable. + :param y: the value of the dependent variable vector on this process. + :param user_data: a pointer to user data, the same as the + *user_data* parameter passed to :c:func:`ARKodeSetUserData()`. + + :return: An *ARKCommFn* should return 0 if successful, a positive value if a + recoverable error occurred (in which case ARKODE will attempt to + correct), or a negative value if it failed unrecoverably (in which + case the integration is halted and :c:func:`ARKodeEvolve()` will return + *ARK_LSETUP_FAIL*). + + .. note:: + The *cfn* function is expected to save communicated data in space defined within the data structure *user_data*. @@ -422,28 +419,30 @@ ARKBBDPRE module, the user's program must include the header file The following is a summary of the proper usage of this module. Steps that are unchanged from the skeleton program presented in -:numref:`ARKODE.Usage.ARKStep.Skeleton` are *italicized*. +:numref:`ARKODE.Usage.Skeleton` are *italicized*. + +#. *Initialize MPI* -1. *Initialize MPI* +#. *Create the SUNDIALS simulation context object* -2. *Set problem dimensions* +#. *Set problem dimensions* -3. *Set vector of initial values* +#. *Set vector of initial values* -4. *Create ARKStep object* +#. *Create ARKODE object* -5. *Specify integration tolerances* +#. *Specify integration tolerances* -6. Create iterative linear solver object +#. Create iterative linear solver object When creating the iterative linear solver object, specify the type of preconditioning (``SUN_PREC_LEFT`` or ``SUN_PREC_RIGHT``) to use. -7. *Set linear solver optional inputs* +#. *Set linear solver optional inputs* -8. *Attach linear solver module* +#. *Attach linear solver module* -9. Initialize the ARKBBDPRE preconditioner module +#. Initialize the ARKBBDPRE preconditioner module Specify the upper and lower half-bandwidths for computation ``mudq`` and ``mldq``, the upper and lower half-bandwidths for @@ -456,36 +455,38 @@ that are unchanged from the skeleton program presented in two user-supplied functions of type :c:func:`ARKLocalFn()` and :c:func:`ARKCommFn()` described above, respectively. -10. *Set optional inputs* +#. *Create nonlinear solver object* - Note that the user should not call - :c:func:`ARKStepSetPreconditioner()` as it will overwrite the - preconditioner setup and solve functions. +#. *Attach nonlinear solver module* -11. *Create nonlinear solver object* +#. *Set nonlinear solver optional inputs* -12. *Attach nonlinear solver module* +#. *Set optional inputs* -13. *Set nonlinear solver optional inputs* + Note that the user should not call + :c:func:`ARKodeSetPreconditioner()` as it will overwrite the + preconditioner setup and solve functions. -14. *Specify rootfinding problem* +#. *Specify rootfinding problem* -15. *Advance solution in time* +#. *Advance solution in time* -16. *Get optional outputs* +#. *Get optional outputs* - Additional optional outputs associated with ARKBBDPRE are - available through the routines - :c:func:`ARKBBDPrecGetWorkSpace()` and - :c:func:`ARKBBDPrecGetNumGfnEvals()`. + Additional optional outputs associated with ARKBBDPRE are + available through the routines + :c:func:`ARKBBDPrecGetWorkSpace()` and + :c:func:`ARKBBDPrecGetNumGfnEvals()`. -17. *Deallocate memory for solution vector* +#. *Deallocate memory for solution vector* -18. *Free solver memory* +#. *Free solver memory* -19. *Free linear solver memory* +#. *Free linear solver memory* -20. *Finalize MPI* +#. *Free nonlinear solver memory* + +#. *Finalize MPI* @@ -502,35 +503,34 @@ and attached to the integrator by calling the following functions: Initializes and allocates (internal) memory for the ARKBBDPRE preconditioner. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *Nlocal* -- local vector length. - * *mudq* -- upper half-bandwidth to be used in the difference - quotient Jacobian approximation. - * *mldq* -- lower half-bandwidth to be used in the difference - quotient Jacobian approximation. - * *mukeep* -- upper half-bandwidth of the retained banded - approximate Jacobian block. - * *mlkeep* -- lower half-bandwidth of the retained banded - approximate Jacobian block. - * *dqrely* -- the relative increment in components of *y* used in - the difference quotient approximations. The default is *dqrely* - = :math:`\sqrt{\text{unit roundoff}}`, which can be specified by - passing *dqrely* = 0.0. - * *gloc* -- the name of the C function (of type :c:func:`ARKLocalFn()`) - which computes the approximation :math:`g(t,y) \approx f^I(t,y)`. - * *cfn* -- the name of the C function (of type :c:func:`ARKCommFn()`) which - performs all inter-process communication required for the - computation of :math:`g(t,y)`. - - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_ILL_INPUT* if an input has an illegal value - * *ARKLS_MEM_FAIL* if a memory allocation request failed - - **Notes:** + :param arkode_mem: pointer to the ARKODE memory block. + :param Nlocal: local vector length. + :param mudq: upper half-bandwidth to be used in the difference + quotient Jacobian approximation. + :param mldq: lower half-bandwidth to be used in the difference + quotient Jacobian approximation. + :param mukeep: upper half-bandwidth of the retained banded + approximate Jacobian block. + :param mlkeep: lower half-bandwidth of the retained banded + approximate Jacobian block. + :param dqrely: the relative increment in components of *y* used in + the difference quotient approximations. The default is *dqrely* + = :math:`\sqrt{\text{unit roundoff}}`, which can be specified by + passing *dqrely* = 0.0. + :param gloc: the name of the C function (of type :c:func:`ARKLocalFn()`) + which computes the approximation :math:`g(t,y) \approx f^I(t,y)`. + :param cfn: the name of the C function (of type :c:func:`ARKCommFn()`) which + performs all inter-process communication required for the + computation of :math:`g(t,y)`. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_MEM_FAIL: a memory allocation request failed. + + .. note:: + If one of the half-bandwidths *mudq* or *mldq* to be used in the difference quotient calculation of the approximate Jacobian is negative or exceeds the value *Nlocal*-1, it is replaced by 0 or @@ -554,7 +554,7 @@ The ARKBBDPRE module also provides a re-initialization function to allow solving a sequence of problems of the same size, with the same linear solver choice, provided there is no change in *Nlocal*, *mukeep*, or *mlkeep*. After solving one problem, and after -calling :c:func:`ARKStepReInit()` to re-initialize ARKStep for a +calling ``*StepReInit`` to re-initialize ARKODE for a subsequent problem, a call to :c:func:`ARKBBDPrecReInit()` can be made to change any of the following: the half-bandwidths *mudq* and *mldq* used in the difference-quotient Jacobian approximations, the @@ -562,31 +562,30 @@ relative increment *dqrely*, or one of the user-supplied functions *gloc* and *cfn*. If there is a change in any of the linear solver inputs, an additional call to the "Set" routines provided by the SUNLINSOL module, and/or one or more of the corresponding -``ARKStepSet***`` functions, must also be made (in the proper order). +``ARKodeSet***`` functions, must also be made (in the proper order). .. c:function:: int ARKBBDPrecReInit(void* arkode_mem, sunindextype mudq, sunindextype mldq, sunrealtype dqrely) Re-initializes the ARKBBDPRE preconditioner module. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *mudq* -- upper half-bandwidth to be used in the difference - quotient Jacobian approximation. - * *mldq* -- lower half-bandwidth to be used in the difference - quotient Jacobian approximation. - * *dqrely* -- the relative increment in components of *y* used in - the difference quotient approximations. The default is *dqrely* - = :math:`\sqrt{\text{unit roundoff}}`, which can be specified by - passing *dqrely* = 0.0. - - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_PMEM_NULL* if the preconditioner memory is ``NULL`` - - **Notes:** + :param arkode_mem: pointer to the ARKODE memory block. + :param mudq: upper half-bandwidth to be used in the difference + quotient Jacobian approximation. + :param mldq: lower half-bandwidth to be used in the difference + quotient Jacobian approximation. + :param dqrely: the relative increment in components of *y* used in + the difference quotient approximations. The default is *dqrely* + = :math:`\sqrt{\text{unit roundoff}}`, which can be specified by + passing *dqrely* = 0.0. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_PMEM_NULL: the preconditioner memory was ``NULL``. + + .. note:: + If one of the half-bandwidths *mudq* or *mldq* is negative or exceeds the value *Nlocal*-1, it is replaced by 0 or *Nlocal*-1 accordingly. @@ -601,26 +600,25 @@ the ARKBBDPRE module: Returns the processor-local ARKBBDPRE real and integer workspace sizes. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *lenrwBBDP* -- the number of ``sunrealtype`` values in the - ARKBBDPRE workspace. - * *leniwBBDP* -- the number of integer values in the ARKBBDPRE workspace. + :param arkode_mem: pointer to the ARKODE memory block. + :param lenrwBBDP: the number of ``sunrealtype`` values in the + ARKBBDPRE workspace. + :param leniwBBDP: the number of integer values in the ARKBBDPRE workspace. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_PMEM_NULL: the preconditioner memory was ``NULL``. - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_PMEM_NULL* if the preconditioner memory is ``NULL`` + .. note:: - **Notes:** The workspace requirements reported by this routine correspond only to memory allocated within the ARKBBDPRE module (the banded matrix approximation, banded ``SUNLinearSolver`` object, temporary vectors). These values are local to each process. The workspaces referred to here exist in addition to those given by - the corresponding function :c:func:`ARKStepGetLinWorkSpace()`. + the corresponding function :c:func:`ARKodeGetLinWorkSpace()`. @@ -631,22 +629,20 @@ the ARKBBDPRE module: difference approximation of the Jacobian blocks used within the preconditioner setup function. - **Arguments:** - * *arkode_mem* -- pointer to the ARKStep memory block. - * *ngevalsBBDP* -- the number of calls made to the user-supplied - *gloc* function. + :param arkode_mem: pointer to the ARKODE memory block. + :param ngevalsBBDP: the number of calls made to the user-supplied + *gloc* function. - **Return value:** - * *ARKLS_SUCCESS* if no errors occurred - * *ARKLS_MEM_NULL* if the ARKStep memory is ``NULL`` - * *ARKLS_LMEM_NULL* if the linear solver memory is ``NULL`` - * *ARKLS_PMEM_NULL* if the preconditioner memory is ``NULL`` + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_PMEM_NULL: the preconditioner memory was ``NULL``. In addition to the *ngevalsBBDP* *gloc* evaluations, the costs associated with ARKBBDPRE also include *nlinsetups* LU factorizations, *nlinsetups* calls to *cfn*, *npsolves* banded backsolve calls, and *nfevalsLS* right-hand side function -evaluations, where *nlinsetups* is an optional ARKStep output and +evaluations, where *nlinsetups* is an optional ARKODE output and *npsolves* and *nfevalsLS* are linear solver optional outputs (see -the table :numref:`ARKODE.Usage.ARKStep.ARKLsOutputs`). +the table :numref:`ARKODE.Usage.ARKLsOutputs`). diff --git a/doc/arkode/guide/source/Usage/Relaxation.rst b/doc/arkode/guide/source/Usage/Relaxation.rst new file mode 100644 index 0000000000..f69c60e392 --- /dev/null +++ b/doc/arkode/guide/source/Usage/Relaxation.rst @@ -0,0 +1,359 @@ +.. ----------------------------------------------------------------------------- + Programmer(s): David J. Gardner @ LLNL + ----------------------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2024, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ----------------------------------------------------------------------------- + +.. _ARKODE.Usage.Relaxation: + +Relaxation Methods +================== + +This section describes user-callable functions for applying relaxation methods +with ARKODE. For more information on relaxation Runge--Kutta methods see +:numref:`ARKODE.Mathematics.Relaxation`. + +.. warning:: + + Relaxation support as not been evaluated with non-identity mass matrices. + While this usage mode is supported, feedback from users who explore this + combination would be appreciated. + +Enabling or Disabling Relaxation +-------------------------------- + +.. c:function:: int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) + + Attaches the user supplied functions for evaluating the relaxation function + (``rfn``) and its Jacobian (``rjac``). + + Both ``rfn`` and ``rjac`` are required and an error will be returned if only + one of the functions is ``NULL``. If both ``rfn`` and ``rjac`` are ``NULL``, + relaxation is disabled. + + With DIRK and IMEX-ARK methods or when a fixed mass matrix is present, + applying relaxation requires allocating :math:`s` additional state vectors + (where :math:`s` is the number of stages in the method). + + :param arkode_mem: the ARKODE memory structure + :param rfn: the user-defined function to compute the relaxation function + :math:`\xi(y)` + :param rjac: the user-defined function to compute the relaxation Jacobian + :math:`\xi'(y)` + + :retval ARK_SUCCESS: the function exited successfully + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_ILL_INPUT: an invalid input combination was provided (see the + output error message for more details) + :retval ARK_MEM_FAIL: a memory allocation failed + + .. warning:: + + Applying relaxation requires using a method of at least second order with + :math:`b^E_i \geq 0` and :math:`b^I_i \geq 0`. If these conditions are not + satisfied, :c:func:`ARKodeEvolve` will return with an error during + initialization. + + .. note:: + + When combined with fixed time step sizes, ARKODE will attempt each step + using the specified step size. If the step is successful, relaxation will + be applied, effectively modifying the step size for the current step. If + the step fails or applying relaxation fails, :c:func:`ARKodeEvolve` will + return with an error. + + .. versionadded:: x.y.z + +Optional Input Functions +------------------------ + +This section describes optional input functions used to control applying +relaxation. + +.. c:function:: int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf) + + Sets the step size reduction factor applied after a failed relaxation + application. + + The default value is 0.25. Input values :math:`\leq 0` or :math:`\geq 1` will + result in the default value being used. + + :param arkode_mem: the ARKODE memory structure + :param eta_rf: the step size reduction factor + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) + + Sets the smallest acceptable value for the relaxation parameter. + + Values smaller than the lower bound will result in a failed relaxation + application and the step will be repeated with a smaller step size + (determined by :c:func:`ARKodeSetRelaxEtaFail`). + + The default value is 0.8. Input values :math:`\leq 0` or :math:`\geq 1` will + result in the default value being used. + + :param arkode_mem: the ARKODE memory structure + :param lower: the relaxation parameter lower bound + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) + + Sets the largest acceptable value for the relaxation parameter. + + Values larger than the upper bound will result in a failed relaxation + application and the step will be repeated with a smaller step size + (determined by :c:func:`ARKodeSetRelaxEtaFail`). + + The default value is 1.2. Input values :math:`\leq 1` will result in the + default value being used. + + :param arkode_mem: the ARKODE memory structure + :param upper: the relaxation parameter upper bound + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails) + + Sets the maximum number of times applying relaxation can fail within a step + attempt before the integration is halted with an error. + + The default value is 10. Input values :math:`\leq 0` will result in the + default value being used. + + :param arkode_mem: the ARKODE memory structure + :param max_fails: the maximum number of failed relaxation applications + allowed in a step + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters) + + Sets the maximum number of nonlinear iterations allowed when solving for the + relaxation parameter. + + If the maximum number of iterations is reached before meeting the solve + tolerance (determined by :c:func:`ARKodeSetRelaxResTol` and + :c:func:`ARKodeSetRelaxTol`), the step will be repeated with a smaller + step size (determined by :c:func:`ARKodeSetRelaxEtaFail`). + + The default value is 10. Input values :math:`\leq 0` will result in the + default value being used. + + :param arkode_mem: the ARKODE memory structure + :param max_iters: the maximum number of solver iterations allowed + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) + + Sets the nonlinear solver method used to compute the relaxation parameter. + + The default value is ``ARK_RELAX_NEWTON``. + + :param arkode_mem: the ARKODE memory structure + :param solver: the nonlinear solver to use: ``ARK_RELAX_BRENT`` or + ``ARK_RELAX_NEWTON`` + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + :retval ARK_ILL_INPUT: an invalid solver option was provided + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) + + Sets the nonlinear solver residual tolerance to use when solving + :eq:`ARKODE_RELAX_NLS`. + + If the residual or iteration update tolerance (see + :c:func:`ARKodeSetRelaxMaxIters`) is not reached within the maximum number of + iterations (determined by :c:func:`ARKodeSetRelaxMaxIters`), the step will + be repeated with a smaller step size (determined by + :c:func:`ARKodeSetRelaxEtaFail`). + + The default value is :math:`4 \epsilon` where :math:`\epsilon` is + floating-point precision. Input values :math:`\leq 0` will result in the + default value being used. + + :param arkode_mem: the ARKODE memory structure + :param res_tol: the nonlinear solver residual tolerance to use + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol) + + Sets the nonlinear solver relative and absolute tolerance on changes in + :math:`r` iterates when solving :eq:`ARKODE_RELAX_NLS`. + + If the residual (see :c:func:`ARKodeSetRelaxResTol`) or iterate update + tolerance is not reached within the maximum number of iterations (determined + by :c:func:`ARKodeSetRelaxMaxIters`), the step will be repeated with a + smaller step size (determined by :c:func:`ARKodeSetRelaxEtaFail`). + + The default relative and absolute tolerances are :math:`4 \epsilon` and + :math:`10^{-14}`, respectively, where :math:`\epsilon` is floating-point + precision. Input values :math:`\leq 0` will result in the default value being + used. + + :param arkode_mem: the ARKODE memory structure + :param rel_tol: the nonlinear solver relative solution tolerance to use + :param abs_tol: the nonlinear solver absolute solution tolerance to use + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +Optional Output Functions +------------------------- + +This section describes optional output functions used to retrieve information +about the performance of the relaxation method. + +.. c:function:: int ARKodeGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) + + Get the number of times the user's relaxation function was evaluated. + + :param arkode_mem: the ARKODE memory structure + :param r_evals: the number of relaxation function evaluations + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) + + Get the number of times the user's relaxation Jacobian was evaluated. + + :param arkode_mem: the ARKODE memory structure + :param J_evals: the number of relaxation Jacobian evaluations + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumRelaxFails(void* arkode_mem, long int* fails) + + Get the total number of times applying relaxation failed. + + The counter includes the sum of the number of nonlinear solver failures + (see :c:func:`ARKodeGetNumRelaxSolveFails`) and the number of failures due + an unacceptable relaxation value (see :c:func:`ARKodeSetRelaxLowerBound` and + :c:func:`ARKodeSetRelaxUpperBound`). + + :param arkode_mem: the ARKODE memory structure + :param fails: the total number of failed relaxation attempts + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumRelaxBoundFails(void* arkode_mem, long int* fails) + + Get the number of times the relaxation parameter was deemed unacceptable. + + :param arkode_mem: the ARKODE memory structure + :param fails: the number of failures due to an unacceptable relaxation + parameter value + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumRelaxSolveFails(void* arkode_mem, long int* fails) + + Get the number of times the relaxation parameter nonlinear solver failed. + + :param arkode_mem: the ARKODE memory structure + :param fails: the number of relaxation nonlinear solver failures + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumRelaxSolveIters(void* arkode_mem, long int* iters) + + Get the number of relaxation parameter nonlinear solver iterations. + + :param arkode_mem: the ARKODE memory structure + :param iters: the number of relaxation nonlinear solver iterations + + :retval ARK_SUCCESS: the value was successfully set + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL`` + :retval ARK_RELAX_MEM_NULL: the internal relaxation memory structure was + ``NULL`` + + .. versionadded:: x.y.z diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/Skeleton.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/Skeleton.rst deleted file mode 100644 index 2cf457359c..0000000000 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/Skeleton.rst +++ /dev/null @@ -1,143 +0,0 @@ -.. ---------------------------------------------------------------- - SUNDIALS Copyright Start - Copyright (c) 2002-2024, Lawrence Livermore National Security - and Southern Methodist University. - All rights reserved. - - See the top-level LICENSE and NOTICE files for details. - - SPDX-License-Identifier: BSD-3-Clause - SUNDIALS Copyright End - ---------------------------------------------------------------- - -.. _ARKODE.Usage.SPRKStep.Skeleton: - -A skeleton of the user's main program -============================================ - -The following is a skeleton of the user's main program (or calling -program) for the integration of an ODE IVP using the SPRKStep module. -Most of the steps are independent of the NVECTOR implementation used. -For the steps that are not, refer to :numref:`NVectors` for -the specific name of the function to be called or macro to be -referenced. - -.. index:: User main program - -#. Initialize parallel or multi-threaded environment, if appropriate. - - For example, call ``MPI_Init`` to initialize MPI if used, or set - ``num_threads``, the number of threads to use within the threaded - vector functions, if used. - -#. Create the SUNDIALS simulation context object. - - Call :c:func:`SUNContext_Create` to allocate the ``SUNContext`` object. - -#. Set problem dimensions, etc. - - This generally includes the problem size, ``N``, and may include - the local vector length ``Nlocal``. The problem size ``N`` is the - size including both the ``q`` and ``p`` variables. - - .. note:: - - The variables ``N`` and ``Nlocal`` should be of type - ``sunindextype``. - -#. Set vector of initial values - - To set the vector ``y0`` of initial values, use the appropriate - functions defined by the particular NVECTOR implementation. - The vector should include both the ``q`` and ``p`` variables. - - For most native SUNDIALS vector implementations, use a call of the form - - .. code-block:: c - - y0 = N_VMake_***(..., ydata); - - if the ``sunrealtype`` array ``ydata`` containing the initial values of - :math:`y` already exists. For some GPU-enabled vectors, a similar constructor - can be used to provide host and device data pointers. If the data array - does not already exist, create a new vector by making a call of the form - - .. code-block:: c - - y0 = N_VNew_***(...); - - and then set its elements by accessing the underlying data where it - is located with a call of the form - - .. code-block:: c - - ydata = N_VGetArrayPointer_***(y0); - - For details on each of SUNDIALS' provided vector implementations, see - the corresponding sections in :numref:`NVectors` for details. - -#. Create SPRKStep object - - Call ``arkode_mem = SPRKStepCreate(...)`` to create the SPRKStep memory - block. :c:func:`SPRKStepCreate` returns a ``void*`` pointer to - this memory structure. See :numref:`ARKODE.Usage.SPRKStep.Initialization` for - details. - -#. Specify time step size - - Call :c:func:`SPRKStepSetFixedStep()` to set the fixed time step size. - .. or :c:func:`SPRKStepAdaptivityFn()` to specify either a fixed time-step - .. size or a callback function that adapts the time-step size. SPRKStep - .. does not support error-based adaptivity like other ARKODE time-stepper - .. modules due to the incompatibility with symplectic methods. - -#. Set optional inputs - - Call ``SPRKStepSet*`` functions to change any optional inputs that - control the behavior of SPRKStep from their default values. See - :numref:`ARKODE.Usage.SPRKStep.OptionalInputs` for details. - -#. Specify rootfinding problem - - Optionally, call :c:func:`SPRKStepRootInit()` to initialize a rootfinding - problem to be solved during the integration of the ODE system. See - :numref:`ARKODE.Usage.SPRKStep.RootFinding` for general details, and - :numref:`ARKODE.Usage.SPRKStep.OptionalInputs` for relevant optional - input calls. - -#. Advance solution in time - - For each point at which output is desired, call - - .. code-block:: c - - ier = SPRKStepEvolve(arkode_mem, tout, yout, &tret, itask); - - Here, ``itask`` specifies the return mode. The vector ``yout`` - (which can be the same as the vector ``y0`` above) will contain - :math:`y(t_\text{out})`. See :numref:`ARKODE.Usage.SPRKStep.Integration` - for details. - -#. Get optional outputs - - Call ``SPRKStepGet*`` functions to obtain optional output. See - :numref:`ARKODE.Usage.SPRKStep.OptionalOutputs` for details. - -#. Deallocate memory for solution vector - - Upon completion of the integration, deallocate memory for the - vector ``y`` (or ``yout``) by calling the NVECTOR destructor - function: - - .. code-block:: c - - N_VDestroy(y); - -#. Free solver memory - - Call :c:func:`SPRKStepFree()` to free the memory allocated for - the SPRKStep module. - -#. Finalize MPI, if used - - Call ``MPI_Finalize`` to terminate MPI. diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index 9dc6d5f359..35180cb6da 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -15,22 +15,13 @@ SPRKStep User-callable functions ================================== -This section describes the functions that are called by the -user to setup and then solve an IVP using the SPRKStep time-stepping -module. Some of these are required; however, starting with -:numref:`ARKODE.Usage.SPRKStep.OptionalInputs`, the functions listed involve -optional inputs/outputs or restarting, and those paragraphs may be -skipped for a casual use of ARKODE's SPRKStep module. In any case, -refer to the preceding section, :numref:`ARKODE.Usage.SPRKStep.Skeleton`, -for the correct order of these calls. - -On an error, each user-callable function returns a negative value (or -``NULL`` if the function returns a pointer) and sends an error message -to the error handler routine, which prints the message to ``stderr`` -by default. However, the user can set a file as error output or can -provide their own error handler function (see -:numref:`ARKODE.Usage.SPRKStep.OptionalInputs` for details). - +This section describes the SPRKStep-specific functions that may be called +by the user to setup and then solve an IVP using the SPRKStep time-stepping +module. The large majority of these routines merely wrap :ref:`underlying +ARKODE functions `, and will be deprecated in an +upcoming release -- each of these are clearly marked below. However, some +of these user-callable functions are specific to SPRKStep, and are explained +below. .. _ARKODE.Usage.SPRKStep.Initialization: @@ -72,26 +63,16 @@ SPRKStep initialization and deallocation functions :param arkode_mem: pointer to the SPRKStep memory block. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeFree` instead. + .. _ARKODE.Usage.SPRKStep.RootFinding: Rootfinding initialization function -------------------------------------- -As described in :numref:`ARKODE.Mathematics.Rootfinding`, while -solving the IVP, ARKODE's time-stepping modules have the capability to -find the roots of a set of user-defined functions. To activate the -root-finding algorithm, call the following function. This is normally -called only once, prior to the first call to -:c:func:`SPRKStepEvolve()`, but if the rootfinding problem is to be -changed during the solution, :c:func:`SPRKStepRootInit()` can also be -called prior to a continuation call to :c:func:`SPRKStepEvolve()`. - -.. note:: - - The solution is interpolated to the times at which roots are found. - - .. c:function:: int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) Initializes a rootfinding problem to be solved during the @@ -116,20 +97,16 @@ called prior to a continuation call to :c:func:`SPRKStepEvolve()`. :retval ARK_MEM_FAIL: if there was a memory allocation failure :retval ARK_ILL_INPUT: if *nrtfn* is greater than zero but *g* = ``NULL``. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeRootInit` instead. + .. _ARKODE.Usage.SPRKStep.Integration: SPRKStep solver function ------------------------- -This is the central step in the solution process -- the call to perform -the integration of the IVP. One of the input arguments (*itask*) -specifies one of two modes as to where SPRKStep is to return a -solution. These modes are modified if the user has set a stop time -(with a call to the optional input function :c:func:`SPRKStepSetStopTime()`) or -has requested rootfinding. - - .. c:function:: int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype *tret, int itask) @@ -215,6 +192,10 @@ has requested rootfinding. On all other error returns, *tret* and *yout* are left unchanged from those provided to the routine. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeEvolve` instead. + @@ -223,34 +204,6 @@ has requested rootfinding. Optional input functions ------------------------- -There are numerous optional input parameters that control the behavior -of SPRKStep, each of which may be modified from its default value through -calling an appropriate input function. The following tables list all -optional input functions, grouped by which aspect of SPRKStep they control. -Detailed information on the calling syntax and arguments for each -function are then provided following each table. - -The optional inputs are grouped into the following categories: - -* General SPRKStep options (:numref:`ARKODE.Usage.SPRKStep.SPRKStepInputTable`), - -* IVP method solver options (:numref:`ARKODE.Usage.SPRKStep.SPRKStepMethodInputTable`), - -* Rootfinding options (:numref:`ARKODE.Usage.SPRKStep.SPRKStepRootfindingInputTable`). - -For the most casual use of SPRKStep, relying on the default set of -solver parameters, the reader can skip to section on user-supplied -functions, :numref:`ARKODE.Usage.UserSupplied`. - -We note that, on an error return, all of the optional input functions send an -error message to the error handler function. All error return values are -negative, so a test on the return arguments for negative values will catch all -errors. Finally, a call to a ``SPRKStepSet***`` function can generally be made -from the user's calling program at any time and, if successful, takes effect -immediately. For ``SPRKStepSet***`` functions that cannot be called at any time, -this is explicitly noted in the function documentation. - - .. _ARKODE.Usage.SPRKStep.SPRKStepInput: @@ -260,26 +213,6 @@ Optional inputs for SPRKStep .. _ARKODE.Usage.SPRKStep.SPRKStepInputTable: .. table:: Optional inputs for SPRKStep - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Optional input | Function name | Default | - +=====================================================+==========================================+========================+ - | Return SPRKStep solver parameters to their defaults | :c:func:`SPRKStepSetDefaults()` | internal | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Set dense output interpolation type | :c:func:`SPRKStepSetInterpolantType()` | ``ARK_INTERP_LAGRANGE``| - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Set dense output polynomial degree | :c:func:`SPRKStepSetInterpolantDegree()` | 5 | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Set fixed step size (required user input) | :c:func:`SPRKStepSetFixedStep()` | user defined | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Maximum no. of internal steps before *tout* | :c:func:`SPRKStepSetMaxNumSteps()` | 500 | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Set a value for :math:`t_{stop}` | :c:func:`SPRKStepSetStopTime()` | undefined | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Disable the stop time | :c:func:`SPRKStepClearStopTime` | N/A | - +-----------------------------------------------------+------------------------------------------+------------------------+ - | Supply a pointer for user data | :c:func:`SPRKStepSetUserData()` | ``NULL`` | - +-----------------------------------------------------+------------------------------------------+------------------------+ - .. c:function:: int SPRKStepSetDefaults(void* arkode_mem) @@ -300,6 +233,10 @@ Optional inputs for SPRKStep Also leaves alone any data structures or options related to root-finding (those can be reset using :c:func:`SPRKStepRootInit()`). + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetDefaults` instead. + .. c:function:: int SPRKStepSetInterpolantType(void* arkode_mem, int itype) @@ -336,6 +273,9 @@ Optional inputs for SPRKStep has shown that Lagrange interpolation typically performs well in this regard, while Hermite interpolation does not. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantType` instead. .. c:function:: int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree) @@ -372,6 +312,10 @@ Optional inputs for SPRKStep When `q = 1`, a linear interpolant is the default to ensure values obtained by the integrator are returned at the ends of the time interval. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetInterpolantDegree` instead. + .. c:function:: int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed) @@ -384,6 +328,10 @@ Optional inputs for SPRKStep :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetFixedStep` instead. + .. c:function:: int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps) @@ -403,6 +351,10 @@ Optional inputs for SPRKStep :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetMaxNumSteps` instead. + .. c:function:: int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop) @@ -426,6 +378,10 @@ Optional inputs for SPRKStep :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetStopTime` instead. + .. c:function:: int SPRKStepClearStopTime(void* arkode_mem) @@ -439,6 +395,10 @@ Optional inputs for SPRKStep :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeClearStopTime` instead. + .. c:function:: int SPRKStepSetUserData(void* arkode_mem, void* user_data) @@ -456,6 +416,10 @@ Optional inputs for SPRKStep :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetUserData` instead. + .. _ARKODE.Usage.SPRKStep.SPRKStepMethodInput: @@ -501,6 +465,10 @@ Optional inputs for IVP method selection This overrides any previously set method so it should not be used with :c:func:`SPRKStepSetMethod` or :c:func:`SPRKStepSetMethodName`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetOrder` instead. + .. c:function:: int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_table) @@ -518,6 +486,10 @@ Optional inputs for IVP method selection No error checking is performed on the coefficients contained in the table to ensure its declared order of accuracy. + .. warning:: + + This should not be used with :c:func:`ARKodeSetOrder`. + .. c:function:: int SPRKStepSetMethodName(void* arkode_mem, const char* method) @@ -530,6 +502,10 @@ Optional inputs for IVP method selection :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. warning:: + + This should not be used with :c:func:`ARKodeSetOrder`. + .. c:function:: int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) @@ -548,6 +524,10 @@ Optional inputs for IVP method selection :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetUseCompensatedSums` instead. + .. _ARKODE.Usage.SPRKStep.SPRKStepRootfindingInput: @@ -555,23 +535,6 @@ Optional inputs for IVP method selection Rootfinding optional input functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following functions can be called to set optional inputs to -control the rootfinding algorithm, the mathematics of which are -described in :numref:`ARKODE.Mathematics.Rootfinding`. - - -.. _ARKODE.Usage.SPRKStep.SPRKStepRootfindingInputTable: -.. table:: Rootfinding optional input functions - - +-----------------------------------------+-------------------------------------------+----------+ - | Optional input | Function name | Default | - +=========================================+===========================================+==========+ - | Direction of zero-crossings to monitor | :c:func:`SPRKStepSetRootDirection()` | both | - +-----------------------------------------+-------------------------------------------+----------+ - | Disable inactive root warnings | :c:func:`SPRKStepSetNoInactiveRootWarn()` | enabled | - +-----------------------------------------+-------------------------------------------+----------+ - - .. c:function:: int SPRKStepSetRootDirection(void* arkode_mem, int* rootdir) @@ -592,6 +555,10 @@ described in :numref:`ARKODE.Mathematics.Rootfinding`. :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetRootDirection` instead. + .. c:function:: int SPRKStepSetNoInactiveRootWarn(void* arkode_mem) @@ -610,22 +577,16 @@ described in :numref:`ARKODE.Mathematics.Rootfinding`. :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeSetNoInactiveRootWarn` instead. + .. _ARKODE.Usage.SPRKStep.InterpolatedOutput: Interpolated output function -------------------------------- -An optional function :c:func:`SPRKStepGetDky()` is available to obtain -additional values of solution-related quantities. This function -should only be called after a successful return from -:c:func:`SPRKStepEvolve()`, as it provides interpolated values either of -:math:`y` or of its derivatives. -interpolated to any value of :math:`t` in the last internal step taken -by :c:func:`SPRKStepEvolve()`. - - - .. c:function:: int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) Computes the *k*-th derivative of the function :math:`y` at the time *t*, @@ -666,84 +627,22 @@ by :c:func:`SPRKStepEvolve()`. It is only legal to call this function after a successful return from :c:func:`SPRKStepEvolve()`. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetDky` instead. + .. _ARKODE.Usage.SPRKStep.OptionalOutputs: Optional output functions ------------------------------ -SPRKStep provides an extensive set of functions that can be used to -obtain solver performance information. We organize these into groups: - -#. General SPRKStep output routines are in - :numref:`ARKODE.Usage.SPRKStep.SPRKStepMainOutputs`, - -#. Output routines regarding root-finding results are in - :numref:`ARKODE.Usage.SPRKStep.SPRKStepRootOutputs`, - -#. General usability routines (e.g. to print the current SPRKStep - parameters, or output the current Butcher tables) are in - :numref:`ARKODE.Usage.SPRKStep.SPRKStepExtraOutputs`. - -Following each table, we elaborate on each function. - -Some of the optional outputs, especially the various counters, can be -very useful in determining the efficiency of various methods inside -SPRKStep. For example: - -* The counters *nsteps* and *nf_evals* provide a rough measure of the - overall cost of a given run, and can be compared between runs with - different solver options to suggest which set of options is the most - efficient. - -.. * The ratio *nsteps/step_attempts* can measure the quality of the -.. time step adaptivity algorithm, since a poor algorithm will result -.. in more failed steps, and hence a lower ratio. - -It is therefore recommended that users retrieve and output these -statistics following each run, and take some time to investigate -alternate solver options that will be more optimal for their -particular problem of interest. - - .. _ARKODE.Usage.SPRKStep.SPRKStepMainOutputs: Main solver optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.SPRKStep.SPRKStepMainOutputsTable: -.. table:: Main solver optional output functions - - +-----------------------------------------------------+--------------------------------------------+ - | Optional output | Function name | - +=====================================================+============================================+ - | Cumulative number of internal steps | :c:func:`SPRKStepGetNumSteps` | - +-----------------------------------------------------+--------------------------------------------+ - | Step size used for the last successful step | :c:func:`SPRKStepGetLastStep` | - +-----------------------------------------------------+--------------------------------------------+ - | Step size to be attempted on the next step | :c:func:`SPRKStepGetCurrentStep` | - +-----------------------------------------------------+--------------------------------------------+ - | Current internal time reached by the solver | :c:func:`SPRKStepGetCurrentTime` | - +-----------------------------------------------------+--------------------------------------------+ - | Current internal state reached by the solver | :c:func:`SPRKStepGetCurrentState` | - +-----------------------------------------------------+--------------------------------------------+ - | Single accessor to many statistics at once | :c:func:`SPRKStepGetStepStats` | - +-----------------------------------------------------+--------------------------------------------+ - | Print all statistics | :c:func:`SPRKStepPrintAllStats` | - +-----------------------------------------------------+--------------------------------------------+ - | Name of constant associated with a return flag | :c:func:`SPRKStepGetReturnFlagName` | - +-----------------------------------------------------+--------------------------------------------+ - | No. of attempted steps | :c:func:`SPRKStepGetNumStepAttempts` | - +-----------------------------------------------------+--------------------------------------------+ - | No. of calls to right-hand side functions | :c:func:`SPRKStepGetNumRhsEvals` | - +-----------------------------------------------------+--------------------------------------------+ - | Current method table | :c:func:`SPRKStepGetCurrentMethod` | - +-----------------------------------------------------+--------------------------------------------+ - | Retrieve a pointer for user data | :c:func:`SPRKStepGetUserData` | - +-----------------------------------------------------+--------------------------------------------+ - - .. c:function:: int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps) @@ -756,6 +655,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumSteps` instead. + .. c:function:: int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast) @@ -768,6 +671,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetLastStep` instead. + .. c:function:: int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur) @@ -779,6 +686,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentStep` instead. + .. c:function:: int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur) @@ -790,6 +701,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentTime` instead. + .. c:function:: int SPRKStepGetCurrentState(void *arkode_mem, N_Vector *ycur) @@ -807,6 +722,10 @@ Main solver optional output functions as altering values of *ycur* may lead to undesirable behavior, depending on the particular use case and on when this routine is called. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentState` instead. + .. c:function:: int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) @@ -822,6 +741,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetStepStats` instead. + .. c:function:: int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) @@ -845,6 +768,9 @@ Main solver optional output functions read and output the data from a SUNDIALS CSV output file using the key and value pair format. + .. deprecated:: x.y.z + + Use :c:func:`ARKodePrintAllStats` instead. .. c:function:: char *SPRKStepGetReturnFlagName(long int flag) @@ -857,6 +783,10 @@ Main solver optional output functions :returns: The return value is a string containing the name of the corresponding constant. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetReturnFlagName` instead. + .. c:function:: int SPRKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts) @@ -868,6 +798,10 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumStepAttempts` instead. + .. c:function:: int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2) @@ -905,26 +839,16 @@ Main solver optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the ARKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetUserData` instead. + .. _ARKODE.Usage.SPRKStep.SPRKStepRootOutputs: Rootfinding optional output functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. _ARKODE.Usage.SPRKStep.SPRKStepRootOutputsTable: -.. table:: Rootfinding optional output functions - - +--------------------------------------------------+---------------------------------+ - | Optional output | Function name | - +==================================================+=================================+ - | Array showing roots found | :c:func:`SPRKStepGetRootInfo()` | - +--------------------------------------------------+---------------------------------+ - | No. of calls to user root function | :c:func:`SPRKStepGetNumGEvals()`| - +--------------------------------------------------+---------------------------------+ - - - .. c:function:: int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound) Returns an array showing which functions were found to have a root. @@ -947,6 +871,10 @@ Rootfinding optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetRootInfo` instead. + .. c:function:: int SPRKStepGetNumGEvals(void* arkode_mem, long int* ngevals) @@ -959,28 +887,16 @@ Rootfinding optional output functions :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNumGEvals` instead. + .. _ARKODE.Usage.SPRKStep.SPRKStepExtraOutputs: General usability functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following optional routine may be called by a user to inquire -about existing solver parameters. While it would not typically be called -during the course of solving an initial value problem, it may be useful -for users wishing to better understand SPRKStep. - - -.. _ARKODE.Usage.SPRKStep.SPRKStepExtraOutputsTable: -.. table:: General usability functions - - +----------------------------------------+--------------------------------------+ - | Optional routine | Function name | - +----------------------------------------+--------------------------------------+ - | Output all SPRKStep solver parameters | :c:func:`SPRKStepWriteParameters()` | - +----------------------------------------+--------------------------------------+ - - .. c:function:: int SPRKStepWriteParameters(void* arkode_mem, FILE *fp) Outputs all SPRKStep solver parameters to the provided file pointer. @@ -997,6 +913,10 @@ for users wishing to better understand SPRKStep. :retval ARK_SUCCESS: if successful :retval ARK_MEM_NULL: if the SPRKStep memory was ``NULL`` + .. deprecated:: x.y.z + + Use :c:func:`ARKodeWriteParameters` instead. + .. _ARKODE.Usage.SPRKStep.Reinitialization: @@ -1061,22 +981,6 @@ the RHS function should not incorporate the discontinuity. SPRKStep reset function ----------------------- -To reset the SPRKStep module to a particular state :math:`(t_R,y(t_R))` for the -continued solution of a problem, where a prior -call to :c:func:`SPRKStepCreate` has been made, the user must call the function -:c:func:`SPRKStepReset()`. Like :c:func:`SPRKStepReInit()` this routine retains -the current settings for all SPRKStep module options and performs no memory -allocations but, unlike :c:func:`SPRKStepReInit()`, this routine performs only a -*subset* of the input checking and initializations that are done in -:c:func:`SPRKStepCreate`. In particular this routine retains all internal -counter values. Like :c:func:`SPRKStepReInit()`, a call to -:c:func:`SPRKStepReset()` will delete any previously-set *tstop* value specified -via a call to :c:func:`SPRKStepSetStopTime()`. Following a successful call to -:c:func:`SPRKStepReset()`, call :c:func:`SPRKStepEvolve()` again to continue -solving the problem. By default the next call to :c:func:`SPRKStepEvolve()` will -use the step size computed by SPRKStep prior to calling :c:func:`SPRKStepReset()`. - - .. c:function:: int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR) Resets the current SPRKStep time-stepper module state to the provided @@ -1101,3 +1005,7 @@ use the step size computed by SPRKStep prior to calling :c:func:`SPRKStepReset() By default the next call to :c:func:`SPRKStepEvolve()` will use the step size computed by SPRKStep prior to calling :c:func:`SPRKStepReset()`. + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeReset` instead. diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/index.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/index.rst index 536d94391c..ec3dbdc935 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/index.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/index.rst @@ -16,30 +16,20 @@ Using the SPRKStep time-stepping module ========================================== -This chapter is concerned with the use of the SPRKStep time-stepping module for -the solution of initial value problems (IVPs) of the form -:eq:`ARKODE_IVP_SPRK` in a C or C++ language setting. The following sections -discuss the header files and the layout of the user's main program, and provide -descriptions of the SPRKStep user-callable functions and user-supplied functions. +This section is concerned with the use of the SPRKStep time-stepping +module for the solution of initial value problems (IVPs) in a C or C++ +language setting. Usage of SPRKStep follows that of the rest of ARKODE, +and so in this section we primarily focus on those usage aspects that +are specific to SPRKStep. -The example programs located in the source code ``examples/arkode`` folder, may -be helpful as templates for new codes. In particular, +We note that of the ARKODE example programs located in the source code +``examples/arkode`` folder, the following demonstrate ``SPRKStep`` usage: * ``examples/arkode/C_serial/ark_harmonic_symplectic.c`` * ``examples/arkode/C_serial/ark_damped_harmonic_symplectic.c``, and * ``examples/arkode/C_serial/ark_kepler.c`` -demonstrate ``SPRKStep`` usage. - -SPRKStep uses the input and output constants from the shared ARKODE infrastructure. -These are defined as needed in this chapter, but for convenience the full list is -provided separately in :numref:`ARKODE.Constants`. - -The relevant information on using SPRKStep's C and C++ interfaces is -detailed in the following subsections. - .. toctree:: :maxdepth: 1 - Skeleton User_callable diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Skeleton.rst b/doc/arkode/guide/source/Usage/Skeleton.rst similarity index 73% rename from doc/arkode/guide/source/Usage/ARKStep_c_interface/Skeleton.rst rename to doc/arkode/guide/source/Usage/Skeleton.rst index daa3586143..5909007646 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/Skeleton.rst +++ b/doc/arkode/guide/source/Usage/Skeleton.rst @@ -12,13 +12,13 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. _ARKODE.Usage.ARKStep.Skeleton: +.. _ARKODE.Usage.Skeleton: A skeleton of the user's main program ============================================ The following is a skeleton of the user's main program (or calling -program) for the integration of an ODE IVP using the ARKStep module. +program) for the integration of an ODE IVP using ARKODE. Most of the steps are independent of the NVECTOR, SUNMATRIX, SUNLINSOL and SUNNONLINSOL implementations used. For the steps that are not, refer to :numref:`NVectors`, :numref:`SUNMatrix`, @@ -77,30 +77,32 @@ the function to be called or macro to be referenced. For details on each of SUNDIALS' provided vector implementations, see the corresponding sections in :numref:`NVectors` for details. -#. Create ARKStep object +#. Create ARKODE object - Call ``arkode_mem = ARKStepCreate(...)`` to create the - ARKStep memory block. :c:func:`ARKStepCreate` returns a ``void*`` pointer to - this memory structure. See :numref:`ARKODE.Usage.ARKStep.Initialization` for - details. + Call a stepper-specific constructor, ``arkode_mem = *StepCreate(...)``, to + create the ARKODE memory block. These routines return a ``void*`` pointer to + this memory structure. See :numref:`ARKODE.Usage.ARKStep.Initialization`, + :numref:`ARKODE.Usage.ERKStep.Initialization`, + :numref:`ARKODE.Usage.MRIStep.Initialization`, or + :numref:`ARKODE.Usage.SPRKStep.Initialization` for details. #. Specify integration tolerances - Call :c:func:`ARKStepSStolerances()` or - :c:func:`ARKStepSVtolerances()` to specify either a scalar relative + Call :c:func:`ARKodeSStolerances()` or + :c:func:`ARKodeSVtolerances()` to specify either a scalar relative tolerance and scalar absolute tolerance, or a scalar relative tolerance and a vector of absolute tolerances, - respectively. Alternatively, call :c:func:`ARKStepWFtolerances()` + respectively. Alternatively, call :c:func:`ARKodeWFtolerances()` to specify a function which sets directly the weights used in evaluating WRMS vector norms. See - :numref:`ARKODE.Usage.ARKStep.Tolerances` for details. + :numref:`ARKODE.Usage.Tolerances` for details. If a problem with non-identity mass matrix is used, and the solution units differ considerably from the equation units, absolute tolerances for the equation residuals (nonlinear and linear) may be specified separately through calls to - :c:func:`ARKStepResStolerance()`, :c:func:`ARKStepResVtolerance()`, or - :c:func:`ARKStepResFtolerance()`. + :c:func:`ARKodeResStolerance()`, :c:func:`ARKodeResVtolerance()`, or + :c:func:`ARKodeResFtolerance()`. #. Create matrix object @@ -156,27 +158,27 @@ the function to be called or macro to be referenced. If a linear solver was created above for implicit stage solves, initialize the ARKLS linear solver interface by attaching the linear solver object (and Jacobian matrix object, if applicable) - with the call (for details see :numref:`ARKODE.Usage.ARKStep.LinearSolvers`): + with the call (for details see :numref:`ARKODE.Usage.LinearSolvers`): .. code-block:: c - ier = ARKStepSetLinearSolver(...); + ier = ARKodeSetLinearSolver(...); Similarly, if the problem involves a non-identity mass matrix, initialize the ARKLS mass matrix linear solver interface by attaching the mass linear solver object (and mass matrix object, if applicable) with the call (for details see - :numref:`ARKODE.Usage.ARKStep.LinearSolvers`): + :numref:`ARKODE.Usage.LinearSolvers`): .. code-block:: c - ier = ARKStepSetMassLinearSolver(...); + ier = ARKodeSetMassLinearSolver(...); #. Create nonlinear solver object If the problem involves an implicit component, and if a non-default nonlinear solver object will be used for implicit stage solves - (see :numref:`ARKODE.Usage.ARKStep.NonlinearSolvers`), + (see :numref:`ARKODE.Usage.NonlinearSolvers`), then the desired nonlinear solver object must be created by using the appropriate functions defined by the particular SUNNONLINSOL implementation (e.g., ``NLS = SUNNonlinSol_***(...);`` where @@ -196,34 +198,41 @@ the function to be called or macro to be referenced. #. Attach nonlinear solver module If a nonlinear solver object was created above, then it must be - attached to ARKStep using the call (for details see - :numref:`ARKODE.Usage.ARKStep.NonlinearSolvers`): + attached to ARKODE using the call (for details see + :numref:`ARKODE.Usage.NonlinearSolvers`): .. code-block:: c - ier = ARKStepSetNonlinearSolver(...); + ier = ARKodeSetNonlinearSolver(...); #. Set nonlinear solver optional inputs Call the appropriate set functions for the selected nonlinear solver module to change optional inputs specific to that nonlinear solver. These *must* be called after attaching the nonlinear - solver to ARKStep, otherwise the optional inputs will be - overridden by ARKStep defaults. See + solver to ARKODE, otherwise the optional inputs will be + overridden by ARKODE defaults. See :numref:`SUNNonlinSol` for more information on optional inputs. #. Set optional inputs - Call ``ARKStepSet*`` functions to change any optional inputs that - control the behavior of ARKStep from their default values. See - :numref:`ARKODE.Usage.ARKStep.OptionalInputs` for details. + Call ``ARKodeSet*`` functions to change any optional inputs that + control the behavior of ARKODE from their default values. See + :numref:`ARKODE.Usage.OptionalInputs` for details. + + Additionally, call ``*StepSet*`` routines to change any + stepper-specific optional inputs from their default values. See + :numref:`ARKODE.Usage.ARKStep.OptionalInputs`, + :numref:`ARKODE.Usage.ERKStep.OptionalInputs`, + :numref:`ARKODE.Usage.MRIStep.OptionalInputs`, or + :numref:`ARKODE.Usage.SPRKStep.OptionalInputs` for details. #. Specify rootfinding problem - Optionally, call :c:func:`ARKStepRootInit()` to initialize a rootfinding + Optionally, call :c:func:`ARKodeRootInit()` to initialize a rootfinding problem to be solved during the integration of the ODE system. See - :numref:`ARKODE.Usage.ARKStep.RootFinding` for general details, and - :numref:`ARKODE.Usage.ARKStep.OptionalInputs` for relevant optional + :numref:`ARKODE.Usage.RootFinding` for general details, and + :numref:`ARKODE.Usage.OptionalInputs` for relevant optional input calls. #. Advance solution in time @@ -232,17 +241,24 @@ the function to be called or macro to be referenced. .. code-block:: c - ier = ARKStepEvolve(arkode_mem, tout, yout, &tret, itask); + ier = ARKodeEvolve(arkode_mem, tout, yout, &tret, itask); Here, ``itask`` specifies the return mode. The vector ``yout`` (which can be the same as the vector ``y0`` above) will contain :math:`y(t_\text{out})`. See - :numref:`ARKODE.Usage.ARKStep.Integration` for details. + :numref:`ARKODE.Usage.Integration` for details. #. Get optional outputs - Call ``ARKStepGet*`` functions to obtain optional output. See - :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` for details. + Call ``ARKodeGet*`` functions to obtain optional output. See + :numref:`ARKODE.Usage.OptionalOutputs` for details. + + Additionally, call ``*StepGet*`` routines to retrieve any + stepper-specific optional outputs. See + :numref:`ARKODE.Usage.ARKStep.OptionalOutputs`, + :numref:`ARKODE.Usage.ERKStep.OptionalOutputs`, + :numref:`ARKODE.Usage.MRIStep.OptionalOutputs`, or + :numref:`ARKODE.Usage.SPRKStep.OptionalOutputs` for details. #. Deallocate memory for solution vector @@ -255,8 +271,8 @@ the function to be called or macro to be referenced. #. Free solver memory - Call :c:func:`ARKStepFree()` to free the memory allocated for - the ARKStep module (and any nonlinear solver module). + Call :c:func:`ARKodeFree()` to free the memory allocated for + the ARKODE module (and any nonlinear solver module). #. Free linear solver and matrix memory @@ -266,10 +282,14 @@ the function to be called or macro to be referenced. #. Free nonlinear solver memory - If a user-supplied ``SUNNonlinearSolver`` was provided to ARKStep, + If a user-supplied ``SUNNonlinearSolver`` was provided to ARKODE, then call :c:func:`SUNNonlinSolFree()` to free any memory allocated for the nonlinear solver object created above. +#. Free the SUNContext object + + Call :c:func:`SUNContext_Free` to free the memory allocated for the ``SUNContext`` object. + #. Finalize MPI, if used Call ``MPI_Finalize`` to terminate MPI. diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst new file mode 100644 index 0000000000..41bd723bf9 --- /dev/null +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -0,0 +1,4386 @@ +.. ---------------------------------------------------------------- + Programmer(s): Daniel R. Reynolds @ SMU + ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2024, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. _ARKODE.Usage.UserCallable: + +ARKODE User-callable functions +================================ + +This section describes the shared ARKODE functions that are called by +the user to setup and then solve an IVP. Some of these are required; +however, starting with :numref:`ARKODE.Usage.OptionalInputs`, +the functions listed involve optional inputs/outputs or restarting, +and those paragraphs may be skipped for a casual use of ARKODE. +In any case, refer to the preceding section, +:numref:`ARKODE.Usage.Skeleton`, for the correct order of these calls. + +On an error, each user-callable function returns a negative value (or +``NULL`` if the function returns a pointer) and sends an error message +to the error handler, which prints the message to ``stderr`` by default. +However, the user can set a file as error output or can +provide their own error handler (see :numref:`SUNDIALS.Errors` for details). + + + +.. _ARKODE.Usage.Tolerances: + +ARKODE tolerance specification functions +------------------------------------------------------ + +These functions specify the integration tolerances. One of them +**should** be called before the first call to +:c:func:`ARKodeEvolve`; otherwise default values of ``reltol = +1e-4`` and ``abstol = 1e-9`` will be used, which may be entirely +incorrect for a specific problem. + +The integration tolerances ``reltol`` and ``abstol`` define a vector +of error weights, ``ewt``. In the case of +:c:func:`ARKodeSStolerances`, this vector has components + +.. code-block:: c + + ewt[i] = 1.0/(reltol*abs(y[i]) + abstol); + +whereas in the case of :c:func:`ARKodeSVtolerances` the vector components +are given by + +.. code-block:: c + + ewt[i] = 1.0/(reltol*abs(y[i]) + abstol[i]); + +This vector is used in all error and convergence tests, which use a +weighted RMS norm on all error-like vectors :math:`v`: + +.. math:: + \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; ewt_i)^2 \right)^{1/2}, + +where :math:`N` is the problem dimension. + +Alternatively, the user may supply a custom function to supply the +``ewt`` vector, through a call to :c:func:`ARKodeWFtolerances`. + + + +.. c:function:: int ARKodeSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol) + + This function specifies scalar relative and absolute tolerances. + + :param arkode_mem: pointer to the ARKODE memory block. + :param reltol: scalar relative tolerance. + :param abstol: scalar absolute tolerance. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: an argument had an illegal value (e.g. a negative tolerance). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol) + + This function specifies a scalar relative tolerance and a vector + absolute tolerance (a potentially different absolute tolerance for + each vector component). + + :param arkode_mem: pointer to the ARKODE memory block. + :param reltol: scalar relative tolerance. + :param abstol: vector containing the absolute tolerances for each + solution component. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: an argument had an illegal value (e.g. a negative tolerance). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeWFtolerances(void* arkode_mem, ARKEwtFn efun) + + This function specifies a user-supplied function *efun* to compute + the error weight vector ``ewt``. + + :param arkode_mem: pointer to the ARKODE memory block. + :param efun: the name of the function (of type :c:func:`ARKEwtFn`) + that implements the error weight vector computation. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + + .. versionadded:: x.y.z + + +Moreover, for problems involving a non-identity mass matrix +:math:`M \ne I`, the units of the solution vector :math:`y` may differ +from the units of the IVP, posed for the vector :math:`My`. When this +occurs, iterative solvers for the Newton linear systems and the mass +matrix linear systems may require a different set of tolerances. +Since the relative tolerance is dimensionless, but the absolute +tolerance encodes a measure of what is "small" in the units of the +respective quantity, a user may optionally define absolute tolerances +in the equation units. In this case, ARKODE defines a vector of residual +weights, ``rwt`` for measuring convergence of these iterative solvers. +In the case of :c:func:`ARKodeResStolerance`, this vector has components + +.. code-block:: c + + rwt[i] = 1.0/(reltol*abs(My[i]) + rabstol); + +whereas in the case of :c:func:`ARKodeResVtolerance` the vector components +are given by + +.. code-block:: c + + rwt[i] = 1.0/(reltol*abs(My[i]) + rabstol[i]); + +This residual weight vector is used in all iterative solver +convergence tests, which similarly use a weighted RMS norm on all +residual-like vectors :math:`v`: + +.. math:: + \|v\|_{WRMS} = \left( \frac{1}{N} \sum_{i=1}^N (v_i\; rwt_i)^2 \right)^{1/2}, + +where :math:`N` is the problem dimension. + +As with the error weight vector, the user may supply a custom function +to supply the ``rwt`` vector, through a call to +:c:func:`ARKodeResFtolerance`. Further information on all three of +these functions is provided below. + + + +.. c:function:: int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) + + This function specifies a scalar absolute residual tolerance. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rabstol: scalar absolute residual tolerance. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: an argument had an illegal value (e.g. a negative tolerance). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol) + + This function specifies a vector of absolute residual tolerances. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rabstol: vector containing the absolute residual + tolerances for each solution component. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: an argument had an illegal value (e.g. a negative tolerance). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun) + + This function specifies a user-supplied function *rfun* to compute + the residual weight vector ``rwt``. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rfun: the name of the function (of type :c:func:`ARKRwtFn`) + that implements the residual weight vector computation. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + + .. versionadded:: x.y.z + + +General advice on the choice of tolerances +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For many users, the appropriate choices for tolerance values in +``reltol``, ``abstol``, and ``rabstol`` are a concern. The following pieces +of advice are relevant. + +(1) The scalar relative tolerance ``reltol`` is to be set to control + relative errors. So a value of :math:`10^{-4}` means that errors + are controlled to .01%. We do not recommend using ``reltol`` larger + than :math:`10^{-3}`. On the other hand, ``reltol`` should not be so + small that it is comparable to the unit roundoff of the machine + arithmetic (generally around :math:`10^{-15}` for double-precision). + +(2) The absolute tolerances ``abstol`` (whether scalar or vector) need + to be set to control absolute errors when any components of the + solution vector :math:`y` may be so small that pure relative error + control is meaningless. For example, if :math:`y_i` starts at some + nonzero value, but in time decays to zero, then pure relative + error control on :math:`y_i` makes no sense (and is overly costly) + after :math:`y_i` is below some noise level. Then ``abstol`` (if + scalar) or ``abstol[i]`` (if a vector) needs to be set to that + noise level. If the different components have different noise + levels, then ``abstol`` should be a vector. For example, see the + example problem ``ark_robertson.c``, and the discussion + of it in the ARKODE Examples Documentation :cite:p:`arkode_ex`. In that + problem, the three components vary between 0 and 1, and have + different noise levels; hence the ``atols`` vector therein. It is + impossible to give any general advice on ``abstol`` values, + because the appropriate noise levels are completely + problem-dependent. The user or modeler hopefully has some idea as + to what those noise levels are. + +(3) The residual absolute tolerances ``rabstol`` (whether scalar or + vector) follow a similar explanation as for ``abstol``, except + that these should be set to the noise level of the equation + components, i.e. the noise level of :math:`My`. For problems in + which :math:`M=I`, it is recommended that ``rabstol`` be left + unset, which will default to the already-supplied ``abstol`` + values. + +(4) Finally, it is important to pick all the tolerance values + conservatively, because they control the error committed on each + individual step. The final (global) errors are an accumulation of + those per-step errors, where that accumulation factor is + problem-dependent. A general rule of thumb is to reduce the + tolerances by a factor of 10 from the actual desired limits on + errors. So if you want .01% relative accuracy (globally), a good + choice for ``reltol`` is :math:`10^{-5}`. In any case, it is + a good idea to do a few experiments with the tolerances to see how + the computed solution values vary as tolerances are reduced. + + + +Advice on controlling nonphysical negative values +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In many applications, some components in the true solution are always +positive or non-negative, though at times very small. In the +numerical solution, however, small negative (nonphysical) values +can then occur. In most cases, these values are harmless, and simply +need to be controlled, not eliminated, but in other cases any value +that violates a constraint may cause a simulation to halt. For both of +these scenarios the following pieces of advice are relevant. + +(1) The best way to control the size of unwanted negative computed + values is with tighter absolute tolerances. Again this requires + some knowledge of the noise level of these components, which may + or may not be different for different components. Some + experimentation may be needed. + +(2) If output plots or tables are being generated, and it is important + to avoid having negative numbers appear there (for the sake of + avoiding a long explanation of them, if nothing else), then + eliminate them, but only in the context of the output medium. Then + the internal values carried by the solver are unaffected. Remember + that a small negative value in :math:`y` returned by ARKODE, with + magnitude comparable to ``abstol`` or less, is equivalent to zero + as far as the computation is concerned. + +(3) The user's right-hand side routines :math:`f^E` and :math:`f^I` + should never change a negative value in the solution vector :math:`y` + to a non-negative value in attempt to "fix" this problem, + since this can lead to numerical instability. If the :math:`f^E` + or :math:`f^I` routines cannot tolerate a zero or negative value + (e.g. because there is a square root or log), then the offending + value should be changed to zero or a tiny positive number in a + temporary variable (not in the input :math:`y` vector) for the + purposes of computing :math:`f^E(t, y)` or :math:`f^I(t, y)`. + +(4) Some of ARKODE's time stepping modules support component-wise + constraints on solution components, :math:`y_i < 0`, + :math:`y_i \le 0`, :math:`y_i > 0`, or :math:`y_i \ge 0`, through + the user-callable function :c:func:`ARKodeSetConstraints`. At each + internal time step, if any constraint is violated then ARKODE will + attempt a smaller time step that should not violate this constraint. + This reduced step size is chosen such that the step size is the + largest possible but where the solution component satisfies the + constraint. + +(5) For time-stepping modules that support temporal adaptivity, + positivity and non-negativity constraints on components can also be + enforced by use of the recoverable error return feature in the + user-supplied right-hand side function(s). When a recoverable error + is encountered, ARKODE will retry the step with a smaller step size, + which typically alleviates the problem. However, since this reduced + step size is chosen without knowledge of the solution constraint, it + may be overly conservative. Thus this option involves some additional + overhead cost, and should only be exercised if the above recommendations + are unsuccessful. + + + +.. _ARKODE.Usage.LinearSolvers: + +Linear solver interface functions +------------------------------------------- + +As previously explained, the Newton iterations used in solving +implicit systems within ARKODE require the solution of linear +systems of the form + +.. math:: + \mathcal{A}\left(z_i^{(m)}\right) \delta^{(m+1)} = -G\left(z_i^{(m)}\right) + +where + +.. math:: + \mathcal{A} \approx M - \gamma J, \qquad J = \frac{\partial f^I}{\partial y}. + +ARKODE's ARKLS linear solver interface supports all valid +``SUNLinearSolver`` modules for this task. + +Matrix-based ``SUNLinearSolver`` modules utilize ``SUNMatrix`` objects +to store the approximate Jacobian matrix :math:`J`, the Newton matrix +:math:`\mathcal{A}`, the mass matrix :math:`M`, and, when using direct +solvers, the factorizations used throughout the solution process. + +Matrix-free ``SUNLinearSolver`` modules instead use iterative methods +to solve the Newton systems of equations, and only require the +*action* of the matrix on a vector, :math:`\mathcal{A}v`. With most +of these methods, preconditioning can be done on the left only, on the +right only, on both the left and the right, or not at all. The +exceptions to this rule are SPFGMR that supports right preconditioning +only and PCG that performs symmetric preconditioning. For the +specification of a preconditioner, see the iterative linear solver +portions of :numref:`ARKODE.Usage.OptionalInputs` and +:numref:`ARKODE.Usage.UserSupplied`. + +If preconditioning is done, user-supplied functions should be used to +define left and right preconditioner matrices :math:`P_1` and +:math:`P_2` (either of which could be the identity matrix), such that +the product :math:`P_{1}P_{2}` approximates the Newton matrix +:math:`\mathcal{A} = M - \gamma J`. + +To specify a generic linear solver for ARKODE to use for the Newton +systems, after the call to ``*StepCreate`` but before any +calls to :c:func:`ARKodeEvolve`, the user's program must create the +appropriate ``SUNLinearSolver`` object and call the function +:c:func:`ARKodeSetLinearSolver`, as documented below. To create +the ``SUNLinearSolver`` object, the user may call one of the +SUNDIALS-packaged SUNLinSol module constructor routines via a call of +the form + +.. code:: c + + SUNLinearSolver LS = SUNLinSol_*(...); + +The current list of SUNDIALS-packaged SUNLinSol modules, and their +constructor routines, may be found in chapter :numref:`SUNLinSol`. +Alternately, a user-supplied ``SUNLinearSolver`` module may be created +and used. Specific information on how to create such user-provided +modules may be found in :numref:`SUNLinSol.API.Custom`. + +Once this solver object has been constructed, the user should attach +it to ARKODE via a call to :c:func:`ARKodeSetLinearSolver`. The +first argument passed to this function is the ARKODE memory pointer +returned by ``*StepCreate``; the second argument is the +``SUNLinearSolver`` object created above. The third argument is an +optional ``SUNMatrix`` object to accompany matrix-based +``SUNLinearSolver`` inputs (for matrix-free linear solvers, the third +argument should be ``NULL``). A call to this function initializes the +ARKLS linear solver interface, linking it to the ARKODE integrator, +and allows the user to specify additional parameters and routines +pertinent to their choice of linear solver. + +.. c:function:: int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix J) + + This function specifies the ``SUNLinearSolver`` object that ARKODE + should use, as well as a template Jacobian ``SUNMatrix`` object (if + applicable). + + :param arkode_mem: pointer to the ARKODE memory block. + :param LS: the ``SUNLinearSolver`` object to use. + :param J: the template Jacobian ``SUNMatrix`` object to use (or + ``NULL`` if not applicable). + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_MEM_FAIL: there was a memory allocation failure. + :retval ARKLS_ILL_INPUT: ARKLS is incompatible with the + provided *LS* or *J* input objects, or the current + ``N_Vector`` module. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported by the + current time-stepping module. + + .. note:: + + If *LS* is a matrix-free linear solver, then the *J* + argument should be ``NULL``. + + If *LS* is a matrix-based linear solver, then the template Jacobian + matrix *J* will be used in the solve process, so if additional + storage is required within the ``SUNMatrix`` object (e.g. for + factorization of a banded matrix), ensure that the input object is + allocated with sufficient size (see the documentation of + the particular SUNMATRIX type in the :numref:`SUNMatrix` for + further information). + + When using sparse linear solvers, it is typically much more + efficient to supply *J* so that it includes the full sparsity + pattern of the Newton system matrices :math:`\mathcal{A} = + M-\gamma J`, even if *J* itself has zeros in nonzero + locations of :math:`M`. The reasoning for this is + that :math:`\mathcal{A}` is constructed in-place, on top of the + user-specified values of *J*, so if the sparsity pattern in *J* is + insufficient to store :math:`\mathcal{A}` then it will need to be + resized internally by ARKODE. + + .. versionadded:: x.y.z + + + + + +.. _ARKODE.Usage.MassMatrixSolvers: + +Mass matrix solver specification functions +------------------------------------------- + +As discussed in :numref:`ARKODE.Mathematics.MassSolve`, if the ODE +system involves a non-identity mass matrix :math:`M\ne I`, then ARKODE +must solve linear systems of the form + +.. math:: + M x = b. + +ARKODE's ARKLS mass-matrix linear solver interface supports all valid +``SUNLinearSolver`` modules for this task. For iterative linear +solvers, user-supplied preconditioning can be applied. For the +specification of a preconditioner, see the iterative linear solver +portions of :numref:`ARKODE.Usage.OptionalInputs` and +:numref:`ARKODE.Usage.UserSupplied`. If preconditioning is to be +performed, user-supplied functions should be used to define left and +right preconditioner matrices :math:`P_1` and :math:`P_2` (either of +which could be the identity matrix), such that the product +:math:`P_{1}P_{2}` approximates the mass matrix :math:`M`. + +To specify a generic linear solver for ARKODE to use for mass matrix +systems, after the call to ``*StepCreate`` but before any +calls to :c:func:`ARKodeEvolve`, the user's program must create the +appropriate ``SUNLinearSolver`` object and call the function +:c:func:`ARKodeSetMassLinearSolver`, as documented below. The +first argument passed to this function is the ARKODE memory +pointer returned by ``*StepCreate``; the second argument is +the desired ``SUNLinearSolver`` object to use for solving mass matrix +systems. The third object is a template ``SUNMatrix`` to use with the +provided ``SUNLinearSolver`` (if applicable). The fourth input is a +flag to indicate whether the mass matrix is time-dependent, +i.e. :math:`M = M(t)`, or not. A call to this function initializes the +ARKLS mass matrix linear solver interface, linking this to the main +ARKODE integrator, and allows the user to specify additional +parameters and routines pertinent to their choice of linear solver. + +Note: if the user program includes linear solvers for *both* the +Newton and mass matrix systems, these must have the same type: + +* If both are matrix-based, then they must utilize the same + ``SUNMatrix`` type, since these will be added when forming the + Newton system matrix :math:`\mathcal{A}`. In this case, both the + Newton and mass matrix linear solver interfaces can use the same + ``SUNLinearSolver`` object, although different solver objects + (e.g. with different solver parameters) are also allowed. + +* If both are matrix-free, then the Newton and mass matrix + ``SUNLinearSolver`` objects must be different. These may even use + different solver algorithms (SPGMR, SPBCGS, etc.), if desired. + For example, if the mass matrix is symmetric but the Jacobian is not, + then PCG may be used for the mass matrix systems and SPGMR for the + Newton systems. + + +.. c:function:: int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, sunbooleantype time_dep) + + This function specifies the ``SUNLinearSolver`` object + that ARKODE should use for mass matrix systems, as well as a + template ``SUNMatrix`` object. + + :param arkode_mem: pointer to the ARKODE memory block. + :param LS: the ``SUNLinearSolver`` object to use. + :param M: the template mass ``SUNMatrix`` object to use. + :param time_dep: flag denoting whether the mass matrix depends on + the independent variable (:math:`M = M(t)`) or not (:math:`M + \ne M(t)`). ``SUNTRUE`` indicates time-dependence of the + mass matrix. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_MEM_FAIL: there was a memory allocation failure. + :retval ARKLS_ILL_INPUT: ARKLS is incompatible with the + provided *LS* or *M* input objects, or the current + ``N_Vector`` module. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + If *LS* is a matrix-free linear solver, then the *M* + argument should be ``NULL``. + + If *LS* is a matrix-based linear solver, then the template mass + matrix *M* will be used in the solve process, so if additional + storage is required within the ``SUNMatrix`` object (e.g. for + factorization of a banded matrix), ensure that the input object is + allocated with sufficient size. + + If called with *time_dep* set to ``SUNFALSE``, then the mass matrix is + only computed and factored once (or when either ``*StepReInit`` + or :c:func:`ARKodeResize` are called), with the results reused + throughout the entire ARKODE simulation. + + Unlike the system Jacobian, the system mass matrix is not approximated + using finite-differences of any functions provided to ARKODE. Hence, + use of the a matrix-based *LS* requires the user to provide a + mass-matrix constructor routine (see :c:type:`ARKLsMassFn` and + :c:func:`ARKodeSetMassFn`). + + Similarly, the system mass matrix-vector-product is not approximated + using finite-differences of any functions provided to ARKODE. Hence, + use of a matrix-free *LS* requires the user to provide a + mass-matrix-times-vector product routine (see + :c:type:`ARKLsMassTimesVecFn` and :c:func:`ARKodeSetMassTimes`). + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.NonlinearSolvers: + +Nonlinear solver interface functions +------------------------------------------- + +When changing the nonlinear solver in ARKODE, after the +call to ``*StepCreate`` but before any calls to +:c:func:`ARKodeEvolve`, the user's program must create the +appropriate ``SUNNonlinearSolver`` object and call +:c:func:`ARKodeSetNonlinearSolver`, as documented below. If any +calls to :c:func:`ARKodeEvolve` have been made, then ARKODE will +need to be reinitialized by calling ``*StepReInit`` to +ensure that the nonlinear solver is initialized correctly before any +subsequent calls to :c:func:`ARKodeEvolve`. + +The first argument passed to the routine +:c:func:`ARKodeSetNonlinearSolver` is the ARKODE memory pointer +returned by ``*StepCreate``; the second argument passed +to this function is the desired ``SUNNonlinearSolver`` object to use for +solving the nonlinear system for each implicit stage. A call to this +function attaches the nonlinear solver to the main ARKODE integrator. + + +.. c:function:: int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) + + This function specifies the ``SUNNonlinearSolver`` object + that ARKODE should use for implicit stage solves. + + :param arkode_mem: pointer to the ARKODE memory block. + :param NLS: the ``SUNNonlinearSolver`` object to use. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_MEM_FAIL: there was a memory allocation failure. + :retval ARK_ILL_INPUT: ARKODE is incompatible with the + provided *NLS* input object. + :retval ARK_STEPPER_UNSUPPORTED: nonlinear solvers are not supported by + the current time-stepping module. + + .. note:: + + ARKODE will use the Newton ``SUNNonlinearSolver`` module by + default; a call to this routine replaces that module with the + supplied *NLS* object. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.RootFinding: + +Rootfinding initialization function +-------------------------------------- + +As described in :numref:`ARKODE.Mathematics.Rootfinding`, while +solving the IVP, ARKODE's time-stepping modules have the capability to +find the roots of a set of user-defined functions. To activate the +root-finding algorithm, call the following function. This is normally +called only once, prior to the first call to +:c:func:`ARKodeEvolve`, but if the rootfinding problem is to be +changed during the solution, :c:func:`ARKodeRootInit` can also be +called prior to a continuation call to :c:func:`ARKodeEvolve`. + +.. note:: + + The solution is interpolated to the times at which roots are found. + + +.. c:function:: int ARKodeRootInit(void* arkode_mem, int nrtfn, ARKRootFn g) + + Initializes a rootfinding problem to be solved during the + integration of the ODE system. It must be called after + ``*StepCreate``, and before :c:func:`ARKodeEvolve`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nrtfn: number of functions :math:`g_i`, an integer :math:`\ge` 0. + :param g: name of user-supplied function, of type :c:func:`ARKRootFn`, + defining the functions :math:`g_i` whose roots are sought. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_MEM_FAIL: there was a memory allocation failure. + :retval ARK_ILL_INPUT: *nrtfn* is greater than zero but *g* is ``NULL``. + + .. note:: + + To disable the rootfinding feature after it has already + been initialized, or to free memory associated with ARKODE's + rootfinding module, call *ARKodeRootInit* with *nrtfn = 0*. + + Similarly, if a new IVP is to be solved with a call to + ``*StepReInit``, where the new IVP has no rootfinding + problem but the prior one did, then call *ARKodeRootInit* with + *nrtfn = 0*. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.Integration: + +ARKODE solver function +------------------------- + +This is the central step in the solution process -- the call to perform +the integration of the IVP. The input argument *itask* specifies one of two +modes as to where ARKODE is to return a solution. These modes are modified if +the user has set a stop time (with a call to the optional input function +:c:func:`ARKodeSetStopTime`) or has requested rootfinding. + + +.. c:function:: int ARKodeEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, sunrealtype *tret, int itask) + + Integrates the ODE over an interval in :math:`t`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param tout: the next time at which a computed solution is desired. + :param yout: the computed solution vector. + :param tret: the time corresponding to *yout* (output). + :param itask: a flag indicating the job of the solver for the next + user step. + + The *ARK_NORMAL* option causes the solver to take internal + steps until it has just overtaken a user-specified output + time, *tout*, in the direction of integration, + i.e. :math:`t_{n-1} <` *tout* :math:`\le t_{n}` for forward + integration, or :math:`t_{n} \le` *tout* :math:`< t_{n-1}` for + backward integration. It will then compute an approximation + to the solution :math:`y(tout)` by interpolation (as described + in :numref:`ARKODE.Mathematics.Interpolation`). + + The *ARK_ONE_STEP* option tells the solver to only take a + single internal step, :math:`y_{n-1} \to y_{n}`, and return the solution + at that point, :math:`y_{n}`, in the vector *yout*. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_ROOT_RETURN: :c:func:`ARKodeEvolve` succeeded, and + found one or more roots. If the number of root functions, + *nrtfn*, is greater than 1, call + :c:func:`ARKodeGetRootInfo` to see which :math:`g_i` were + found to have a root at (*\*tret*). + :retval ARK_TSTOP_RETURN: :c:func:`ARKodeEvolve` succeeded and + returned at *tstop*. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: one of the inputs to :c:func:`ARKodeEvolve` + is illegal, or some other input to the solver was + either illegal or missing. Details will be + provided in the error message. Typical causes of + this failure: + + (a) A component of the error weight vector became + zero during internal time-stepping. + + (b) The linear solver initialization function (called + by the user after calling ``*StepCreate``) failed + to set the linear solver-specific *lsolve* field in + ``arkode_mem``. + + (c) A root of one of the root functions was found both at a + point :math:`t` and also very near :math:`t`. + + (d) The initial condition violates the inequality constraints. + + :retval ARK_TOO_MUCH_WORK: the solver took *mxstep* internal steps + but could not reach *tout*. The default value for + *mxstep* is *MXSTEP_DEFAULT = 500*. + :retval ARK_TOO_MUCH_ACC: the solver could not satisfy the accuracy + demanded by the user for some internal step. + :retval ARK_ERR_FAILURE: error test failures occurred either too many + times (*ark_maxnef*) during one internal time step + or occurred with :math:`|h| = h_{min}`. + :retval ARK_CONV_FAILURE: either convergence test failures occurred too many + times (*ark_maxncf*) during one internal time step + or occurred with :math:`|h| = h_{min}`. + :retval ARK_LINIT_FAIL: the linear solver's initialization function failed. + :retval ARK_LSETUP_FAIL: the linear solver's setup routine failed in + an unrecoverable manner. + :retval ARK_LSOLVE_FAIL: the linear solver's solve routine failed in + an unrecoverable manner. + :retval ARK_MASSINIT_FAIL: the mass matrix solver's + initialization function failed. + :retval ARK_MASSSETUP_FAIL: the mass matrix solver's setup routine failed. + :retval ARK_MASSSOLVE_FAIL: the mass matrix solver's solve routine failed. + :retval ARK_VECTOROP_ERR: a vector operation error occurred. + + .. note:: + + The input vector *yout* can use the same memory as the + vector *y0* of initial conditions that was passed to + ``*StepCreate``. + + In *ARK_ONE_STEP* mode, *tout* is used only on the first call, and + only to get the direction and a rough scale of the independent + variable. + + All failure return values are negative and so testing the return argument + for negative values will trap all :c:func:`ARKodeEvolve` failures. + + Since interpolation may reduce the accuracy in the reported + solution, if full method accuracy is desired the user should issue + a call to :c:func:`ARKodeSetStopTime` before the call to + :c:func:`ARKodeEvolve` to specify a fixed stop time to + end the time step and return to the user. Upon return from + :c:func:`ARKodeEvolve`, a copy of the internal solution + :math:`y_{n}` will be returned in the vector *yout*. Once the + integrator returns at a *tstop* time, any future testing for + *tstop* is disabled (and can be re-enabled only though a new call + to :c:func:`ARKodeSetStopTime`). + + On any error return in which one or more internal steps were taken + by :c:func:`ARKodeEvolve`, the returned values of *tret* and + *yout* correspond to the farthest point reached in the integration. + On all other error returns, *tret* and *yout* are left unchanged + from those provided to the routine. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.OptionalInputs: + +Optional input functions +------------------------- + +There are numerous optional input parameters that control the behavior +of ARKODE, each of which may be modified from its default value through +calling an appropriate input function. The following tables list all +optional input functions, grouped by which aspect of ARKODE they control. +Detailed information on the calling syntax and arguments for each +function are then provided following each table. + +The optional inputs are grouped into the following categories: + +* General ARKODE options (:ref:`ARKODE.Usage.ARKodeInputTable`), +* Step adaptivity solver options (:ref:`ARKODE.Usage.ARKodeAdaptivityInputTable`), +* Implicit stage solver options (:ref:`ARKODE.Usage.ARKodeSolverInputTable`), +* Linear solver interface options (:ref:`ARKODE.Usage.ARKLsInputs`), and +* Rootfinding options (:ref:`ARKODE.Usage.ARKodeRootfindingInputTable`). + +For the most casual use of ARKODE, relying on the default set of +solver parameters, the reader can skip to section on user-supplied +functions, :numref:`ARKODE.Usage.UserSupplied`. + +We note that, on an error return, all of the optional input functions send an +error message to the error handler function. All error return values are +negative, so a test on the return arguments for negative values will catch all +errors. Finally, a call to an ``ARKodeSet***`` function can generally be made +from the user's calling program at any time *after* creation of the ARKODE +solver via ``*StepCreate``, and, the function exited successfully, takes effect immediately. +``ARKodeSet***`` functions that cannot be called at any time note +this in the "notes" section of the function documentation. + + + +.. _ARKODE.Usage.ARKodeInputTable: + +Optional inputs for ARKODE +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cssclass:: table-bordered + +================================================ ======================================= ======================= +Optional input Function name Default +================================================ ======================================= ======================= +Return ARKODE parameters to their defaults :c:func:`ARKodeSetDefaults` internal +Set integrator method order :c:func:`ARKodeSetOrder` 4 +Set dense output interpolation type :c:func:`ARKodeSetInterpolantType` ``ARK_INTERP_HERMITE`` +Set dense output polynomial degree :c:func:`ARKodeSetInterpolantDegree` 5 +Supply a pointer to a diagnostics output file :c:func:`ARKodeSetDiagnostics` ``NULL`` +Disable time step adaptivity (fixed-step mode) :c:func:`ARKodeSetFixedStep` disabled +Supply an initial step size to attempt :c:func:`ARKodeSetInitStep` estimated +Maximum no. of warnings for :math:`t_n+h = t_n` :c:func:`ARKodeSetMaxHnilWarns` 10 +Maximum no. of internal steps before *tout* :c:func:`ARKodeSetMaxNumSteps` 500 +Maximum absolute step size :c:func:`ARKodeSetMaxStep` :math:`\infty` +Minimum absolute step size :c:func:`ARKodeSetMinStep` 0.0 +Set a value for :math:`t_{stop}` :c:func:`ARKodeSetStopTime` undefined +Interpolate at :math:`t_{stop}` :c:func:`ARKodeSetInterpolateStopTime` ``SUNFALSE`` +Disable the stop time :c:func:`ARKodeClearStopTime` N/A +Supply a pointer for user data :c:func:`ARKodeSetUserData` ``NULL`` +Maximum no. of ARKODE error test failures :c:func:`ARKodeSetMaxErrTestFails` 7 +Set inequality constraints on solution :c:func:`ARKodeSetConstraints` ``NULL`` +Set max number of constraint failures :c:func:`ARKodeSetMaxNumConstrFails` 10 +Use compensated summation :c:func:`ARKodeSetUseCompensatedSums` off +================================================ ======================================= ======================= + + + + +.. c:function:: int ARKodeSetDefaults(void* arkode_mem) + + Resets all optional input parameters to ARKODE's original + default values. + + :param arkode_mem: pointer to the ARKODE memory block. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + Does not change the *user_data* pointer or any + parameters within the specified time-stepping module. + + Also leaves alone any data structures or options related to + root-finding (those can be reset using :c:func:`ARKodeRootInit`). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetOrder(void* arkode_mem, int ord) + + Specifies the order of accuracy for the IVP integration method. + + :param arkode_mem: pointer to the ARKODE memory block. + :param ord: requested order of accuracy. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + For explicit methods, the allowed values are :math:`2 \le` + *ord* :math:`\le 8`. For implicit methods, the allowed values are + :math:`2\le` *ord* :math:`\le 5`, and for ImEx methods the allowed + values are :math:`2 \le` *ord* :math:`\le 5`. Any illegal input + will result in the default value of 4. + + Since *ord* affects the memory requirements for the internal + ARKODE memory block, it cannot be changed after the first call to + :c:func:`ARKodeEvolve`, unless ``*StepReInit`` is called. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetInterpolantType(void* arkode_mem, int itype) + + Specifies use of the Lagrange or Hermite interpolation modules (used for + dense output -- interpolation of solution output values and implicit + method predictors). + + :param arkode_mem: pointer to the ARKODE memory block. + :param itype: requested interpolant type (``ARK_INTERP_HERMITE`` or ``ARK_INTERP_LAGRANGE``). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_MEM_FAIL: the interpolation module could not be allocated. + :retval ARK_ILL_INPUT: the *itype* argument is not recognized or the + interpolation module has already been initialized. + + .. note:: + + The Hermite interpolation module is described in + :numref:`ARKODE.Mathematics.Interpolation.Hermite`, and the Lagrange interpolation module + is described in :numref:`ARKODE.Mathematics.Interpolation.Lagrange`. + + This routine frees any previously-allocated interpolation module, and re-creates + one according to the specified argument. Thus any previous calls to + :c:func:`ARKodeSetInterpolantDegree` will be nullified. + + After the first call to :c:func:`ARKodeEvolve` the interpolation type may + not be changed without first calling ``*StepReInit``. + + If this routine is not called, the Hermite interpolation module will be used. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetInterpolantDegree(void* arkode_mem, int degree) + + Specifies the degree of the polynomial interpolant + used for dense output (i.e. interpolation of solution output values + and implicit method predictors). + + :param arkode_mem: pointer to the ARKODE memory block. + :param degree: requested polynomial degree. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` or the interpolation module are ``NULL``. + :retval ARK_INTERP_FAIL: this was called after :c:func:`ARKodeEvolve`. + :retval ARK_ILL_INPUT: an argument had an illegal value or the + interpolation module has already been initialized. + + .. note:: + + Allowed values are between 0 and 5. + + This routine should be called *before* :c:func:`ARKodeEvolve`. After the + first call to :c:func:`ARKodeEvolve` the interpolation degree may not be + changed without first calling ``*StepReInit``. + + If a user calls both this routine and :c:func:`ARKodeSetInterpolantType`, then + :c:func:`ARKodeSetInterpolantType` must be called first. + + Since the accuracy of any polynomial interpolant is limited by the + accuracy of the time-step solutions on which it is based, the *actual* + polynomial degree that is used by ARKODE will be the minimum of + :math:`q-1` and the input *degree*, for :math:`q > 1` where :math:`q` is + the order of accuracy for the time integration method. + + When :math:`q=1`, a linear interpolant is the default to ensure values + obtained by the integrator are returned at the ends of the time + interval. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed) + + Disables time step adaptivity within ARKODE, and specifies the + fixed time step size to use for the following internal step(s). + + :param arkode_mem: pointer to the ARKODE memory block. + :param hfixed: value of the fixed step size to use. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + Pass 0.0 to return ARKODE to the default (adaptive-step) mode. + + Use of this function is not generally recommended, since it gives no + assurance of the validity of the computed solutions. It is + primarily provided for code-to-code verification testing purposes. + + When using :c:func:`ARKodeSetFixedStep`, any values provided to + the functions + :c:func:`ARKodeSetInitStep`, + :c:func:`ARKodeSetMaxErrTestFails`, + :c:func:`ARKodeSetCFLFraction`, + :c:func:`ARKodeSetErrorBias`, + :c:func:`ARKodeSetFixedStepBounds`, + :c:func:`ARKodeSetMaxCFailGrowth`, + :c:func:`ARKodeSetMaxEFailGrowth`, + :c:func:`ARKodeSetMaxFirstGrowth`, + :c:func:`ARKodeSetMaxGrowth`, + :c:func:`ARKodeSetMinReduction`, + :c:func:`ARKodeSetSafetyFactor`, + :c:func:`ARKodeSetSmallNumEFails`, + :c:func:`ARKodeSetStabilityFn`, and + :c:func:`ARKodeSetAdaptController` + will be ignored, since temporal adaptivity is disabled. + + If both :c:func:`ARKodeSetFixedStep` and + :c:func:`ARKodeSetStopTime` are used, then the fixed step size + will be used for all steps until the final step preceding the + provided stop time (which may be shorter). To resume use of the + previous fixed step size, another call to + :c:func:`ARKodeSetFixedStep` must be made prior to calling + :c:func:`ARKodeEvolve` to resume integration. + + It is *not* recommended that :c:func:`ARKodeSetFixedStep` be used + in concert with :c:func:`ARKodeSetMaxStep` or + :c:func:`ARKodeSetMinStep`, since at best those latter two + routines will provide no useful information to the solver, and at + worst they may interfere with the desired fixed step size. + + .. versionadded:: x.y.z + + + +.. c:function:: int ARKodeSetInitStep(void* arkode_mem, sunrealtype hin) + + Specifies the initial time step size ARKODE should use after + initialization, re-initialization, or resetting. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hin: value of the initial step to be attempted :math:`(\ne 0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + Pass 0.0 to use the default value. + + By default, ARKODE estimates the initial step size to be + :math:`h = \sqrt{\dfrac{2}{\left\| \ddot{y}\right\|}}`, where + :math:`\ddot{y}` is estimate of the second derivative of the solution + at :math:`t_0`. + + This routine will also reset the step size and error history. + + .. versionadded:: x.y.z + + + +.. c:function:: int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil) + + Specifies the maximum number of messages issued by the + solver to warn that :math:`t+h=t` on the next internal step, before + ARKODE will instead return with an error. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mxhnil: maximum allowed number of warning messages :math:`(>0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + The default value is 10; set *mxhnil* to zero to specify + this default. + + A negative value indicates that no warning messages should be issued. + + .. versionadded:: x.y.z + + + +.. c:function:: int ARKodeSetMaxNumSteps(void* arkode_mem, long int mxsteps) + + Specifies the maximum number of steps to be taken by the + solver in its attempt to reach the next output time, before ARKODE + will return with an error. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mxsteps: maximum allowed number of internal steps. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + Passing *mxsteps* = 0 results in ARKODE using the + default value (500). + + Passing *mxsteps* < 0 disables the test (not recommended). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax) + + Specifies the upper bound on the magnitude of the time step size. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hmax: maximum absolute value of the time step size :math:`(\ge 0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Pass *hmax* :math:`\le 0.0` to set the default value of :math:`\infty`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin) + + Specifies the lower bound on the magnitude of the time step size. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hmin: minimum absolute value of the time step size :math:`(\ge 0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Pass *hmin* :math:`\le 0.0` to set the default value of 0. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop) + + Specifies the value of the independent variable + :math:`t` past which the solution is not to proceed. + + :param arkode_mem: pointer to the ARKODE memory block. + :param tstop: stopping time for the integrator. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + The default is that no stop time is imposed. + + Once the integrator returns at a stop time, any future testing for + ``tstop`` is disabled (and can be reenabled only though a new call to + :c:func:`ARKodeSetStopTime`). + + A stop time not reached before a call to ``*StepReInit`` or + :c:func:`ARKodeReset` will remain active but can be disabled by calling + :c:func:`ARKodeClearStopTime`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp) + + Specifies that the output solution should be interpolated when the current + :math:`t` equals the specified ``tstop`` (instead of merely copying the + internal solution :math:`y_n`). + + :param arkode_mem: pointer to the ARKODE memory block. + :param interp: flag indicating to use interpolation (1) or copy (0). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeClearStopTime(void* arkode_mem) + + Disables the stop time set with :c:func:`ARKodeSetStopTime`. + + :param arkode_mem: pointer to the ARKODE memory block. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + The stop time can be reenabled though a new call to + :c:func:`ARKodeSetStopTime`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetUserData(void* arkode_mem, void* user_data) + + Specifies the user data block *user_data* and + attaches it to the main ARKODE memory block. + + :param arkode_mem: pointer to the ARKODE memory block. + :param user_data: pointer to the user data. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + If specified, the pointer to *user_data* is passed to all + user-supplied functions for which it is an argument; otherwise + ``NULL`` is passed. + + If *user_data* is needed in user preconditioner functions, the call to + this function must be made *before* any calls to + :c:func:`ARKodeSetLinearSolver` and/or :c:func:`ARKodeSetMassLinearSolver`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef) + + Specifies the maximum number of error test failures + permitted in attempting one step, before returning with an error. + + :param arkode_mem: pointer to the ARKODE memory block. + :param maxnef: maximum allowed number of error test failures :math:`(>0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + The default value is 7; set *maxnef* :math:`\le 0` + to specify this default. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) + + Specifies a vector defining inequality constraints for each component of the + solution vector :math:`y`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param constraints: vector of constraint flags. Each component specifies + the type of solution constraint: + + .. math:: + + \texttt{constraints[i]} = \left\{ \begin{array}{rcl} + 0.0 &\Rightarrow\;& \text{no constraint is imposed on}\; y_i,\\ + 1.0 &\Rightarrow\;& y_i \geq 0,\\ + -1.0 &\Rightarrow\;& y_i \leq 0,\\ + 2.0 &\Rightarrow\;& y_i > 0,\\ + -2.0 &\Rightarrow\;& y_i < 0.\\ + \end{array}\right. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: the constraints vector contains illegal values. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + The presence of a non-``NULL`` constraints vector that is not 0.0 + in all components will cause constraint checking to be performed. However, a + call with 0.0 in all components of ``constraints`` will result in an illegal + input return. A ``NULL`` constraints vector will disable constraint checking. + + After a call to :c:func:`ARKodeResize` inequality constraint checking + will be disabled and a call to :c:func:`ARKodeSetConstraints` is + required to re-enable constraint checking. + + Since constraint-handling is performed through cutting time steps that would + violate the constraints, it is possible that this feature will cause some + problems to fail due to an inability to enforce constraints even at the + minimum time step size. Additionally, the features :c:func:`ARKodeSetConstraints` + and :c:func:`ARKodeSetFixedStep` are incompatible, and should not be used + simultaneously. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails) + + Specifies the maximum number of constraint failures in a step before ARKODE + will return with an error. + + :param arkode_mem: pointer to the ARKODE memory block. + :param maxfails: maximum allowed number of constrain failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Passing *maxfails* <= 0 results in ARKODE using the + default value (10). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) + + Specifies if :ref:`compensated summation (and the incremental form) ` + should be used where applicable. This is currently only supported when using + the SPRKStep time-stepping module, but may be incorporated more thoroughly into + ARKODE in a future release. + + This increases the computational cost by 2 extra vector operations per stage + and an additional 5 per time step. It also requires one extra vector to be + stored. However, it is signficantly more robust to roundoff error + accumulation. + + :param arkode_mem: pointer to the ARKODE memory block. + :param onoff: should compensated summation be used (1) or not (0). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + + +.. _ARKODE.Usage.ARKodeAdaptivityInputTable: + +Optional inputs for time step adaptivity +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The mathematical explanation of ARKODE's time step adaptivity +algorithm, including how each of the parameters below is used within +the code, is provided in :numref:`ARKODE.Mathematics.Adaptivity`. + + +.. cssclass:: table-bordered + +========================================================= ========================================== ======== +Optional input Function name Default +========================================================= ========================================== ======== +Provide a :c:type:`SUNAdaptController` for ARKODE to use :c:func:`ARKodeSetAdaptController` PID +Adjust the method order used in the controller :c:func:`ERKStepSetAdaptivityAdjustment` -1 +Explicit stability safety factor :c:func:`ARKodeSetCFLFraction` 0.5 +Time step error bias factor :c:func:`ARKodeSetErrorBias` 1.5 +Bounds determining no change in step size :c:func:`ARKodeSetFixedStepBounds` 1.0 1.5 +Maximum step growth factor on convergence fail :c:func:`ARKodeSetMaxCFailGrowth` 0.25 +Maximum step growth factor on error test fail :c:func:`ARKodeSetMaxEFailGrowth` 0.3 +Maximum first step growth factor :c:func:`ARKodeSetMaxFirstGrowth` 10000.0 +Maximum allowed general step growth factor :c:func:`ARKodeSetMaxGrowth` 20.0 +Minimum allowed step reduction factor on error test fail :c:func:`ARKodeSetMinReduction` 0.1 +Time step safety factor :c:func:`ARKodeSetSafetyFactor` 0.96 +Error fails before MaxEFailGrowth takes effect :c:func:`ARKodeSetSmallNumEFails` 2 +Explicit stability function :c:func:`ARKodeSetStabilityFn` none +========================================================= ========================================== ======== + + + +.. c:function:: int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C) + + Sets a user-supplied time-step controller object. + + :param arkode_mem: pointer to the ARKODE memory block. + :param C: user-supplied time adaptivity controller. If ``NULL`` then the PID controller + will be created (see :numref:`SUNAdaptController.Soderlind`). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_MEM_FAIL: *C* was ``NULL`` and the PID controller could not be allocated. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) + + Called by a user to adjust the method order supplied to the temporal adaptivity + controller. For example, if the user expects order reduction due to problem stiffness, + they may request that the controller assume a reduced order of accuracy for the method + by specifying a value :math:`adjust < 0`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param adjust: adjustment factor (default is -1). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + This should be called prior to calling :c:func:`ARKodeEvolve`, and can only be + reset following a call to ``*StepReInit``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) + + Specifies the fraction of the estimated explicitly stable step to use. + + :param arkode_mem: pointer to the ARKODE memory block. + :param cfl_frac: maximum allowed fraction of explicitly stable step (default is 0.5). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any non-positive parameter will imply a reset to the default + value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) + + Specifies the bias to be applied to the error estimates within + accuracy-based adaptivity strategies. + + :param arkode_mem: pointer to the ARKODE memory block. + :param bias: bias applied to error in accuracy-based time + step estimation (default is 1.5). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value below 1.0 will imply a reset to the default value. + + If both this and one of :c:func:`ARKodeSetAdaptivityMethod` or + :c:func:`ARKodeSetAdaptController` will be called, then this routine must be called + *second*. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) + + Specifies the step growth interval in which the step size will remain unchanged. + + :param arkode_mem: pointer to the ARKODE memory block. + :param lb: lower bound on window to leave step size fixed (default is 1.0). + :param ub: upper bound on window to leave step size fixed (default is 1.5). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any interval *not* containing 1.0 will imply a reset to the default values. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) + + Specifies the maximum step size growth factor upon an algebraic + solver convergence failure on a stage solve within a step, :math:`\eta_{cf}` from + :numref:`ARKODE.Mathematics.Error.Nonlinear`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param etacf: time step reduction factor on a nonlinear solver + convergence failure (default is 0.25). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value outside the interval :math:`(0,1]` will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) + + Specifies the maximum step size growth factor upon multiple successive + accuracy-based error failures in the solver. + + :param arkode_mem: pointer to the ARKODE memory block. + :param etamxf: time step reduction factor on multiple error fails (default is 0.3). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value outside the interval :math:`(0,1]` will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) + + Specifies the maximum allowed growth factor in step size following the very + first integration step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param etamx1: maximum allowed growth factor after the first time + step (default is 10000.0). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value :math:`\le 1.0` will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) + + Specifies the maximum allowed growth factor in step size between + consecutive steps in the integration process. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mx_growth: maximum allowed growth factor between consecutive time steps (default is 20.0). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value :math:`\le 1.0` will imply a reset to the default + value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min) + + Specifies the minimum allowed reduction factor in step size between + step attempts, resulting from a temporal error failure in the integration + process. + + :param arkode_mem: pointer to the ARKODE memory block. + :param eta_min: minimum allowed reduction factor in time step after an error + test failure (default is 0.1). + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + Any value outside the interval :math:`(0,1)` will imply a reset to + the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety) + + Specifies the safety factor to be applied to the accuracy-based + estimated step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param safety: safety factor applied to accuracy-based time step (default is 0.96). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value :math:`\le 0` will imply a reset to the default + value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef) + + Specifies the threshold for "multiple" successive error failures + before the *etamxf* parameter from + :c:func:`ARKodeSetMaxEFailGrowth` is applied. + + :param arkode_mem: pointer to the ARKODE memory block. + :param small_nef: bound to determine 'multiple' for *etamxf* (default is 2). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + Any value :math:`\le 0` will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) + + Sets the problem-dependent function to estimate a stable + time step size for the explicit portion of the ODE system. + + :param arkode_mem: pointer to the ARKODE memory block. + :param EStab: name of user-supplied stability function. + :param estab_data: pointer to user data passed to *EStab* every time + it is called. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. note:: + + This function should return an estimate of the absolute + value of the maximum stable time step for the explicit portion of + the ODE system. It is not required, since accuracy-based + adaptivity may be sufficient for retaining stability, but this can + be quite useful for problems where the explicit right-hand side + function :math:`f^E(t,y)` contains stiff terms. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.ARKodeSolverInputTable: + +Optional inputs for implicit stage solves +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The mathematical explanation for the nonlinear solver strategies used +by ARKODE, including how each of the parameters below is used within +the code, is provided in :numref:`ARKODE.Mathematics.Nonlinear`. + + +.. cssclass:: table-bordered + +============================================================== ====================================== ============ +Optional input Function name Default +============================================================== ====================================== ============ +Specify that the implicit RHS is linear :c:func:`ARKodeSetLinear` ``SUNFALSE`` +Specify that the implicit RHS nonlinear :c:func:`ARKodeSetNonlinear` ``SUNTRUE`` +Implicit predictor method :c:func:`ARKodeSetPredictorMethod` 0 +User-provided implicit stage predictor :c:func:`ARKodeSetStagePredictFn` ``NULL`` +RHS function for nonlinear system evaluations :c:func:`ARKodeSetNlsRhsFn` ``NULL`` +Maximum number of nonlinear iterations :c:func:`ARKodeSetMaxNonlinIters` 3 +Coefficient in the nonlinear convergence test :c:func:`ARKodeSetNonlinConvCoef` 0.1 +Nonlinear convergence rate constant :c:func:`ARKodeSetNonlinCRDown` 0.3 +Nonlinear residual divergence ratio :c:func:`ARKodeSetNonlinRDiv` 2.3 +Maximum number of convergence failures :c:func:`ARKodeSetMaxConvFails` 10 +Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeSetDeduceImplicitRhs` ``SUNFALSE`` +============================================================== ====================================== ============ + + + + + +.. c:function:: int ARKodeSetLinear(void* arkode_mem, int timedepend) + + Specifies that the implicit portion of the problem is linear. + + :param arkode_mem: pointer to the ARKODE memory block. + :param timedepend: flag denoting whether the Jacobian of + :math:`f^I(t,y)` is time-dependent (1) or not (0). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Tightens the linear solver tolerances and takes only a + single Newton iteration. Calls :c:func:`ARKodeSetDeltaGammaMax` + to enforce Jacobian recomputation when the step size ratio changes + by more than 100 times the unit roundoff (since nonlinear + convergence is not tested). Only applicable when used in + combination with the modified or inexact Newton iteration (not the + fixed-point solver). + + When :math:`f^I(t,y)` is time-dependent, all linear solver structures + (Jacobian, preconditioner) will be updated preceding *each* implicit + stage. Thus one must balance the relative costs of such recomputation + against the benefits of requiring only a single Newton linear solve. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNonlinear(void* arkode_mem) + + Specifies that the implicit portion of the problem is nonlinear. + + :param arkode_mem: pointer to the ARKODE memory block. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + This is the default behavior of ARKODE, so the function + is primarily useful to undo a previous call to + :c:func:`ARKodeSetLinear`. Calls + :c:func:`ARKodeSetDeltaGammaMax` to reset the step size ratio + threshold to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetPredictorMethod(void* arkode_mem, int method) + + Specifies the method from :numref:`ARKODE.Mathematics.Predictors` to use + for predicting implicit solutions. + + :param arkode_mem: pointer to the ARKODE memory block. + :param method: method choice (0 :math:`\le` *method* :math:`\le` 4): + + * 0 is the trivial predictor, + + * 1 is the maximum order (dense output) predictor, + + * 2 is the variable order predictor, that decreases the + polynomial degree for more distant RK stages, + + * 3 is the cutoff order predictor, that uses the maximum order + for early RK stages, and a first-order predictor for distant + RK stages, + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default value is 0. If *method* is set to an + undefined value, this default predictor will be used. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) + + Sets the user-supplied function to update the implicit stage predictor prior to + execution of the nonlinear or linear solver algorithms that compute the implicit stage solution. + + :param arkode_mem: pointer to the ARKODE memory block. + :param PredictStage: name of user-supplied predictor function. If ``NULL``, then any + previously-provided stage prediction function will be disabled. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + See :numref:`ARKODE.Usage.StagePredictFn` for more information on + this user-supplied routine. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) + + Specifies an alternative implicit right-hand side function for evaluating + :math:`f^I(t,y)` within nonlinear system function evaluations + :eq:`ARKODE_Residual_MeqI` - :eq:`ARKODE_Residual_MTimeDep`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nls_fi: the alternative C function for computing the right-hand side + function :math:`f^I(t,y)` in the ODE. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default is to use the implicit right-hand side function + provided to :c:func:`ARKodeCreate` in nonlinear system functions. If the + input implicit right-hand side function is ``NULL``, the default is used. + + When using a non-default nonlinear solver, this function must be called + *after* :c:func:`ARKodeSetNonlinearSolver`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) + + Specifies the maximum number of nonlinear solver + iterations permitted per implicit stage solve within each time step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param maxcor: maximum allowed solver iterations per stage :math:`(>0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value or if the SUNNONLINSOL module is ``NULL``. + :retval ARK_NLS_OP_ERR: the SUNNONLINSOL object returned a failure flag. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default value is 3; set *maxcor* :math:`\le 0` + to specify this default. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) + + Specifies the safety factor :math:`\epsilon` used within the nonlinear + solver convergence test :eq:`ARKODE_NonlinearTolerance`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nlscoef: coefficient in nonlinear solver convergence test :math:`(>0.0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default value is 0.1; set *nlscoef* :math:`\le 0` + to specify this default. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) + + Specifies the constant :math:`c_r` used in estimating the nonlinear solver convergence rate :eq:`ARKODE_NonlinearCRate`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param crdown: nonlinear convergence rate estimation constant (default is 0.3). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Any non-positive parameter will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) + + Specifies the nonlinear correction threshold :math:`r_{div}` from + :eq:`ARKODE_NonlinearDivergence`, beyond which the iteration will be declared divergent. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rdiv: tolerance on nonlinear correction size ratio to + declare divergence (default is 2.3). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Any non-positive parameter will imply a reset to the default value. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) + + Specifies the maximum number of nonlinear solver convergence + failures permitted during one step, :math:`max_{ncf}` from + :numref:`ARKODE.Mathematics.Error.Nonlinear`, before ARKODE will return with + an error. + + :param arkode_mem: pointer to the ARKODE memory block. + :param maxncf: maximum allowed nonlinear solver convergence failures + per step :math:`(>0)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default value is 10; set *maxncf* :math:`\le 0` + to specify this default. + + Upon each convergence failure, ARKODE will first call the Jacobian + setup routine and try again (if a Newton method is used). If a + convergence failure still occurs, the time step size is reduced by + the factor *etacf* (set within :c:func:`ARKodeSetMaxCFailGrowth`). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetDeduceImplicitRhs(void *arkode_mem, sunbooleantype deduce) + + Specifies if implicit stage derivatives are deduced without evaluating + :math:`f^I`. See :numref:`ARKODE.Mathematics.Nonlinear` for more details. + + :param arkode_mem: pointer to the ARKODE memory block. + :param deduce: if ``SUNFALSE`` (default), the stage derivative is obtained + by evaluating :math:`f^I` with the stage solution returned from the + nonlinear solver. If ``SUNTRUE``, the stage derivative is deduced + without an additional evaluation of :math:`f^I`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. versionadded:: x.y.z + + +.. _ARKODE.Usage.ARKLsInputs: + + +Linear solver interface optional input functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The mathematical explanation of the linear solver methods +available to ARKODE is provided in :numref:`ARKODE.Mathematics.Linear`. We group +the user-callable routines into four categories: general routines concerning +the update frequency for matrices and/or preconditioners, optional inputs for +matrix-based linear solvers, optional inputs for matrix-free linear solvers, +and optional inputs for iterative linear solvers. We note that the +matrix-based and matrix-free groups are mutually exclusive, whereas the +"iterative" tag can apply to either case. + + + +.. _ARKODE.Usage.ARKLsInputs.General: + +.. index:: + single: optional input; generic linear solver interface (ARKODE) + +Optional inputs for the ARKLS linear solver interface +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +As discussed in :numref:`ARKODE.Mathematics.Linear.Setup`, ARKODE +strives to reuse matrix and preconditioner data for as many solves as +possible to amortize the high costs of matrix construction and +factorization. To that end, ARKODE provides user-callable +routines to modify this behavior. Recall that the +Newton system matrices that arise within an implicit stage solve are +:math:`\mathcal{A}(t,z) \approx M(t) - \gamma J(t,z)`, where the +implicit right-hand side function has Jacobian matrix +:math:`J(t,z) = \frac{\partial f^I(t,z)}{\partial z}`. + +The matrix or preconditioner for :math:`\mathcal{A}` can only be +updated within a call to the linear solver "setup" routine. In +general, the frequency with which the linear solver setup routine is +called may be controlled with the *msbp* argument to +:c:func:`ARKodeSetLSetupFrequency`. When this occurs, the +validity of :math:`\mathcal{A}` for successive time steps +intimately depends on whether the corresponding :math:`\gamma` and +:math:`J` inputs remain valid. + +At each call to the linear solver setup routine the decision to update +:math:`\mathcal{A}` with a new value of :math:`\gamma`, and to reuse +or reevaluate Jacobian information, depends on several factors including: + +* the success or failure of previous solve attempts, +* the success or failure of the previous time step attempts, +* the change in :math:`\gamma` from the value used when constructing :math:`\mathcal{A}`, and +* the number of steps since Jacobian information was last evaluated. + +Jacobian information is considered out-of-date when :math:`msbj` or more steps +have been completed since the last update, in which case it will be recomputed during the next +linear solver setup call. The value of :math:`msbj` is controlled with the +``msbj`` argument to :c:func:`ARKodeSetJacEvalFrequency`. + +For linear-solvers with user-supplied preconditioning the above factors are used +to determine whether to recommend updating the Jacobian information in the +preconditioner (i.e., whether to set *jok* to ``SUNFALSE`` in calling the +user-supplied :c:type:`ARKLsPrecSetupFn`). For matrix-based linear solvers +these factors determine whether the matrix :math:`J(t,y) = \frac{\partial f^I(t,y)}{\partial y}` +should be updated (either with an internal finite difference approximation or +a call to the user-supplied :c:type:`ARKLsJacFn`); if not then the previous +value is reused and the system matrix :math:`\mathcal{A}(t,y) \approx M(t) - \gamma J(t,y)` +is recomputed using the current :math:`\gamma` value. + + + +.. _ARKODE.Usage.ARKLsInputs.General.Table: +.. table:: Optional inputs for the ARKLS linear solver interface + + ============================================= ==================================== ============ + Optional input Function name Default + ============================================= ==================================== ============ + Max change in step signaling new :math:`J` :c:func:`ARKodeSetDeltaGammaMax` 0.2 + Linear solver setup frequency :c:func:`ARKodeSetLSetupFrequency` 20 + Jacobian / preconditioner update frequency :c:func:`ARKodeSetJacEvalFrequency` 51 + ============================================= ==================================== ============ + + +.. c:function:: int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) + + Specifies a scaled step size ratio tolerance, :math:`\Delta\gamma_{max}` from + :numref:`ARKODE.Mathematics.Linear.Setup`, beyond which the linear solver + setup routine will be signaled. + + :param arkode_mem: pointer to the ARKODE memory block. + :param dgmax: tolerance on step size ratio change before calling + linear solver setup routine (default is 0.2). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Any non-positive parameter will imply a reset to the default value. + + .. versionadded:: x.y.z + +.. index:: + single: optional input; linear solver setup frequency (ARKODE) + +.. c:function:: int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) + + Specifies the frequency of calls to the linear solver setup + routine, :math:`msbp` from :numref:`ARKODE.Mathematics.Linear.Setup`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param msbp: the linear solver setup frequency. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Positive values of **msbp** specify the linear solver setup frequency. For + example, an input of 1 means the setup function will be called every time + step while an input of 2 means it will be called called every other time + step. If **msbp** is 0, the default value of 20 will be used. A negative + value forces a linear solver step at each implicit stage. + + .. versionadded:: x.y.z + + +.. index:: + single: optional input; Jacobian update frequency (ARKODE) + single: optional input; preconditioner update frequency (ARKODE) + +.. c:function:: int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) + + Specifies the number of steps after which the Jacobian information is + considered out-of-date, :math:`msbj` from :numref:`ARKODE.Mathematics.Linear.Setup`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param msbj: the Jacobian re-computation or preconditioner update frequency. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + If ``nstlj`` is the step number at which the Jacobian information was + lasted updated and ``nst`` is the current step number, + ``nst - nstlj >= msbj`` indicates that the Jacobian information will be updated + during the next linear solver setup call. + + As the Jacobian update frequency is only checked *within* calls to the + linear solver setup routine, Jacobian information may be more than + ``msbj`` steps old when updated depending on when a linear solver setup + call occurs. See :numref:`ARKODE.Mathematics.Linear.Setup` + for more information on when linear solver setups are performed. + + Passing a value *msbj* :math:`\le 0` indicates to use the + default value of 51. + + This function must be called *after* the ARKLS system solver interface has + been initialized through a call to :c:func:`ARKodeSetLinearSolver`. + + .. versionadded:: x.y.z + + + + + + +.. _ARKODE.Usage.ARKLsInputs.MatrixBased: + +Optional inputs for matrix-based ``SUNLinearSolver`` modules +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +.. cssclass:: table-bordered + +========================================= ======================================== ============= +Optional input Function name Default +========================================= ======================================== ============= +Jacobian function :c:func:`ARKodeSetJacFn` ``DQ`` +Linear system function :c:func:`ARKodeSetLinSysFn` internal +Mass matrix function :c:func:`ARKodeSetMassFn` none +Enable or disable linear solution scaling :c:func:`ARKodeSetLinearSolutionScaling` on +========================================= ======================================== ============= + +When using matrix-based linear solver modules, the ARKLS solver interface needs +a function to compute an approximation to the Jacobian matrix :math:`J(t,y)` or +the linear system :math:`\mathcal{A}(t,y) = M(t) - \gamma J(t,y)`. + +For :math:`J(t,y)`, the ARKLS interface is packaged with a routine that can approximate +:math:`J` if the user has selected either the :ref:`SUNMATRIX_DENSE ` or +:ref:`SUNMATRIX_BAND ` objects. Alternatively, +the user can supply a custom Jacobian function of type :c:func:`ARKLsJacFn` -- this is +*required* when the user selects other matrix formats. To specify a user-supplied +Jacobian function, ARKODE provides the function :c:func:`ARKodeSetJacFn`. + +Alternatively, a function of type :c:func:`ARKLsLinSysFn` can be provided to +evaluate the matrix :math:`\mathcal{A}(t,y)`. By default, ARKLS uses an +internal linear system function leveraging the SUNMATRIX API to form the matrix +:math:`\mathcal{A}(t,y)` by combining the matrices :math:`M(t)` and :math:`J(t,y)`. +To specify a user-supplied linear system function instead, ARKODE provides the function +:c:func:`ARKodeSetLinSysFn`. + +If the ODE system involves a non-identity mass matrix, :math:`M\ne I`, matrix-based linear +solver modules require a function to compute an approximation to the mass matrix :math:`M(t)`. +There is no default difference quotient approximation (for any matrix type), so this +routine must be supplied by the user. This function must be of type +:c:func:`ARKLsMassFn`, and should be set using the function +:c:func:`ARKodeSetMassFn`. + +In either case (:math:`J(t,y)` versus :math:`\mathcal{A}(t,y)` is supplied) the matrix +information will be updated infrequently to reduce matrix construction and, with direct +solvers, factorization costs. As a result the value of :math:`\gamma` may not be current +and a scaling factor is applied to the solution of the linear system to account for +the lagged value of :math:`\gamma`. See :numref:`SUNLinSol.Lagged_matrix` for more details. +The function :c:func:`ARKodeSetLinearSolutionScaling` can be used to disable this +scaling when necessary, e.g., when providing a custom linear solver that updates the +matrix using the current :math:`\gamma` as part of the solve. + +The ARKLS interface passes the user data pointer to the Jacobian, linear +system, and mass matrix functions. This allows the user to create an arbitrary +structure with relevant problem data and access it during the execution of the +user-supplied Jacobian, linear system or mass matrix functions, without using global +data in the program. The user data pointer may be specified through +:c:func:`ARKodeSetUserData`. + + + +.. c:function:: int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) + + Specifies the Jacobian approximation routine to + be used for the matrix-based solver with the ARKLS interface. + + :param arkode_mem: pointer to the ARKODE memory block. + :param jac: name of user-supplied Jacobian approximation function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + This routine must be called after the ARKLS linear + solver interface has been initialized through a call to + :c:func:`ARKodeSetLinearSolver`. + + By default, ARKLS uses an internal difference quotient function for + the :ref:`SUNMATRIX_DENSE ` and + :ref:`SUNMATRIX_BAND ` modules. If ``NULL`` is passed + in for *jac*, this default is used. An error will occur if no *jac* is + supplied when using other matrix types. + + The function type :c:func:`ARKLsJacFn` is described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) + + Specifies the linear system approximation routine to be used for the + matrix-based solver with the ARKLS interface. + + :param arkode_mem: pointer to the ARKODE memory block. + :param linsys: name of user-supplied linear system approximation function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + This routine must be called after the ARKLS linear + solver interface has been initialized through a call to + :c:func:`ARKodeSetLinearSolver`. + + By default, ARKLS uses an internal linear system function that leverages the + SUNMATRIX API to form the system :math:`M - \gamma J`. If ``NULL`` is passed + in for *linsys*, this default is used. + + The function type :c:func:`ARKLsLinSysFn` is described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) + + Specifies the mass matrix approximation routine to be used for the + matrix-based solver with the ARKLS interface. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mass: name of user-supplied mass matrix approximation function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_MASSMEM_NULL: the mass matrix solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This routine must be called after the ARKLS mass matrix + solver interface has been initialized through a call to + :c:func:`ARKodeSetMassLinearSolver`. + + Since there is no default difference quotient function for mass + matrices, *mass* must be non-``NULL``. + + The function type :c:func:`ARKLsMassFn` is described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) + + Enables or disables scaling the linear system solution to account for a + change in :math:`\gamma` in the linear system. For more details see + :numref:`SUNLinSol.Lagged_matrix`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param onoff: flag to enable (``SUNTRUE``) or disable (``SUNFALSE``) + scaling. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_ILL_INPUT: the attached linear solver is not matrix-based. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Linear solution scaling is enabled by default when a matrix-based + linear solver is attached. + + .. versionadded:: x.y.z + + +.. _ARKODE.Usage.ARKLsInputs.MatrixFree: + +Optional inputs for matrix-free ``SUNLinearSolver`` modules +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +.. cssclass:: table-bordered + +================================================== ================================= ================== +Optional input Function name Default +================================================== ================================= ================== +:math:`Jv` functions (*jtimes* and *jtsetup*) :c:func:`ARKodeSetJacTimes` DQ, none +:math:`Jv` DQ rhs function (*jtimesRhsFn*) :c:func:`ARKodeSetJacTimesRhsFn` fi +:math:`Mv` functions (*mtimes* and *mtsetup*) :c:func:`ARKodeSetMassTimes` none, none +================================================== ================================= ================== + + +As described in :numref:`ARKODE.Mathematics.Linear`, when solving +the Newton linear systems with matrix-free methods, the ARKLS +interface requires a *jtimes* function to compute an approximation to +the product between the Jacobian matrix +:math:`J(t,y)` and a vector :math:`v`. The user can supply a custom +Jacobian-times-vector approximation function, or use the default +internal difference quotient function that comes with the ARKLS +interface. + +A user-defined Jacobian-vector function must be of type +:c:type:`ARKLsJacTimesVecFn` and can be specified through a call +to :c:func:`ARKodeSetJacTimes` (see :numref:`ARKODE.Usage.UserSupplied` +for specification details). As with the +user-supplied preconditioner functions, the evaluation and +processing of any Jacobian-related data needed by the user's +Jacobian-times-vector function is done in the optional user-supplied +function of type :c:type:`ARKLsJacTimesSetupFn` (see +:numref:`ARKODE.Usage.UserSupplied` for specification details). As with +the preconditioner functions, a pointer to the user-defined +data structure, *user_data*, specified through +:c:func:`ARKodeSetUserData` (or a ``NULL`` pointer otherwise) is +passed to the Jacobian-times-vector setup and product functions each +time they are called. + + +.. c:function:: int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsJacTimesVecFn jtimes) + + Specifies the Jacobian-times-vector setup and product functions. + + :param arkode_mem: pointer to the ARKODE memory block. + :param jtsetup: user-defined Jacobian-vector setup function. + Pass ``NULL`` if no setup is necessary. + :param jtimes: user-defined Jacobian-vector product function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_SUNLS_FAIL: an error occurred when setting up + the Jacobian-vector product in the ``SUNLinearSolver`` + object used by the ARKLS interface. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default is to use an internal finite difference + quotient for *jtimes* and to leave out *jtsetup*. If ``NULL`` is + passed to *jtimes*, these defaults are used. A user may + specify non-``NULL`` *jtimes* and ``NULL`` *jtsetup* inputs. + + This function must be called *after* the ARKLS system solver + interface has been initialized through a call to + :c:func:`ARKodeSetLinearSolver`. + + The function types :c:type:`ARKLsJacTimesSetupFn` and + :c:type:`ARKLsJacTimesVecFn` are described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +When using the internal difference quotient the user may optionally supply +an alternative implicit right-hand side function for use in the Jacobian-vector +product approximation by calling :c:func:`ARKodeSetJacTimesRhsFn`. The +alternative implicit right-hand side function should compute a suitable (and +differentiable) approximation to the :math:`f^I` function provided to +``*StepCreate``. For example, as done in :cite:p:`dorr2010numerical`, +the alternative function may use lagged values when evaluating a nonlinearity +in :math:`f^I` to avoid differencing a potentially non-differentiable factor. +We note that in many instances this same :math:`f^I` routine would also have +been desirable for the nonlinear solver, in which case the user should specify +this through calls to *both* :c:func:`ARKodeSetJacTimesRhsFn` and +:c:func:`ARKodeSetNlsRhsFn`. + + +.. c:function:: int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) + + Specifies an alternative implicit right-hand side function for use in the + internal Jacobian-vector product difference quotient approximation. + + :param arkode_mem: pointer to the ARKODE memory block. + :param jtimesRhsFn: the name of the C function (of type + :c:func:`ARKRhsFn`) defining the alternative right-hand side function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default is to use the implicit right-hand side function + provided to ``*StepCreate`` in the internal difference quotient. If + the input implicit right-hand side function is ``NULL``, the default is used. + + This function must be called *after* the ARKLS system solver interface has + been initialized through a call to :c:func:`ARKodeSetLinearSolver`. + + .. versionadded:: x.y.z + + +Similarly, if a problem involves a non-identity mass matrix, +:math:`M\ne I`, then matrix-free solvers require a *mtimes* function +to compute an approximation to the product between the mass matrix +:math:`M(t)` and a vector :math:`v`. This function must be +user-supplied since there is no default value, it must be +of type :c:func:`ARKLsMassTimesVecFn`, and can be specified +through a call to the :c:func:`ARKodeSetMassTimes` routine. +Similarly to the user-supplied preconditioner functions, any evaluation +and processing of any mass matrix-related data needed by the user's +mass-matrix-times-vector function may be done in an optional user-supplied +function of type :c:type:`ARKLsMassTimesSetupFn` (see +:numref:`ARKODE.Usage.UserSupplied` for specification details). + + + +.. c:function:: int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, ARKLsMassTimesVecFn mtimes, void* mtimes_data) + + Specifies the mass matrix-times-vector setup and product functions. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mtsetup: user-defined mass matrix-vector setup function. + Pass ``NULL`` if no setup is necessary. + :param mtimes: user-defined mass matrix-vector product function. + :param mtimes_data: a pointer to user data, that will be supplied + to both the *mtsetup* and *mtimes* functions. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_MASSMEM_NULL: the mass matrix solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_SUNLS_FAIL: an error occurred when setting up + the mass-matrix-vector product in the ``SUNLinearSolver`` + object used by the ARKLS interface. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + There is no default finite difference quotient for + *mtimes*, so if using the ARKLS mass matrix solver interface with + NULL-valued SUNMATRIX input :math:`M`, and this routine is called + with NULL-valued *mtimes*, an error will occur. A user may + specify ``NULL`` for *mtsetup*. + + This function must be called *after* the ARKLS mass + matrix solver interface has been initialized through a call to + :c:func:`ARKodeSetMassLinearSolver`. + + The function types :c:type:`ARKLsMassTimesSetupFn` and + :c:type:`ARKLsMassTimesVecFn` are described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.ARKLsInputs.Iterative: + +Optional inputs for iterative ``SUNLinearSolver`` modules +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +.. cssclass:: table-bordered + +==================================================== ====================================== ================== +Optional input Function name Default +==================================================== ====================================== ================== +Newton preconditioning functions :c:func:`ARKodeSetPreconditioner` ``NULL``, ``NULL`` +Mass matrix preconditioning functions :c:func:`ARKodeSetMassPreconditioner` ``NULL``, ``NULL`` +Newton linear and nonlinear tolerance ratio :c:func:`ARKodeSetEpsLin` 0.05 +Mass matrix linear and nonlinear tolerance ratio :c:func:`ARKodeSetMassEpsLin` 0.05 +Newton linear solve tolerance conversion factor :c:func:`ARKodeSetLSNormFactor` vector length +Mass matrix linear solve tolerance conversion factor :c:func:`ARKodeSetMassLSNormFactor` vector length +==================================================== ====================================== ================== + + +As described in :numref:`ARKODE.Mathematics.Linear`, when using +an iterative linear solver the user may supply a preconditioning +operator to aid in solution of the system. This operator consists of +two user-supplied functions, *psetup* and *psolve*, that are supplied +to ARKODE using either the function +:c:func:`ARKodeSetPreconditioner` (for preconditioning the +Newton system), or the function +:c:func:`ARKodeSetMassPreconditioner` (for preconditioning the +mass matrix system). The *psetup* function supplied to these routines +should handle evaluation and preprocessing of any Jacobian or +mass-matrix data needed by the user's preconditioner solve function, +*psolve*. The user data pointer received through +:c:func:`ARKodeSetUserData` (or a pointer to ``NULL`` if user data +was not specified) is passed to the *psetup* and *psolve* functions. +This allows the user to create an arbitrary +structure with relevant problem data and access it during the +execution of the user-supplied preconditioner functions without using +global data in the program. If preconditioning is supplied for both +the Newton and mass matrix linear systems, it is expected that the +user will supply different *psetup* and *psolve* function for each. + +Also, as described in :numref:`ARKODE.Mathematics.Error.Linear`, the +ARKLS interface requires that iterative linear solvers stop when +the norm of the preconditioned residual satisfies + +.. math:: + \|r\| \le \frac{\epsilon_L \epsilon}{10} + +where the default :math:`\epsilon_L = 0.05` may be modified by +the user through the :c:func:`ARKodeSetEpsLin` function. + + +.. c:function:: int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, ARKLsPrecSolveFn psolve) + + Specifies the user-supplied preconditioner setup and solve functions. + + :param arkode_mem: pointer to the ARKODE memory block. + :param psetup: user defined preconditioner setup function. Pass + ``NULL`` if no setup is needed. + :param psolve: user-defined preconditioner solve function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_SUNLS_FAIL: an error occurred when setting up preconditioning + in the ``SUNLinearSolver`` object used + by the ARKLS interface. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + The default is ``NULL`` for both arguments (i.e., no + preconditioning). + + This function must be called *after* the ARKLS system solver + interface has been initialized through a call to + :c:func:`ARKodeSetLinearSolver`. + + Both of the function types :c:func:`ARKLsPrecSetupFn` and + :c:func:`ARKLsPrecSolveFn` are described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, ARKLsMassPrecSolveFn psolve) + + Specifies the mass matrix preconditioner setup and solve functions. + + :param arkode_mem: pointer to the ARKODE memory block. + :param psetup: user defined preconditioner setup function. Pass + ``NULL`` if no setup is to be done. + :param psolve: user-defined preconditioner solve function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARKLS_SUNLS_FAIL: an error occurred when setting up preconditioning + in the ``SUNLinearSolver`` object used + by the ARKLS interface. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This function must be called *after* the ARKLS mass + matrix solver interface has been initialized through a call to + :c:func:`ARKodeSetMassLinearSolver`. + + The default is ``NULL`` for both arguments (i.e. no + preconditioning). + + Both of the function types :c:func:`ARKLsMassPrecSetupFn` and + :c:func:`ARKLsMassPrecSolveFn` are described in + :numref:`ARKODE.Usage.UserSupplied`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) + + Specifies the factor :math:`\epsilon_L` by which the tolerance on + the nonlinear iteration is multiplied to get a tolerance on the + linear iteration. + + :param arkode_mem: pointer to the ARKODE memory block. + :param eplifac: linear convergence safety factor. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + Passing a value *eplifac* :math:`\le 0` indicates to use the + default value of 0.05. + + This function must be called *after* the ARKLS system solver + interface has been initialized through a call to + :c:func:`ARKodeSetLinearSolver`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) + + Specifies the factor by which the tolerance on the nonlinear + iteration is multiplied to get a tolerance on the mass matrix + linear iteration. + + :param arkode_mem: pointer to the ARKODE memory block. + :param eplifac: linear convergence safety factor. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_MASSMEM_NULL: the mass matrix solver memory was ``NULL``. + :retval ARKLS_ILL_INPUT: an input had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This function must be called *after* the ARKLS mass + matrix solver interface has been initialized through a call to + :c:func:`ARKodeSetMassLinearSolver`. + + Passing a value *eplifac* :math:`\le 0` indicates to use the default value + of 0.05. + + .. versionadded:: x.y.z + + +Since iterative linear solver libraries typically consider linear residual +tolerances using the :math:`L_2` norm, whereas ARKODE focuses on errors +measured in the WRMS norm :eq:`ARKODE_WRMS_NORM`, the ARKLS interface internally +converts between these quantities when interfacing with linear solvers, + +.. math:: + \text{tol}_{L2} = \text{\em nrmfac}\; \text{tol}_{WRMS}. + :label: ARKODE_NRMFAC + +Prior to the introduction of :c:func:`N_VGetLength` in SUNDIALS v5.0.0 the +value of :math:`nrmfac` was computed using the vector dot product. Now, the +functions :c:func:`ARKodeSetLSNormFactor` and :c:func:`ARKodeSetMassLSNormFactor` +allow for additional user control over these conversion factors. + + +.. c:function:: int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) + + Specifies the factor to use when converting from the integrator tolerance + (WRMS norm) to the linear solver tolerance (L2 norm) for Newton linear system + solves. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nrmfac: the norm conversion factor. If *nrmfac* is: + + :math:`> 0` then the provided value is used. + + :math:`= 0` then the conversion factor is computed using the vector + length i.e., ``nrmfac = sqrt(N_VGetLength(y))`` (*default*). + + :math:`< 0` then the conversion factor is computed using the vector dot + product i.e., ``nrmfac = sqrt(N_VDotProd(v,v))`` where all the entries + of ``v`` are one. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the + current time-stepping module. + + .. note:: + + This function must be called *after* the ARKLS system solver interface has + been initialized through a call to :c:func:`ARKodeSetLinearSolver`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) + + Specifies the factor to use when converting from the integrator tolerance + (WRMS norm) to the linear solver tolerance (L2 norm) for mass matrix linear + system solves. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nrmfac: the norm conversion factor. If *nrmfac* is: + + :math:`> 0` then the provided value is used. + + :math:`= 0` then the conversion factor is computed using the vector + length i.e., ``nrmfac = sqrt(N_VGetLength(y))`` (*default*). + + :math:`< 0` then the conversion factor is computed using the vector dot + product i.e., ``nrmfac = sqrt(N_VDotProd(v,v))`` where all the entries + of ``v`` are one. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This function must be called *after* the ARKLS mass matrix solver interface + has been initialized through a call to :c:func:`ARKodeSetMassLinearSolver`. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.ARKodeRootfindingInputTable: + + +Rootfinding optional input functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following functions can be called to set optional inputs to +control the rootfinding algorithm, the mathematics of which are +described in :numref:`ARKODE.Mathematics.Rootfinding`. + + +.. cssclass:: table-bordered + +====================================== ===================================== ================== +Optional input Function name Default +====================================== ===================================== ================== +Direction of zero-crossings to monitor :c:func:`ARKodeSetRootDirection` both +Disable inactive root warnings :c:func:`ARKodeSetNoInactiveRootWarn` enabled +====================================== ===================================== ================== + + + +.. c:function:: int ARKodeSetRootDirection(void* arkode_mem, int* rootdir) + + Specifies the direction of zero-crossings to be located and returned. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rootdir: state array of length *nrtfn*, the number of root + functions :math:`g_i` (the value of *nrtfn* was supplied in + the call to :c:func:`ARKodeRootInit`). If ``rootdir[i] == + 0`` then crossing in either direction for :math:`g_i` should be + reported. A value of +1 or -1 indicates that the solver + should report only zero-crossings where :math:`g_i` is + increasing or decreasing, respectively. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + The default behavior is to monitor for both zero-crossing directions. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeSetNoInactiveRootWarn(void* arkode_mem) + + Disables issuing a warning if some root function appears + to be identically zero at the beginning of the integration. + + :param arkode_mem: pointer to the ARKODE memory block. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + ARKODE will not report the initial conditions as a + possible zero-crossing (assuming that one or more components + :math:`g_i` are zero at the initial time). However, if it appears + that some :math:`g_i` is identically zero at the initial time + (i.e., :math:`g_i` is zero at the initial time *and* after the + first step), ARKODE will issue a warning which can be disabled with + this optional input function. + + .. versionadded:: x.y.z + + + + +.. _ARKODE.Usage.InterpolatedOutput: + +Interpolated output function +-------------------------------- + +An optional function :c:func:`ARKodeGetDky` is available to obtain +additional values of solution-related quantities. This function +should only be called after a successful return from +:c:func:`ARKodeEvolve`, as it provides interpolated values either of +:math:`y` or of its derivatives (up to the 5th derivative) +interpolated to any value of :math:`t` in the last internal step taken +by :c:func:`ARKodeEvolve`. Internally, this "dense output" or +"continuous extension" algorithm is identical to the algorithm used for +the maximum order implicit predictors, described in +:numref:`ARKODE.Mathematics.Predictors.Max`, except that derivatives of the +polynomial model may be evaluated upon request. + + + +.. c:function:: int ARKodeGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky) + + Computes the *k*-th derivative of the function + :math:`y` at the time *t*, + i.e. :math:`y^{(k)}(t)`, for values of the + independent variable satisfying :math:`t_n-h_n \le t \le t_n`, with + :math:`t_n` as current internal time reached, and :math:`h_n` is + the last internal step size successfully used by the solver. This + routine uses an interpolating polynomial of degree *min(degree, 5)*, + where *degree* is the argument provided to + :c:func:`ARKodeSetInterpolantDegree`. The user may request *k* in the + range {0,..., *min(degree, kmax)*} where *kmax* depends on the choice of + interpolation module. For Hermite interpolants *kmax = 5* and for Lagrange + interpolants *kmax = 3*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param t: the value of the independent variable at which the + derivative is to be evaluated. + :param k: the derivative order requested. + :param dky: output vector (must be allocated by the user). + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_BAD_K: *k* is not in the range {0,..., *min(degree, kmax)*}. + :retval ARK_BAD_T: *t* is not in the interval :math:`[t_n-h_n, t_n]`. + :retval ARK_BAD_DKY: the *dky* vector was ``NULL``. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + It is only legal to call this function after a successful + return from :c:func:`ARKodeEvolve`. + + A user may access the values :math:`t_n` and :math:`h_n` via the + functions :c:func:`ARKodeGetCurrentTime` and + :c:func:`ARKodeGetLastStep`, respectively. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.OptionalOutputs: + +Optional output functions +------------------------------ + +ARKODE provides an extensive set of functions that can be used to +obtain solver performance information. We organize these into groups: + +#. General ARKODE output routines are in + :numref:`ARKODE.Usage.ARKodeMainOutputs`, +#. ARKODE implicit solver output routines are in + :numref:`ARKODE.Usage.ARKodeImplicitSolverOutputs`, +#. Output routines regarding root-finding results are in + :numref:`ARKODE.Usage.ARKodeRootOutputs`, +#. Linear solver output routines are in + :numref:`ARKODE.Usage.ARKLsOutputs` and +#. General usability routines (e.g. to print the current ARKODE + parameters, or output the current Butcher table(s)) are in + :numref:`ARKODE.Usage.ARKodeExtraOutputs`. + +Following each table, we elaborate on each function. + +Some of the optional outputs, especially the various counters, can be +very useful in determining the efficiency of various methods inside +ARKODE. For example: + +* The counters *nsteps*, *nfe_evals* and *nfi_evals* + provide a rough measure of the overall cost of a given run, and can + be compared between runs with different solver options to suggest + which set of options is the most efficient. + +* The ratio *nniters/nsteps* measures the performance of the + nonlinear iteration in solving the nonlinear systems at each stage, + providing a measure of the degree of nonlinearity in the problem. + Typical values of this for a Newton solver on a general problem + range from 1.1 to 1.8. + +* When using a Newton nonlinear solver, the ratio *njevals/nniters* + (when using a direct linear solver), and the ratio + *nliters/nniters* (when using an iterative linear solver) can + indicate the quality of the approximate Jacobian or preconditioner being + used. For example, if this ratio is larger for a user-supplied + Jacobian or Jacobian-vector product routine than for the + difference-quotient routine, it can indicate that the user-supplied + Jacobian is inaccurate. + +* The ratio *expsteps/accsteps* can measure the quality of the ImEx + splitting used, since a higher-quality splitting will be dominated + by accuracy-limited steps, and hence a lower ratio. + +* The ratio *nsteps/step_attempts* can measure the quality of the + time step adaptivity algorithm, since a poor algorithm will result + in more failed steps, and hence a lower ratio. + +It is therefore recommended that users retrieve and output these +statistics following each run, and take some time to investigate +alternate solver options that will be more optimal for their +particular problem of interest. + + + +.. _ARKODE.Usage.ARKodeMainOutputs: + +Main solver optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cssclass:: table-bordered + +===================================================== ============================================ +Optional output Function name +===================================================== ============================================ +Size of ARKODE real and integer workspaces :c:func:`ARKodeGetWorkSpace` +Cumulative number of internal steps :c:func:`ARKodeGetNumSteps` +Actual initial time step size used :c:func:`ARKodeGetActualInitStep` +Step size used for the last successful step :c:func:`ARKodeGetLastStep` +Step size to be attempted on the next step :c:func:`ARKodeGetCurrentStep` +Current internal time reached by the solver :c:func:`ARKodeGetCurrentTime` +Current internal solution reached by the solver :c:func:`ARKodeGetCurrentState` +Current :math:`\gamma` value used by the solver :c:func:`ARKodeGetCurrentGamma` +Suggested factor for tolerance scaling :c:func:`ARKodeGetTolScaleFactor` +Error weight vector for state variables :c:func:`ARKodeGetErrWeights` +Residual weight vector :c:func:`ARKodeGetResWeights` +Single accessor to many statistics at once :c:func:`ARKodeGetStepStats` +Print all statistics :c:func:`ARKodePrintAllStats` +Name of constant associated with a return flag :c:func:`ARKodeGetReturnFlagName` +No. of explicit stability-limited steps :c:func:`ARKodeGetNumExpSteps` +No. of accuracy-limited steps :c:func:`ARKodeGetNumAccSteps` +No. of attempted steps :c:func:`ARKodeGetNumStepAttempts` +No. of local error test failures that have occurred :c:func:`ARKodeGetNumErrTestFails` +No. of failed steps due to a nonlinear solver failure :c:func:`ARKodeGetNumStepSolveFails` +Estimated local truncation error vector :c:func:`ARKodeGetEstLocalErrors` +Number of constraint test failures :c:func:`ARKodeGetNumConstrFails` +Retrieve a pointer for user data :c:func:`ARKodeGetUserData` +===================================================== ============================================ + + + + +.. c:function:: int ARKodeGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) + + Returns the ARKODE real and integer workspace sizes. + + :param arkode_mem: pointer to the ARKODE memory block. + :param lenrw: the number of ``sunrealtype`` values in the ARKODE workspace. + :param leniw: the number of integer values in the ARKODE workspace. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumSteps(void* arkode_mem, long int* nsteps) + + Returns the cumulative number of internal steps taken by + the solver (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nsteps: number of steps taken in the solver. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetActualInitStep(void* arkode_mem, sunrealtype* hinused) + + Returns the value of the integration step size used on the first step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hinused: actual value of initial step size. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + Even if the value of the initial integration step was + specified by the user through a call to + :c:func:`ARKodeSetInitStep`, this value may have been changed by + ARKODE to ensure that the step size fell within the prescribed + bounds :math:`(h_{min} \le h_0 \le h_{max})`, or to satisfy the + local error test condition, or to ensure convergence of the + nonlinear solver. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetLastStep(void* arkode_mem, sunrealtype* hlast) + + Returns the integration step size taken on the last successful + internal step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hlast: step size taken on the last internal step. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetCurrentStep(void* arkode_mem, sunrealtype* hcur) + + Returns the integration step size to be attempted on the next internal step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param hcur: step size to be attempted on the next internal step. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetCurrentTime(void* arkode_mem, sunrealtype* tcur) + + Returns the current internal time reached by the solver. + + :param arkode_mem: pointer to the ARKODE memory block. + :param tcur: current internal time reached. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetCurrentState(void *arkode_mem, N_Vector *ycur) + + Returns the current internal solution reached by the solver. + + :param arkode_mem: pointer to the ARKODE memory block. + :param ycur: current internal solution. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + Users should exercise extreme caution when using this function, + as altering values of *ycur* may lead to undesirable behavior, depending + on the particular use case and on when this routine is called. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetCurrentGamma(void *arkode_mem, sunrealtype *gamma) + + Returns the current internal value of :math:`\gamma` used in the implicit + solver Newton matrix (see equation :eq:`ARKODE_NewtonMatrix`). + + :param arkode_mem: pointer to the ARKODE memory block. + :param gamma: current step size scaling factor in the Newton system. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac) + + Returns a suggested factor by which the user's + tolerances should be scaled when too much accuracy has been + requested for some internal step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param tolsfac: suggested scaling factor for user-supplied tolerances. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetErrWeights(void* arkode_mem, N_Vector eweight) + + Returns the current error weight vector. + + :param arkode_mem: pointer to the ARKODE memory block. + :param eweight: solution error weights at the current time. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + The user must allocate space for *eweight*, that will be + filled in by this function. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight) + + Returns the current residual weight vector. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rweight: residual error weights at the current time. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + The user must allocate space for *rweight*, that will be + filled in by this function. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur) + + Returns many of the most useful optional outputs in a single call. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nsteps: number of steps taken in the solver. + :param hinused: actual value of initial step size. + :param hlast: step size taken on the last internal step. + :param hcur: step size to be attempted on the next internal step. + :param tcur: current internal time reached. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodePrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) + + Outputs all of the integrator, nonlinear solver, linear solver, and other + statistics. + + :param arkode_mem: pointer to the ARKODE memory block. + :param outfile: pointer to output file. + :param fmt: the output format: + + * :c:enumerator:`SUN_OUTPUTFORMAT_TABLE` -- prints a table of values + + * :c:enumerator:`SUN_OUTPUTFORMAT_CSV` -- prints a comma-separated list + of key and value pairs e.g., ``key1,value1,key2,value2,...`` + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_ILL_INPUT: an invalid formatting option was provided. + + .. note:: + + The file ``scripts/sundials_csv.py`` provides python utility functions to + read and output the data from a SUNDIALS CSV output file using the key + and value pair format. + + .. versionadded:: x.y.z + + +.. c:function:: char* ARKodeGetReturnFlagName(long int flag) + + Returns the name of the ARKODE constant corresponding to *flag*. + See :ref:`ARKODE.Constants`. + + :param flag: a return flag from an ARKODE function. + + :return: The return value is a string containing the name of + the corresponding constant. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumExpSteps(void* arkode_mem, long int* expsteps) + + Returns the cumulative number of stability-limited steps + taken by the solver (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param expsteps: number of stability-limited steps taken in the solver. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumAccSteps(void* arkode_mem, long int* accsteps) + + Returns the cumulative number of accuracy-limited steps + taken by the solver (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param accsteps: number of accuracy-limited steps taken in the solver. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumStepAttempts(void* arkode_mem, long int* step_attempts) + + Returns the cumulative number of steps attempted by the solver (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param step_attempts: number of steps attempted by solver. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) + + Returns the number of local error test failures that + have occurred (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param netfails: number of error test failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* ncnf) + + Returns the number of failed steps due to a nonlinear solver failure (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param ncnf: number of step failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetEstLocalErrors(void* arkode_mem, N_Vector ele) + + Returns the vector of estimated local truncation errors + for the current step. + + :param arkode_mem: pointer to the ARKODE memory block. + :param ele: vector of estimated local truncation errors. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + The user must allocate space for *ele*, that will be + filled in by this function. + + The values returned in *ele* are valid only after a successful call + to :c:func:`ARKodeEvolve` (i.e., it returned a non-negative value). + + The *ele* vector, together with the *eweight* vector from + :c:func:`ARKodeGetErrWeights`, can be used to determine how the + various components of the system contributed to the estimated local + error test. Specifically, that error test uses the WRMS norm of a + vector whose components are the products of the components of these + two vectors. Thus, for example, if there were recent error test + failures, the components causing the failures are those with largest + values for the products, denoted loosely as ``eweight[i]*ele[i]``. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) + + Returns the cumulative number of constraint test failures (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nconstrfails: number of constraint test failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetUserData(void* arkode_mem, void** user_data) + + Returns the user data pointer previously set with + :c:func:`ARKodeSetUserData`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param user_data: memory reference to a user data pointer. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + +.. _ARKODE.Usage.ARKodeImplicitSolverOutputs: + +Implicit solver optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cssclass:: table-bordered + +=================================================== ============================================ +Optional output Function name +=================================================== ============================================ +No. of calls to linear solver setup function :c:func:`ARKodeGetNumLinSolvSetups` +No. of nonlinear solver iterations :c:func:`ARKodeGetNumNonlinSolvIters` +No. of nonlinear solver convergence failures :c:func:`ARKodeGetNumNonlinSolvConvFails` +Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSolvStats` +=================================================== ============================================ + + + + +.. c:function:: int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) + + Returns the number of calls made to the linear solver's + setup routine (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nlinsetups: number of linear solver setup calls made. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the nonlinear + solver object; the counter is reset whenever a new nonlinear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) + + Returns the number of nonlinear solver iterations + performed (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nniters: number of nonlinear iterations performed. + :retval ARK_STEPPER_UNSUPPORTED: nonlinear solvers are not supported + by the current time-stepping module. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NLS_OP_ERR: the SUNNONLINSOL object returned a failure flag. + + .. note:: + + This is only accumulated for the "life" of the nonlinear + solver object; the counter is reset whenever a new nonlinear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nncfails) + + Returns the number of nonlinear solver convergence + failures that have occurred (so far). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nncfails: number of nonlinear convergence failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: nonlinear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the nonlinear + solver object; the counter is reset whenever a new nonlinear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, long int* nncfails) + + Returns all of the nonlinear solver statistics in a single call. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nniters: number of nonlinear iterations performed. + :param nncfails: number of nonlinear convergence failures. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NLS_OP_ERR: the SUNNONLINSOL object returned a failure flag. + :retval ARK_STEPPER_UNSUPPORTED: nonlinear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the nonlinear + solver object; the counters are reset whenever a new nonlinear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. _ARKODE.Usage.ARKodeRootOutputs: + +Rootfinding optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cssclass:: table-bordered + +=================================================== ========================================== +Optional output Function name +=================================================== ========================================== +Array showing roots found :c:func:`ARKodeGetRootInfo` +No. of calls to user root function :c:func:`ARKodeGetNumGEvals` +=================================================== ========================================== + + + +.. c:function:: int ARKodeGetRootInfo(void* arkode_mem, int* rootsfound) + + Returns an array showing which functions were found to + have a root. + + :param arkode_mem: pointer to the ARKODE memory block. + :param rootsfound: array of length *nrtfn* with the indices of the + user functions :math:`g_i` found to have a root (the value of + *nrtfn* was supplied in the call to + :c:func:`ARKodeRootInit`). For :math:`i = 0 \ldots` + *nrtfn*-1, ``rootsfound[i]`` is nonzero if :math:`g_i` has a + root, and 0 if not. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + The user must allocate space for *rootsfound* prior to + calling this function. + + For the components of :math:`g_i` for which a root was found, the + sign of ``rootsfound[i]`` indicates the direction of + zero-crossing. A value of +1 indicates that :math:`g_i` is + increasing, while a value of -1 indicates a decreasing :math:`g_i`. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumGEvals(void* arkode_mem, long int* ngevals) + + Returns the cumulative number of calls made to the + user's root function :math:`g`. + + :param arkode_mem: pointer to the ARKODE memory block. + :param ngevals: number of calls made to :math:`g` so far. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.ARKLsOutputs: + +Linear solver interface optional output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A variety of optional outputs are available from the ARKLS interface, +as listed in the following table and elaborated below. We note that +where the name of an output would otherwise conflict with the +name of an optional output from the main solver, a suffix LS (for +Linear Solver) or MLS (for Mass Linear Solver) has been added here +(e.g. *lenrwLS*). + + + +.. cssclass:: table-bordered + +================================================================= ======================================== +Optional output Function name +================================================================= ======================================== +Stored Jacobian of the ODE RHS function :c:func:`ARKodeGetJac` +Time at which the Jacobian was evaluated :c:func:`ARKodeGetJacTime` +Step number at which the Jacobian was evaluated :c:func:`ARKodeGetJacNumSteps` +Size of real and integer workspaces :c:func:`ARKodeGetLinWorkSpace` +No. of Jacobian evaluations :c:func:`ARKodeGetNumJacEvals` +No. of preconditioner evaluations :c:func:`ARKodeGetNumPrecEvals` +No. of preconditioner solves :c:func:`ARKodeGetNumPrecSolves` +No. of linear iterations :c:func:`ARKodeGetNumLinIters` +No. of linear convergence failures :c:func:`ARKodeGetNumLinConvFails` +No. of Jacobian-vector setup evaluations :c:func:`ARKodeGetNumJTSetupEvals` +No. of Jacobian-vector product evaluations :c:func:`ARKodeGetNumJtimesEvals` +No. of *fi* calls for finite diff. :math:`J` or :math:`Jv` evals. :c:func:`ARKodeGetNumLinRhsEvals` +Last return from a linear solver function :c:func:`ARKodeGetLastLinFlag` +Name of constant associated with a return flag :c:func:`ARKodeGetLinReturnFlagName` +Size of real and integer mass matrix solver workspaces :c:func:`ARKodeGetMassWorkSpace` +No. of mass matrix solver setups (incl. :math:`M` evals.) :c:func:`ARKodeGetNumMassSetups` +No. of mass matrix multiply setups :c:func:`ARKodeGetNumMassMultSetups` +No. of mass matrix multiplies :c:func:`ARKodeGetNumMassMult` +No. of mass matrix solves :c:func:`ARKodeGetNumMassSolves` +No. of mass matrix preconditioner evaluations :c:func:`ARKodeGetNumMassPrecEvals` +No. of mass matrix preconditioner solves :c:func:`ARKodeGetNumMassPrecSolves` +No. of mass matrix linear iterations :c:func:`ARKodeGetNumMassIters` +No. of mass matrix solver convergence failures :c:func:`ARKodeGetNumMassConvFails` +No. of mass-matrix-vector setup evaluations :c:func:`ARKodeGetNumMTSetups` +Last return from a mass matrix solver function :c:func:`ARKodeGetLastMassFlag` +================================================================= ======================================== + +.. c:function:: int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) + + Returns the internally stored copy of the Jacobian matrix of the ODE + implicit right-hand side function. + + :param arkode_mem: the ARKODE memory structure. + :param J: the Jacobian matrix. + + :retval ARKLS_SUCCESS: the output value has been successfully set. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. warning:: + + This function is provided for debugging purposes and the values in the + returned matrix should not be altered. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) + + Returns the time at which the internally stored copy of the Jacobian matrix + of the ODE implicit right-hand side function was evaluated. + + :param arkode_mem: the ARKODE memory structure. + :param t_J: the time at which the Jacobian was evaluated. + + :retval ARKLS_SUCCESS: the output value has been successfully set. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + +.. c:function:: int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) + + Returns the value of the internal step counter at which the internally stored copy of the + Jacobian matrix of the ODE implicit right-hand side function was evaluated. + + :param arkode_mem: the ARKODE memory structure. + :param nst_J: the value of the internal step counter at which the Jacobian was evaluated. + + :retval ARKLS_SUCCESS: the output value has been successfully set. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver interface has not been initialized. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, long int* leniwLS) + + Returns the real and integer workspace used by the ARKLS linear solver interface. + + :param arkode_mem: pointer to the ARKODE memory block. + :param lenrwLS: the number of ``sunrealtype`` values in the ARKLS workspace. + :param leniwLS: the number of integer values in the ARKLS workspace. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + The workspace requirements reported by this routine + correspond only to memory allocated within this interface and to + memory allocated by the ``SUNLinearSolver`` object attached + to it. The template Jacobian matrix allocated by the user outside + of ARKLS is not included in this report. + + In a parallel setting, the above values are global (i.e. summed over all + processors). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) + + Returns the number of Jacobian evaluations. + + :param arkode_mem: pointer to the ARKODE memory block. + :param njevals: number of Jacobian evaluations. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) + + Returns the total number of preconditioner evaluations, + i.e. the number of calls made to *psetup* with ``jok`` = ``SUNFALSE`` and + that returned ``*jcurPtr`` = ``SUNTRUE``. + + :param arkode_mem: pointer to the ARKODE memory block. + :param npevals: the current number of calls to *psetup*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) + + Returns the number of calls made to the preconditioner + solve function, *psolve*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param npsolves: the number of calls to *psolve*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) + + Returns the cumulative number of linear iterations. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nliters: the current number of linear iterations. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) + + Returns the cumulative number of linear convergence failures. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nlcfails: the current number of linear convergence failures. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetup) + + Returns the cumulative number of calls made to the user-supplied + Jacobian-vector setup function, *jtsetup*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param njtsetup: the current number of calls to *jtsetup*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) + + Returns the cumulative number of calls made to the + Jacobian-vector product function, *jtimes*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param njvevals: the current number of calls to *jtimes*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) + + Returns the number of calls to the user-supplied implicit + right-hand side function :math:`f^I` for finite difference + Jacobian or Jacobian-vector product approximation. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nfevalsLS: the number of calls to the user implicit + right-hand side function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + The value *nfevalsLS* is incremented only if the default + internal difference quotient function is used. + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new linear solver + module is "attached" to ARKODE, or when ARKODE is resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetLastLinFlag(void* arkode_mem, long int* lsflag) + + Returns the last return value from an ARKLS routine. + + :param arkode_mem: pointer to the ARKODE memory block. + :param lsflag: the value of the last return flag from an + ARKLS function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported + by the current time-stepping module. + + .. note:: + + If the ARKLS setup function failed when using the + ``SUNLINSOL_DENSE`` or ``SUNLINSOL_BAND`` modules, then the value + of *lsflag* is equal to the column index (numbered from one) at + which a zero diagonal element was encountered during the LU + factorization of the (dense or banded) Jacobian matrix. For all + other failures, *lsflag* is negative. + + Otherwise, if the ARKLS setup function failed + (:c:func:`ARKodeEvolve` returned *ARK_LSETUP_FAIL*), then + *lsflag* will be *SUNLS_PSET_FAIL_UNREC*, *SUNLS_ASET_FAIL_UNREC* + or *SUN_ERR_EXT_FAIL*. + + If the ARKLS solve function failed (:c:func:`ARKodeEvolve` + returned *ARK_LSOLVE_FAIL*), then *lsflag* contains the error + return flag from the ``SUNLinearSolver`` object, which will + be one of: + *SUN_ERR_ARG_CORRUPTRRUPT*, indicating that the ``SUNLinearSolver`` + memory is ``NULL``; + *SUNLS_ATIMES_NULL*, indicating that a matrix-free iterative solver + was provided, but is missing a routine for the matrix-vector product + approximation, + *SUNLS_ATIMES_FAIL_UNREC*, indicating an unrecoverable failure in + the :math:`Jv` function; + *SUNLS_PSOLVE_NULL*, indicating that an iterative linear solver was + configured to use preconditioning, but no preconditioner solve + routine was provided, + *SUNLS_PSOLVE_FAIL_UNREC*, indicating that the preconditioner solve + function failed unrecoverably; + *SUNLS_GS_FAIL*, indicating a failure in the Gram-Schmidt procedure + (SPGMR and SPFGMR only); + *SUNLS_QRSOL_FAIL*, indicating that the matrix :math:`R` was found + to be singular during the QR solve phase (SPGMR and SPFGMR only); or + *SUN_ERR_EXT_FAIL*, indicating an unrecoverable failure in + an external iterative linear solver package. + + .. versionadded:: x.y.z + + +.. c:function:: char* ARKodeGetLinReturnFlagName(long int lsflag) + + Returns the name of the ARKLS constant corresponding to *lsflag*. + + :param lsflag: a return flag from an ARKLS function. + + :returns: The return value is a string containing the name of + the corresponding constant. If using the ``SUNLINSOL_DENSE`` or + ``SUNLINSOL_BAND`` modules, then if 1 :math:`\le` `lsflag` + :math:`\le n` (LU factorization failed), this routine returns "NONE". + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, long int* leniwMLS) + + Returns the real and integer workspace used by the ARKLS mass matrix linear solver interface. + + :param arkode_mem: pointer to the ARKODE memory block. + :param lenrwMLS: the number of ``sunrealtype`` values in the ARKLS mass solver workspace. + :param leniwMLS: the number of integer values in the ARKLS mass solver workspace. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + The workspace requirements reported by this routine + correspond only to memory allocated within this interface and to + memory allocated by the ``SUNLinearSolver`` object attached + to it. The template mass matrix allocated by the user outside + of ARKLS is not included in this report. + + In a parallel setting, the above values are global (i.e. summed over all + processors). + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) + + Returns the number of calls made to the ARKLS mass matrix solver + 'setup' routine; these include all calls to the user-supplied + mass-matrix constructor function. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmsetups: number of calls to the mass matrix solver setup routine. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) + + Returns the number of calls made to the ARKLS mass matrix 'matvec setup' + (matrix-based solvers) routine. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmvsetups: number of calls to the mass matrix matrix-times-vector setup routine. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassMult(void* arkode_mem, long int* nmmults) + + Returns the number of calls made to the ARKLS mass matrix 'matvec' + routine (matrix-based solvers) or the user-supplied *mtimes* + routine (matris-free solvers). + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmmults: number of calls to the mass matrix solver matrix-times-vector routine. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) + + Returns the number of calls made to the ARKLS mass matrix solver 'solve' routine. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmsolves: number of calls to the mass matrix solver solve routine. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals) + + Returns the total number of mass matrix preconditioner evaluations, + i.e. the number of calls made to *psetup*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmpevals: the current number of calls to *psetup*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves) + + Returns the number of calls made to the mass matrix preconditioner + solve function, *psolve*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmpsolves: the number of calls to *psolve*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) + + Returns the cumulative number of mass matrix solver iterations. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmiters: the current number of mass matrix solver linear iterations. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) + + Returns the cumulative number of mass matrix solver convergence failures. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmcfails: the current number of mass matrix solver convergence failures. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetup) + + Returns the cumulative number of calls made to the user-supplied + mass-matrix-vector product setup function, *mtsetup*. + + :param arkode_mem: pointer to the ARKODE memory block. + :param nmtsetup: the current number of calls to *mtsetup*. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + This is only accumulated for the "life" of the linear + solver object; the counter is reset whenever a new mass-matrix + linear solver module is "attached" to ARKODE, or when ARKODE is + resized. + + .. versionadded:: x.y.z + + +.. c:function:: int ARKodeGetLastMassFlag(void* arkode_mem, long int* mlsflag) + + Returns the last return value from an ARKLS mass matrix interface routine. + + :param arkode_mem: pointer to the ARKODE memory block. + :param mlsflag: the value of the last return flag from an ARKLS + mass matrix solver interface function. + + :retval ARKLS_SUCCESS: the function exited successfully. + :retval ARKLS_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARKLS_LMEM_NULL: the linear solver memory was ``NULL``. + :retval ARK_STEPPER_UNSUPPORTED: non-identity mass matrices are not supported + by the current time-stepping module. + + .. note:: + + The values of *msflag* for each of the various solvers + will match those described above for the function + :c:func:`ARKodeGetLastLinFlag`. + + .. versionadded:: x.y.z + + + + +.. _ARKODE.Usage.ARKodeExtraOutputs: + +General usability functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following optional routine may be called by a user to inquire +about existing solver parameters. While this would not typically be +called during the course of solving an initial value problem, it may +be useful for users wishing to better understand ARKODE. + + +.. cssclass:: table-bordered + +==================================== =================================== +Optional routine Function name +==================================== =================================== +Output all ARKODE solver parameters :c:func:`ARKodeWriteParameters` +==================================== =================================== + + + + +.. c:function:: int ARKodeWriteParameters(void* arkode_mem, FILE *fp) + + Outputs all ARKODE solver parameters to the provided file pointer. + + :param arkode_mem: pointer to the ARKODE memory block. + :param fp: pointer to use for printing the solver parameters. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + + .. note:: + + The *fp* argument can be ``stdout`` or ``stderr``, or it + may point to a specific file created using ``fopen``. + + When run in parallel, only one process should set a non-NULL value + for this pointer, since parameters for all processes would be + identical. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.Reset: + +ARKODE reset function +---------------------- + +To reset the ARKODE module to a particular state :math:`(t_R,y(t_R))` for the +continued solution of a problem, where a prior +call to ``*StepCreate`` has been made, the user must call the function +:c:func:`ARKodeReset`. Like the stepper-specific ``*StepReInit`` functions, +this routine retains the current settings for all solver options and +performs no memory allocations but, unlike ``*StepReInit``, this routine +performs only a *subset* of the input checking and initializations that are +done in ``*StepCreate``. In particular this routine retains all internal +counter values and the step size/error history and does not reinitialize the +linear and/or nonlinear solver but it does indicate that a linear solver setup +is necessary in the next step. Like ``*StepReInit``, a call to +:c:func:`ARKodeReset` will delete any previously-set *tstop* value specified +via a call to :c:func:`ARKodeSetStopTime`. Following a successful call to +:c:func:`ARKodeReset`, call :c:func:`ARKodeEvolve` again to continue +solving the problem. By default the next call to :c:func:`ARKodeEvolve` will +use the step size computed by ARKODE prior to calling :c:func:`ARKodeReset`. +To set a different step size or have ARKODE estimate a new step size use +:c:func:`ARKodeSetInitStep`. + +One important use of the :c:func:`ARKodeReset` function is in the +treating of jump discontinuities in the RHS functions. Except in cases +of fairly small jumps, it is usually more efficient to stop at each +point of discontinuity and restart the integrator with a readjusted +ODE model, using a call to :c:func:`ARKodeReset`. To stop when +the location of the discontinuity is known, simply make that location +a value of ``tout``. To stop when the location of the discontinuity +is determined by the solution, use the rootfinding feature. In either +case, it is critical that the RHS functions *not* incorporate the +discontinuity, but rather have a smooth extension over the +discontinuity, so that the step across it (and subsequent rootfinding, +if used) can be done efficiently. Then use a switch within the RHS +functions (communicated through ``user_data``) that can be flipped +between the stopping of the integration and the restart, so that the +restarted problem uses the new values (which have jumped). Similar +comments apply if there is to be a jump in the dependent variable +vector. + + +.. c:function:: int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR) + + Resets the current ARKODE time-stepper module state to the provided + independent variable value and dependent variable vector. + + :param arkode_mem: pointer to the ARKODE memory block. + :param tR: the value of the independent variable :math:`t`. + :param yR: the value of the dependent variable vector :math:`y(t_R)`. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_MEM_FAIL: a memory allocation failed. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + By default the next call to :c:func:`ARKodeEvolve` will use the step size + computed by ARKODE prior to calling :c:func:`ARKodeReset`. To set a + different step size or have ARKODE estimate a new step size use + :c:func:`ARKodeSetInitStep`. + + All previously set options are retained but may be updated by calling + the appropriate "Set" functions. + + If an error occurred, :c:func:`ARKodeReset` also sends an error message to + the error handler function. + + .. versionadded:: x.y.z + + + +.. _ARKODE.Usage.Resizing: + +ARKODE system resize function +------------------------------------- + +For simulations involving changes to the number of equations and +unknowns in the ODE system (e.g. when using spatially-adaptive +PDE simulations under a method-of-lines approach), the ARKODE +integrator may be "resized" between integration steps, through calls +to the :c:func:`ARKodeResize` function. This function modifies +ARKODE's internal memory structures to use the new problem size, +without destruction of the temporal adaptivity heuristics. It is +assumed that the dynamical time scales before and after the vector +resize will be comparable, so that all time-stepping heuristics prior +to calling :c:func:`ARKodeResize` remain valid after the call. If +instead the dynamics should be recomputed from scratch, the ARKODE +memory structure should be deleted with a call to +:c:func:`ARKodeFree`, and recreated with a calls to +``*StepCreate``. + +To aid in the vector resize operation, the user can supply a vector +resize function that will take as input a vector with the previous +size, and transform it in-place to return a corresponding vector of +the new size. If this function (of type :c:func:`ARKVecResizeFn`) +is not supplied (i.e., is set to ``NULL``), then all existing vectors +internal to ARKODE will be destroyed and re-cloned from the new input +vector. + +In the case that the dynamical time scale should be modified slightly +from the previous time scale, an input *hscale* is allowed, that will +rescale the upcoming time step by the specified factor. If a value +*hscale* :math:`\le 0` is specified, the default of 1.0 will be used. + + + +.. c:function:: int ARKodeResize(void* arkode_mem, N_Vector yR, sunrealtype hscale, sunrealtype tR, ARKVecResizeFn resize, void* resize_data) + + Re-sizes ARKODE with a different state vector but with comparable + dynamical time scale. + + :param arkode_mem: pointer to the ARKODE memory block. + :param yR: the newly-sized state vector, holding the current + dependent variable values :math:`y(t_R)`. + :param hscale: the desired time step scaling factor (i.e. the next + step will be of size *h\*hscale*). + :param tR: the current value of the independent variable + :math:`t_R` (this must be consistent with *yR*). + :param resize: the user-supplied vector resize function (of type + :c:func:`ARKVecResizeFn`. + :param resize_data: the user-supplied data structure to be passed + to *resize* when modifying internal ARKODE vectors. + + :retval ARK_SUCCESS: the function exited successfully. + :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + :retval ARK_NO_MALLOC: ``arkode_mem`` was not allocated. + :retval ARK_ILL_INPUT: an argument had an illegal value. + + .. note:: + + If an error occurred, :c:func:`ARKodeResize` also sends an error + message to the error handler function. + + If inequality constraint checking is enabled a call to + :c:func:`ARKodeResize` will disable constraint checking. A call + to :c:func:`ARKodeSetConstraints` is required to re-enable constraint + checking. + + **Resizing the linear solver:** + + When using any of the SUNDIALS-provided linear solver modules, the + linear solver memory structures must also be resized. At present, + none of these include a solver-specific "resize" function, so the linear + solver memory must be destroyed and re-allocated **following** each + call to :c:func:`ARKodeResize`. Moreover, the existing ARKLS + interface should then be deleted and recreated by attaching the + updated ``SUNLinearSolver`` (and possibly ``SUNMatrix``) object(s) + through calls to + :c:func:`ARKodeSetLinearSolver`, and + :c:func:`ARKodeSetMassLinearSolver`. + + If any user-supplied routines are provided to aid the linear solver + (e.g. Jacobian construction, Jacobian-vector product, + mass-matrix-vector product, preconditioning), then the corresponding + "set" routines must be called again **following** the solver + re-specification. + + **Resizing the absolute tolerance array:** + + If using array-valued absolute tolerances, the absolute tolerance + vector will be invalid after the call to :c:func:`ARKodeResize`, so + the new absolute tolerance vector should be re-set **following** each + call to :c:func:`ARKodeResize` through a new call to + :c:func:`ARKodeSVtolerances` and possibly + :c:func:`ARKodeResVtolerance` if applicable. + + If scalar-valued tolerances or a tolerance function was specified + through either :c:func:`ARKodeSStolerances` or + :c:func:`ARKodeWFtolerances`, then these will remain valid and no + further action is necessary. + + **Example codes:** + + * ``examples/arkode/C_serial/ark_heat1D_adapt.c`` + + .. versionadded:: x.y.z diff --git a/doc/arkode/guide/source/Usage/User_supplied.rst b/doc/arkode/guide/source/Usage/User_supplied.rst index 88942bff99..cb27409c48 100644 --- a/doc/arkode/guide/source/Usage/User_supplied.rst +++ b/doc/arkode/guide/source/Usage/User_supplied.rst @@ -20,52 +20,60 @@ User-supplied functions The user-supplied functions for ARKODE consist of: -* at least one function defining the ODE (required), +* at least one function :ref:`defining the ODE ` + (required), -* a function that handles error and warning messages (optional), +* a function that + :ref:`provides the error weight vector ` (optional), -* a function that provides the error weight vector (optional), +* a function that + :ref:`provides the residual weight vector ` (optional), -* a function that provides the residual weight vector (optional, ARKStep only), +* a function that + :ref:`handles explicit time step stability ` (optional), -* a function that handles adaptive time step error control (optional, ARKStep/ERKStep only), +* a function that + :ref:`updates the implicit stage prediction ` (optional), -* a function that handles explicit time step stability (optional, ARKStep/ERKStep only), +* a function that + :ref:`defines auxiliary temporal root-finding problem(s) to solve ` (optional), -* a function that updates the implicit stage prediction (optional, ARKStep/MRIStep only), +* one or two functions that + :ref:`provide Jacobian-related information ` + for the linear solver, if a component is treated implicitly and a + Newton-based nonlinear iteration is chosen (optional), -* a function that defines the root-finding problem(s) to solve (optional), - -* one or two functions that provide Jacobian-related information for - the linear solver, if a component is treated implicitly and a - Newton-based nonlinear iteration is chosen (optional, ARKStep/MRIStep only), - -* one or two functions that define the preconditioner for use in any - of the Krylov iterative algorithms, if linear systems of equations are to - be solved using an iterative method (optional, ARKStep/MRIStep only), +* one or two functions that :ref:`define the preconditioner ` + for use in any of the Krylov iterative algorithms, if linear systems of + equations are to be solved using an iterative method (optional), * if the problem involves a non-identity mass matrix :math:`M\ne I` with ARKStep: - * one or two functions that provide mass-matrix-related information + * one or two functions that + :ref:`provide mass-matrix-related information ` for the linear and mass matrix solvers (required), - * one or two functions that define the mass matrix preconditioner + * one or two functions that + :ref:`define the mass matrix preconditioner ` for use if an iterative mass matrix solver is chosen (optional), and -* a function that handles vector resizing operations, if the +* a function that + :ref:`handles vector resizing operations `, if the underlying vector structure supports resizing (as opposed to deletion/recreation), and if the user plans to call - :c:func:`ARKStepResize`, :c:func:`ERKStepResize`, or - :c:func:`MRIStepResize` (optional). + :c:func:`ARKodeResize` (optional). -* MRIStep only: functions to be called before and after each inner integration to - perform any communication or memory transfers of forcing data supplied +* MRIStep only: functions to be + :ref:`called before and after each inner integration ` + to perform any communication or memory transfers of forcing data supplied by the outer integrator to the inner integrator, or state data supplied by the inner integrator to the outer integrator. -* if relaxation is enabled (optional), a function that evaluates the - conservative or dissipative function :math:`\xi(y(t))` (required) and a - function to evaluate its Jacobian :math:`\xi'(y(t))` (required). +* if relaxation is enabled (optional), a function that + :ref:`evaluates the conservative or dissipative function ` + :math:`\xi(y(t))` (required) and a function to + :ref:`evaluate its Jacobian ` + :math:`\xi'(y(t))` (required). .. _ARKODE.Usage.ODERHS: @@ -74,31 +82,26 @@ ODE right-hand side ----------------------------- The user must supply at least one function of type :c:type:`ARKRhsFn` to -specify the explicit and/or implicit portions of the ODE system to ARKStep, -the ODE system function to ERKStep, or the "slow" right-hand side of the -ODE system to MRIStep: - +specify the IVP-defininig right-hand side function(s) when creating the +ARKODE time-stepping module: .. c:type:: int (*ARKRhsFn)(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) These functions compute the ODE right-hand side for a given value of the independent variable :math:`t` and state vector :math:`y`. - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *ydot* -- the output vector that forms [a portion of] the ODE RHS :math:`f(t,y)`. - * *user_data* -- the `user_data` pointer that was passed to - :c:func:`ARKStepSetUserData`, :c:func:`ERKStepSetUserData`, or :c:func:`MRIStepSetUserData`. + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param ydot: the output vector that forms [a portion of] the ODE RHS :math:`f(t,y)`. + :param user_data: the `user_data` pointer that was passed to + :c:func:`ARKodeSetUserData`. - **Return value:** + :return: An *ARKRhsFn* should return 0 if successful, a positive value if a + recoverable error occurred (in which case ARKODE will attempt to + correct), or a negative value if it failed unrecoverably (in which + case the integration is halted and *ARK_RHSFUNC_FAIL* is returned). - An *ARKRhsFn* should return 0 if successful, a positive value if a - recoverable error occurred (in which case ARKODE will attempt to - correct), or a negative value if it failed unrecoverably (in which - case the integration is halted and *ARK_RHSFUNC_FAIL* is returned). - - **Notes:** + .. note:: Allocation of memory for `ydot` is handled within ARKODE. @@ -110,18 +113,17 @@ ODE system to MRIStep: "illegal" in some way (e.g., negative where only a non-negative value is physically meaningful). If such a return is made, ARKODE will attempt to recover (possibly repeating the - nonlinear iteration, or reducing the step size in ARKStep or ERKStep) + nonlinear iteration, or reducing the step size in ARKodeEvolve) in order to avoid this recoverable error return. There are some situations in which recovery is not possible even if the right-hand side function returns a recoverable error flag. One is when this occurs at the very first call to the *ARKRhsFn* (in which case ARKODE returns *ARK_FIRST_RHSFUNC_ERR*). Another is when a - recoverable error is reported by *ARKRhsFn* after the ARKStep - integrator completes a successful stage, in which case ARKStep returns - *ARK_UNREC_RHSFUNC_ERR*). Similarly, since MRIStep does not currently - support adaptive time stepping at the slow time scale, it may - halt on a recoverable error flag that would normally have resulted - in a stepsize reduction. + recoverable error is reported by *ARKRhsFn* after the time-stepping + module completes a successful stage, in which case ARKodeEvolve returns + *ARK_UNREC_RHSFUNC_ERR*). Finally, when ARKODE is run in fixed-step + mode, it may halt on a recoverable error flag that would normally have + resulted in a stepsize reduction. @@ -144,18 +146,16 @@ in :numref:`ARKODE.Mathematics.Error.Norm`. This function computes the WRMS error weights for the vector :math:`y`. - **Arguments:** - * *y* -- the dependent variable vector at which the - weight vector is to be computed. - * *ewt* -- the output vector containing the error weights. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to the ``SetUserData`` function + :param y: the dependent variable vector at which the weight vector is to be computed. + :param ewt: the output vector containing the error weights. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData` function + + :return: An *ARKEwtFn* function must return 0 if it + successfully set the error weights, and -1 otherwise. - **Return value:** - An *ARKEwtFn* function must return 0 if it - successfully set the error weights, and -1 otherwise. + .. note:: - **Notes:** Allocation of memory for *ewt* is handled within ARKODE. The error weight vector must have all components positive. It is @@ -166,8 +166,14 @@ in :numref:`ARKODE.Mathematics.Error.Norm`. .. _ARKODE.Usage.ResidualWeight: -Residual weight function (ARKStep only) ----------------------------------------- +Residual weight function +------------------------ + +.. warning:: + + The functions in this section are specific to time-stepping modules + that support non-identity mass matrices. + As an alternative to providing the scalar or vector absolute residual tolerances (when the IVP units differ from the solution units), the @@ -184,19 +190,18 @@ in :numref:`ARKODE.Mathematics.Error.Norm`. This function computes the WRMS residual weights for the vector :math:`y`. - **Arguments:** - * *y* -- the dependent variable vector at which the - weight vector is to be computed. - * *rwt* -- the output vector containing the residual weights. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData()`. + :param y: the dependent variable vector at which the + weight vector is to be computed. + :param rwt: the output vector containing the residual weights. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: An *ARKRwtFn* function must return 0 if it + successfully set the residual weights, and -1 otherwise. - **Return value:** - An *ARKRwtFn* function must return 0 if it - successfully set the residual weights, and -1 otherwise. + .. note:: - **Notes:** - Allocation of memory for *rwt* is handled within ARKStep. + Allocation of memory for *rwt* is handled within ARKODE. The residual weight vector must have all components positive. It is the user's responsibility to perform this test and return -1 if it @@ -206,9 +211,15 @@ in :numref:`ARKODE.Mathematics.Error.Norm`. .. _ARKODE.Usage.AdaptivityFn: -Time step adaptivity function (ARKStep and ERKStep only) +Time step adaptivity function -------------------------------------------------------- +.. warning:: + + The function in this section is only used in now-deprecated functions + in ARKStep and ERKStep, and will be removed in a future release. + + As an alternative to using one of the built-in time step adaptivity methods for controlling solution error, the user may provide a function of type :c:type:`ARKAdaptFn` to compute a target step size @@ -222,41 +233,48 @@ such that the error estimate for the next time step remains below 1. This function implements a time step adaptivity algorithm that chooses :math:`h` to satisfy the error tolerances. - **Arguments:** - * *y* -- the current value of the dependent variable vector. - * *t* -- the current value of the independent variable. - * *h1* -- the current step size, :math:`t_n - t_{n-1}`. - * *h2* -- the previous step size, :math:`t_{n-1} - t_{n-2}`. - * *h3* -- the step size :math:`t_{n-2}-t_{n-3}`. - * *e1* -- the error estimate from the current step, :math:`n`. - * *e2* -- the error estimate from the previous step, :math:`n-1`. - * *e3* -- the error estimate from the step :math:`n-2`. - * *q* -- the global order of accuracy for the method. - * *p* -- the global order of accuracy for the embedded method. - * *hnew* -- the output value of the next step size. - * *user_data* -- a pointer to user data, the same as the - *h_data* parameter that was passed to :c:func:`ARKStepSetAdaptivityFn` - or :c:func:`ERKStepSetAdaptivityFn`. + :param y: the current value of the dependent variable vector. + :param t: the current value of the independent variable. + :param h1: the current step size, :math:`t_n - t_{n-1}`. + :param h2: the previous step size, :math:`t_{n-1} - t_{n-2}`. + :param h3: the step size :math:`t_{n-2}-t_{n-3}`. + :param e1: the error estimate from the current step, :math:`n`. + :param e2: the error estimate from the previous step, :math:`n-1`. + :param e3: the error estimate from the step :math:`n-2`. + :param q: the global order of accuracy for the method. + :param p: the global order of accuracy for the embedded method. + :param hnew: the output value of the next step size. + :param user_data: a pointer to user data, the same as the + *h_data* parameter that was passed to :c:func:`ARKStepSetAdaptivityFn` + or :c:func:`ERKStepSetAdaptivityFn`. - **Return value:** - An *ARKAdaptFn* function should return 0 if it - successfully set the next step size, and a non-zero value otherwise. + :return: An *ARKAdaptFn* function should return 0 if it + successfully set the next step size, and a non-zero value otherwise. + .. deprecated:: 5.7.0 + + Use the SUNAdaptController infrastructure instead (see + :numref:`SUNAdaptController.Description`). .. _ARKODE.Usage.StabilityFn: -Explicit stability function (ARKStep and ERKStep only) ------------------------------------------------------- +Explicit stability function +--------------------------- + +.. warning:: + + The functions in this section are specific to time-stepping modules + that support temporal adaptivity. + A user may supply a function to predict the maximum stable step size -for the explicit portion of the problem, :math:`f^E(t,y)` in ARKStep -or the full :math:`f(t,y)` in ERKStep. While -the accuracy-based time step adaptivity algorithms may be sufficient -for retaining a stable solution to the ODE system, these may be -inefficient if the explicit right-hand side function contains moderately stiff terms. In -this scenario, a user may provide a function of type :c:type:`ARKExpStabFn` +for an explicit portion of their IVP. While the accuracy-based time step +adaptivity algorithms may be sufficient for retaining a stable solution to +the ODE system, these may be inefficient if the explicit right-hand side +function contains moderately stiff terms. In this scenario, a user may +provide a function of type :c:type:`ARKExpStabFn` to provide this stability information to ARKODE. This function must set the scalar step size satisfying the stability restriction for the upcoming time step. This value will subsequently be bounded by @@ -270,21 +288,19 @@ step, and the accuracy-based time step. This function predicts the maximum stable step size for the explicit portion of the ODE system. - **Arguments:** - * *y* -- the current value of the dependent variable vector. - * *t* -- the current value of the independent variable. - * *hstab* -- the output value with the absolute value of the - maximum stable step size. - * *user_data* -- a pointer to user data, the same as the - *estab_data* parameter that was passed to :c:func:`ARKStepSetStabilityFn` - or :c:func:`ERKStepSetStabilityFn`. - - **Return value:** - An *ARKExpStabFn* function should return 0 if it - successfully set the upcoming stable step size, and a non-zero - value otherwise. - - **Notes:** + :param y: the current value of the dependent variable vector. + :param t: the current value of the independent variable. + :param hstab: the output value with the absolute value of the + maximum stable step size. + :param user_data: a pointer to user data, the same as the *estab_data* + parameter that was passed to :c:func:`ARKodeSetStabilityFn`. + + :return: An *ARKExpStabFn* function should return 0 if it + successfully set the upcoming stable step size, and a non-zero + value otherwise. + + .. note:: + If this function is not supplied, or if it returns *hstab* :math:`\le 0.0`, then ARKODE will assume that there is no explicit stability restriction on the time step size. @@ -294,19 +310,19 @@ step, and the accuracy-based time step. .. _ARKODE.Usage.StagePredictFn: -Implicit stage prediction function (ARKStep and MRIStep only) -------------------------------------------------------------- +Implicit stage prediction function +---------------------------------- A user may supply a function to update the prediction for each implicit stage solution. -If supplied, this routine will be called *after* any existing ARKStep or MRIStep predictor +If supplied, this routine will be called *after* any existing ARKODE predictor algorithm completes, so that the predictor may be modified by the user as desired. In this scenario, a user may provide a function of type :c:type:`ARKStagePredictFn` to provide this implicit predictor to ARKODE. This function takes as input the already-predicted implicit stage solution and the corresponding "time" for that prediction; it then updates the prediction vector as desired. If the user-supplied routine will construct a full prediction (and thus the ARKODE prediction is irrelevant), it is -recommended that the user *not* call :c:func:`ARKStepSetPredictorMethod` or -:c:func:`MRIStepSetPredictorMethod`, thereby leaving the default trivial predictor in place. +recommended that the user *not* call :c:func:`ARKodeSetPredictorMethod`, thereby leaving +the default trivial predictor in place. @@ -314,27 +330,25 @@ recommended that the user *not* call :c:func:`ARKStepSetPredictorMethod` or This function updates the prediction for the implicit stage solution. - **Arguments:** - * *t* -- the current value of the independent variable containing the - "time" corresponding to the predicted solution. - * *zpred* -- the ARKStep-predicted stage solution on input, and the - user-modified predicted stage solution on output. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - - **Return value:** - An *ARKStagePredictFn* function should return 0 if it - successfully set the upcoming stable step size, and a non-zero - value otherwise. - - **Notes:** + :param t: the current value of the independent variable containing the + "time" corresponding to the predicted solution. + :param zpred: the ARKODE-predicted stage solution on input, and the + user-modified predicted stage solution on output. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: An *ARKStagePredictFn* function should return 0 if it + successfully set the upcoming stable step size, and a non-zero + value otherwise. + + .. note:: + This may be useful if there are bound constraints on the solution, and these should be enforced prior to beginning the nonlinear or linear implicit solver algorithm. This routine is incompatible with the "minimum correction predictor" -- option 5 to the - routine :c:func:`ARKStepSetPredictorMethod()`. If both are selected, then ARKStep will + routine :c:func:`ARKodeSetPredictorMethod`. If both are selected, then ARKODE will override its built-in implicit predictor routine to instead use option 0 (trivial predictor). @@ -354,65 +368,60 @@ ODE system, the user must supply a function of type :c:type:`ARKRootFn`. :math:`g(t,y)` such that roots are sought for the components :math:`g_i(t,y)`, :math:`i=0,\ldots,` *nrtfn*-1. - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *gout* -- the output array, of length *nrtfn*, with components :math:`g_i(t,y)`. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to the ``SetUserData`` function + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param gout: the output array, of length *nrtfn*, with components :math:`g_i(t,y)`. + :param user_data: a pointer to user data, the same as the + *user_data* parameter that was passed to the ``SetUserData`` function + + :return: An *ARKRootFn* function should return 0 if successful + or a non-zero value if an error occurred (in which case the + integration is halted and ARKODE returns *ARK_RTFUNC_FAIL*). - **Return value:** - An *ARKRootFn* function should return 0 if successful - or a non-zero value if an error occurred (in which case the - integration is halted and ARKODE returns *ARK_RTFUNC_FAIL*). + .. note:: - **Notes:** Allocation of memory for *gout* is handled within ARKODE. .. _ARKODE.Usage.JacobianFn: -Jacobian construction (matrix-based linear solvers, ARKStep and MRIStep only) ------------------------------------------------------------------------------ +Jacobian construction +--------------------- If a matrix-based linear solver module is used (i.e., a non-NULL ``SUNMatrix`` -object was supplied to :c:func:`ARKStepSetLinearSolver` or -:c:func:`MRIStepSetLinearSolver`, the user may provide a function of type -:c:type:`ARKLsJacFn` to provide the Jacobian approximation or +object was supplied to :c:func:`ARKodeSetLinearSolver`, the user may provide a +function of type :c:type:`ARKLsJacFn` to provide the Jacobian approximation or :c:type:`ARKLsLinSysFn` to provide an approximation of the linear system :math:`\mathcal{A}(t,y) = M(t) - \gamma J(t,y)`. - .. c:type:: int (*ARKLsJacFn)(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) This function computes the Jacobian matrix :math:`J(t,y) = \dfrac{\partial f^I}{\partial y}(t,y)` (or an approximation to it). - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector, namely - the predicted value of :math:`y(t)`. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *Jac* -- the output Jacobian matrix. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - * *tmp1*, *tmp2*, *tmp3* -- pointers to memory allocated to - variables of type ``N_Vector`` which can be used by an - ARKLsJacFn as temporary storage or work space. - - **Return value:** - An *ARKLsJacFn* function should return 0 if successful, a positive - value if a recoverable error occurred (in which case ARKODE will - attempt to correct, while ARKLS sets *last_flag* to - *ARKLS_JACFUNC_RECVR*), or a negative value if it failed - unrecoverably (in which case the integration is halted, - :c:func:`ARKStepEvolve` or :c:func:`MRIStepEvolve` returns - *ARK_LSETUP_FAIL* and ARKLS sets *last_flag* to *ARKLS_JACFUNC_UNRECVR*). - - **Notes:** + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector, namely + the predicted value of :math:`y(t)`. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param Jac: the output Jacobian matrix. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + :param tmp*: pointers to memory allocated to + variables of type ``N_Vector`` which can be used by an + ARKLsJacFn as temporary storage or work space. + + :return: An *ARKLsJacFn* function should return 0 if successful, a positive + value if a recoverable error occurred (in which case ARKODE will + attempt to correct, while ARKLS sets *last_flag* to + *ARKLS_JACFUNC_RECVR*), or a negative value if it failed + unrecoverably (in which case the integration is halted, + :c:func:`ARKodeEvolve` returns *ARK_LSETUP_FAIL* and + ARKLS sets *last_flag* to *ARKLS_JACFUNC_UNRECVR*). + + .. note:: + Information regarding the specific ``SUNMatrix`` structure (e.g.~number of rows, upper/lower bandwidth, sparsity type) may be obtained through using the @@ -439,9 +448,8 @@ object was supplied to :c:func:`ARKStepSetLinearSolver` or in the argument list, including the current step size, the error weights, etc. To obtain these, the user will need to add a pointer to the ``ark_mem`` structure to their ``user_data``, and - then use the ``ARKStepGet*`` or ``MRIStepGet*`` functions listed in - :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` or - :numref:`ARKODE.Usage.MRIStep.OptionalOutputs`. The unit roundoff can be + then use the ``ARKSodeGet*`` functions listed in + :numref:`ARKODE.Usage.OptionalOutputs`. The unit roundoff can be accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the header file ``sundials_types.h``. @@ -478,51 +486,47 @@ object was supplied to :c:func:`ARKStepSetLinearSolver` or This function computes the linear system matrix :math:`\mathcal{A}(t,y) = M(t) - \gamma J(t,y)` (or an approximation to it). - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector, namely the - predicted value of :math:`y(t)`. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *A* -- the output linear system matrix. - * *M* -- the current mass matrix (this input is ``NULL`` if :math:`M = I`). - * *jok* -- is an input flag indicating whether the Jacobian-related data - needs to be updated. The *jok* argument provides for the reuse of - Jacobian data. When *jok* = ``SUNFALSE``, the Jacobian-related data - should be recomputed from scratch. When *jok* = ``SUNTRUE`` the Jacobian - data, if saved from the previous call to this function, can be reused - (with the current value of *gamma*). A call with *jok* = ``SUNTRUE`` can - only occur after a call with *jok* = ``SUNFALSE``. - * *jcur* -- is a pointer to a flag which should be set to ``SUNTRUE`` if - Jacobian data was recomputed, or set to ``SUNFALSE`` if Jacobian data - was not recomputed, but saved data was still reused. - * *gamma* -- the scalar :math:`\gamma` appearing in the Newton system matrix - :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. - * *user_data* -- a pointer to user data, the same as the *user_data* - parameter that was passed to :c:func:`ARKStepSetUserData` or - :c:func:`MRIStepSetUserData`. - * *tmp1*, *tmp2*, *tmp3* -- pointers to memory allocated to variables of - type ``N_Vector`` which can be used by an ARKLsLinSysFn as temporary - storage or work space. - - **Return value:** - An *ARKLsLinSysFn* function should return 0 if successful, a positive value - if a recoverable error occurred (in which case ARKODE will attempt to - correct, while ARKLS sets *last_flag* to *ARKLS_JACFUNC_RECVR*), or a - negative value if it failed unrecoverably (in which case the integration is - halted, :c:func:`ARKStepEvolve` or :c:func:`MRIStepEvolve` returns - *ARK_LSETUP_FAIL* and ARKLS sets *last_flag* to *ARKLS_JACFUNC_UNRECVR*). + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector, namely the + predicted value of :math:`y(t)`. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param A: the output linear system matrix. + :param M: the current mass matrix (this input is ``NULL`` if :math:`M = I`). + :param jok: is an input flag indicating whether the Jacobian-related data + needs to be updated. The *jok* argument provides for the reuse of + Jacobian data. When *jok* = ``SUNFALSE``, the Jacobian-related data + should be recomputed from scratch. When *jok* = ``SUNTRUE`` the Jacobian + data, if saved from the previous call to this function, can be reused + (with the current value of *gamma*). A call with *jok* = ``SUNTRUE`` can + only occur after a call with *jok* = ``SUNFALSE``. + :param jcur: is a pointer to a flag which should be set to ``SUNTRUE`` if + Jacobian data was recomputed, or set to ``SUNFALSE`` if Jacobian data + was not recomputed, but saved data was still reused. + :param gamma: the scalar :math:`\gamma` appearing in the Newton system matrix + :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + :param tmp*: pointers to memory allocated to variables of + type ``N_Vector`` which can be used by an ARKLsLinSysFn as temporary + storage or work space. + + :return: An *ARKLsLinSysFn* function should return 0 if successful, a positive value + if a recoverable error occurred (in which case ARKODE will attempt to + correct, while ARKLS sets *last_flag* to *ARKLS_JACFUNC_RECVR*), or a + negative value if it failed unrecoverably (in which case the integration is + halted, :c:func:`ARKodeEvolve` returns *ARK_LSETUP_FAIL* and ARKLS sets + *last_flag* to *ARKLS_JACFUNC_UNRECVR*). .. _ARKODE.Usage.JTimesFn: -Jacobian-vector product (matrix-free linear solvers, ARKStep and MRIStep only) ------------------------------------------------------------------------------- +Jacobian-vector product +----------------------- When using a matrix-free linear solver module for the implicit stage solves (i.e., a NULL-valued SUNMATRIX argument was supplied to -:c:func:`ARKStepSetLinearSolver` or :c:func:`MRIStepSetLinearSolver`, -the user may provide a function +:c:func:`ARKodeSetLinearSolver`, the user may provide a function of type :c:type:`ARKLsJacTimesVecFn` in the following form, to compute matrix-vector products :math:`Jv`. If such a function is not supplied, the default is a difference quotient approximation to these products. @@ -533,43 +537,40 @@ the default is a difference quotient approximation to these products. This function computes the product :math:`Jv` where :math:`J(t,y) \approx \dfrac{\partial f^I}{\partial y}(t,y)` (or an approximation to it). - **Arguments:** - * *v* -- the vector to multiply. - * *Jv* -- the output vector computed. - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - * *tmp* -- pointer to memory allocated to a variable of type - ``N_Vector`` which can be used as temporary storage or work space. - - **Return value:** - The value to be returned by the Jacobian-vector product - function should be 0 if successful. Any other return value will - result in an unrecoverable error of the generic Krylov solver, - in which case the integration is halted. - - **Notes:** + :param v: the vector to multiply. + :param Jv: the output vector computed. + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + :param tmp: pointer to memory allocated to a variable of type + ``N_Vector`` which can be used as temporary storage or work space. + + :return: The value to be returned by the Jacobian-vector product + function should be 0 if successful. Any other return value will + result in an unrecoverable error of the generic Krylov solver, + in which case the integration is halted. + + .. note:: + If the user's :c:type:`ARKLsJacTimesVecFn` function uses difference quotient approximations, it may need to access quantities not in the argument list. These include the current step size, the error weights, etc. To obtain these, the user will need to add a pointer to the ``ark_mem`` structure to - their ``user_data``, and then use the ``ARKStepGet*`` or ``MRIStepGet*`` - functions listed in :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` or - :numref:`ARKODE.Usage.MRIStep.OptionalOutputs`. The unit roundoff can be - accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the header - file ``sundials_types.h``. + their ``user_data``, and then use the ``ARKodeGet*`` functions + listed in :numref:`ARKODE.Usage.OptionalOutputs`. The unit roundoff + can be accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the + header file ``sundials_types.h``. .. _ARKODE.Usage.JTSetupFn: -Jacobian-vector product setup (matrix-free linear solvers, ARKStep and MRIStep only) ------------------------------------------------------------------------------------- +Jacobian-vector product setup +----------------------------- If the user's Jacobian-times-vector routine requires that any Jacobian-related data be preprocessed or evaluated, then this needs to be done in a @@ -582,21 +583,19 @@ defined as follows: This function preprocesses and/or evaluates any Jacobian-related data needed by the Jacobian-times-vector routine. - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - - **Return value:** - The value to be returned by the Jacobian-vector setup - function should be 0 if successful, positive for a recoverable - error (in which case the step will be retried), or negative for an - unrecoverable error (in which case the integration is halted). - - **Notes:** + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: The value to be returned by the Jacobian-vector setup + function should be 0 if successful, positive for a recoverable + error (in which case the step will be retried), or negative for an + unrecoverable error (in which case the integration is halted). + + .. note:: + Each call to the Jacobian-vector setup function is preceded by a call to the implicit :c:type:`ARKRhsFn` user function with the same :math:`(t,y)` arguments. Thus, the setup @@ -608,20 +607,18 @@ defined as follows: quantities not in the argument list. These include the current step size, the error weights, etc. To obtain these, the user will need to add a pointer to the ``ark_mem`` structure to - their ``user_data``, and then use the ``ARKStepGet*`` or - ``MRIStepGet*`` functions listed in - :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` or - :numref:`ARKODE.Usage.MRIStep.OptionalOutputs`. The unit roundoff can be - accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the header - file ``sundials_types.h``. + their ``user_data``, and then use the ``ARKodeGet*`` functions + listed in :numref:`ARKODE.Usage.OptionalOutputs`. The unit roundoff + can be accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the + header file ``sundials_types.h``. .. _ARKODE.Usage.PrecSolveFn: -Preconditioner solve (iterative linear solvers, ARKStep and MRIStep only) -------------------------------------------------------------------------- +Preconditioner solve +-------------------- If a user-supplied preconditioner is to be used with a SUNLinSol solver module, then the user must provide a function of type @@ -639,44 +636,41 @@ preconditioner matrices should approximate :math:`\mathcal{A}`. This function solves the preconditioner system :math:`Pz=r`. - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *r* -- the right-hand side vector of the linear system. - * *z* -- the computed output solution vector. - * *gamma* -- the scalar :math:`\gamma` appearing in the Newton - matrix given by :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. - * *delta* -- an input tolerance to be used if an iterative method - is employed in the solution. In that case, the residual vector - :math:`Res = r-Pz` of the system should be made to be less than *delta* - in the weighted :math:`l_2` norm, i.e. :math:`\left(\displaystyle \sum_{i=1}^n - \left(Res_i * ewt_i\right)^2 \right)^{1/2} < \delta`, where :math:`\delta =` - `delta`. To obtain the ``N_Vector`` *ewt*, call - :c:func:`ARKStepGetErrWeights` or :c:func:`MRIStepGetErrWeights`. - * *lr* -- an input flag indicating whether the preconditioner - solve is to use the left preconditioner (*lr* = 1) or the right - preconditioner (*lr* = 2). - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - - **Return value:** - The value to be returned by the preconditioner solve - function is a flag indicating whether it was successful. This value - should be 0 if successful, positive for a recoverable error (in - which case the step will be retried), or negative for an - unrecoverable error (in which case the integration is halted). + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param r: the right-hand side vector of the linear system. + :param z: the computed output solution vector. + :param gamma: the scalar :math:`\gamma` appearing in the Newton + matrix given by :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. + :param delta: an input tolerance to be used if an iterative method + is employed in the solution. In that case, the residual vector + :math:`Res = r-Pz` of the system should be made to be less than *delta* + in the weighted :math:`l_2` norm, i.e. :math:`\left(\displaystyle \sum_{i=1}^n + \left(Res_i * ewt_i\right)^2 \right)^{1/2} < \delta`, where :math:`\delta =` + `delta`. To obtain the ``N_Vector`` *ewt*, call + :c:func:`ARKodeGetErrWeights`. + :param lr: an input flag indicating whether the preconditioner + solve is to use the left preconditioner (*lr* = 1) or the right + preconditioner (*lr* = 2). + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: The value to be returned by the preconditioner solve + function is a flag indicating whether it was successful. This value + should be 0 if successful, positive for a recoverable error (in + which case the step will be retried), or negative for an + unrecoverable error (in which case the integration is halted). .. _ARKODE.Usage.PrecSetupFn: -Preconditioner setup (iterative linear solvers, ARKStep and MRIStep only) -------------------------------------------------------------------------- +Preconditioner setup +-------------------- -If the user's preconditioner routine requires that any data be +If the user's preconditioner routine above requires that any data be preprocessed or evaluated, then these actions need to occur within a user-supplied function of type :c:type:`ARKLsPrecSetupFn`. @@ -686,35 +680,33 @@ user-supplied function of type :c:type:`ARKLsPrecSetupFn`. This function preprocesses and/or evaluates Jacobian-related data needed by the preconditioner. - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *fy* -- the current value of the vector :math:`f^I(t,y)`. - * *jok* -- is an input flag indicating whether the Jacobian-related - data needs to be updated. The *jok* argument provides for the - reuse of Jacobian data in the preconditioner solve function. When - *jok* = ``SUNFALSE``, the Jacobian-related data should be recomputed - from scratch. When *jok* = ``SUNTRUE`` the Jacobian data, if saved from the - previous call to this function, can be reused (with the current - value of *gamma*). A call with *jok* = ``SUNTRUE`` can only occur - after a call with *jok* = ``SUNFALSE``. - * *jcurPtr* -- is a pointer to a flag which should be set to - ``SUNTRUE`` if Jacobian data was recomputed, or set to ``SUNFALSE`` if - Jacobian data was not recomputed, but saved data was still reused. - * *gamma* -- the scalar :math:`\gamma` appearing in the Newton - matrix given by :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData` - or :c:func:`MRIStepSetUserData`. - - **Return value:** - The value to be returned by the preconditioner setup - function is a flag indicating whether it was successful. This value - should be 0 if successful, positive for a recoverable error (in - which case the step will be retried), or negative for an - unrecoverable error (in which case the integration is halted). - - **Notes:** + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param fy: the current value of the vector :math:`f^I(t,y)`. + :param jok: is an input flag indicating whether the Jacobian-related + data needs to be updated. The *jok* argument provides for the + reuse of Jacobian data in the preconditioner solve function. When + *jok* = ``SUNFALSE``, the Jacobian-related data should be recomputed + from scratch. When *jok* = ``SUNTRUE`` the Jacobian data, if saved from the + previous call to this function, can be reused (with the current + value of *gamma*). A call with *jok* = ``SUNTRUE`` can only occur + after a call with *jok* = ``SUNFALSE``. + :param jcurPtr: is a pointer to a flag which should be set to + ``SUNTRUE`` if Jacobian data was recomputed, or set to ``SUNFALSE`` if + Jacobian data was not recomputed, but saved data was still reused. + :param gamma: the scalar :math:`\gamma` appearing in the Newton + matrix given by :math:`\mathcal{A}=M(t)-\gamma J(t,y)`. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: The value to be returned by the preconditioner setup + function is a flag indicating whether it was successful. This value + should be 0 if successful, positive for a recoverable error (in + which case the step will be retried), or negative for an + unrecoverable error (in which case the integration is halted). + + .. note:: + The operations performed by this function might include forming a crude approximate Jacobian, and performing an LU factorization of the resulting approximation to :math:`\mathcal{A} = M(t) - @@ -739,9 +731,8 @@ user-supplied function of type :c:type:`ARKLsPrecSetupFn`. quantities not in the call list. These include the current step size, the error weights, etc. To obtain these, the user will need to add a pointer to the ``ark_mem`` structure to their - ``user_data``, and then use the ``ARKStepGet*`` or ``MRIStepGet*`` - functions listed in :numref:`ARKODE.Usage.ARKStep.OptionalOutputs` or - :numref:`ARKODE.Usage.MRIStep.OptionalOutputs`. The unit roundoff can be + ``user_data``, and then use the ``ARKodeGet*`` functions listed in + :numref:`ARKODE.Usage.OptionalOutputs`. The unit roundoff can be accessed as ``SUN_UNIT_ROUNDOFF``, which is defined in the header file ``sundials_types.h``. @@ -749,11 +740,12 @@ user-supplied function of type :c:type:`ARKLsPrecSetupFn`. .. _ARKODE.Usage.MassFn: -Mass matrix construction (matrix-based linear solvers, ARKStep only) --------------------------------------------------------------------- +Mass matrix construction +------------------------ -If a matrix-based mass-matrix linear solver is used (i.e., a non-NULL -SUNMATRIX was supplied to :c:func:`ARKStepSetMassLinearSolver`, the +For problems involving a non-identity mass matrix, if a matrix-based +mass-matrix linear solver is used (i.e., a non-NULL SUNMATRIX was +supplied to :c:func:`ARKodeSetMassLinearSolver`, the user must provide a function of type :c:type:`ARKLsMassFn` to provide the mass matrix approximation. @@ -763,23 +755,22 @@ the mass matrix approximation. This function computes the mass matrix :math:`M(t)` (or an approximation to it). - **Arguments:** - * *t* -- the current value of the independent variable. - * *M* -- the output mass matrix. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData()`. - * *tmp1*, *tmp2*, *tmp3* -- pointers to memory allocated to - variables of type ``N_Vector`` which can be used by an - ARKLsMassFn as temporary storage or work space. - - **Return value:** - An *ARKLsMassFn* function should return 0 if successful, or a - negative value if it failed unrecoverably (in which case the - integration is halted, :c:func:`ARKStepEvolve()` returns - *ARK_MASSSETUP_FAIL* and ARKLS sets *last_flag* to - *ARKLS_MASSFUNC_UNRECVR*). - - **Notes:** + :param t: the current value of the independent variable. + :param M: the output mass matrix. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + :param tmp1*: pointers to memory allocated to + variables of type ``N_Vector`` which can be used by an + ARKLsMassFn as temporary storage or work space. + + :return: An *ARKLsMassFn* function should return 0 if successful, or a + negative value if it failed unrecoverably (in which case the + integration is halted, :c:func:`ARKodeEvolve` returns + *ARK_MASSSETUP_FAIL* and ARKLS sets *last_flag* to + *ARKLS_MASSFUNC_UNRECVR*). + + .. note:: + Information regarding the structure of the specific ``SUNMatrix`` structure (e.g.~number of rows, upper/lower bandwidth, sparsity type) may be obtained through using the @@ -818,13 +809,14 @@ the mass matrix approximation. .. _ARKODE.Usage.MTimesFn: -Mass matrix-vector product (matrix-free linear solvers, ARKStep only) ---------------------------------------------------------------------- +Mass matrix-vector product +-------------------------- -If a matrix-free linear solver is to be used for mass-matrix linear -systems (i.e., a NULL-valued SUNMATRIX argument was supplied to -:c:func:`ARKStepSetMassLinearSolver()` in -:numref:`ARKODE.Usage.ARKStep.Skeleton`), the user *must* provide a +For problems involving a non-identity mass matrix, if a matrix-free +linear solver is to be used for mass-matrix linear systems (i.e., a +NULL-valued SUNMATRIX argument was supplied to +:c:func:`ARKodeSetMassLinearSolver` in +:numref:`ARKODE.Usage.Skeleton`), the user *must* provide a function of type :c:type:`ARKLsMassTimesVecFn` in the following form, to compute matrix-vector products :math:`M(t)\, v`. @@ -834,28 +826,27 @@ compute matrix-vector products :math:`M(t)\, v`. This function computes the product :math:`M(t)\, v` (or an approximation to it). - **Arguments:** - * *v* -- the vector to multiply. - * *Mv* -- the output vector computed. - * *t* -- the current value of the independent variable. - * *mtimes_data* -- a pointer to user data, the same as the - *mtimes_data* parameter that was passed to :c:func:`ARKStepSetMassTimes()`. + :param v: the vector to multiply. + :param Mv: the output vector computed. + :param t: the current value of the independent variable. + :param mtimes_data: a pointer to user data, the same as the *mtimes_data* + parameter that was passed to :c:func:`ARKodeSetMassTimes`. - **Return value:** - The value to be returned by the mass-matrix-vector product - function should be 0 if successful. Any other return value will - result in an unrecoverable error of the generic Krylov solver, - in which case the integration is halted. + :return: The value to be returned by the mass-matrix-vector product + function should be 0 if successful. Any other return value will + result in an unrecoverable error of the generic Krylov solver, + in which case the integration is halted. .. _ARKODE.Usage.MTSetupFn: -Mass matrix-vector product setup (matrix-free linear solvers, ARKStep only) ---------------------------------------------------------------------------- +Mass matrix-vector product setup +-------------------------------- -If the user's mass-matrix-times-vector routine requires that any mass -matrix-related data be preprocessed or evaluated, then this needs to +For problems involving a non-identity mass matrix and a matrix-free linear +solver, if the user's mass-matrix-times-vector routine requires that any +mass matrix-related data be preprocessed or evaluated, then this needs to be done in a user-supplied function of type :c:type:`ARKLsMassTimesSetupFn`, defined as follows: @@ -866,25 +857,24 @@ be done in a user-supplied function of type This function preprocesses and/or evaluates any mass-matrix-related data needed by the mass-matrix-times-vector routine. - **Arguments:** - * *t* -- the current value of the independent variable. - * *mtimes_data* -- a pointer to user data, the same as the - *mtimes_data* parameter that was passed to :c:func:`ARKStepSetMassTimes()`. + :param t: the current value of the independent variable. + :param mtimes_data: a pointer to user data, the same as the *mtimes_data* + parameter that was passed to :c:func:`ARKodeSetMassTimes`. - **Return value:** - The value to be returned by the mass-matrix-vector setup - function should be 0 if successful. Any other return value will - result in an unrecoverable error of the ARKLS mass matrix solver - interface, in which case the integration is halted. + :return: The value to be returned by the mass-matrix-vector setup + function should be 0 if successful. Any other return value will + result in an unrecoverable error of the ARKLS mass matrix solver + interface, in which case the integration is halted. .. _ARKODE.Usage.MassPrecSolveFn: -Mass matrix preconditioner solve (iterative linear solvers, ARKStep only) -------------------------------------------------------------------------- +Mass matrix preconditioner solve +-------------------------------- -If a user-supplied preconditioner is to be used with a SUNLINEAR +For problems involving a non-identity mass matrix and an iterative linear +solver, if a user-supplied preconditioner is to be used with a SUNLINEAR solver module for mass matrix linear systems, then the user must provide a function of type :c:type:`ARKLsMassPrecSolveFn` to solve the linear system :math:`Pz=r`, where :math:`P` may be either a left or right @@ -898,39 +888,38 @@ approximate :math:`M(t)`. This function solves the preconditioner system :math:`Pz=r`. - **Arguments:** - * *t* -- the current value of the independent variable. - * *r* -- the right-hand side vector of the linear system. - * *z* -- the computed output solution vector. - * *delta* -- an input tolerance to be used if an iterative method - is employed in the solution. In that case, the residual vector - :math:`Res = r-Pz` of the system should be made to be less than *delta* - in the weighted :math:`l_2` norm, i.e. :math:`\left(\displaystyle \sum_{i=1}^n - \left(Res_i * ewt_i\right)^2 \right)^{1/2} < \delta`, where :math:`\delta =` - *delta*. To obtain the ``N_Vector`` *ewt*, call - :c:func:`ARKStepGetErrWeights()`. - * *lr* -- an input flag indicating whether the preconditioner - solve is to use the left preconditioner (*lr* = 1) or the right - preconditioner (*lr* = 2). - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData()`. - - **Return value:** - The value to be returned by the preconditioner solve - function is a flag indicating whether it was successful. This value - should be 0 if successful, positive for a recoverable error (in - which case the step will be retried), or negative for an - unrecoverable error (in which case the integration is halted). + :param t: the current value of the independent variable. + :param r: the right-hand side vector of the linear system. + :param z: the computed output solution vector. + :param delta: an input tolerance to be used if an iterative method + is employed in the solution. In that case, the residual vector + :math:`Res = r-Pz` of the system should be made to be less than *delta* + in the weighted :math:`l_2` norm, i.e. :math:`\left(\displaystyle \sum_{i=1}^n + \left(Res_i * ewt_i\right)^2 \right)^{1/2} < \delta`, where :math:`\delta =` + *delta*. To obtain the ``N_Vector`` *ewt*, call + :c:func:`ARKodeGetErrWeights`. + :param lr: an input flag indicating whether the preconditioner + solve is to use the left preconditioner (*lr* = 1) or the right + preconditioner (*lr* = 2). + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. + + :return: The value to be returned by the preconditioner solve + function is a flag indicating whether it was successful. This value + should be 0 if successful, positive for a recoverable error (in + which case the step will be retried), or negative for an + unrecoverable error (in which case the integration is halted). .. _ARKODE.Usage.MassPrecSetupFn: -Mass matrix preconditioner setup (iterative linear solvers, ARKStep only) -------------------------------------------------------------------------- +Mass matrix preconditioner setup +-------------------------------- -If the user's mass matrix preconditioner above requires that any +For problems involving a non-identity mass matrix and an iterative linear +solver, if the user's mass matrix preconditioner above requires that any problem data be preprocessed or evaluated, then these actions need to occur within a user-supplied function of type :c:type:`ARKLsMassPrecSetupFn`. @@ -942,19 +931,18 @@ occur within a user-supplied function of type This function preprocesses and/or evaluates mass-matrix-related data needed by the preconditioner. - **Arguments:** - * *t* -- the current value of the independent variable. - * *user_data* -- a pointer to user data, the same as the - *user_data* parameter that was passed to :c:func:`ARKStepSetUserData()`. + :param t: the current value of the independent variable. + :param user_data: a pointer to user data, the same as the *user_data* + parameter that was passed to :c:func:`ARKodeSetUserData`. - **Return value:** - The value to be returned by the mass matrix preconditioner setup - function is a flag indicating whether it was successful. This value - should be 0 if successful, positive for a recoverable error (in - which case the step will be retried), or negative for an - unrecoverable error (in which case the integration is halted). + :return: The value to be returned by the mass matrix preconditioner setup + function is a flag indicating whether it was successful. This value + should be 0 if successful, positive for a recoverable error (in + which case the step will be retried), or negative for an + unrecoverable error (in which case the integration is halted). + + .. note:: - **Notes:** The operations performed by this function might include forming a mass matrix and performing an incomplete factorization of the result. Although such operations would @@ -976,8 +964,7 @@ Vector resize function For simulations involving changes to the number of equations and unknowns in the ODE system (e.g. when using spatial adaptivity in a PDE simulation), the ARKODE integrator may be "resized" between -integration steps, through calls to the :c:func:`ARKStepResize`, -:c:func:`ERKStepResize`, or :c:func:`MRIStepResize` +integration steps, through calls to the :c:func:`ARKodeResize` function. Typically, when performing adaptive simulations the solution is stored in a customized user-supplied data structure, to enable adaptivity without repeated allocation/deallocation of memory. In @@ -985,8 +972,7 @@ these scenarios, it is recommended that the user supply a customized vector kernel to interface between SUNDIALS and their problem-specific data structure. If this vector kernel includes a function of type :c:type:`ARKVecResizeFn` to resize a given vector implementation, then -this function may be supplied to :c:func:`ARKStepResize`, -:c:func:`ERKStepResize`, or :c:func:`MRIStepResize`, so that all +this function may be supplied to :c:func:`ARKodeResize` so that all internal ARKODE vectors may be resized, instead of deleting and re-creating them at each call. This resize function should have the following form: @@ -997,18 +983,16 @@ following form: This function resizes the vector *y* to match the dimensions of the supplied vector, *ytemplate*. - **Arguments:** - * *y* -- the vector to resize. - * *ytemplate* -- a vector of the desired size. - * *user_data* -- a pointer to user data, the same as the - *resize_data* parameter that was passed to :c:func:`ARKStepResize`, - :c:func:`ERKStepResize`, or :c:func:`MRIStepResize`. + :param y: the vector to resize. + :param ytemplate: a vector of the desired size. + :param user_data: a pointer to user data, the same as the *resize_data* + parameter that was passed to :c:func:`ARKodeResize`. + + :return: An *ARKVecResizeFn* function should return 0 if it successfully + resizes the vector *y*, and a non-zero value otherwise. - **Return value:** - An *ARKVecResizeFn* function should return 0 if it successfully - resizes the vector *y*, and a non-zero value otherwise. + .. note:: - **Notes:** If this function is not supplied, then ARKODE will instead destroy the vector *y* and clone a new vector *y* off of *ytemplate*. @@ -1029,20 +1013,19 @@ integrator for the inner integration. .. c:type:: int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector* f, int num_vecs, void* user_data) - **Arguments:** - * *t* -- the current value of the independent variable. - * *f* -- an ``N_Vector`` array of outer forcing vectors. - * *num_vecs* -- the number of vectors in the ``N_Vector`` array. - * *user_data* -- the `user_data` pointer that was passed to - :c:func:`MRIStepSetUserData()`. + :param t: the current value of the independent variable. + :param f: an ``N_Vector`` array of outer forcing vectors. + :param num_vecs: the number of vectors in the ``N_Vector`` array. + :param user_data: the `user_data` pointer that was passed to + :c:func:`MRIStepSetUserData`. + + :return: An *MRIStepPreInnerFn* function should return 0 if successful, a positive value + if a recoverable error occurred, or a negative value if an unrecoverable + error occurred. As the MRIStep module only supports fixed step sizes at this + time any non-zero return value will halt the integration. - **Return value:** - An *MRIStepPreInnerFn* function should return 0 if successful, a positive value - if a recoverable error occurred, or a negative value if an unrecoverable - error occurred. As the MRIStep module only supports fixed step sizes at this - time any non-zero return value will halt the integration. + .. note:: - **Notes:** In a heterogeneous computing environment if any data copies between the host and device vector data are necessary, this is where that should occur. @@ -1060,19 +1043,18 @@ outer integrator for the outer integration. .. c:type:: int (*MRIStepPostInnerFn)(sunrealtype t, N_Vector y, void* user_data) - **Arguments:** - * *t* -- the current value of the independent variable. - * *y* -- the current value of the dependent variable vector. - * *user_data* -- the ``user_data`` pointer that was passed to - :c:func:`MRIStepSetUserData`. + :param t: the current value of the independent variable. + :param y: the current value of the dependent variable vector. + :param user_data: the ``user_data`` pointer that was passed to + :c:func:`MRIStepSetUserData`. - **Return value:** - An :c:func:`MRIStepPostInnerFn` function should return 0 if successful, a - positive value if a recoverable error occurred, or a negative value if an - unrecoverable error occurred. As the MRIStep module only supports fixed step - sizes at this time any non-zero return value will halt the integration. + :return: An :c:func:`MRIStepPostInnerFn` function should return 0 if successful, a + positive value if a recoverable error occurred, or a negative value if an + unrecoverable error occurred. As the MRIStep module only supports fixed step + sizes at this time any non-zero return value will halt the integration. + + .. note:: - **Notes:** In a heterogeneous computing environment if any data copies between the host and device vector data are necessary, this is where that should occur. @@ -1087,17 +1069,15 @@ Relaxation function When applying relaxation, an :c:func:`ARKRelaxFn` function is required to compute the conservative or dissipative function :math:`\xi(y)`. - **Arguments:** - * *y* -- the current value of the dependent variable vector. - * *r* -- the value of :math:`\xi(y)`. - * *user_data* -- the ``user_data`` pointer that was passed to - :c:func:`ARKStepSetUserData`. + :param y: the current value of the dependent variable vector. + :param r: the value of :math:`\xi(y)`. + :param user_data: the ``user_data`` pointer that was passed to + :c:func:`ARKodeSetUserData`. - **Return value:** - An :c:func:`ARKRelaxFn` function should return 0 if successful, a positive - value if a recoverable error occurred, or a negative value if an - unrecoverable error occurred. If a recoverable error occurs, the step size - will be reduced and the step repeated. + :return: An :c:func:`ARKRelaxFn` function should return 0 if successful, a positive + value if a recoverable error occurred, or a negative value if an + unrecoverable error occurred. If a recoverable error occurs, the step size + will be reduced and the step repeated. .. _ARKODE.Usage.RelaxJacFn: @@ -1110,14 +1090,12 @@ Relaxation Jacobian function compute the Jacobian :math:`\xi'(y)` of the :c:func:`ARKRelaxFn` :math:`\xi(y)`. - **Arguments:** - * *y* -- the current value of the dependent variable vector. - * *J* -- the Jacobian vector :math:`\xi'(y)`. - * *user_data* -- the ``user_data`` pointer that was passed to - :c:func:`ARKStepSetUserData`. - - **Return value:** - An :c:func:`ARKRelaxJacFn` function should return 0 if successful, a - positive value if a recoverable error occurred, or a negative value if an - unrecoverable error occurred. If a recoverable error occurs, the step size - will be reduced and the step repeated. + :param y: the current value of the dependent variable vector. + :param J: the Jacobian vector :math:`\xi'(y)`. + :param user_data: the ``user_data`` pointer that was passed to + :c:func:`ARKodeSetUserData`. + + :return: An :c:func:`ARKRelaxJacFn` function should return 0 if successful, a + positive value if a recoverable error occurred, or a negative value if an + unrecoverable error occurred. If a recoverable error occurs, the step size + will be reduced and the step repeated. diff --git a/doc/arkode/guide/source/Usage/index.rst b/doc/arkode/guide/source/Usage/index.rst index fba04368cd..2ecc9a671c 100644 --- a/doc/arkode/guide/source/Usage/index.rst +++ b/doc/arkode/guide/source/Usage/index.rst @@ -16,23 +16,66 @@ Using ARKODE ************ -This chapter discusses usage for ARKODE from C, C++ and Fortran applications. -The chapter builds upon :numref:`SUNDIALS`. We first discuss commonalities to -each of ARKODE's time-stepping modules, including locations and naming -conventions for the library and header files, and discussion of data types in -SUNDIALS. We then separately discuss the C and C++ interfaces to each of -ARKODE's time stepping modules: :ref:`ARKStep `, +This chapter discusses usage of ARKODE for the solution of initial value +problems (IVPs) in C, C++ and Fortran applications. The chapter builds upon +:numref:`SUNDIALS`. Unlike other packages in SUNDIALS, ARKODE provides an +infrastructure for one-step methods. However, ARKODE's individual +time-stepping methods, including definition of the IVP itself, are handled +by time-stepping modules that sit on top of ARKODE. While most of the +routines to use ARKODE generally apply to all of its time-stepping modules, +some of these apply to only a subset of these "steppers," while others are +specific to a given stepper. + +Thus, we organize this chapter as follows. We first discuss commonalities +to each of ARKODE's time-stepping modules. These commonalities include the +locations and naming conventions for the library and header files, data types +in SUNDIALS, the layout of the user's main program, and a variety of +user-callable and user-supplied functions. For these user-callable routines, +we distinguish those that apply for only a subset of ARKODE's time-stepping +modules. We then describe shared utilities that are supported by some of +ARKODE's time stepping modules, including "relaxation" methods and +preconitioners. Following our discussion of these commonalities, we +separately discuss the usage details that that are specific to each of ARKODE's +time stepping modules: :ref:`ARKStep `, :ref:`ERKStep `, :ref:`SPRKStep ` -and :ref:`MRIStep `. Following these, we describe the set of -:ref:`user-supplied routines ` -(both required and optional) that can be supplied to ARKODE. +and :ref:`MRIStep `. + +ARKODE also uses various input and output constants; these are defined as +needed throughout this chapter, but for convenience the full list is provided +separately in :numref:`ARKODE.Constants`. + +The example programs for ARKODE are located in the source code ``examples/arkode`` +folder. We note that these may be helpful as templates for new codes. Users +with applications written in Fortran should see the chapter +:numref:`SUNDIALS.Fortran`, which describes the Fortran interfaces for +SUNDIALS, and we additionally include multiple Fortran example programs +in the ARKODE ``examples`` directory. + +When solving problems with an implicit component, we note that not all +SUNLINSOL, SUNMATRIX, and preconditioning modules are compatible with +all NVECTOR implementations. Details on compatibility are given in the +documentation for each SUNMATRIX (see :numref:`SUNMatrix`) and each +SUNLINSOL module (see :numref:`SUNLinSol`). For example, NVECTOR_PARALLEL +is not compatible with the dense, banded, or sparse SUNMATRIX types, +or with the corresponding dense, banded, or sparse SUNLINSOL modules. +Please check :numref:`SUNMatrix` and :numref:`SUNLinSol` to +verify compatibility between these modules. In addition to that +documentation, we note that the ARKBANDPRE preconditioning module is +only compatible with the NVECTOR_SERIAL, NVECTOR_OPENMP or +NVECTOR_PTHREADS vector implementations, and the preconditioner module +ARKBBDPRE can only be used with NVECTOR_PARALLEL. + .. toctree:: :maxdepth: 1 - General.rst + General + Skeleton + User_callable + User_supplied + Relaxation + Preconditioners ARKStep_c_interface/index.rst ERKStep_c_interface/index.rst SPRKStep_c_interface/index.rst MRIStep_c_interface/index.rst - User_supplied.rst diff --git a/doc/arkode/guide/source/index.rst b/doc/arkode/guide/source/index.rst index 809a408329..e809010fd0 100644 --- a/doc/arkode/guide/source/index.rst +++ b/doc/arkode/guide/source/index.rst @@ -19,7 +19,7 @@ ARKODE Documentation This is the documentation for ARKODE, an adaptive step time integration package for stiff, nonstiff and mixed stiff/nonstiff systems of ordinary differential equations (ODEs) using Runge--Kutta -(i.e. one-step, multi-stage) methods. The ARKODE solver is a +(i.e., one-step, multi-stage) methods. The ARKODE solver is a component of the `SUNDIALS `_ suite of nonlinear and differential/algebraic equation solvers. It is designed diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index ace964d2ac..01b60e99f3 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -221,7 +221,6 @@ SUNDIALS_EXPORT int ARKodeSetDefaults(void* arkode_mem); SUNDIALS_EXPORT int ARKodeSetOrder(void* arkode_mem, int maxord); SUNDIALS_EXPORT int ARKodeSetInterpolantType(void* arkode_mem, int itype); SUNDIALS_EXPORT int ARKodeSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_EXPORT int ARKodeSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_EXPORT int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); SUNDIALS_EXPORT int ARKodeSetLinear(void* arkode_mem, int timedepend); diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index f3e8f333b2..d4fa99e1da 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -60,8 +60,8 @@ int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER SPRKStepCreate */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") int SPRKStepSetDefaults(void* arkode_mem); -SUNDIALS_EXPORT int SPRKStepSetUseCompensatedSums(void* arkode_mem, - sunbooleantype onoff); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUseCompensatedSums instead") +int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); SUNDIALS_EXPORT int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage); SUNDIALS_EXPORT int SPRKStepSetMethodName(void* arkode_mem, const char* method); diff --git a/include/arkode/arkode_xbraid.h b/include/arkode/arkode_xbraid.h index e3cf93c213..6ce4df639d 100644 --- a/include/arkode/arkode_xbraid.h +++ b/include/arkode/arkode_xbraid.h @@ -57,13 +57,19 @@ SUNDIALS_EXPORT int ARKBraid_SetAccessFn(braid_App app, braid_PtFcnAccess access SUNDIALS_EXPORT int ARKBraid_GetVecTmpl(braid_App app, N_Vector* tmpl); -SUNDIALS_EXPORT int ARKBraid_GetARKStepMem(braid_App app, void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKBraid_GetARKodeMem instead") +int ARKBraid_GetARKStepMem(braid_App app, void** arkode_mem); + +SUNDIALS_EXPORT int ARKBraid_GetARKodeMem(braid_App app, void** arkode_mem); SUNDIALS_EXPORT int ARKBraid_GetUserData(braid_App app, void** user_data); SUNDIALS_EXPORT int ARKBraid_GetLastBraidFlag(braid_App app, int* last_flag); -SUNDIALS_EXPORT int ARKBraid_GetLastARKStepFlag(braid_App app, int* last_flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKBraid_GetLastARKodeFlag instead") +int ARKBraid_GetLastARKStepFlag(braid_App app, int* last_flag); + +SUNDIALS_EXPORT int ARKBraid_GetLastARKodeFlag(braid_App app, int* last_flag); SUNDIALS_EXPORT int ARKBraid_GetSolution(braid_App app, sunrealtype* tout, N_Vector yout); diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 8739ceff6a..13fec5ff58 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -97,7 +97,7 @@ int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun) int ARKStepSetDenseOrder(void* arkode_mem, int dord) { - return (ARKodeSetDenseOrder(arkode_mem, dord)); + return (ARKodeSetInterpolantDegree(arkode_mem, dord)); } int ARKStepSetInterpolantDegree(void* arkode_mem, int degree) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index a4775b70a8..ec8f98e555 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -258,25 +258,6 @@ int ARKodeSetInterpolantDegree(void* arkode_mem, int degree) return (arkInterpSetDegree(ark_mem, ark_mem->interp, degree)); } -/*--------------------------------------------------------------- - ARKodeSetDenseOrder: - - Specifies the polynomial degree for the dense output - interpolation module. - - Return values: - ARK_SUCCESS on success. - ARK_MEM_NULL on NULL-valued arkode_mem input or nonexistent - interpolation module. - ARK_INTERP_FAIL if the interpolation module is already - initialized. - ARK_ILL_INPUT if the degree is illegal. - ---------------------------------------------------------------*/ -int ARKodeSetDenseOrder(void* arkode_mem, int degree) -{ - return (ARKodeSetInterpolantDegree(arkode_mem, degree)); -} - /*--------------------------------------------------------------- ARKodeSetNonlinearSolver: diff --git a/src/arkode/fmod/farkode_mod.c b/src/arkode/fmod/farkode_mod.c index cf1dda27b9..dc0299d451 100644 --- a/src/arkode/fmod/farkode_mod.c +++ b/src/arkode/fmod/farkode_mod.c @@ -537,20 +537,6 @@ SWIGEXPORT int _wrap_FARKodeSetInterpolantDegree(void *farg1, int const *farg2) } -SWIGEXPORT int _wrap_FARKodeSetDenseOrder(void *farg1, int const *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - result = (int)ARKodeSetDenseOrder(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FARKodeSetNonlinearSolver(void *farg1, SUNNonlinearSolver farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_mod.f90 b/src/arkode/fmod/farkode_mod.f90 index 18ef81a68e..6dc40bb8c2 100644 --- a/src/arkode/fmod/farkode_mod.f90 +++ b/src/arkode/fmod/farkode_mod.f90 @@ -116,7 +116,6 @@ module farkode_mod public :: FARKodeSetOrder public :: FARKodeSetInterpolantType public :: FARKodeSetInterpolantDegree - public :: FARKodeSetDenseOrder public :: FARKodeSetNonlinearSolver public :: FARKodeSetLinear public :: FARKodeSetNonlinear @@ -590,15 +589,6 @@ function swigc_FARKodeSetInterpolantDegree(farg1, farg2) & integer(C_INT) :: fresult end function -function swigc_FARKodeSetDenseOrder(farg1, farg2) & -bind(C, name="_wrap_FARKodeSetDenseOrder") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -integer(C_INT) :: fresult -end function - function swigc_FARKodeSetNonlinearSolver(farg1, farg2) & bind(C, name="_wrap_FARKodeSetNonlinearSolver") & result(fresult) @@ -2609,22 +2599,6 @@ function FARKodeSetInterpolantDegree(arkode_mem, degree) & swig_result = fresult end function -function FARKodeSetDenseOrder(arkode_mem, dord) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -integer(C_INT), intent(in) :: dord -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 - -farg1 = arkode_mem -farg2 = dord -fresult = swigc_FARKodeSetDenseOrder(farg1, farg2) -swig_result = fresult -end function - function FARKodeSetNonlinearSolver(arkode_mem, nls) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/xbraid/arkode_xbraid.c b/src/arkode/xbraid/arkode_xbraid.c index fd98282db7..67e20edf1f 100644 --- a/src/arkode/xbraid/arkode_xbraid.c +++ b/src/arkode/xbraid/arkode_xbraid.c @@ -215,6 +215,11 @@ int ARKBraid_GetVecTmpl(braid_App app, N_Vector* tmpl) } int ARKBraid_GetARKStepMem(braid_App app, void** arkode_mem) +{ + return (ARKBraid_GetARKodeMem(app, arkode_mem)); +} + +int ARKBraid_GetARKodeMem(braid_App app, void** arkode_mem) { ARKBraidContent content; if (app == NULL) { return SUNBRAID_ILLINPUT; } @@ -247,6 +252,11 @@ int ARKBraid_GetLastBraidFlag(braid_App app, int* last_flag) } int ARKBraid_GetLastARKStepFlag(braid_App app, int* last_flag) +{ + return (ARKBraid_GetLastARKodeFlag(app, last_flag)); +} + +int ARKBraid_GetLastARKodeFlag(braid_App app, int* last_flag) { ARKBraidContent content; if (app == NULL) { return SUNBRAID_ILLINPUT; } @@ -321,7 +331,7 @@ int ARKBraid_Step(braid_App app, braid_Vector ustop, braid_Vector fstop, { /* Get the suggested step size. The rfac value is given by ETACF on a solver failure and limited by ETAMIN on an error test failure */ - flag = ARKStepGetCurrentStep((void*)(content->ark_mem), &hacc); + flag = ARKodeGetCurrentStep((void*)(content->ark_mem), &hacc); CHECK_ARKODE_RETURN(content->last_flag_arkode, flag); /* Set the refinement factor */ @@ -446,12 +456,12 @@ int ARKBraid_TakeStep(void* arkode_mem, sunrealtype tstart, sunrealtype tstop, if (arkode_mem == NULL) { return ARK_MEM_NULL; } if (y == NULL) { return ARK_ILL_INPUT; } - /* Reset ARKStep state */ - flag = ARKStepReset(arkode_mem, tstart, y); + /* Reset ARKODE state */ + flag = ARKodeReset(arkode_mem, tstart, y); if (flag != ARK_SUCCESS) { return flag; } /* Set the time step size */ - flag = ARKStepSetInitStep(arkode_mem, tstop - tstart); + flag = ARKodeSetInitStep(arkode_mem, tstop - tstart); if (flag != ARK_SUCCESS) { return flag; } /* Ignore temporal error test result and force step to pass */ @@ -459,7 +469,7 @@ int ARKBraid_TakeStep(void* arkode_mem, sunrealtype tstart, sunrealtype tstop, if (flag != ARK_SUCCESS) { return flag; } /* Take step, check flag below */ - tmp_flag = ARKStepEvolve(arkode_mem, tstop, y, &tret, ARK_ONE_STEP); + tmp_flag = ARKodeEvolve(arkode_mem, tstop, y, &tret, ARK_ONE_STEP); /* Re-enable temporal error test check */ flag = arkSetForcePass(arkode_mem, SUNFALSE); From 6d633d63f10580e1ca8737633fbf4f798f7c0cba Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Wed, 24 Apr 2024 13:49:51 -0500 Subject: [PATCH 11/39] Finished first pass at revised ARKODE documentation --- .../ARKStep_c_interface/User_callable.rst | 13 +- .../ERKStep_c_interface/User_callable.rst | 12 +- .../MRIStep_c_interface/User_callable.rst | 11 +- .../SPRKStep_c_interface/User_callable.rst | 11 +- .../guide/source/Usage/User_callable.rst | 224 ++++++++++- .../source/sunnonlinsol/ARKODE_interface.rst | 147 ++++++- src/arkode/arkode_io.c | 366 +++++++++++++----- src/arkode/arkode_ls.c | 138 +++---- 8 files changed, 739 insertions(+), 183 deletions(-) diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index c5669a6880..4a8da0e5a5 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -21,10 +21,19 @@ This section describes the ARKStep-specific functions that may be called by the user to setup and then solve an IVP using the ARKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked below. However, some -of these user-callable functions are specific to ARKStep, and are explained +upcoming release -- each of these are clearly marked. However, some +of these user-callable functions are specific to ARKStep, as explained below. +As discussed in the main :ref:`ARKODE user-callable function introduction +`, each of ARKODE's time-stepping modules +clarifies the categories of user-callable functions that it supports. +ARKStep supports *all categories*: + +* temporal adaptivity +* implicit nonlinear and/or linear solvers +* non-identity mass matrices +* relaxation Runge--Kutta methods .. _ARKODE.Usage.ARKStep.Initialization: diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index a0728f1ada..c60c511373 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -21,10 +21,18 @@ This section describes the ERKStep-specific functions that may be called by the user to setup and then solve an IVP using the ERKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked below. However, some -of these user-callable functions are specific to ERKStep, and are explained +upcoming release -- each of these are clearly marked. However, some +of these user-callable functions are specific to ERKStep, as explained below. +As discussed in the main :ref:`ARKODE user-callable function introduction +`, each of ARKODE's time-stepping modules +clarifies the categories of user-callable functions that it supports. +ERKStep supports the following categories: + +* temporal adaptivity +* relaxation Runge--Kutta methods + .. _ARKODE.Usage.ERKStep.Initialization: diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst index 58ceaa1bf9..230eb30113 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst @@ -22,10 +22,17 @@ This section describes the MRIStep-specific functions that may be called by the user to setup and then solve an IVP using the MRIStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked below. However, some -of these user-callable functions are specific to MRIStep, and are explained +upcoming release -- each of these are clearly marked. However, some +of these user-callable functions are specific to ERKStep, as explained below. +As discussed in the main :ref:`ARKODE user-callable function introduction +`, each of ARKODE's time-stepping modules +clarifies the categories of user-callable functions that it supports. +MRIStep supports the following categories: + +* implicit nonlinear and/or linear solvers + .. _ARKODE.Usage.MRIStep.Initialization: diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index 35180cb6da..eef8e78ef4 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -19,10 +19,17 @@ This section describes the SPRKStep-specific functions that may be called by the user to setup and then solve an IVP using the SPRKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked below. However, some -of these user-callable functions are specific to SPRKStep, and are explained +upcoming release -- each of these are clearly marked. However, some +of these user-callable functions are specific to ERKStep, as explained below. +As discussed in the main :ref:`ARKODE user-callable function introduction +`, each of ARKODE's time-stepping modules +clarifies the categories of user-callable functions that it supports. +SPRKStep supports only the basic set of user-callable functions, and +does not support any of the restricted groups (time adaptivity, implicit +solvers, etc.). + .. _ARKODE.Usage.SPRKStep.Initialization: diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index 41bd723bf9..6f4a4f2c49 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -31,6 +31,22 @@ to the error handler, which prints the message to ``stderr`` by default. However, the user can set a file as error output or can provide their own error handler (see :numref:`SUNDIALS.Errors` for details). +We note that depending on the choice of time-stepping module, only a +subset of ARKODE's user-callable functions will be applicable/supported. +We thus categorize the functions below into five groups: + +A. functions that apply for all time-stepping modules, + +B. functions that apply for time-stepping modules that allow temporal adaptivity, + +C. functions that apply for time-stepping modules that utilize implicit solvers (nonlinear or linear), + +D. functions that apply for time-stepping modules that support non-identity mass matrices, and + +E. functions that apply for time-stepping modules that support relaxation Runge--Kutta methods. + +In the function descriptions below, we identify those that have any of the restrictions B-E above. Then in the introduction for each of the stepper-specific documentation sections (:numref:`ARKODE.Usage.ARKStep.UserCallable`, :numref:`ARKODE.Usage.ERKStep.UserCallable`, :numref:`ARKODE.Usage.MRIStep.UserCallable`, and :numref:`ARKODE.Usage.SPRKStep.UserCallable`) we clarify the categories of these functions that are supported. + .. _ARKODE.Usage.Tolerances: @@ -417,6 +433,8 @@ pertinent to their choice of linear solver. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + If *LS* is a matrix-free linear solver, then the *J* argument should be ``NULL``. @@ -526,6 +544,8 @@ Newton and mass matrix systems, these must have the same type: .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + If *LS* is a matrix-free linear solver, then the *M* argument should be ``NULL``. @@ -597,6 +617,8 @@ function attaches the nonlinear solver to the main ARKODE integrator. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + ARKODE will use the Newton ``SUNNonlinearSolver`` module by default; a call to this routine replaces that module with the supplied *NLS* object. @@ -877,6 +899,7 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat :retval ARK_SUCCESS: the function exited successfully. :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. :retval ARK_ILL_INPUT: an argument had an illegal value. + :retval ARK_STEPPER_UNSUPPORTED: this option is not supported by the time-stepping module. .. note:: @@ -979,7 +1002,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: - Pass 0.0 to return ARKODE to the default (adaptive-step) mode. + Pass 0.0 to return ARKODE to the default (adaptive-step) mode -- this is only + allowed when using a time-stepping module that supports temporal adaptivity. Use of this function is not generally recommended, since it gives no assurance of the validity of the computed solutions. It is @@ -1035,7 +1059,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: - Pass 0.0 to use the default value. + Pass 0.0 to use the default value -- this is only + allowed when using a time-stepping module that supports temporal adaptivity. By default, ARKODE estimates the initial step size to be :math:`h = \sqrt{\dfrac{2}{\left\| \ddot{y}\right\|}}`, where @@ -1065,6 +1090,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + The default value is 10; set *mxhnil* to zero to specify this default. @@ -1112,6 +1139,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Pass *hmax* :math:`\le 0.0` to set the default value of :math:`\infty`. .. versionadded:: x.y.z @@ -1132,6 +1161,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Pass *hmin* :math:`\le 0.0` to set the default value of 0. .. versionadded:: x.y.z @@ -1237,6 +1268,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + The default value is 7; set *maxnef* :math:`\le 0` to specify this default. @@ -1270,6 +1303,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + The presence of a non-``NULL`` constraints vector that is not 0.0 in all components will cause constraint checking to be performed. However, a call with 0.0 in all components of ``constraints`` will result in an illegal @@ -1304,6 +1339,8 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Passing *maxfails* <= 0 results in ARKODE using the default value (10). @@ -1377,7 +1414,11 @@ Explicit stability function :c:func:`ARKodeSetSt :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported by the current time-stepping module. - .. versionadded:: x.y.z + .. note:: + + This is only compatible with time-stepping modules that support temporal adaptivity. + + .. versionadded:: x.y.z .. c:function:: int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) @@ -1398,6 +1439,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + This should be called prior to calling :c:func:`ARKodeEvolve`, and can only be reset following a call to ``*StepReInit``. @@ -1419,6 +1462,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any non-positive parameter will imply a reset to the default value. @@ -1442,6 +1487,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value below 1.0 will imply a reset to the default value. If both this and one of :c:func:`ARKodeSetAdaptivityMethod` or @@ -1467,6 +1514,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any interval *not* containing 1.0 will imply a reset to the default values. .. versionadded:: x.y.z @@ -1490,6 +1539,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value outside the interval :math:`(0,1]` will imply a reset to the default value. .. versionadded:: x.y.z @@ -1511,6 +1562,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value outside the interval :math:`(0,1]` will imply a reset to the default value. .. versionadded:: x.y.z @@ -1533,6 +1586,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value :math:`\le 1.0` will imply a reset to the default value. .. versionadded:: x.y.z @@ -1554,6 +1609,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value :math:`\le 1.0` will imply a reset to the default value. @@ -1578,6 +1635,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value outside the interval :math:`(0,1)` will imply a reset to the default value. @@ -1600,6 +1659,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value :math:`\le 0` will imply a reset to the default value. @@ -1623,6 +1684,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + Any value :math:`\le 0` will imply a reset to the default value. .. versionadded:: x.y.z @@ -1646,6 +1709,8 @@ Explicit stability function :c:func:`ARKodeSetSt .. note:: + This is only compatible with time-stepping modules that support temporal adaptivity. + This function should return an estimate of the absolute value of the maximum stable time step for the explicit portion of the ODE system. It is not required, since accuracy-based @@ -1705,6 +1770,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Tightens the linear solver tolerances and takes only a single Newton iteration. Calls :c:func:`ARKodeSetDeltaGammaMax` to enforce Jacobian recomputation when the step size ratio changes @@ -1735,6 +1802,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is the default behavior of ARKODE, so the function is primarily useful to undo a previous call to :c:func:`ARKodeSetLinear`. Calls @@ -1771,6 +1840,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default value is 0. If *method* is set to an undefined value, this default predictor will be used. @@ -1793,6 +1864,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + See :numref:`ARKODE.Usage.StagePredictFn` for more information on this user-supplied routine. @@ -1816,6 +1889,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default is to use the implicit right-hand side function provided to :c:func:`ARKodeCreate` in nonlinear system functions. If the input implicit right-hand side function is ``NULL``, the default is used. @@ -1843,6 +1918,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default value is 3; set *maxcor* :math:`\le 0` to specify this default. @@ -1865,6 +1942,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default value is 0.1; set *nlscoef* :math:`\le 0` to specify this default. @@ -1886,6 +1965,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Any non-positive parameter will imply a reset to the default value. .. versionadded:: x.y.z @@ -1908,6 +1989,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Any non-positive parameter will imply a reset to the default value. .. versionadded:: x.y.z @@ -1932,6 +2015,8 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default value is 10; set *maxncf* :math:`\le 0` to specify this default. @@ -1959,6 +2044,10 @@ Specify if the implicit RHS is deduced after a nonlinear solve :c:func:`ARKodeS :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + .. versionadded:: x.y.z @@ -2062,6 +2151,8 @@ is recomputed using the current :math:`\gamma` value. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Any non-positive parameter will imply a reset to the default value. .. versionadded:: x.y.z @@ -2084,6 +2175,8 @@ is recomputed using the current :math:`\gamma` value. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Positive values of **msbp** specify the linear solver setup frequency. For example, an input of 1 means the setup function will be called every time step while an input of 2 means it will be called called every other time @@ -2113,6 +2206,8 @@ is recomputed using the current :math:`\gamma` value. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + If ``nstlj`` is the step number at which the Jacobian information was lasted updated and ``nst`` is the current step number, ``nst - nstlj >= msbj`` indicates that the Jacobian information will be updated @@ -2212,6 +2307,8 @@ data in the program. The user data pointer may be specified through .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This routine must be called after the ARKLS linear solver interface has been initialized through a call to :c:func:`ARKodeSetLinearSolver`. @@ -2244,6 +2341,8 @@ data in the program. The user data pointer may be specified through .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This routine must be called after the ARKLS linear solver interface has been initialized through a call to :c:func:`ARKodeSetLinearSolver`. @@ -2275,6 +2374,8 @@ data in the program. The user data pointer may be specified through .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This routine must be called after the ARKLS mass matrix solver interface has been initialized through a call to :c:func:`ARKodeSetMassLinearSolver`. @@ -2306,6 +2407,8 @@ data in the program. The user data pointer may be specified through .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Linear solution scaling is enabled by default when a matrix-based linear solver is attached. @@ -2374,6 +2477,8 @@ time they are called. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default is to use an internal finite difference quotient for *jtimes* and to leave out *jtsetup*. If ``NULL`` is passed to *jtimes*, these defaults are used. A user may @@ -2422,6 +2527,8 @@ this through calls to *both* :c:func:`ARKodeSetJacTimesRhsFn` and .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default is to use the implicit right-hand side function provided to ``*StepCreate`` in the internal difference quotient. If the input implicit right-hand side function is ``NULL``, the default is used. @@ -2470,6 +2577,8 @@ function of type :c:type:`ARKLsMassTimesSetupFn` (see .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + There is no default finite difference quotient for *mtimes*, so if using the ARKLS mass matrix solver interface with NULL-valued SUNMATRIX input :math:`M`, and this routine is called @@ -2560,6 +2669,8 @@ the user through the :c:func:`ARKodeSetEpsLin` function. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The default is ``NULL`` for both arguments (i.e., no preconditioning). @@ -2595,6 +2706,8 @@ the user through the :c:func:`ARKodeSetEpsLin` function. .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This function must be called *after* the ARKLS mass matrix solver interface has been initialized through a call to :c:func:`ARKodeSetMassLinearSolver`. @@ -2627,6 +2740,8 @@ the user through the :c:func:`ARKodeSetEpsLin` function. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + Passing a value *eplifac* :math:`\le 0` indicates to use the default value of 0.05. @@ -2655,6 +2770,8 @@ the user through the :c:func:`ARKodeSetEpsLin` function. .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This function must be called *after* the ARKLS mass matrix solver interface has been initialized through a call to :c:func:`ARKodeSetMassLinearSolver`. @@ -2705,6 +2822,8 @@ allow for additional user control over these conversion factors. .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This function must be called *after* the ARKLS system solver interface has been initialized through a call to :c:func:`ARKodeSetLinearSolver`. @@ -2736,6 +2855,8 @@ allow for additional user control over these conversion factors. .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This function must be called *after* the ARKLS mass matrix solver interface has been initialized through a call to :c:func:`ARKodeSetMassLinearSolver`. @@ -3094,6 +3215,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + .. versionadded:: x.y.z @@ -3144,6 +3269,8 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + The user must allocate space for *rweight*, that will be filled in by this function. @@ -3220,6 +3347,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support temporal adaptivity. + .. versionadded:: x.y.z @@ -3236,6 +3367,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support temporal adaptivity. + .. versionadded:: x.y.z @@ -3263,6 +3398,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_SUCCESS: the function exited successfully. :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. + .. note:: + + This is only compatible with time-stepping modules that support temporal adaptivity. + .. versionadded:: x.y.z @@ -3278,6 +3417,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_STEPPER_UNSUPPORTED: implicit solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + .. versionadded:: x.y.z @@ -3324,6 +3467,10 @@ Retrieve a pointer for user data :c:func:`ARKodeGetUserDat :retval ARK_STEPPER_UNSUPPORTED: adaptive step sizes are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support temporal adaptivity. + .. versionadded:: x.y.z @@ -3351,8 +3498,11 @@ Implicit solver optional output functions =================================================== ============================================ Optional output Function name =================================================== ============================================ +Computes state given a correction :c:func:`ARKodeComputeState` +Access data to compute the nonlin. sys. function :c:func:`ARKodeGetNonlinearSystemData` No. of calls to linear solver setup function :c:func:`ARKodeGetNumLinSolvSetups` No. of nonlinear solver iterations :c:func:`ARKodeGetNumNonlinSolvIters` +No. of nonlinear solver iterations :c:func:`ARKodeGetNumNonlinSolvIters` No. of nonlinear solver convergence failures :c:func:`ARKodeGetNumNonlinSolvConvFails` Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSolvStats` =================================================== ============================================ @@ -3375,6 +3525,8 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSol .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the nonlinear solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3398,6 +3550,8 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSol .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the nonlinear solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3420,6 +3574,8 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSol .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the nonlinear solver object; the counter is reset whenever a new nonlinear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3443,6 +3599,8 @@ Single accessor to all nonlinear solver statistics :c:func:`ARKodeGetNonlinSol .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the nonlinear solver object; the counters are reset whenever a new nonlinear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3570,6 +3728,10 @@ Last return from a mass matrix solver function :c:func:`ARKo :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + .. warning:: This function is provided for debugging purposes and the values in the @@ -3592,6 +3754,11 @@ Last return from a mass matrix solver function :c:func:`ARKo :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + + .. c:function:: int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) Returns the value of the internal step counter at which the internally stored copy of the @@ -3606,6 +3773,10 @@ Last return from a mass matrix solver function :c:func:`ARKo :retval ARK_STEPPER_UNSUPPORTED: linear solvers are not supported by the current time-stepping module. + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + .. versionadded:: x.y.z @@ -3625,6 +3796,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The workspace requirements reported by this routine correspond only to memory allocated within this interface and to memory allocated by the ``SUNLinearSolver`` object attached @@ -3652,6 +3825,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3676,6 +3851,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3699,6 +3876,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3721,6 +3900,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3743,6 +3924,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3766,6 +3949,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3789,6 +3974,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new linear solver module is "attached" to ARKODE, or when ARKODE is resized. @@ -3814,6 +4001,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + The value *nfevalsLS* is incremented only if the default internal difference quotient function is used. @@ -3840,6 +4029,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support implicit algebraic solvers. + If the ARKLS setup function failed when using the ``SUNLINSOL_DENSE`` or ``SUNLINSOL_BAND`` modules, then the value of *lsflag* is equal to the column index (numbered from one) at @@ -3889,6 +4080,11 @@ Last return from a mass matrix solver function :c:func:`ARKo ``SUNLINSOL_BAND`` modules, then if 1 :math:`\le` `lsflag` :math:`\le n` (LU factorization failed), this routine returns "NONE". + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + + .. versionadded:: x.y.z @@ -3908,6 +4104,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + The workspace requirements reported by this routine correspond only to memory allocated within this interface and to memory allocated by the ``SUNLinearSolver`` object attached @@ -3937,6 +4135,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -3961,6 +4161,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -3986,6 +4188,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4009,6 +4213,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4033,6 +4239,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4057,6 +4265,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4080,6 +4290,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4103,6 +4315,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4127,6 +4341,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + This is only accumulated for the "life" of the linear solver object; the counter is reset whenever a new mass-matrix linear solver module is "attached" to ARKODE, or when ARKODE is @@ -4151,6 +4367,8 @@ Last return from a mass matrix solver function :c:func:`ARKo .. note:: + This is only compatible with time-stepping modules that support non-identity mass matrices. + The values of *msflag* for each of the various solvers will match those described above for the function :c:func:`ARKodeGetLastLinFlag`. diff --git a/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst b/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst index 5607ca9084..fe7f768419 100644 --- a/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst +++ b/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst @@ -74,8 +74,128 @@ access to the internal integrator data required to evaluate :eq:`ARKODE_Residual_corrector` or :eq:`ARKODE_FixedPt_corrector`. -ARKStep advanced output functions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +ARKODE advanced output functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Two notable functions were already listed in :numref:`ARKODE.Usage.ARKodeMainOutputs`: + +* :c:func:`ARKodeGetCurrentState` -- returns the current state vector. + When called within the computation of a step (i.e., during a nonlinear solve) + this is the current stage state vector :math:`z_i = z_{pred} + z_{cor}`. + Otherwise this is the current internal solution state vector :math:`y(t)`. In + either case the corresponding stage or solution time can be obtained from + :c:func:`ARKodeGetCurrentTime`. + +* :c:func:`ARKodeGetCurrentGamma` -- returns the current value of the scalar :math:`\gamma`. + + +Additional advanced output functions that are provided to aid in the construction +of user-supplied SUNNonlinSol modules are as follows. + +.. c:function:: int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) + + Returns the current mass matrix. For a time dependent mass matrix the + corresponding time can be obtained from :c:func:`ARKodeGetCurrentTime`. + + **Arguments:** + * *arkode_mem* -- pointer to the ARKODE memory block. + * *M* -- SUNMatrix pointer that will get set to the current mass matrix + :math:`M(t)`. If a matrix-free method is used the output is ``NULL``. + + **Return value:** + * ``ARK_SUCCESS`` if successful. + * ``ARK_MEM_NULL`` if the ARKStep memory was ``NULL``. + + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + + +.. c:function:: int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype *tcur, N_Vector *zpred, N_Vector *z, N_Vector *Fi, sunrealtype *gamma, N_Vector *sdata, void **user_data) + + Returns all internal data required to construct the current nonlinear + implicit system :eq:`ARKODE_Residual_corrector` or :eq:`ARKODE_FixedPt_corrector`: + + **Arguments:** + * *arkode_mem* -- pointer to the ARKODE memory block. + * *tcur* -- value of the independent variable corresponding to implicit + stage, :math:`t^I_{n,i}`. + * *zpred* -- the predicted stage vector :math:`z_{pred}` at + :math:`t^I_{n,i}`. This vector must not be changed. + * *z* -- the stage vector :math:`z_{i}` above. This vector may be not + current and may need to be filled (see the note below). + * *Fi* -- the implicit function evaluated at the current time and state, + :math:`f^I(t^I_{n,i}, z_{i})`. This vector may be not current and may + need to be filled (see the note below). + * *gamma* -- current :math:`\gamma` for implicit stage calculation. + * *sdata* -- accumulated data from previous solution and stages, + :math:`\tilde{a}_i`. This vector must not be changed. + * *user_data* -- pointer to the user-defined data structure (as specified + through :c:func:`ARKodeSetUserData`, or ``NULL`` otherwise) + + **Return value:** + * ``ARK_SUCCESS`` if successful. + * ``ARK_MEM_NULL`` if the ARKODE memory was ``NULL``. + + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + + This routine is intended for users who whish to attach a custom + :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object + (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to + nonlinear system data to compute the nonlinear system function as part of + a custom ``SUNNonlinearSolver`` object. + + When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing + ``SUNNonlinearSolver`` object, the user should call + :c:func:`ARKodeGetNonlinearSystemData()` **inside** the nonlinear system + function to access the requisite data for evaluting the nonlinear systen + function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object + (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or + :c:type:`SUNNonlinSolLSolveFn` functions supplied by ARKODE (through + calls to :c:func:`SUNNonlinSolSetLSetupFn()` and + :c:func:`SUNNonlinSolSetLSolveFn()` respectively) the vectors *z* and *Fi* + **must be filled** in by the user's :c:type:`SUNNonlinSolSysFn` with the + current state and corresponding evaluation of the right-hand side function + respectively i.e., + + .. math:: + z &= z_{pred} + z_{cor}, \\ + Fi &= f^I\left(t^I_{n,i}, z_i\right), + + where :math:`z_{cor}` was the first argument supplied to the + :c:type:`SUNNonlinSolSysFn`. + + If this function is called as part of a custom linear solver (i.e., the + default :c:type:`SUNNonlinSolSysFn` is used) then the vectors *z* and + *Fi* are only current when :c:func:`ARKodeGetNonlinearSystemData()` is + called after an evaluation of the nonlinear system function. + + +.. c:function:: int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) + + Computes the current stage state vector using the stored prediction and the + supplied correction from the nonlinear solver i.e., + :math:`z_i(t) = z_{pred} + z_{cor}`. + + **Arguments:** + * *arkode_mem* -- pointer to the ARKODE memory block. + * *zcor* -- the correction from the nonlinear solver. + * *z* -- on output, the current stage state vector :math:`z_i`. + + **Return value:** + * ``ARK_SUCCESS`` if successful. + * ``ARK_MEM_NULL`` if the ARKODE memory was ``NULL``. + + .. note:: + + This is only compatible with time-stepping modules that support implicit algebraic solvers. + + + +ARKStep advanced output functions (deprecated) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Two notable functions were already listed in :numref:`ARKODE.Usage.ARKStep.ARKStepMainOutputs`: @@ -106,6 +226,10 @@ of user-supplied SUNNonlinSol modules are as follows. * ``ARK_SUCCESS`` if successful. * ``ARK_MEM_NULL`` if the ARKStep memory was ``NULL``. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetCurrentMassMatrix` instead. + .. c:function:: int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype *tcur, N_Vector *zpred, N_Vector *z, N_Vector *Fi, sunrealtype *gamma, N_Vector *sdata, void **user_data) @@ -166,6 +290,10 @@ of user-supplied SUNNonlinSol modules are as follows. *Fi* are only current when :c:func:`ARKStepGetNonlinearSystemData()` is called after an evaluation of the nonlinear system function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNonlinearSystemData` instead. + .. c:function:: int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) @@ -182,10 +310,13 @@ of user-supplied SUNNonlinSol modules are as follows. * ``ARK_SUCCESS`` if successful. * ``ARK_MEM_NULL`` if the ARKStep memory was ``NULL``. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeComputeState` instead. -MRIStep advanced output functions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +MRIStep advanced output functions (deprecated) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Two notable functions were already listed in :numref:`ARKODE.Usage.MRIStep.MRIStepMainOutputs`: @@ -262,6 +393,10 @@ of user-supplied SUNNonlinSol modules are as follows. *Fi* are only current when :c:func:`MRIStepGetNonlinearSystemData()` is called after an evaluation of the nonlinear system function. + .. deprecated:: x.y.z + + Use :c:func:`ARKodeGetNonlinearSystemData` instead. + .. c:function:: int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) @@ -277,3 +412,7 @@ of user-supplied SUNNonlinSol modules are as follows. **Return value:** * ``ARK_SUCCESS`` if successful. * ``ARK_MEM_NULL`` if the MRIStep memory was ``NULL``. + + .. deprecated:: x.y.z + + Use :c:func:`ARKodeComputeState` instead. diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index ec8f98e555..55e380a2b7 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -131,7 +131,7 @@ int ARKodeSetOrder(void* arkode_mem, int ord) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -275,6 +275,14 @@ int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnonlinearsolver) { @@ -282,7 +290,7 @@ int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -314,6 +322,14 @@ int ARKodeSetLinear(void* arkode_mem, int timedepend) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setlinear) { @@ -321,7 +337,7 @@ int ARKodeSetLinear(void* arkode_mem, int timedepend) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -344,6 +360,14 @@ int ARKodeSetNonlinear(void* arkode_mem) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnonlinear) { @@ -351,7 +375,7 @@ int ARKodeSetNonlinear(void* arkode_mem) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -375,6 +399,14 @@ int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnlsrhsfn) { @@ -382,7 +414,7 @@ int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -411,6 +443,14 @@ int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setdeduceimplicitrhs) { @@ -418,7 +458,7 @@ int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -442,6 +482,14 @@ int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnonlincrdown) { @@ -449,7 +497,7 @@ int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -473,6 +521,14 @@ int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnonlinrdiv) { @@ -480,7 +536,7 @@ int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -504,6 +560,14 @@ int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setdeltagammamax) { @@ -511,7 +575,7 @@ int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -536,6 +600,14 @@ int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setlsetupfrequency) { @@ -543,7 +615,7 @@ int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -565,6 +637,14 @@ int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setpredictormethod) { @@ -572,7 +652,7 @@ int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -596,6 +676,14 @@ int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setmaxnonliniters) { @@ -603,7 +691,7 @@ int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -626,6 +714,14 @@ int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setnonlinconvcoef) { @@ -633,7 +729,7 @@ int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -655,6 +751,14 @@ int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine (if provided) */ if (ark_mem->step_setstagepredictfn) { @@ -662,7 +766,7 @@ int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -729,9 +833,9 @@ int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* Remove current SUNAdaptController object @@ -824,9 +928,9 @@ int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* Passing mxhnil=0 sets the default, otherwise use input. */ @@ -853,6 +957,14 @@ int ARKodeSetInitStep(void* arkode_mem, sunrealtype hin) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against hin==0 for non-adaptive time stepper modules */ + if ((!ark_mem->step_supports_adaptive) && (hin == ZERO)) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Passing hin=0 sets the default, otherwise use input. */ if (hin == ZERO) { ark_mem->hin = ZERO; } else { ark_mem->hin = hin; } @@ -886,9 +998,9 @@ int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* Passing a value <= 0 sets hmin = 0 */ @@ -932,9 +1044,9 @@ int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* Passing a value <= 0 sets hmax = infinity */ @@ -1250,9 +1362,9 @@ int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive && (constraints != NULL)) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* If there are no constraints, destroy data structures */ @@ -1316,9 +1428,9 @@ int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* Passing maxfails = 0 sets the default, otherwise set to input */ @@ -1641,9 +1753,9 @@ int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* check for allowable parameters */ @@ -1681,9 +1793,9 @@ int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* store requested adjustment */ @@ -1710,9 +1822,9 @@ int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* check for allowable parameters */ @@ -1748,9 +1860,9 @@ int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* set allowed value, otherwise set default */ @@ -1790,9 +1902,9 @@ int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* set allowed value, otherwise set default */ @@ -1821,9 +1933,9 @@ int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* set allowed value, otherwise set default */ @@ -1851,9 +1963,9 @@ int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* set allowable interval, otherwise set defaults */ @@ -1889,9 +2001,9 @@ int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* if argument legal set it, otherwise set default */ @@ -1919,9 +2031,9 @@ int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* if argument legal set it, otherwise set default */ @@ -1949,9 +2061,9 @@ int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* if argument legal set it, otherwise set default */ @@ -1979,9 +2091,9 @@ int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* if argument legal set it, otherwise set default */ @@ -2009,9 +2121,9 @@ int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* NULL argument sets default, otherwise set inputs */ @@ -2050,9 +2162,9 @@ int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } /* argument <= 0 sets default, otherwise set input */ @@ -2082,9 +2194,9 @@ int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* argument <= 0 sets default, otherwise set input */ @@ -2296,6 +2408,14 @@ int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getcurrentgamma) { @@ -2303,7 +2423,7 @@ int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2368,9 +2488,9 @@ int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_STEPPER_UNSUPPORTED); } N_VScale(ONE, ark_mem->rwt, rweight); @@ -2500,9 +2620,9 @@ int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } *nconstrfails = ark_mem->nconstrfails; @@ -2528,9 +2648,9 @@ int ARKodeGetNumExpSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } *nsteps = ark_mem->hadapt_mem->nst_exp; @@ -2556,9 +2676,9 @@ int ARKodeGetNumAccSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } *nsteps = ark_mem->hadapt_mem->nst_acc; @@ -2584,9 +2704,9 @@ int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support temporal adaptivity"); + return (ARK_STEPPER_UNSUPPORTED); } *netfails = ark_mem->netf; @@ -2610,6 +2730,14 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for incompatible time stepper modules */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support algebraic solvers"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_computestate) { @@ -2617,7 +2745,7 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2643,6 +2771,14 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for incompatible time stepper modules */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support algebraic solvers"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinearsystemdata) { @@ -2651,7 +2787,7 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2673,6 +2809,14 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for incompatible time stepper modules */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support algebraic solvers"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolviters) { @@ -2680,7 +2824,7 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2702,6 +2846,14 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolvconvfails) { @@ -2709,7 +2861,7 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2732,6 +2884,14 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinsolvstats) { @@ -2739,7 +2899,7 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2765,9 +2925,9 @@ int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } *nncfails = ark_mem->ncfn; @@ -2790,6 +2950,14 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not need an algebraic solver */ + if (!ark_mem->step_supports_algebraic) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); + } + /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumlinsolvsetups) { @@ -2797,7 +2965,7 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index b3c2c90c60..63ab562f66 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -66,9 +66,9 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } if (LS == NULL) @@ -556,9 +556,9 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* return with failure if jac cannot be used */ @@ -650,9 +650,9 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* store input and return */ @@ -679,9 +679,9 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* store input and return */ @@ -722,9 +722,9 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* store input and return */ @@ -750,9 +750,9 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* check for valid solver type */ @@ -784,9 +784,9 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* issue error if LS object does not allow user-supplied preconditioning */ @@ -835,9 +835,9 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* issue error if LS object does not allow user-supplied ATimes */ @@ -894,9 +894,9 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* check if using internal finite difference approximation */ @@ -938,9 +938,9 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* return with failure if linsys cannot be used */ @@ -1011,9 +1011,9 @@ int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1034,9 +1034,9 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1057,9 +1057,9 @@ int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1086,9 +1086,9 @@ int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* start with fixed sizes plus vector/matrix pointers */ @@ -1147,9 +1147,9 @@ int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1175,9 +1175,9 @@ int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1202,9 +1202,9 @@ int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1229,9 +1229,9 @@ int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1256,9 +1256,9 @@ int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1283,9 +1283,9 @@ int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1310,9 +1310,9 @@ int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1337,9 +1337,9 @@ int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1391,9 +1391,9 @@ int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ From 01b7d1a5219e178027029a5ccee434e5e2f8888f Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Thu, 25 Apr 2024 14:47:31 -0500 Subject: [PATCH 12/39] Applied suggestion from code review regarding internal ARKODE routines (void* arkode_mem -> ARKodeMem ark_mem) --- .../SPRKStep_c_interface/User_callable.rst | 3 - .../guide/source/Usage/User_callable.rst | 21 - .../C_serial/ark_damped_harmonic_symplectic.c | 4 +- .../arkode/C_serial/ark_harmonic_symplectic.c | 4 +- examples/arkode/C_serial/ark_kepler.c | 4 +- include/arkode/arkode.h | 2 - include/arkode/arkode_sprkstep.h | 4 +- src/arkode/arkode.c | 14 +- src/arkode/arkode_adapt.c | 10 +- src/arkode/arkode_adapt_impl.h | 4 +- src/arkode/arkode_arkstep.c | 124 ++--- src/arkode/arkode_arkstep_impl.h | 88 ++-- src/arkode/arkode_arkstep_io.c | 171 ++++--- src/arkode/arkode_arkstep_nls.c | 51 +-- src/arkode/arkode_bandpre.c | 12 +- src/arkode/arkode_bbdpre.c | 16 +- src/arkode/arkode_erkstep.c | 67 +-- src/arkode/arkode_erkstep_impl.h | 32 +- src/arkode/arkode_erkstep_io.c | 50 +-- src/arkode/arkode_impl.h | 124 ++--- src/arkode/arkode_interp.c | 140 ++---- src/arkode/arkode_interp_impl.h | 29 +- src/arkode/arkode_io.c | 289 ++++++------ src/arkode/arkode_ls.c | 423 +++++++++--------- src/arkode/arkode_ls_impl.h | 37 +- src/arkode/arkode_mristep.c | 102 +++-- src/arkode/arkode_mristep_impl.h | 80 ++-- src/arkode/arkode_mristep_io.c | 143 +++--- src/arkode/arkode_mristep_nls.c | 37 +- src/arkode/arkode_relaxation.c | 13 +- src/arkode/arkode_relaxation_impl.h | 2 +- src/arkode/arkode_sprkstep.c | 71 +-- src/arkode/arkode_sprkstep_impl.h | 32 +- src/arkode/arkode_sprkstep_io.c | 62 ++- src/arkode/fmod/farkode_mod.c | 14 - src/arkode/fmod/farkode_mod.f90 | 26 -- 36 files changed, 1079 insertions(+), 1226 deletions(-) diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index eef8e78ef4..f9e8ae12ef 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -531,9 +531,6 @@ Optional inputs for IVP method selection :retval ARK_MEM_NULL: if the SPRKStep memory is ``NULL`` :retval ARK_ILL_INPUT: if an argument has an illegal value - .. deprecated:: x.y.z - - Use :c:func:`ARKodeSetUseCompensatedSums` instead. .. _ARKODE.Usage.SPRKStep.SPRKStepRootfindingInput: diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index 6f4a4f2c49..34af1d3284 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -861,7 +861,6 @@ Supply a pointer for user data :c:func:`ARKodeSetUserData` Maximum no. of ARKODE error test failures :c:func:`ARKodeSetMaxErrTestFails` 7 Set inequality constraints on solution :c:func:`ARKodeSetConstraints` ``NULL`` Set max number of constraint failures :c:func:`ARKodeSetMaxNumConstrFails` 10 -Use compensated summation :c:func:`ARKodeSetUseCompensatedSums` off ================================================ ======================================= ======================= @@ -1347,26 +1346,6 @@ Use compensated summation :c:func:`ARKodeSetUseCompensat .. versionadded:: x.y.z -.. c:function:: int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) - - Specifies if :ref:`compensated summation (and the incremental form) ` - should be used where applicable. This is currently only supported when using - the SPRKStep time-stepping module, but may be incorporated more thoroughly into - ARKODE in a future release. - - This increases the computational cost by 2 extra vector operations per stage - and an additional 5 per time step. It also requires one extra vector to be - stored. However, it is signficantly more robust to roundoff error - accumulation. - - :param arkode_mem: pointer to the ARKODE memory block. - :param onoff: should compensated summation be used (1) or not (0). - - :retval ARK_SUCCESS: the function exited successfully. - :retval ARK_MEM_NULL: ``arkode_mem`` was ``NULL``. - :retval ARK_ILL_INPUT: an argument had an illegal value. - - .. _ARKODE.Usage.ARKodeAdaptivityInputTable: diff --git a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c index bcb05f830b..8bfca224ed 100644 --- a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c @@ -109,8 +109,8 @@ int main(int argc, char* argv[]) retval = ARKodeSetOrder(arkode_mem, order); if (check_retval(&retval, "ARKodeSetOrder", 1)) { return 1; } - retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } + retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } retval = ARKodeSetFixedStep(arkode_mem, dt); if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } diff --git a/examples/arkode/C_serial/ark_harmonic_symplectic.c b/examples/arkode/C_serial/ark_harmonic_symplectic.c index 60a9d41d33..72ddfa656c 100644 --- a/examples/arkode/C_serial/ark_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_harmonic_symplectic.c @@ -131,8 +131,8 @@ int main(int argc, char* argv[]) retval = ARKodeSetUserData(arkode_mem, &udata); if (check_retval(&retval, "ARKodeSetUserData", 1)) { return 1; } - retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } + retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } retval = ARKodeSetFixedStep(arkode_mem, dt); if (check_retval(&retval, "ARKodeSetFixedStep", 1)) { return 1; } diff --git a/examples/arkode/C_serial/ark_kepler.c b/examples/arkode/C_serial/ark_kepler.c index f298389049..5492d040fd 100644 --- a/examples/arkode/C_serial/ark_kepler.c +++ b/examples/arkode/C_serial/ark_kepler.c @@ -168,8 +168,8 @@ int SolveProblem(ProgramArgs* args, ProblemResult* result, SUNContext sunctx) retval = SPRKStepSetMethodName(arkode_mem, method_name); if (check_retval(&retval, "SPRKStepSetMethodName", 1)) { return 1; } - retval = ARKodeSetUseCompensatedSums(arkode_mem, use_compsums); - if (check_retval(&retval, "ARKodeSetUseCompensatedSums", 1)) { return 1; } + retval = SPRKStepSetUseCompensatedSums(arkode_mem, use_compsums); + if (check_retval(&retval, "SPRKStepSetUseCompensatedSums", 1)) { return 1; } if (step_mode == 0) { diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index 01b60e99f3..14027693af 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -266,8 +266,6 @@ SUNDIALS_EXPORT int ARKodeSetStopTime(void* arkode_mem, sunrealtype tstop); SUNDIALS_EXPORT int ARKodeClearStopTime(void* arkode_mem); SUNDIALS_EXPORT int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed); SUNDIALS_EXPORT int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails); -SUNDIALS_EXPORT int ARKodeSetUseCompensatedSums(void* arkode_mem, - sunbooleantype onoff); SUNDIALS_EXPORT int ARKodeSetUserData(void* arkode_mem, void* user_data); diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index d4fa99e1da..f3e8f333b2 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -60,8 +60,8 @@ int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER SPRKStepCreate */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") int SPRKStepSetDefaults(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUseCompensatedSums instead") -int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_EXPORT int SPRKStepSetUseCompensatedSums(void* arkode_mem, + sunbooleantype onoff); SUNDIALS_EXPORT int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage); SUNDIALS_EXPORT int SPRKStepSetMethodName(void* arkode_mem, const char* method); diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index b723026a1c..95675b448e 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -366,7 +366,7 @@ int ARKodeResize(void* arkode_mem, N_Vector y0, sunrealtype hscale, /* Call the stepper-specific resize (if provided) */ if (ark_mem->step_resize) { - return (ark_mem->step_resize(arkode_mem, y0, hscale, t0, resize, resize_data)); + return (ark_mem->step_resize(ark_mem, y0, hscale, t0, resize, resize_data)); } /* Problem has been successfully re-sized */ @@ -402,7 +402,7 @@ int ARKodeReset(void* arkode_mem, sunrealtype tR, N_Vector yR) } /* Call stepper routine to perform remaining reset operations (if provided) */ - if (ark_mem->step_reset) { return (ark_mem->step_reset(arkode_mem, tR, yR)); } + if (ark_mem->step_reset) { return (ark_mem->step_reset(ark_mem, tR, yR)); } return (ARK_SUCCESS); } @@ -1356,7 +1356,7 @@ void ARKodeFree(void** arkode_mem) ark_mem = (ARKodeMem)(*arkode_mem); /* free the time-stepper module memory (if provided) */ - if (ark_mem->step_free) { ark_mem->step_free(*arkode_mem); } + if (ark_mem->step_free) { ark_mem->step_free(ark_mem); } /* free vector storage */ arkFreeVectors(ark_mem); @@ -1384,7 +1384,7 @@ void ARKodeFree(void** arkode_mem) /* free the root-finding module */ if (ark_mem->root_mem != NULL) { - (void)arkRootFree(*arkode_mem); + (void)arkRootFree(ark_mem); ark_mem->root_mem = NULL; } @@ -1735,7 +1735,7 @@ void ARKodePrintMem(void* arkode_mem, FILE* outfile) #endif /* Call stepper PrintMem function (if provided) */ - if (ark_mem->step_printmem) { ark_mem->step_printmem(arkode_mem, outfile); } + if (ark_mem->step_printmem) { ark_mem->step_printmem(ark_mem, outfile); } } /*--------------------------------------------------------------- @@ -3410,8 +3410,8 @@ int arkCheckTemporalError(ARKodeMem ark_mem, int* nflagPtr, int* nefPtr, larger/smaller than current step, depending on dsm) */ ttmp = (dsm <= ONE) ? ark_mem->tn + ark_mem->h : ark_mem->tn; nsttmp = (dsm <= ONE) ? ark_mem->nst + 1 : ark_mem->nst; - retval = arkAdapt((void*)ark_mem, hadapt_mem, ark_mem->ycur, ttmp, ark_mem->h, - dsm, nsttmp); + retval = arkAdapt(ark_mem, hadapt_mem, ark_mem->ycur, ttmp, ark_mem->h, dsm, + nsttmp); if (retval != ARK_SUCCESS) { return (ARK_ERR_FAILURE); } /* if we've made it here then no nonrecoverable failures occurred; someone above diff --git a/src/arkode/arkode_adapt.c b/src/arkode/arkode_adapt.c index 93a7c8b35b..5d6896a46f 100644 --- a/src/arkode/arkode_adapt.c +++ b/src/arkode/arkode_adapt.c @@ -91,20 +91,12 @@ void arkPrintAdaptMem(ARKodeHAdaptMem hadapt_mem, FILE* outfile) computes and sets the value of ark_eta inside of the ARKodeMem data structure. ---------------------------------------------------------------*/ -int arkAdapt(void* arkode_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, +int arkAdapt(ARKodeMem ark_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, sunrealtype tcur, sunrealtype hcur, sunrealtype dsm, long int nst) { int retval; sunrealtype h_acc, h_cfl, int_dir; - ARKodeMem ark_mem; int controller_order; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; /* Request error-based step size from adaptivity controller */ if (hadapt_mem->pq == 0) diff --git a/src/arkode/arkode_adapt_impl.h b/src/arkode/arkode_adapt_impl.h index 9f96027ca4..757be20da1 100644 --- a/src/arkode/arkode_adapt_impl.h +++ b/src/arkode/arkode_adapt_impl.h @@ -22,6 +22,8 @@ #include #include +#include "arkode_types_impl.h" + #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif @@ -108,7 +110,7 @@ typedef struct ARKodeHAdaptMemRec ARKodeHAdaptMem arkAdaptInit(void); void arkPrintAdaptMem(ARKodeHAdaptMem hadapt_mem, FILE* outfile); -int arkAdapt(void* arkode_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, +int arkAdapt(ARKodeMem ark_mem, ARKodeHAdaptMem hadapt_mem, N_Vector ycur, sunrealtype tcur, sunrealtype hcur, sunrealtype dsm, long int nst); #ifdef __cplusplus diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 2c3e936965..6774f0bd76 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -266,17 +266,16 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, This routine resizes the memory within the ARKStep module. ---------------------------------------------------------------*/ -int arkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int arkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; SUNNonlinearSolver NLS; sunindextype lrw1, liw1, lrw_diff, liw_diff; int i, retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determine change in vector sizes */ @@ -396,8 +395,8 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ @@ -458,14 +457,13 @@ int ARKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, Computes y based on the current prediction and given correction. ---------------------------------------------------------------*/ -int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +int arkStep_ComputeState(ARKodeMem ark_mem, N_Vector zcor, N_Vector z) { int retval; - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } N_VLinearSum(ONE, step_mem->zpred, ONE, zcor, z); @@ -476,18 +474,16 @@ int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /*--------------------------------------------------------------- arkStep_Free frees all ARKStep memory. ---------------------------------------------------------------*/ -void arkStep_Free(void* arkode_mem) +void arkStep_Free(ARKodeMem ark_mem) { int j; sunindextype Bliw, Blrw; - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - /* nothing to do if arkode_mem is already NULL */ - if (arkode_mem == NULL) { return; } + /* nothing to do if ark_mem is already NULL */ + if (ark_mem == NULL) { return; } /* conditional frees on non-NULL ARKStep module */ - ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -625,9 +621,8 @@ void arkStep_Free(void* arkode_mem) This routine outputs the memory from the ARKStep structure to a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void arkStep_PrintMem(void* arkode_mem, FILE* outfile) +void arkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; @@ -636,7 +631,7 @@ void arkStep_PrintMem(void* arkode_mem, FILE* outfile) #endif /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return; } /* output integer quantities */ @@ -724,21 +719,20 @@ void arkStep_PrintMem(void* arkode_mem, FILE* outfile) interface routines, data structure, and solver type to the ARKStep module. ---------------------------------------------------------------*/ -int arkStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, +int arkStep_AttachLinsol(ARKodeMem ark_mem, ARKLinsolInitFn linit, ARKLinsolSetupFn lsetup, ARKLinsolSolveFn lsolve, ARKLinsolFreeFn lfree, SUNLinearSolver_Type lsolve_type, void* lmem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing system solver */ - if (step_mem->lfree != NULL) { step_mem->lfree(arkode_mem); } + if (step_mem->lfree != NULL) { step_mem->lfree(ark_mem); } /* Attach the provided routines, data structure and solve type */ step_mem->linit = linit; @@ -762,22 +756,21 @@ int arkStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, interface routines, data structure, and solver type to the ARKStep module. ---------------------------------------------------------------*/ -int arkStep_AttachMasssol(void* arkode_mem, ARKMassInitFn minit, +int arkStep_AttachMasssol(ARKodeMem ark_mem, ARKMassInitFn minit, ARKMassSetupFn msetup, ARKMassMultFn mmult, ARKMassSolveFn msolve, ARKMassFreeFn mfree, sunbooleantype time_dep, SUNLinearSolver_Type msolve_type, void* mass_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing mass matrix solver */ - if (step_mem->mfree != NULL) { step_mem->mfree(arkode_mem); } + if (step_mem->mfree != NULL) { step_mem->mfree(ark_mem); } /* Attach the provided routines, data structure and solve type */ step_mem->minit = minit; @@ -801,14 +794,11 @@ int arkStep_AttachMasssol(void* arkode_mem, ARKMassInitFn minit, This routine NULLifies the lsetup function pointer in the ARKStep module. ---------------------------------------------------------------*/ -void arkStep_DisableLSetup(void* arkode_mem) +void arkStep_DisableLSetup(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; /* access ARKodeARKStepMem structure */ - if (arkode_mem == NULL) { return; } - ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem == NULL) { return; } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -822,14 +812,11 @@ void arkStep_DisableLSetup(void* arkode_mem) This routine NULLifies the msetup function pointer in the ARKStep module. ---------------------------------------------------------------*/ -void arkStep_DisableMSetup(void* arkode_mem) +void arkStep_DisableMSetup(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; /* access ARKodeARKStepMem structure */ - if (arkode_mem == NULL) { return; } - ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem == NULL) { return; } step_mem = (ARKodeARKStepMem)ark_mem->step_mem; @@ -843,14 +830,13 @@ void arkStep_DisableMSetup(void* arkode_mem) This routine returns the system linear solver interface memory structure, lmem. ---------------------------------------------------------------*/ -void* arkStep_GetLmem(void* arkode_mem) +void* arkStep_GetLmem(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure, and return lmem */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->lmem); } @@ -861,14 +847,13 @@ void* arkStep_GetLmem(void* arkode_mem) This routine returns the mass matrix solver interface memory structure, mass_mem. ---------------------------------------------------------------*/ -void* arkStep_GetMassMem(void* arkode_mem) +void* arkStep_GetMassMem(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure, and return mass_mem */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->mass_mem); } @@ -878,14 +863,13 @@ void* arkStep_GetMassMem(void* arkode_mem) This routine returns the implicit RHS function pointer, fi. ---------------------------------------------------------------*/ -ARKRhsFn arkStep_GetImplicitRHS(void* arkode_mem) +ARKRhsFn arkStep_GetImplicitRHS(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure, and return fi */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->fi); } @@ -896,15 +880,14 @@ ARKRhsFn arkStep_GetImplicitRHS(void* arkode_mem) This routine fills the current value of gamma, and states whether the gamma ratio fails the dgmax criteria. ---------------------------------------------------------------*/ -int arkStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, +int arkStep_GetGammas(ARKodeMem ark_mem, sunrealtype* gamma, sunrealtype* gamrat, sunbooleantype** jcur, sunbooleantype* dgamma_fail) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set outputs */ @@ -951,15 +934,14 @@ int arkStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, With initialization type RESET_INIT, this routine does nothing. ---------------------------------------------------------------*/ -int arkStep_Init(void* arkode_mem, int init_type) +int arkStep_Init(ARKodeMem ark_mem, int init_type) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int j, retval; sunbooleantype reset_efun; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -1265,10 +1247,9 @@ int arkStep_Init(void* arkode_mem, int init_type) when estimating the initial time step size, so we strive to store the intermediate parts so that they do not interfere with the other two modes. ----------------------------------------------------------------------------*/ -int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int arkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int nvec, retval; sunbooleantype recomputeRHS; @@ -1277,7 +1258,7 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, sunrealtype stage_coefs = ONE; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* local shortcuts for use with fused vector operations */ @@ -1635,19 +1616,18 @@ int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, reduce step and retry (if possible) <0 => step encountered unrecoverable failure ---------------------------------------------------------------*/ -int arkStep_TakeStep_Z(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) +int arkStep_TakeStep_Z(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) { int retval, is, is_start, mode; sunbooleantype implicit_stage; sunbooleantype deduce_stage; sunbooleantype save_stages; sunbooleantype stiffly_accurate; - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; N_Vector zcor0; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if problem will involve no algebraic solvers, initialize nflagPtr to success */ @@ -2010,13 +1990,13 @@ int arkStep_TakeStep_Z(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) ---------------------------------------------------------------*/ /*--------------------------------------------------------------- - arkStep_AccessStepMem: + arkStep_AccessARKODEStepMem: Shortcut routine to unpack ark_mem and step_mem structures from void* pointer. If either is missing it returns ARK_MEM_NULL. ---------------------------------------------------------------*/ -int arkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeARKStepMem* step_mem) +int arkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeARKStepMem* step_mem) { /* access ARKodeMem structure */ if (arkode_mem == NULL) @@ -2026,6 +2006,8 @@ int arkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; + + /* access ARKodeARKStepMem structure */ if ((*ark_mem)->step_mem == NULL) { arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, @@ -2036,6 +2018,26 @@ int arkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_SUCCESS); } +/*--------------------------------------------------------------- + arkStep_AccessStepMem: + + Shortcut routine to unpack ark_mem and step_mem structures from + void* pointer. If either is missing it returns ARK_MEM_NULL. + ---------------------------------------------------------------*/ +int arkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeARKStepMem* step_mem) +{ + /* access ARKodeARKStepMem structure */ + if (ark_mem->step_mem == NULL) + { + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ARKSTEP_NO_MEM); + return (ARK_MEM_NULL); + } + *step_mem = (ARKodeARKStepMem)ark_mem->step_mem; + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- arkStep_CheckNVector: @@ -3056,9 +3058,9 @@ int ARKStepCreateMRIStepInnerStepper(void* inner_arkode_mem, ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - retval = arkStep_AccessStepMem(inner_arkode_mem, - "ARKStepCreateMRIStepInnerStepper", &ark_mem, - &step_mem); + retval = arkStep_AccessARKODEStepMem(inner_arkode_mem, + "ARKStepCreateMRIStepInnerStepper", + &ark_mem, &step_mem); if (retval) { arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -3253,8 +3255,8 @@ int arkStep_SetInnerForcing(void* arkode_mem, sunrealtype tshift, ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nvecs > 0) diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index edca35e890..b8d091c424 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -166,64 +166,66 @@ typedef struct ARKodeARKStepMemRec ===============================================================*/ /* Interface routines supplied to ARKODE */ -int arkStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, +int arkStep_AttachLinsol(ARKodeMem ark_mem, ARKLinsolInitFn linit, ARKLinsolSetupFn lsetup, ARKLinsolSolveFn lsolve, ARKLinsolFreeFn lfree, SUNLinearSolver_Type lsolve_type, void* lmem); -int arkStep_AttachMasssol(void* arkode_mem, ARKMassInitFn minit, +int arkStep_AttachMasssol(ARKodeMem ark_mem, ARKMassInitFn minit, ARKMassSetupFn msetup, ARKMassMultFn mmult, ARKMassSolveFn msolve, ARKMassFreeFn lfree, sunbooleantype time_dep, SUNLinearSolver_Type msolve_type, void* mass_mem); -void arkStep_DisableLSetup(void* arkode_mem); -void arkStep_DisableMSetup(void* arkode_mem); -int arkStep_Init(void* arkode_mem, int init_type); -void* arkStep_GetLmem(void* arkode_mem); -void* arkStep_GetMassMem(void* arkode_mem); -ARKRhsFn arkStep_GetImplicitRHS(void* arkode_mem); -int arkStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, +void arkStep_DisableLSetup(ARKodeMem ark_mem); +void arkStep_DisableMSetup(ARKodeMem ark_mem); +int arkStep_Init(ARKodeMem ark_mem, int init_type); +void* arkStep_GetLmem(ARKodeMem ark_mem); +void* arkStep_GetMassMem(ARKodeMem ark_mem); +ARKRhsFn arkStep_GetImplicitRHS(ARKodeMem ark_mem); +int arkStep_GetGammas(ARKodeMem ark_mem, sunrealtype* gamma, sunrealtype* gamrat, sunbooleantype** jcur, sunbooleantype* dgamma_fail); -int arkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int arkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); -int arkStep_TakeStep_Z(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); -int arkStep_SetUserData(void* arkode_mem, void* user_data); -int arkStep_SetDefaults(void* arkode_mem); -int arkStep_SetOrder(void* arkode_mem, int ord); -int arkStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); -int arkStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); -int arkStep_SetLinear(void* arkode_mem, int timedepend); -int arkStep_SetNonlinear(void* arkode_mem); -int arkStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -int arkStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -int arkStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -int arkStep_SetLSetupFrequency(void* arkode_mem, int msbp); -int arkStep_SetPredictorMethod(void* arkode_mem, int pred_method); -int arkStep_SetMaxNonlinIters(void* arkode_mem, int maxcor); -int arkStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); -int arkStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -int arkStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); -int arkStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -int arkStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, +int arkStep_TakeStep_Z(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr); +int arkStep_SetUserData(ARKodeMem ark_mem, void* user_data); +int arkStep_SetDefaults(ARKodeMem ark_mem); +int arkStep_SetOrder(ARKodeMem ark_mem, int ord); +int arkStep_SetNonlinearSolver(ARKodeMem ark_mem, SUNNonlinearSolver NLS); +int arkStep_SetNlsRhsFn(ARKodeMem ark_mem, ARKRhsFn nls_fi); +int arkStep_SetLinear(ARKodeMem ark_mem, int timedepend); +int arkStep_SetNonlinear(ARKodeMem ark_mem); +int arkStep_SetNonlinCRDown(ARKodeMem ark_mem, sunrealtype crdown); +int arkStep_SetNonlinRDiv(ARKodeMem ark_mem, sunrealtype rdiv); +int arkStep_SetDeltaGammaMax(ARKodeMem ark_mem, sunrealtype dgmax); +int arkStep_SetLSetupFrequency(ARKodeMem ark_mem, int msbp); +int arkStep_SetPredictorMethod(ARKodeMem ark_mem, int pred_method); +int arkStep_SetMaxNonlinIters(ARKodeMem ark_mem, int maxcor); +int arkStep_SetNonlinConvCoef(ARKodeMem ark_mem, sunrealtype nlscoef); +int arkStep_SetStagePredictFn(ARKodeMem ark_mem, ARKStagePredictFn PredictStage); +int arkStep_SetDeduceImplicitRhs(ARKodeMem ark_mem, sunbooleantype deduce); +int arkStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma); +int arkStep_GetNonlinearSystemData(ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); -int arkStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); -int arkStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters); -int arkStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); -int arkStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, +int arkStep_GetNumLinSolvSetups(ARKodeMem ark_mem, long int* nlinsetups); +int arkStep_GetNumNonlinSolvIters(ARKodeMem ark_mem, long int* nniters); +int arkStep_GetNumNonlinSolvConvFails(ARKodeMem ark_mem, long int* nnfails); +int arkStep_GetNonlinSolvStats(ARKodeMem ark_mem, long int* nniters, long int* nnfails); -int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -int arkStep_WriteParameters(void* arkode_mem, FILE* fp); -int arkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); -int arkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int arkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt); +int arkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp); +int arkStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR); +int arkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -int arkStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -void arkStep_Free(void* arkode_mem); -void arkStep_PrintMem(void* arkode_mem, FILE* outfile); +int arkStep_ComputeState(ARKodeMem ark_mem, N_Vector zcor, N_Vector z); +void arkStep_Free(ARKodeMem ark_mem); +void arkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile); /* Internal utility routines */ -int arkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeARKStepMem* step_mem); +int arkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeARKStepMem* step_mem); +int arkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeARKStepMem* step_mem); sunbooleantype arkStep_CheckNVector(N_Vector tmpl); int arkStep_SetButcherTables(ARKodeMem ark_mem); int arkStep_CheckButcherTables(ARKodeMem ark_mem); @@ -260,7 +262,7 @@ int arkStep_MRIStepInnerReset(MRIStepInnerStepper stepper, sunrealtype tR, N_Vector yR); /* private functions for relaxation */ -int arkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +int arkStep_SetRelaxFn(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); int arkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, long int* relax_jac_fn_evals, sunrealtype* delta_e_out); int arkStep_GetOrder(ARKodeMem ark_mem); diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 13fec5ff58..65d0474f2d 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -719,10 +719,10 @@ char* ARKStepGetLinReturnFlagName(long int flag) * ---------------------------------------------------------------------------*/ /* ARKStep-specific utility routine */ -int arkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) +int arkStep_SetRelaxFn(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) { - return (arkRelaxCreate(arkode_mem, rfn, rjac, arkStep_RelaxDeltaE, - arkStep_GetOrder)); + return ( + arkRelaxCreate(ark_mem, rfn, rjac, arkStep_RelaxDeltaE, arkStep_GetOrder)); } int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) @@ -846,27 +846,26 @@ int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias) ARKStep optional input functions -- stepper-specific ===============================================================*/ -int arkStep_SetUserData(void* arkode_mem, void* user_data) +int arkStep_SetUserData(ARKodeMem ark_mem, void* user_data) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user data in ARKODE LS mem */ if (step_mem->lmem != NULL) { - retval = arkLSSetUserData(arkode_mem, user_data); + retval = arkLSSetUserData(ark_mem, user_data); if (retval != ARKLS_SUCCESS) { return (retval); } } /* set user data in ARKODE LSMass mem */ if (step_mem->mass_mem != NULL) { - retval = arkLSSetMassUserData(arkode_mem, user_data); + retval = arkLSSetMassUserData(ark_mem, user_data); if (retval != ARKLS_SUCCESS) { return (retval); } } @@ -882,14 +881,13 @@ int arkStep_SetUserData(void* arkode_mem, void* user_data) structures/options related to the ARKODE infrastructure itself (e.g., root-finding and post-process step). ---------------------------------------------------------------*/ -int arkStep_SetDefaults(void* arkode_mem) +int arkStep_SetDefaults(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default values for integrator optional inputs */ @@ -936,8 +934,8 @@ int ARKStepSetOptimalParams(void* arkode_mem) int retval; long int lenrw, leniw; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* access ARKodeHAdaptMem structure */ @@ -1212,15 +1210,14 @@ int ARKStepSetOptimalParams(void* arkode_mem) Specifies the method order ---------------------------------------------------------------*/ -int arkStep_SetOrder(void* arkode_mem, int ord) +int arkStep_SetOrder(ARKodeMem ark_mem, int ord) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; sunindextype Blrw, Bliw; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user-provided value, or default, depending on argument */ @@ -1263,14 +1260,13 @@ int arkStep_SetOrder(void* arkode_mem, int ord) using an iterative linear solver this flag denotes time dependence of the preconditioner. ---------------------------------------------------------------*/ -int arkStep_SetLinear(void* arkode_mem, int timedepend) +int arkStep_SetLinear(ARKodeMem ark_mem, int timedepend) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -1288,14 +1284,13 @@ int arkStep_SetLinear(void* arkode_mem, int timedepend) Used to undo a previous call to arkStep_SetLinear. Automatically loosens DeltaGammaMax back to default value. ---------------------------------------------------------------*/ -int arkStep_SetNonlinear(void* arkode_mem) +int arkStep_SetNonlinear(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -1318,8 +1313,8 @@ int ARKStepSetExplicit(void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fe is defined */ @@ -1349,8 +1344,8 @@ int ARKStepSetImplicit(void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fi is defined */ @@ -1394,8 +1389,8 @@ int ARKStepSetImEx(void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that fe and fi are defined */ @@ -1452,8 +1447,8 @@ int ARKStepSetTables(void* arkode_mem, int q, int p, ARKodeButcherTable Bi, ARKodeARKStepMem step_mem; sunindextype Blrw, Bliw; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for illegal inputs */ @@ -1621,8 +1616,8 @@ int ARKStepSetTableNum(void* arkode_mem, ARKODE_DIRKTableID itable, ARKodeARKStepMem step_mem; sunindextype Blrw, Bliw; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* clear any existing parameters and Butcher tables */ @@ -1797,14 +1792,13 @@ int ARKStepSetTableName(void* arkode_mem, const char* itable, const char* etable crdown. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int arkStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +int arkStep_SetNonlinCRDown(ARKodeMem ark_mem, sunrealtype crdown) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1821,14 +1815,13 @@ int arkStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) rdiv. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int arkStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +int arkStep_SetNonlinRDiv(ARKodeMem ark_mem, sunrealtype rdiv) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1845,14 +1838,13 @@ int arkStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) dgmax. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int arkStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +int arkStep_SetDeltaGammaMax(ARKodeMem ark_mem, sunrealtype dgmax) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1870,14 +1862,13 @@ int arkStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) negative values imply recomputation of lsetup at each nonlinear solve; a zero value implies a reset to the default. ---------------------------------------------------------------*/ -int arkStep_SetLSetupFrequency(void* arkode_mem, int msbp) +int arkStep_SetLSetupFrequency(ARKodeMem ark_mem, int msbp) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -1894,14 +1885,13 @@ int arkStep_SetLSetupFrequency(void* arkode_mem, int msbp) Non-default choices are {1,2,3,4}, all others will use default (trivial) predictor. ---------------------------------------------------------------*/ -int arkStep_SetPredictorMethod(void* arkode_mem, int pred_method) +int arkStep_SetPredictorMethod(ARKodeMem ark_mem, int pred_method) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameter */ @@ -1917,14 +1907,13 @@ int arkStep_SetPredictorMethod(void* arkode_mem, int pred_method) one solve. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) +int arkStep_SetMaxNonlinIters(ARKodeMem ark_mem, int maxcor) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } SUNFunctionBegin(ark_mem->sunctx); @@ -1959,14 +1948,13 @@ int arkStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) Specifies the coefficient in the nonlinear solver convergence test. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int arkStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +int arkStep_SetNonlinConvCoef(ARKodeMem ark_mem, sunrealtype nlscoef) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* argument <= 0 sets default, otherwise set input */ @@ -1981,14 +1969,13 @@ int arkStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) predictor function having type ARKStagePredictFn. A NULL input function disables calls to this routine. ---------------------------------------------------------------*/ -int arkStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +int arkStep_SetStagePredictFn(ARKodeMem ark_mem, ARKStagePredictFn PredictStage) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure and set function pointer */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->stage_predict = PredictStage; @@ -2007,14 +1994,13 @@ int arkStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) fi(z_i), and SUNFALSE indicates that fi(z_i) is computed with an additional evaluation of fi. ---------------------------------------------------------------*/ -int arkStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +int arkStep_SetDeduceImplicitRhs(ARKodeMem ark_mem, sunbooleantype deduce) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure and set function pointer */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->deduce_rhs = deduce; @@ -2028,12 +2014,11 @@ int arkStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) /*--------------------------------------------------------------- arkStep_GetCurrentGamma: Returns the current value of gamma ---------------------------------------------------------------*/ -int arkStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +int arkStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma) { int retval; - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *gamma = step_mem->gamma; return (retval); @@ -2050,8 +2035,8 @@ int ARKStepGetNumRhsEvals(void* arkode_mem, long int* fe_evals, long int* fi_eva ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get values from step_mem */ @@ -2066,14 +2051,13 @@ int ARKStepGetNumRhsEvals(void* arkode_mem, long int* fe_evals, long int* fi_eva Returns the current number of calls to the lsetup routine ---------------------------------------------------------------*/ -int arkStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +int arkStep_GetNumLinSolvSetups(ARKodeMem ark_mem, long int* nlinsetups) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get value from step_mem */ @@ -2095,8 +2079,8 @@ int ARKStepGetCurrentButcherTables(void* arkode_mem, ARKodeButcherTable* Bi, ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get tables from step_mem */ @@ -2119,8 +2103,8 @@ int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set expsteps and accsteps from adaptivity structure */ @@ -2142,14 +2126,13 @@ int ARKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, Returns the current number of nonlinear solver iterations ---------------------------------------------------------------*/ -int arkStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +int arkStep_GetNumNonlinSolvIters(ARKodeMem ark_mem, long int* nniters) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -2162,14 +2145,13 @@ int arkStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) Returns the current number of nonlinear solver convergence fails ---------------------------------------------------------------*/ -int arkStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +int arkStep_GetNumNonlinSolvConvFails(ARKodeMem ark_mem, long int* nnfails) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set output from step_mem */ @@ -2183,15 +2165,14 @@ int arkStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) Returns nonlinear solver statistics ---------------------------------------------------------------*/ -int arkStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, +int arkStep_GetNonlinSolvStats(ARKodeMem ark_mem, long int* nniters, long int* nnfails) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -2205,16 +2186,15 @@ int arkStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, Prints integrator statistics ---------------------------------------------------------------*/ -int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int arkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; ARKLsMem arkls_mem; ARKLsMassMem arklsm_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } switch (fmt) @@ -2235,9 +2215,9 @@ int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) /* linear solver stats */ fprintf(outfile, "LS setups = %ld\n", step_mem->nsetups); - if (ark_mem->step_getlinmem(arkode_mem)) + if (ark_mem->step_getlinmem(ark_mem)) { - arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(arkode_mem)); + arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(ark_mem)); fprintf(outfile, "Jac fn evals = %ld\n", arkls_mem->nje); fprintf(outfile, "LS RHS fn evals = %ld\n", arkls_mem->nfeDQ); fprintf(outfile, "Prec setup evals = %ld\n", arkls_mem->npe); @@ -2260,9 +2240,9 @@ int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) } /* mass solve stats */ - if (ark_mem->step_getmassmem(arkode_mem)) + if (ark_mem->step_getmassmem(ark_mem)) { - arklsm_mem = (ARKLsMassMem)(ark_mem->step_getmassmem(arkode_mem)); + arklsm_mem = (ARKLsMassMem)(ark_mem->step_getmassmem(ark_mem)); fprintf(outfile, "Mass setups = %ld\n", arklsm_mem->nmsetups); fprintf(outfile, "Mass solves = %ld\n", @@ -2295,9 +2275,9 @@ int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) /* linear solver stats */ fprintf(outfile, ",LS setups,%ld", step_mem->nsetups); - if (ark_mem->step_getlinmem(arkode_mem)) + if (ark_mem->step_getlinmem(ark_mem)) { - arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(arkode_mem)); + arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(ark_mem)); fprintf(outfile, ",Jac fn evals,%ld", arkls_mem->nje); fprintf(outfile, ",LS RHS fn evals,%ld", arkls_mem->nfeDQ); fprintf(outfile, ",Prec setup evals,%ld", arkls_mem->npe); @@ -2324,9 +2304,9 @@ int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) } /* mass solve stats */ - if (ark_mem->step_getmassmem(arkode_mem)) + if (ark_mem->step_getmassmem(ark_mem)) { - arklsm_mem = (ARKLsMassMem)(ark_mem->step_getmassmem(arkode_mem)); + arklsm_mem = (ARKLsMassMem)(ark_mem->step_getmassmem(ark_mem)); fprintf(outfile, ",Mass setups,%ld", arklsm_mem->nmsetups); fprintf(outfile, ",Mass solves,%ld", arklsm_mem->nmsolves); fprintf(outfile, ",Mass Prec setup evals,%ld", arklsm_mem->npe); @@ -2357,14 +2337,13 @@ int arkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int arkStep_WriteParameters(void* arkode_mem, FILE* fp) +int arkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* print integrator parameters to file */ @@ -2415,8 +2394,8 @@ int ARKStepWriteButcher(void* arkode_mem, FILE* fp) ARKodeMem ark_mem; ARKodeARKStepMem step_mem; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that Butcher table is non-NULL (otherwise report error) */ diff --git a/src/arkode/arkode_arkstep_nls.c b/src/arkode/arkode_arkstep_nls.c index e05464cb27..d6105f8ed4 100644 --- a/src/arkode/arkode_arkstep_nls.c +++ b/src/arkode/arkode_arkstep_nls.c @@ -33,14 +33,13 @@ This routine attaches a SUNNonlinearSolver object to the ARKStep module. ---------------------------------------------------------------*/ -int arkStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +int arkStep_SetNonlinearSolver(ARKodeMem ark_mem, SUNNonlinearSolver NLS) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if NLS input is NULL */ @@ -338,14 +337,13 @@ int arkStep_Nls(ARKodeMem ark_mem, int nflag) right-hand side function to use in the evaluation of nonlinear system functions. ---------------------------------------------------------------*/ -int arkStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) +int arkStep_SetNlsRhsFn(ARKodeMem ark_mem, ARKRhsFn nls_fi) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nls_fi) { step_mem->nls_fi = nls_fi; } @@ -360,17 +358,16 @@ int arkStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) This routine provides access to the relevant data needed to compute the nonlinear system function. ---------------------------------------------------------------*/ -int arkStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, +int arkStep_GetNonlinearSystemData(ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data) { - ARKodeMem ark_mem; ARKodeARKStepMem step_mem; int retval; /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *tcur = ark_mem->tcur; @@ -400,8 +397,8 @@ int arkStep_NlsLSetup(sunbooleantype jbad, sunbooleantype* jcur, void* arkode_me ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update convfail based on jbad flag */ @@ -442,8 +439,8 @@ int arkStep_NlsLSolve(N_Vector b, void* arkode_mem) ARKodeARKStepMem step_mem; int retval, nonlin_iter; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* retrieve nonlinear solver iteration from module */ @@ -497,8 +494,8 @@ int arkStep_NlsResidual_MassIdent(N_Vector zcor, N_Vector r, void* arkode_mem) sunrealtype c[3]; N_Vector X[3]; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -559,8 +556,8 @@ int arkStep_NlsResidual_MassFixed(N_Vector zcor, N_Vector r, void* arkode_mem) sunrealtype c[3]; N_Vector X[3]; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -627,8 +624,8 @@ int arkStep_NlsResidual_MassTDep(N_Vector zcor, N_Vector r, void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -692,8 +689,8 @@ int arkStep_NlsFPFunction_MassIdent(N_Vector zcor, N_Vector g, void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -755,8 +752,8 @@ int arkStep_NlsFPFunction_MassFixed(N_Vector zcor, N_Vector g, void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -824,8 +821,8 @@ int arkStep_NlsFPFunction_MassTDep(N_Vector zcor, N_Vector g, void* arkode_mem) ARKodeARKStepMem step_mem; int retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -880,8 +877,8 @@ int arkStep_NlsConvTest(SUNNonlinearSolver NLS, N_Vector y, N_Vector del, sunrealtype delnrm, dcon; int m, retval; - /* access ARKodeARKStepMem structure */ - retval = arkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeARKStepMem structures */ + retval = arkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if the problem is linearly implicit, just return success */ diff --git a/src/arkode/arkode_bandpre.c b/src/arkode/arkode_bandpre.c index c54566cc54..ad1d72e2b1 100644 --- a/src/arkode/arkode_bandpre.c +++ b/src/arkode/arkode_bandpre.c @@ -62,8 +62,8 @@ int ARKBandPrecInit(void* arkode_mem, sunindextype N, sunindextype mu, sunindextype mup, mlp, storagemu; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Test compatibility of NVECTOR package with the BAND preconditioner */ @@ -201,8 +201,8 @@ int ARKBandPrecGetWorkSpace(void* arkode_mem, long int* lenrwBP, long int* leniw long int lrw, liw; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if ARKBandPrecData is NULL */ @@ -261,8 +261,8 @@ int ARKBandPrecGetNumRhsEvals(void* arkode_mem, long int* nfevalsBP) ARKBandPrecData pdata; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if ARKBandPrecData is NULL */ diff --git a/src/arkode/arkode_bbdpre.c b/src/arkode/arkode_bbdpre.c index e090d5084d..aa2c2fb652 100644 --- a/src/arkode/arkode_bbdpre.c +++ b/src/arkode/arkode_bbdpre.c @@ -60,8 +60,8 @@ int ARKBBDPrecInit(void* arkode_mem, sunindextype Nlocal, sunindextype mudq, long int lrw, liw; int retval; - /* access ARKMilsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structure */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Test compatibility of NVECTOR package with the BBD preconditioner */ @@ -297,8 +297,8 @@ int ARKBBDPrecReInit(void* arkode_mem, sunindextype mudq, sunindextype mldq, sunindextype Nlocal; int retval; - /* access ARKMilsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structure */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately ARKBBDPrecData is NULL */ @@ -333,8 +333,8 @@ int ARKBBDPrecGetWorkSpace(void* arkode_mem, long int* lenrwBBDP, ARKBBDPrecData pdata; int retval; - /* access ARKMilsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structure */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately ARKBBDPrecData is NULL */ @@ -361,8 +361,8 @@ int ARKBBDPrecGetNumGfnEvals(void* arkode_mem, long int* ngevalsBBDP) ARKBBDPrecData pdata; int retval; - /* access ARKMilsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structure */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if ARKBBDPrecData is NULL */ diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 7031764f55..8fdaa5047c 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -148,16 +148,15 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) This routine resizes the memory within the ERKStep module. ---------------------------------------------------------------*/ -int erkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int erkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; sunindextype lrw1, liw1, lrw_diff, liw_diff; int i, retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determine change in vector sizes */ @@ -201,7 +200,7 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ @@ -249,18 +248,16 @@ int ERKStepReInit(void* arkode_mem, ARKRhsFn f, sunrealtype t0, N_Vector y0) /*--------------------------------------------------------------- erkStep_Free frees all ERKStep memory. ---------------------------------------------------------------*/ -void erkStep_Free(void* arkode_mem) +void erkStep_Free(ARKodeMem ark_mem) { int j; sunindextype Bliw, Blrw; - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; - /* nothing to do if arkode_mem is already NULL */ - if (arkode_mem == NULL) { return; } + /* nothing to do if ark_mem is already NULL */ + if (ark_mem == NULL) { return; } /* conditional frees on non-NULL ERKStep module */ - ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeERKStepMem)ark_mem->step_mem; @@ -313,9 +310,8 @@ void erkStep_Free(void* arkode_mem) This routine outputs the memory from the ERKStep structure to a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void erkStep_PrintMem(void* arkode_mem, FILE* outfile) +void erkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; int retval; @@ -324,7 +320,7 @@ void erkStep_PrintMem(void* arkode_mem, FILE* outfile) #endif /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return; } /* output integer quantities */ @@ -372,14 +368,13 @@ void erkStep_PrintMem(void* arkode_mem, FILE* outfile) With other initialization types, this routine does nothing. ---------------------------------------------------------------*/ -int erkStep_Init(void* arkode_mem, int init_type) +int erkStep_Init(ARKodeMem ark_mem, int init_type) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; int retval, j; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if resize or reset */ @@ -516,16 +511,15 @@ int erkStep_Init(void* arkode_mem, int init_type) when estimating the initial time step size, so we strive to store the intermediate parts so that they do not interfere with the other two modes. ----------------------------------------------------------------------------*/ -int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int erkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode) { int retval; - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; sunbooleantype recomputeRHS; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* perform RHS functions contingent on 'mode' argument */ @@ -626,19 +620,18 @@ int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, reduce step and retry (if possible) <0 => step encountered unrecoverable failure ---------------------------------------------------------------*/ -int erkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) +int erkStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) { int retval, is, js, nvec, mode; sunrealtype* cvals; N_Vector* Xvecs; - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; /* initialize algebraic solver convergence flag to success */ *nflagPtr = ARK_SUCCESS; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* local shortcuts for fused vector operations */ @@ -753,13 +746,13 @@ int erkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) ---------------------------------------------------------------*/ /*--------------------------------------------------------------- - erkStep_AccessStepMem: + erkStep_AccessARKODEStepMem: - Shortcut routine to unpack ark_mem and step_mem structures from - void* pointer. If either is missing it returns ARK_MEM_NULL. + Shortcut routine to unpack both ark_mem and step_mem structures + from void* pointer. If either is missing it returns ARK_MEM_NULL. ---------------------------------------------------------------*/ -int erkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeERKStepMem* step_mem) +int erkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeERKStepMem* step_mem) { /* access ARKodeMem structure */ if (arkode_mem == NULL) @@ -769,6 +762,8 @@ int erkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; + + /* access ARKodeERKStepMem structure */ if ((*ark_mem)->step_mem == NULL) { arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, @@ -779,6 +774,26 @@ int erkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_SUCCESS); } +/*--------------------------------------------------------------- + erkStep_AccessStepMem: + + Shortcut routine to unpack the step_mem structure from + ark_mem. If missing it returns ARK_MEM_NULL. + ---------------------------------------------------------------*/ +int erkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeERKStepMem* step_mem) +{ + /* access ARKodeERKStepMem structure */ + if (ark_mem->step_mem == NULL) + { + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_ERKSTEP_NO_MEM); + return (ARK_MEM_NULL); + } + *step_mem = (ARKodeERKStepMem)ark_mem->step_mem; + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- erkStep_CheckNVector: diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index 629ea9f6f6..e3ecdc7baf 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -68,31 +68,33 @@ typedef struct ARKodeERKStepMemRec ===============================================================*/ /* Interface routines supplied to ARKODE */ -int erkStep_Init(void* arkode_mem, int init_type); -int erkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int erkStep_Init(ARKodeMem ark_mem, int init_type); +int erkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); -int erkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); -int erkStep_SetUserData(void* arkode_mem, void* user_data); -int erkStep_SetDefaults(void* arkode_mem); -int erkStep_SetOrder(void* arkode_mem, int ord); -int erkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -int erkStep_WriteParameters(void* arkode_mem, FILE* fp); -int erkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); -int erkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int erkStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr); +int erkStep_SetUserData(ARKodeMem ark_mem, void* user_data); +int erkStep_SetDefaults(ARKodeMem ark_mem); +int erkStep_SetOrder(ARKodeMem ark_mem, int ord); +int erkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt); +int erkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp); +int erkStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR); +int erkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -void erkStep_Free(void* arkode_mem); -void erkStep_PrintMem(void* arkode_mem, FILE* outfile); +void erkStep_Free(ARKodeMem ark_mem); +void erkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile); /* Internal utility routines */ -int erkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeERKStepMem* step_mem); +int erkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeERKStepMem* step_mem); +int erkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeERKStepMem* step_mem); sunbooleantype erkStep_CheckNVector(N_Vector tmpl); int erkStep_SetButcherTable(ARKodeMem ark_mem); int erkStep_CheckButcherTable(ARKodeMem ark_mem); int erkStep_ComputeSolutions(ARKodeMem ark_mem, sunrealtype* dsm); /* private functions for relaxation */ -int erkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +int erkStep_SetRelaxFn(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); int erkStep_RelaxDeltaE(ARKodeMem ark_mem, ARKRelaxJacFn relax_jac_fn, long int* relax_jac_fn_evals, sunrealtype* delta_e_out); int erkStep_GetOrder(ARKodeMem ark_mem); diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 151f37270a..dece670718 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -351,10 +351,10 @@ int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele) * ---------------------------------------------------------------------------*/ /* ERKStep-specific utility routine */ -int erkStep_SetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) +int erkStep_SetRelaxFn(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) { - return (arkRelaxCreate(arkode_mem, rfn, rjac, erkStep_RelaxDeltaE, - erkStep_GetOrder)); + return ( + arkRelaxCreate(ark_mem, rfn, rjac, erkStep_RelaxDeltaE, erkStep_GetOrder)); } int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) @@ -485,15 +485,14 @@ int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias) Does not change problem-defining function pointers or user_data pointer. ---------------------------------------------------------------*/ -int erkStep_SetDefaults(void* arkode_mem) +int erkStep_SetDefaults(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; int retval; long int lenrw, leniw; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Remove current SUNAdaptController object, and replace with "PI" */ @@ -553,15 +552,14 @@ int erkStep_SetDefaults(void* arkode_mem) Specifies the method order ---------------------------------------------------------------*/ -int erkStep_SetOrder(void* arkode_mem, int ord) +int erkStep_SetOrder(ARKodeMem ark_mem, int ord) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; sunindextype Blrw, Bliw; int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user-provided value, or default, depending on argument */ @@ -600,8 +598,8 @@ int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B) sunindextype Blrw, Bliw; int retval; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for legal inputs */ @@ -658,8 +656,8 @@ int ERKStepSetTableNum(void* arkode_mem, ARKODE_ERKTableID etable) sunindextype Blrw, Bliw; int retval; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that argument specifies an explicit table */ @@ -727,8 +725,8 @@ int ERKStepGetNumRhsEvals(void* arkode_mem, long int* fevals) ARKodeERKStepMem step_mem; int retval; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get values from step_mem */ @@ -748,8 +746,8 @@ int ERKStepGetCurrentButcherTable(void* arkode_mem, ARKodeButcherTable* B) ARKodeERKStepMem step_mem; int retval; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get tables from step_mem */ @@ -770,8 +768,8 @@ int ERKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, ARKodeERKStepMem step_mem; int retval; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set expsteps and accsteps from adaptivity structure */ @@ -791,14 +789,13 @@ int ERKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, Prints integrator statistics ---------------------------------------------------------------*/ -int erkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int erkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } switch (fmt) @@ -828,14 +825,13 @@ int erkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int erkStep_WriteParameters(void* arkode_mem, FILE* fp) +int erkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp) { - ARKodeMem ark_mem; ARKodeERKStepMem step_mem; int retval; /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* print integrator parameters to file */ @@ -857,8 +853,8 @@ int ERKStepWriteButcher(void* arkode_mem, FILE* fp) ARKodeMem ark_mem; ARKodeERKStepMem step_mem; - /* access ARKodeERKStepMem structure */ - retval = erkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeERKStepMem structures */ + retval = erkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that Butcher table is non-NULL (otherwise report error) */ diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 3cecc4b9f0..2f4b33518d 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -147,92 +147,92 @@ extern "C" { located at the end of this file */ /* linear solver interface functions */ -typedef int (*ARKLinsolInitFn)(void* arkode_mem); -typedef int (*ARKLinsolSetupFn)(void* arkode_mem, int convfail, +typedef int (*ARKLinsolInitFn)(ARKodeMem ark_mem); +typedef int (*ARKLinsolSetupFn)(ARKodeMem ark_mem, int convfail, sunrealtype tpred, N_Vector ypred, N_Vector fpred, sunbooleantype* jcurPtr, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3); -typedef int (*ARKLinsolSolveFn)(void* arkode_mem, N_Vector b, sunrealtype tcur, +typedef int (*ARKLinsolSolveFn)(ARKodeMem ark_mem, N_Vector b, sunrealtype tcur, N_Vector ycur, N_Vector fcur, sunrealtype client_tol, int mnewt); -typedef int (*ARKLinsolFreeFn)(void* arkode_mem); +typedef int (*ARKLinsolFreeFn)(ARKodeMem ark_mem); /* mass-matrix solver interface functions */ -typedef int (*ARKMassInitFn)(void* arkode_mem); -typedef int (*ARKMassSetupFn)(void* arkode_mem, sunrealtype t, N_Vector vtemp1, +typedef int (*ARKMassInitFn)(ARKodeMem ark_mem); +typedef int (*ARKMassSetupFn)(ARKodeMem ark_mem, sunrealtype t, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3); typedef int (*ARKMassMultFn)(void* arkode_mem, N_Vector v, N_Vector Mv); -typedef int (*ARKMassSolveFn)(void* arkode_mem, N_Vector b, +typedef int (*ARKMassSolveFn)(ARKodeMem ark_mem, N_Vector b, sunrealtype client_tol); -typedef int (*ARKMassFreeFn)(void* arkode_mem); +typedef int (*ARKMassFreeFn)(ARKodeMem ark_mem); /* time stepper interface functions */ -typedef int (*ARKTimestepInitFn)(void* arkode_mem, int init_type); -typedef int (*ARKTimestepAttachLinsolFn)(void* arkode_mem, ARKLinsolInitFn linit, +typedef int (*ARKTimestepInitFn)(ARKodeMem ark_mem, int init_type); +typedef int (*ARKTimestepAttachLinsolFn)(ARKodeMem ark_mem, ARKLinsolInitFn linit, ARKLinsolSetupFn lsetup, ARKLinsolSolveFn lsolve, ARKLinsolFreeFn lfree, SUNLinearSolver_Type lsolve_type, void* lmem); typedef int (*ARKTimestepAttachMasssolFn)( - void* arkode_mem, ARKMassInitFn minit, ARKMassSetupFn msetup, + ARKodeMem ark_mem, ARKMassInitFn minit, ARKMassSetupFn msetup, ARKMassMultFn mmult, ARKMassSolveFn msolve, ARKMassFreeFn mfree, sunbooleantype time_dep, SUNLinearSolver_Type msolve_type, void* mass_mem); -typedef void (*ARKTimestepDisableLSetup)(void* arkode_mem); -typedef void (*ARKTimestepDisableMSetup)(void* arkode_mem); -typedef void* (*ARKTimestepGetLinMemFn)(void* arkode_mem); -typedef void* (*ARKTimestepGetMassMemFn)(void* arkode_mem); -typedef ARKRhsFn (*ARKTimestepGetImplicitRHSFn)(void* arkode_mem); -typedef int (*ARKTimestepGetGammasFn)(void* arkode_mem, sunrealtype* gamma, +typedef void (*ARKTimestepDisableLSetup)(ARKodeMem ark_mem); +typedef void (*ARKTimestepDisableMSetup)(ARKodeMem ark_mem); +typedef void* (*ARKTimestepGetLinMemFn)(ARKodeMem ark_mem); +typedef void* (*ARKTimestepGetMassMemFn)(ARKodeMem ark_mem); +typedef ARKRhsFn (*ARKTimestepGetImplicitRHSFn)(ARKodeMem ark_mem); +typedef int (*ARKTimestepGetGammasFn)(ARKodeMem ark_mem, sunrealtype* gamma, sunrealtype* gamrat, sunbooleantype** jcur, sunbooleantype* dgamma_fail); -typedef int (*ARKTimestepFullRHSFn)(void* arkode_mem, sunrealtype t, N_Vector y, - N_Vector f, int mode); -typedef int (*ARKTimestepStepFn)(void* arkode_mem, sunrealtype* dsm, int* nflag); -typedef int (*ARKTimetepSetUserDataFn)(void* arkode_mem, void* user_data); -typedef int (*ARKTimestepPrintAllStats)(void* arkode_mem, FILE* outfile, +typedef int (*ARKTimestepFullRHSFn)(ARKodeMem ark_mem, sunrealtype t, + N_Vector y, N_Vector f, int mode); +typedef int (*ARKTimestepStepFn)(ARKodeMem ark_mem, sunrealtype* dsm, int* nflag); +typedef int (*ARKTimetepSetUserDataFn)(ARKodeMem ark_mem, void* user_data); +typedef int (*ARKTimestepPrintAllStats)(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt); -typedef int (*ARKTimestepWriteParameters)(void* arkode_mem, FILE* fp); -typedef int (*ARKTimestepResize)(void* arkode_mem, N_Vector ynew, +typedef int (*ARKTimestepWriteParameters)(ARKodeMem ark_mem, FILE* fp); +typedef int (*ARKTimestepResize)(ARKodeMem ark_mem, N_Vector ynew, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -typedef int (*ARKTimestepReset)(void* arkode_mem, sunrealtype tR, N_Vector yR); -typedef void (*ARKTimestepFree)(void* arkode_mem); -typedef void (*ARKTimestepPrintMem)(void* arkode_mem, FILE* outfile); -typedef int (*ARKTimestepSetDefaults)(void* arkode_mem); -typedef int (*ARKTimestepComputeState)(void* arkode_mem, N_Vector zcor, +typedef int (*ARKTimestepReset)(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR); +typedef void (*ARKTimestepFree)(ARKodeMem ark_mem); +typedef void (*ARKTimestepPrintMem)(ARKodeMem ark_mem, FILE* outfile); +typedef int (*ARKTimestepSetDefaults)(ARKodeMem ark_mem); +typedef int (*ARKTimestepComputeState)(ARKodeMem ark_mem, N_Vector zcor, N_Vector z); -typedef int (*ARKTimestepSetRelaxFn)(void* arkode_mem, ARKRelaxFn rfn, +typedef int (*ARKTimestepSetRelaxFn)(ARKodeMem ark_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); -typedef int (*ARKTimestepSetOrder)(void* arkode_mem, int maxord); -typedef int (*ARKTimestepSetNonlinearSolver)(void* arkode_mem, +typedef int (*ARKTimestepSetOrder)(ARKodeMem ark_mem, int maxord); +typedef int (*ARKTimestepSetNonlinearSolver)(ARKodeMem ark_mem, SUNNonlinearSolver NLS); -typedef int (*ARKTimestepSetLinear)(void* arkode_mem, int timedepend); -typedef int (*ARKTimestepSetNonlinear)(void* arkode_mem); -typedef int (*ARKTimestepSetNlsRhsFn)(void* arkode_mem, ARKRhsFn nls_fi); -typedef int (*ARKTimestepSetDeduceImplicitRhs)(void* arkode_mem, +typedef int (*ARKTimestepSetLinear)(ARKodeMem ark_mem, int timedepend); +typedef int (*ARKTimestepSetNonlinear)(ARKodeMem ark_mem); +typedef int (*ARKTimestepSetNlsRhsFn)(ARKodeMem ark_mem, ARKRhsFn nls_fi); +typedef int (*ARKTimestepSetDeduceImplicitRhs)(ARKodeMem ark_mem, sunbooleantype deduce); -typedef int (*ARKTimestepSetNonlinCRDown)(void* arkode_mem, sunrealtype crdown); -typedef int (*ARKTimestepSetNonlinRDiv)(void* arkode_mem, sunrealtype rdiv); -typedef int (*ARKTimestepSetDeltaGammaMax)(void* arkode_mem, sunrealtype dgmax); -typedef int (*ARKTimestepSetLSetupFrequency)(void* arkode_mem, int msbp); -typedef int (*ARKTimestepSetPredictorMethod)(void* arkode_mem, int method); -typedef int (*ARKTimestepSetMaxNonlinIters)(void* arkode_mem, int maxcor); -typedef int (*ARKTimestepSetNonlinConvCoef)(void* arkode_mem, +typedef int (*ARKTimestepSetNonlinCRDown)(ARKodeMem ark_mem, sunrealtype crdown); +typedef int (*ARKTimestepSetNonlinRDiv)(ARKodeMem ark_mem, sunrealtype rdiv); +typedef int (*ARKTimestepSetDeltaGammaMax)(ARKodeMem ark_mem, sunrealtype dgmax); +typedef int (*ARKTimestepSetLSetupFrequency)(ARKodeMem ark_mem, int msbp); +typedef int (*ARKTimestepSetPredictorMethod)(ARKodeMem ark_mem, int method); +typedef int (*ARKTimestepSetMaxNonlinIters)(ARKodeMem ark_mem, int maxcor); +typedef int (*ARKTimestepSetNonlinConvCoef)(ARKodeMem ark_mem, sunrealtype nlscoef); -typedef int (*ARKTimestepSetStagePredictFn)(void* arkode_mem, +typedef int (*ARKTimestepSetStagePredictFn)(ARKodeMem ark_mem, ARKStagePredictFn PredictStage); -typedef int (*ARKTimestepGetNumLinSolvSetups)(void* arkode_mem, +typedef int (*ARKTimestepGetNumLinSolvSetups)(ARKodeMem ark_mem, long int* nlinsetups); -typedef int (*ARKTimestepGetCurrentGamma)(void* arkode_mem, sunrealtype* gamma); +typedef int (*ARKTimestepGetCurrentGamma)(ARKodeMem ark_mem, sunrealtype* gamma); typedef int (*ARKTimestepGetNonlinearSystemData)( - void* arkode_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, + ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); -typedef int (*ARKTimestepGetNumNonlinSolvIters)(void* arkode_mem, +typedef int (*ARKTimestepGetNumNonlinSolvIters)(ARKodeMem ark_mem, long int* nniters); -typedef int (*ARKTimestepGetNumNonlinSolvConvFails)(void* arkode_mem, +typedef int (*ARKTimestepGetNumNonlinSolvConvFails)(ARKodeMem ark_mem, long int* nnfails); -typedef int (*ARKTimestepGetNonlinSolvStats)(void* arkode_mem, long int* nniters, +typedef int (*ARKTimestepGetNonlinSolvStats)(ARKodeMem ark_mem, long int* nniters, long int* nnfails); /*=============================================================== @@ -248,15 +248,15 @@ typedef struct _generic_ARKInterp* ARKInterp; /* Structure containing function pointers to interpolation operations */ struct _generic_ARKInterpOps { - int (*resize)(void* arkode_mem, ARKInterp interp, ARKVecResizeFn resize, + int (*resize)(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector tmpl); - void (*free)(void* arkode_mem, ARKInterp interp); + void (*free)(ARKodeMem ark_mem, ARKInterp interp); void (*print)(ARKInterp interp, FILE* outfile); - int (*setdegree)(void* arkode_mem, ARKInterp interp, int degree); - int (*init)(void* arkode_mem, ARKInterp interp, sunrealtype tnew); - int (*update)(void* arkode_mem, ARKInterp interp, sunrealtype tnew); - int (*evaluate)(void* arkode_mem, ARKInterp interp, sunrealtype tau, int d, + int (*setdegree)(ARKodeMem ark_mem, ARKInterp interp, int degree); + int (*init)(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); + int (*update)(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); + int (*evaluate)(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tau, int d, int order, N_Vector yout); }; @@ -269,15 +269,15 @@ struct _generic_ARKInterp }; /* ARKInterp module functions */ -int arkInterpResize(void* arkode_mem, ARKInterp interp, ARKVecResizeFn resize, +int arkInterpResize(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector tmpl); -void arkInterpFree(void* arkode_mem, ARKInterp interp); +void arkInterpFree(ARKodeMem ark_mem, ARKInterp interp); void arkInterpPrintMem(ARKInterp interp, FILE* outfile); -int arkInterpSetDegree(void* arkode_mem, ARKInterp interp, int degree); -int arkInterpInit(void* arkode_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpUpdate(void* arkode_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpEvaluate(void* arkode_mem, ARKInterp interp, sunrealtype tau, +int arkInterpSetDegree(ARKodeMem ark_mem, ARKInterp interp, int degree); +int arkInterpInit(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); +int arkInterpUpdate(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); +int arkInterpEvaluate(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tau, int d, int order, N_Vector yout); /*=============================================================== diff --git a/src/arkode/arkode_interp.c b/src/arkode/arkode_interp.c index c481e465df..2d61283c7a 100644 --- a/src/arkode/arkode_interp.c +++ b/src/arkode/arkode_interp.c @@ -31,19 +31,19 @@ interpolation modules ---------------------------------------------------------------*/ -int arkInterpResize(void* arkode_mem, ARKInterp interp, ARKVecResizeFn resize, +int arkInterpResize(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector tmpl) { if (interp == NULL) { return (ARK_SUCCESS); } - return ((int)interp->ops->resize(arkode_mem, interp, resize, resize_data, + return ((int)interp->ops->resize(ark_mem, interp, resize, resize_data, lrw_diff, liw_diff, tmpl)); } -void arkInterpFree(void* arkode_mem, ARKInterp interp) +void arkInterpFree(ARKodeMem ark_mem, ARKInterp interp) { if (interp == NULL) { return; } - interp->ops->free(arkode_mem, interp); + interp->ops->free(ark_mem, interp); return; } @@ -54,29 +54,29 @@ void arkInterpPrintMem(ARKInterp interp, FILE* outfile) return; } -int arkInterpSetDegree(void* arkode_mem, ARKInterp interp, int degree) +int arkInterpSetDegree(ARKodeMem ark_mem, ARKInterp interp, int degree) { if (interp == NULL) { return (ARK_SUCCESS); } - return ((int)interp->ops->setdegree(arkode_mem, interp, degree)); + return ((int)interp->ops->setdegree(ark_mem, interp, degree)); } -int arkInterpInit(void* arkode_mem, ARKInterp interp, sunrealtype tnew) +int arkInterpInit(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew) { if (interp == NULL) { return (ARK_SUCCESS); } - return ((int)interp->ops->init(arkode_mem, interp, tnew)); + return ((int)interp->ops->init(ark_mem, interp, tnew)); } -int arkInterpUpdate(void* arkode_mem, ARKInterp interp, sunrealtype tnew) +int arkInterpUpdate(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew) { if (interp == NULL) { return (ARK_SUCCESS); } - return ((int)interp->ops->update(arkode_mem, interp, tnew)); + return ((int)interp->ops->update(ark_mem, interp, tnew)); } -int arkInterpEvaluate(void* arkode_mem, ARKInterp interp, sunrealtype tau, +int arkInterpEvaluate(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tau, int d, int order, N_Vector yout) { if (interp == NULL) { return (ARK_SUCCESS); } - return ((int)interp->ops->evaluate(arkode_mem, interp, tau, d, order, yout)); + return ((int)interp->ops->evaluate(ark_mem, interp, tau, d, order, yout)); } /*--------------------------------------------------------------- @@ -90,16 +90,11 @@ int arkInterpEvaluate(void* arkode_mem, ARKInterp interp, sunrealtype tau, cloning an input template N_Vector. This returns a non-NULL structure if no errors occurred, or a NULL value otherwise. ---------------------------------------------------------------*/ -ARKInterp arkInterpCreate_Hermite(void* arkode_mem, int degree) +ARKInterp arkInterpCreate_Hermite(ARKodeMem ark_mem, int degree) { ARKInterp interp; ARKInterpContent_Hermite content; ARKInterpOps ops; - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (NULL); } - ark_mem = (ARKodeMem)arkode_mem; /* check for valid degree */ if (degree < 0 || degree > ARK_INTERP_MAX_DEGREE) { return (NULL); } @@ -168,17 +163,11 @@ ARKInterp arkInterpCreate_Hermite(void* arkode_mem, int degree) This routine resizes the internal vectors. ---------------------------------------------------------------*/ -int arkInterpResize_Hermite(void* arkode_mem, ARKInterp interp, +int arkInterpResize_Hermite(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector y0) { - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* resize vectors */ if (interp == NULL) { return (ARK_SUCCESS); } @@ -219,14 +208,8 @@ int arkInterpResize_Hermite(void* arkode_mem, ARKInterp interp, This routine frees the Hermite ARKInterp structure. ---------------------------------------------------------------*/ -void arkInterpFree_Hermite(void* arkode_mem, ARKInterp interp) +void arkInterpFree_Hermite(ARKodeMem ark_mem, ARKInterp interp) { - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return; } - ark_mem = (ARKodeMem)arkode_mem; - /* if interpolation structure is NULL, just return */ if (interp == NULL) { return; } @@ -321,20 +304,13 @@ void arkInterpPrintMem_Hermite(ARKInterp interp, FILE* outfile) polynomial]. Return values: - ARK_MEM_NULL -- if either arkode_mem or interp are NULL ARK_ILL_INPUT -- if the input is outside of allowable bounds ARK_INTERP_FAIL -- if the interpolation module has already been initialized, ARK_SUCCESS -- successful completion. ---------------------------------------------------------------*/ -int arkInterpSetDegree_Hermite(void* arkode_mem, ARKInterp interp, int degree) +int arkInterpSetDegree_Hermite(ARKodeMem ark_mem, ARKInterp interp, int degree) { - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* if this degree is already stored, just return */ if (abs(degree) == HINT_DEGREE(interp)) { return (ARK_SUCCESS); } @@ -370,14 +346,8 @@ int arkInterpSetDegree_Hermite(void* arkode_mem, ARKInterp interp, int degree) 4. Calls the full RHS routine to fill fnew 5. Copies fnew into fold ---------------------------------------------------------------*/ -int arkInterpInit_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew) +int arkInterpInit_Hermite(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew) { - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* initialize time values */ HINT_TOLD(interp) = tnew; HINT_TNEW(interp) = tnew; @@ -430,14 +400,9 @@ int arkInterpInit_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew) This routine copies ynew into yold, and fnew into fold, so that yold and fold contain the previous values. ---------------------------------------------------------------*/ -int arkInterpUpdate_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew) +int arkInterpUpdate_Hermite(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew) { int retval; - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; /* call full RHS if needed -- called just BEFORE the end of a step, so yn has NOT been updated to ycur yet */ @@ -491,7 +456,7 @@ int arkInterpUpdate_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew where h = tnew-told, i.e. values -1 ARK_INTERP_MAX_DEGREE) { return (NULL); } @@ -932,16 +887,12 @@ ARKInterp arkInterpCreate_Lagrange(void* arkode_mem, int degree) This routine resizes the internal vectors. ---------------------------------------------------------------*/ -int arkInterpResize_Lagrange(void* arkode_mem, ARKInterp I, ARKVecResizeFn resize, - void* resize_data, sunindextype lrw_diff, - sunindextype liw_diff, N_Vector y0) +int arkInterpResize_Lagrange(ARKodeMem ark_mem, ARKInterp I, + ARKVecResizeFn resize, void* resize_data, + sunindextype lrw_diff, sunindextype liw_diff, + N_Vector y0) { int i; - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; /* resize vectors */ if (I == NULL) { return (ARK_SUCCESS); } @@ -968,14 +919,9 @@ int arkInterpResize_Lagrange(void* arkode_mem, ARKInterp I, ARKVecResizeFn resiz This routine frees the Lagrange ARKInterp structure. ---------------------------------------------------------------*/ -void arkInterpFree_Lagrange(void* arkode_mem, ARKInterp I) +void arkInterpFree_Lagrange(ARKodeMem ark_mem, ARKInterp I) { int i; - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return; } - ark_mem = (ARKodeMem)arkode_mem; /* if interpolation structure is NULL, just return */ if (I == NULL) { return; } @@ -1083,20 +1029,13 @@ void arkInterpPrintMem_Lagrange(ARKInterp I, FILE* outfile) polynomial]. Return values: - ARK_MEM_NULL -- if either arkode_mem or interp are NULL ARK_ILL_INPUT -- if the input is outside of allowable bounds ARK_INTERP_FAIL -- if the interpolation module has already been initialized, ARK_SUCCESS -- successful completion. ---------------------------------------------------------------*/ -int arkInterpSetDegree_Lagrange(void* arkode_mem, ARKInterp I, int degree) +int arkInterpSetDegree_Lagrange(ARKodeMem ark_mem, ARKInterp I, int degree) { - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* if this degree is already stored, just return */ if (abs(degree) + 1 == LINT_NMAX(I)) { return (ARK_SUCCESS); } @@ -1131,14 +1070,9 @@ int arkInterpSetDegree_Lagrange(void* arkode_mem, ARKInterp I, int degree) 3. copies current (t,y) from main ARKODE memory into history 4. updates the 'active' history counter to 1 ---------------------------------------------------------------*/ -int arkInterpInit_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tnew) +int arkInterpInit_Lagrange(ARKodeMem ark_mem, ARKInterp I, sunrealtype tnew) { int i; - ARKodeMem ark_mem; - - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; /* check if storage has increased since the last init */ if (LINT_NMAX(I) > LINT_NMAXALLOC(I)) @@ -1224,20 +1158,15 @@ int arkInterpInit_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tnew) into the first history vector Otherwise it just returns with success. ---------------------------------------------------------------*/ -int arkInterpUpdate_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tnew) +int arkInterpUpdate_Lagrange(ARKodeMem ark_mem, ARKInterp I, sunrealtype tnew) { int i; - ARKodeMem ark_mem; sunrealtype tdiff; N_Vector ytmp; int nhist, nmax; sunrealtype* thist; N_Vector* yhist; - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* set readability shortcuts */ nhist = LINT_NHIST(I); nmax = LINT_NMAX(I); @@ -1298,7 +1227,7 @@ int arkInterpUpdate_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tnew) fixed step sizes, otherwise the stated lower bound is only approximate). ---------------------------------------------------------------*/ -int arkInterpEvaluate_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tau, +int arkInterpEvaluate_Lagrange(ARKodeMem ark_mem, ARKInterp I, sunrealtype tau, int deriv, int degree, N_Vector yout) { /* local variables */ @@ -1306,15 +1235,10 @@ int arkInterpEvaluate_Lagrange(void* arkode_mem, ARKInterp I, sunrealtype tau, sunrealtype tval; sunrealtype a[6]; N_Vector X[6]; - ARKodeMem ark_mem; int nhist; sunrealtype* thist; N_Vector* yhist; - /* access ARKodeMem structure */ - if (arkode_mem == NULL) { return (ARK_MEM_NULL); } - ark_mem = (ARKodeMem)arkode_mem; - /* set readability shortcuts */ nhist = LINT_NHIST(I); thist = LINT_THIST(I); diff --git a/src/arkode/arkode_interp_impl.h b/src/arkode/arkode_interp_impl.h index 502817746e..7222259942 100644 --- a/src/arkode/arkode_interp_impl.h +++ b/src/arkode/arkode_interp_impl.h @@ -71,18 +71,19 @@ typedef struct _ARKInterpContent_Hermite* ARKInterpContent_Hermite; /* Hermite structure operations */ -ARKInterp arkInterpCreate_Hermite(void* arkode_mem, int degree); +ARKInterp arkInterpCreate_Hermite(ARKodeMem ark_mem, int degree); -int arkInterpResize_Hermite(void* arkode_mem, ARKInterp interp, +int arkInterpResize_Hermite(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector tmpl); -void arkInterpFree_Hermite(void* arkode_mem, ARKInterp interp); +void arkInterpFree_Hermite(ARKodeMem ark_mem, ARKInterp interp); void arkInterpPrintMem_Hermite(ARKInterp interp, FILE* outfile); -int arkInterpSetDegree_Hermite(void* arkode_mem, ARKInterp interp, int degree); -int arkInterpInit_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpUpdate_Hermite(void* arkode_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpEvaluate_Hermite(void* arkode_mem, ARKInterp interp, +int arkInterpSetDegree_Hermite(ARKodeMem ark_mem, ARKInterp interp, int degree); +int arkInterpInit_Hermite(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); +int arkInterpUpdate_Hermite(ARKodeMem ark_mem, ARKInterp interp, + sunrealtype tnew); +int arkInterpEvaluate_Hermite(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tau, int d, int order, N_Vector yout); /*=============================================================== @@ -117,19 +118,19 @@ typedef struct _ARKInterpContent_Lagrange* ARKInterpContent_Lagrange; /* Lagrange structure operations */ -ARKInterp arkInterpCreate_Lagrange(void* arkode_mem, int degree); +ARKInterp arkInterpCreate_Lagrange(ARKodeMem ark_mem, int degree); -int arkInterpResize_Lagrange(void* arkode_mem, ARKInterp interp, +int arkInterpResize_Lagrange(ARKodeMem ark_mem, ARKInterp interp, ARKVecResizeFn resize, void* resize_data, sunindextype lrw_diff, sunindextype liw_diff, N_Vector tmpl); -void arkInterpFree_Lagrange(void* arkode_mem, ARKInterp interp); +void arkInterpFree_Lagrange(ARKodeMem ark_mem, ARKInterp interp); void arkInterpPrintMem_Lagrange(ARKInterp interp, FILE* outfile); -int arkInterpSetDegree_Lagrange(void* arkode_mem, ARKInterp interp, int degree); -int arkInterpInit_Lagrange(void* arkode_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpUpdate_Lagrange(void* arkode_mem, ARKInterp interp, +int arkInterpSetDegree_Lagrange(ARKodeMem ark_mem, ARKInterp interp, int degree); +int arkInterpInit_Lagrange(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); +int arkInterpUpdate_Lagrange(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tnew); -int arkInterpEvaluate_Lagrange(void* arkode_mem, ARKInterp interp, +int arkInterpEvaluate_Lagrange(ARKodeMem ark_mem, ARKInterp interp, sunrealtype tau, int d, int order, N_Vector yout); /* Lagrange structure utility routines */ diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 55e380a2b7..f09db2c998 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -131,7 +131,8 @@ int ARKodeSetOrder(void* arkode_mem, int ord) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -278,8 +279,8 @@ int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -290,7 +291,8 @@ int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -325,8 +327,8 @@ int ARKodeSetLinear(void* arkode_mem, int timedepend) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -337,7 +339,8 @@ int ARKodeSetLinear(void* arkode_mem, int timedepend) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -363,8 +366,8 @@ int ARKodeSetNonlinear(void* arkode_mem) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -375,7 +378,8 @@ int ARKodeSetNonlinear(void* arkode_mem) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -402,8 +406,8 @@ int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -414,7 +418,8 @@ int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -446,8 +451,8 @@ int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -458,7 +463,8 @@ int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -485,8 +491,8 @@ int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -497,7 +503,8 @@ int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -524,8 +531,8 @@ int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -536,7 +543,8 @@ int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -563,8 +571,8 @@ int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -575,7 +583,8 @@ int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -603,8 +612,8 @@ int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -615,7 +624,8 @@ int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -640,8 +650,8 @@ int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -652,7 +662,8 @@ int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -679,8 +690,8 @@ int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -691,7 +702,8 @@ int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -717,8 +729,8 @@ int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -729,7 +741,8 @@ int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -754,8 +767,8 @@ int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -766,7 +779,8 @@ int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -833,8 +847,8 @@ int ARKodeSetAdaptController(void* arkode_mem, SUNAdaptController C) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -928,8 +942,8 @@ int ARKodeSetMaxHnilWarns(void* arkode_mem, int mxhnil) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -960,8 +974,8 @@ int ARKodeSetInitStep(void* arkode_mem, sunrealtype hin) /* Guard against hin==0 for non-adaptive time stepper modules */ if ((!ark_mem->step_supports_adaptive) && (hin == ZERO)) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -998,8 +1012,8 @@ int ARKodeSetMinStep(void* arkode_mem, sunrealtype hmin) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1044,8 +1058,8 @@ int ARKodeSetMaxStep(void* arkode_mem, sunrealtype hmax) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1362,8 +1376,8 @@ int ARKodeSetConstraints(void* arkode_mem, N_Vector constraints) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive && (constraints != NULL)) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1428,8 +1442,8 @@ int ARKodeSetMaxNumConstrFails(void* arkode_mem, int maxfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1753,8 +1767,8 @@ int ARKodeSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1793,8 +1807,8 @@ int ARKodeSetAdaptivityAdjustment(void* arkode_mem, int adjust) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1822,8 +1836,8 @@ int ARKodeSetSafetyFactor(void* arkode_mem, sunrealtype safety) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1860,8 +1874,8 @@ int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1902,8 +1916,8 @@ int ARKodeSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1933,8 +1947,8 @@ int ARKodeSetMinReduction(void* arkode_mem, sunrealtype eta_min) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1963,8 +1977,8 @@ int ARKodeSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2001,8 +2015,8 @@ int ARKodeSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2031,8 +2045,8 @@ int ARKodeSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2061,8 +2075,8 @@ int ARKodeSetSmallNumEFails(void* arkode_mem, int small_nef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2091,8 +2105,8 @@ int ARKodeSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2121,8 +2135,8 @@ int ARKodeSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2162,8 +2176,8 @@ int ARKodeSetMaxErrTestFails(void* arkode_mem, int maxnef) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2194,8 +2208,8 @@ int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2205,29 +2219,6 @@ int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - ARKodeSetUseCompensatedSums: - - Specifies that ARKODE should use compensated (Kahan) summation - where relevant to mitigate roundoff error. - ---------------------------------------------------------------*/ -int ARKodeSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) -{ - ARKodeMem ark_mem; - if (arkode_mem == NULL) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return (ARK_MEM_NULL); - } - ark_mem = (ARKodeMem)arkode_mem; - - if (onoff) { ark_mem->use_compensated_sums = SUNTRUE; } - else { ark_mem->use_compensated_sums = SUNFALSE; } - - return (ARK_SUCCESS); -} - /*=============================================================== ARKODE optional output utility functions ===============================================================*/ @@ -2411,19 +2402,20 @@ int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getcurrentgamma) { - return (ark_mem->step_getcurrentgamma(arkode_mem, gamma)); + return (ark_mem->step_getcurrentgamma(ark_mem, gamma)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2488,8 +2480,8 @@ int ARKodeGetResWeights(void* arkode_mem, N_Vector rweight) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2620,8 +2612,8 @@ int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2648,8 +2640,8 @@ int ARKodeGetNumExpSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2676,8 +2668,8 @@ int ARKodeGetNumAccSteps(void* arkode_mem, long int* nsteps) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2704,8 +2696,8 @@ int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) /* Guard against use for non-adaptive time stepper modules */ if (!ark_mem->step_supports_adaptive) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support temporal adaptivity"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support temporal adaptivity"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2733,7 +2725,8 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /* Guard against use for incompatible time stepper modules */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support algebraic solvers"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2741,11 +2734,12 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_computestate) { - return (ark_mem->step_computestate(arkode_mem, zcor, z)); + return (ark_mem->step_computestate(ark_mem, zcor, z)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2774,7 +2768,8 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, /* Guard against use for incompatible time stepper modules */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support algebraic solvers"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2782,12 +2777,13 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinearsystemdata) { - return (ark_mem->step_getnonlinearsystemdata(arkode_mem, tcur, zpred, z, Fi, + return (ark_mem->step_getnonlinearsystemdata(ark_mem, tcur, zpred, z, Fi, gamma, sdata, user_data)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2812,7 +2808,8 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) /* Guard against use for incompatible time stepper modules */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support algebraic solvers"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2820,11 +2817,12 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolviters) { - return (ark_mem->step_getnumnonlinsolviters(arkode_mem, nniters)); + return (ark_mem->step_getnumnonlinsolviters(ark_mem, nniters)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2849,19 +2847,20 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolvconvfails) { - return (ark_mem->step_getnumnonlinsolvconvfails(arkode_mem, nnfails)); + return (ark_mem->step_getnumnonlinsolvconvfails(ark_mem, nnfails)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2887,19 +2886,20 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinsolvstats) { - return (ark_mem->step_getnonlinsolvstats(arkode_mem, nniters, nnfails)); + return (ark_mem->step_getnonlinsolvstats(ark_mem, nniters, nnfails)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2925,8 +2925,8 @@ int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -2953,19 +2953,20 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumlinsolvsetups) { - return (ark_mem->step_getnumlinsolvsetups(arkode_mem, nlinsetups)); + return (ark_mem->step_getnumlinsolvsetups(ark_mem, nlinsetups)); } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support this function"); return (ARK_STEPPER_UNSUPPORTED); } @@ -3065,14 +3066,14 @@ int ARKodePrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) /* Print relaxation stats */ if (ark_mem->relax_enabled) { - retval = arkRelaxPrintAllStats(arkode_mem, outfile, fmt); + retval = arkRelaxPrintAllStats(ark_mem, outfile, fmt); if (retval != ARK_SUCCESS) { return (retval); } } /* Print stepper stats (if provided) */ if (ark_mem->step_printallstats) { - return (ark_mem->step_printallstats(arkode_mem, outfile, fmt)); + return (ark_mem->step_printallstats(ark_mem, outfile, fmt)); } return (ARK_SUCCESS); diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 63ab562f66..a9198a5c7a 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -35,7 +35,7 @@ /* Prototypes for internal functions */ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, SUNMatrix M, sunbooleantype jok, sunbooleantype* jcur, - sunrealtype gamma, void* user_data, N_Vector tmp1, + sunrealtype gamma, void* arkode_mem, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3); /*=============================================================== @@ -66,8 +66,8 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -189,7 +189,7 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) arkls_mem->jtsetup = NULL; arkls_mem->jtimes = arkLsDQJtimes; arkls_mem->Jt_data = ark_mem; - arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(arkode_mem); + arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(ark_mem); if (arkls_mem->Jt_f == NULL) { @@ -285,7 +285,7 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) else { arkls_mem->scalesol = SUNFALSE; } /* Attach ARKLs interface to time stepper module */ - retval = ark_mem->step_attachlinsol(arkode_mem, arkLsInitialize, arkLsSetup, + retval = ark_mem->step_attachlinsol(ark_mem, arkLsInitialize, arkLsSetup, arkLsSolve, arkLsFree, LSType, arkls_mem); if (retval != ARK_SUCCESS) { @@ -518,7 +518,7 @@ int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, if (iterative) { arkls_mem->nrmfac = SUNRsqrt(N_VGetLength(arkls_mem->x)); } /* Attach ARKLs interface to time stepper module */ - retval = ark_mem->step_attachmasssol(arkode_mem, arkLsMassInitialize, + retval = ark_mem->step_attachmasssol(ark_mem, arkLsMassInitialize, arkLsMassSetup, arkLsMTimes, arkLsMassSolve, arkLsMassFree, time_dep, LSType, arkls_mem); @@ -549,15 +549,15 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -600,8 +600,8 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -643,15 +643,15 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -672,15 +672,15 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -715,15 +715,15 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -743,15 +743,15 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -777,15 +777,15 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, SUNPSolveFn arkls_psolve; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -828,15 +828,15 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -863,7 +863,7 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, arkls_mem->jtsetup = NULL; arkls_mem->jtimes = arkLsDQJtimes; arkls_mem->Jt_data = ark_mem; - arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(arkode_mem); + arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(ark_mem); if (arkls_mem->Jt_f == NULL) { @@ -887,15 +887,15 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -911,7 +911,7 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) if (jtimesRhsFn != NULL) { arkls_mem->Jt_f = jtimesRhsFn; } else { - arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(arkode_mem); + arkls_mem->Jt_f = ark_mem->step_getimplicitrhs(ark_mem); if (arkls_mem->Jt_f == NULL) { @@ -931,15 +931,15 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -969,14 +969,13 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) } /* arkLSSetUserData sets user_data pointers in arkLS */ -int arkLSSetUserData(void* arkode_mem, void* user_data) +int arkLSSetUserData(ARKodeMem ark_mem, void* user_data) { - ARKodeMem ark_mem; ARKLsMem arkls_mem; int retval; /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); if (retval != ARKLS_SUCCESS) { return (retval); } /* Set data for Jacobian */ @@ -1004,15 +1003,15 @@ int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1027,15 +1026,15 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1050,15 +1049,15 @@ int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1079,15 +1078,15 @@ int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) long int lrw, liw; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1140,15 +1139,15 @@ int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1168,15 +1167,15 @@ int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1195,15 +1194,15 @@ int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1222,15 +1221,15 @@ int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1249,15 +1248,15 @@ int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1276,15 +1275,15 @@ int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1303,15 +1302,15 @@ int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1330,15 +1329,15 @@ int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1357,8 +1356,8 @@ int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1384,15 +1383,15 @@ int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_algebraic) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not require an algebraic solver"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); return (ARK_STEPPER_UNSUPPORTED); } @@ -1440,8 +1439,8 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1469,8 +1468,8 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1515,8 +1514,8 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, SUNPSolveFn arkls_mpsolve; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1566,8 +1565,8 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1613,14 +1612,13 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, } /* arkLSMassSetUserData sets user_data pointers in arkLSMass */ -int arkLSSetMassUserData(void* arkode_mem, void* user_data) +int arkLSSetMassUserData(ARKodeMem ark_mem, void* user_data) { - ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; /* access ARKLsMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); if (retval != ARKLS_SUCCESS) { return (retval); } /* Set data for mass matrix */ @@ -1645,8 +1643,8 @@ int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) long int lrw, liw; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1707,8 +1705,8 @@ int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1734,8 +1732,8 @@ int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1761,8 +1759,8 @@ int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1788,8 +1786,8 @@ int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1815,8 +1813,8 @@ int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1842,8 +1840,8 @@ int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1869,8 +1867,8 @@ int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1895,8 +1893,8 @@ int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1922,8 +1920,8 @@ int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure; set output value and return */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1949,8 +1947,8 @@ int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not support mass matrices */ @@ -1990,8 +1988,8 @@ int arkLsATimes(void* arkode_mem, N_Vector v, N_Vector z) sunrealtype gamma, gamrat; sunbooleantype dgamma_fail, *jcur; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Access mass matrix solver (if it exists) */ @@ -2049,8 +2047,8 @@ int arkLsPSetup(void* arkode_mem) sunbooleantype dgamma_fail, *jcur; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get gamma values from time step module */ @@ -2090,8 +2088,8 @@ int arkLsPSolve(void* arkode_mem, N_Vector r, N_Vector z, sunrealtype tol, int l sunbooleantype dgamma_fail, *jcur; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get gamma values from time step module */ @@ -2125,8 +2123,8 @@ int arkLsMTimes(void* arkode_mem, N_Vector v, N_Vector z) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* perform multiply by either calling the user-supplied routine @@ -2181,8 +2179,8 @@ int arkLsMPSetup(void* arkode_mem) ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* only proceed if the mass matrix is time-independent or if @@ -2212,8 +2210,8 @@ int arkLsMPSolve(void* arkode_mem, N_Vector r, N_Vector z, sunrealtype tol, int ARKLsMassMem arkls_mem; int retval; - /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMassMem structures */ + retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* call the user-supplied psolve routine, and accumulate count */ @@ -2237,8 +2235,8 @@ int arkLsDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, ARKRhsFn fi; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* verify that Jac is non-NULL */ @@ -2511,8 +2509,8 @@ int arkLsDQJtimes(N_Vector v, N_Vector Jv, sunrealtype t, N_Vector y, sunrealtype sig, siginv; int iter, retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Initialize perturbation to 1/||v|| */ @@ -2557,8 +2555,8 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, ARKLsMem arkls_mem; int retval; - /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + /* access ARKodeMem and ARKLsMem structures */ + retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); if (retval != ARKLS_SUCCESS) { return (retval); } /* Check if Jacobian needs to be updated */ @@ -2642,25 +2640,23 @@ static int arkLsLinSys(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix A, arkLsInitialize performs remaining initializations specific to the linear solver interface (and solver itself) ---------------------------------------------------------------*/ -int arkLsInitialize(void* arkode_mem) +int arkLsInitialize(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKLsMem arkls_mem; ARKLsMassMem arkls_massmem; int retval; /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* access ARKLsMassMem (if applicable) */ arkls_massmem = NULL; if (ark_mem->step_getmassmem != NULL) { - if (ark_mem->step_getmassmem(arkode_mem) != NULL) + if (ark_mem->step_getmassmem(ark_mem) != NULL) { - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, - &arkls_massmem); + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_massmem); if (retval != ARK_SUCCESS) { return (retval); } } } @@ -2801,13 +2797,13 @@ int arkLsInitialize(void* arkode_mem) if ((arkls_mem->A == NULL) && (arkls_mem->pset == NULL) && (ark_mem->step_disablelsetup != NULL)) { - ark_mem->step_disablelsetup(arkode_mem); + ark_mem->step_disablelsetup(ark_mem); } /* When using a matrix-embedded linear solver, disable lsetup call and solution scaling */ if (SUNLinSolGetType(arkls_mem->LS) == SUNLINEARSOLVER_MATRIX_EMBEDDED) { - ark_mem->step_disablelsetup(arkode_mem); + ark_mem->step_disablelsetup(ark_mem); arkls_mem->scalesol = SUNFALSE; } @@ -2829,11 +2825,10 @@ int arkLsInitialize(void* arkode_mem) This routine then calls the LS 'setup' routine with A. ---------------------------------------------------------------*/ -int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, +int arkLsSetup(ARKodeMem ark_mem, int convfail, sunrealtype tpred, N_Vector ypred, N_Vector fpred, sunbooleantype* jcurPtr, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3) { - ARKodeMem ark_mem = NULL; ARKLsMem arkls_mem = NULL; void* ark_step_massmem = NULL; SUNMatrix M = NULL; @@ -2842,7 +2837,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, int retval; /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Immediately return when using matrix-embedded linear solver */ @@ -2859,7 +2854,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, arkls_mem->fcur = fpred; /* get gamma values from time step module */ - arkls_mem->last_flag = ark_mem->step_getgammas(arkode_mem, &gamma, &gamrat, + arkls_mem->last_flag = ark_mem->step_getgammas(ark_mem, &gamma, &gamrat, &jcur, &dgamma_fail); if (arkls_mem->last_flag) { @@ -2880,7 +2875,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, /* Check for mass matrix module and setup mass matrix */ if (ark_mem->step_getmassmem) { - ark_step_massmem = ark_mem->step_getmassmem(arkode_mem); + ark_step_massmem = ark_mem->step_getmassmem(ark_mem); } if (ark_step_massmem) @@ -2889,8 +2884,7 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, M = ((ARKLsMassMem)ark_step_massmem)->M; /* Setup mass matrix linear solver (including recomputation of mass matrix) */ - arkls_mem->last_flag = arkLsMassSetup(arkode_mem, tpred, vtemp1, vtemp2, - vtemp3); + arkls_mem->last_flag = arkLsMassSetup(ark_mem, tpred, vtemp1, vtemp2, vtemp3); if (arkls_mem->last_flag) { arkProcessError(ark_mem, ARKLS_SUNMAT_FAIL, __LINE__, __func__, __FILE__, @@ -2973,11 +2967,10 @@ int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, When using a non-NULL SUNMatrix, this will additionally scale the solution appropriately when gamrat != 1. ---------------------------------------------------------------*/ -int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, +int arkLsSolve(ARKodeMem ark_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, N_Vector fnow, sunrealtype eRNrm, int mnewt) { sunrealtype bnorm, resnorm; - ARKodeMem ark_mem; ARKLsMem arkls_mem; sunrealtype gamma, gamrat, delta, deltar, rwt_mean; sunbooleantype dgamma_fail, *jcur; @@ -2985,7 +2978,7 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, int nli_inc, retval; /* access ARKLsMem structure */ - retval = arkLs_AccessLMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set scalar tcur and vectors ycur and fcur for use by the @@ -3079,7 +3072,7 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, account for change in gamma (this is only beneficial if M==I) */ if (arkls_mem->scalesol) { - arkls_mem->last_flag = ark_mem->step_getgammas(arkode_mem, &gamma, &gamrat, + arkls_mem->last_flag = ark_mem->step_getgammas(ark_mem, &gamma, &gamrat, &jcur, &dgamma_fail); if (arkls_mem->last_flag != ARK_SUCCESS) { @@ -3169,16 +3162,14 @@ int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tnow, N_Vector ynow, arkLsFree frees memory associates with the ARKLs system solver interface. ---------------------------------------------------------------*/ -int arkLsFree(void* arkode_mem) +int arkLsFree(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKLsMem arkls_mem; void* ark_step_lmem; /* Return immediately if ARKodeMem, ARKLsMem are NULL */ - if (arkode_mem == NULL) { return (ARKLS_SUCCESS); } - ark_mem = (ARKodeMem)arkode_mem; - ark_step_lmem = ark_mem->step_getlinmem(arkode_mem); + if (ark_mem == NULL) { return (ARKLS_SUCCESS); } + ark_step_lmem = ark_mem->step_getlinmem(ark_mem); if (ark_step_lmem == NULL) { return (ARKLS_SUCCESS); } arkls_mem = (ARKLsMem)ark_step_lmem; @@ -3221,14 +3212,13 @@ int arkLsFree(void* arkode_mem) arkLsMassInitialize performs remaining initializations specific to the mass matrix solver interface (and solver itself) ---------------------------------------------------------------*/ -int arkLsMassInitialize(void* arkode_mem) +int arkLsMassInitialize(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKLsMassMem arkls_mem; int retval; /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* reset counters */ @@ -3280,13 +3270,13 @@ int arkLsMassInitialize(void* arkode_mem) if ((arkls_mem->M == NULL) && (arkls_mem->pset == NULL) && (arkls_mem->mtsetup == NULL) && (ark_mem->step_disablemsetup != NULL)) { - ark_mem->step_disablemsetup(arkode_mem); + ark_mem->step_disablemsetup(ark_mem); } /* When using a matrix-embedded linear solver, disable lsetup call */ if (SUNLinSolGetType(arkls_mem->LS) == SUNLINEARSOLVER_MATRIX_EMBEDDED) { - ark_mem->step_disablemsetup(arkode_mem); + ark_mem->step_disablemsetup(ark_mem); } /* Call LS initialize routine */ @@ -3297,16 +3287,15 @@ int arkLsMassInitialize(void* arkode_mem) /*--------------------------------------------------------------- arkLsMassSetup calls the LS 'setup' routine. ---------------------------------------------------------------*/ -int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, +int arkLsMassSetup(ARKodeMem ark_mem, sunrealtype t, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3) { - ARKodeMem ark_mem; ARKLsMassMem arkls_mem; sunbooleantype call_mtsetup, call_mvsetup, call_lssetup; int retval; /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Immediately return when using matrix-embedded linear solver */ @@ -3451,16 +3440,15 @@ int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, and scaling vectors, calling the solver, and accumulating statistics from the solve for use/reporting by ARKODE. ---------------------------------------------------------------*/ -int arkLsMassSolve(void* arkode_mem, N_Vector b, sunrealtype nlscoef) +int arkLsMassSolve(ARKodeMem ark_mem, N_Vector b, sunrealtype nlscoef) { sunrealtype resnorm, delta, rwt_mean; - ARKodeMem ark_mem; ARKLsMassMem arkls_mem; long int nps_inc; int nli_inc, retval; /* access ARKLsMassMem structure */ - retval = arkLs_AccessMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set input tolerance for iterative solvers (in 2-norm) */ @@ -3596,16 +3584,14 @@ int arkLsMassSolve(void* arkode_mem, N_Vector b, sunrealtype nlscoef) arkLsMassFree frees memory associates with the ARKLs mass matrix solver interface. ---------------------------------------------------------------*/ -int arkLsMassFree(void* arkode_mem) +int arkLsMassFree(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKLsMassMem arkls_mem; void* ark_step_massmem; /* Return immediately if ARKodeMem, ARKLsMassMem are NULL */ - if (arkode_mem == NULL) { return (ARKLS_SUCCESS); } - ark_mem = (ARKodeMem)arkode_mem; - ark_step_massmem = ark_mem->step_getmassmem(arkode_mem); + if (ark_mem == NULL) { return (ARKLS_SUCCESS); } + ark_step_massmem = ark_mem->step_getmassmem(ark_mem); if (ark_step_massmem == NULL) { return (ARKLS_SUCCESS); } arkls_mem = (ARKLsMassMem)ark_step_massmem; @@ -3691,14 +3677,16 @@ int arkLsInitializeMassCounters(ARKLsMassMem arkls_mem) } /*--------------------------------------------------------------- - arkLs_AccessLMem and arkLs_AccessMassMem: + arkLs_AccessARKODELMem, arkLs_AccessLMem, + arkLs_AccessARKODEMassMem and arkLs_AccessMassMem: Shortcut routines to unpack ark_mem, ls_mem and mass_mem - structures from void* pointer. If any is missing it returns - ARKLS_MEM_NULL, ARKLS_LMEM_NULL or ARKLS_MASSMEM_NULL. + structures from void* pointer and ark_mem structure. If any + is missing it returns ARKLS_MEM_NULL, ARKLS_LMEM_NULL or + ARKLS_MASSMEM_NULL. ---------------------------------------------------------------*/ -int arkLs_AccessLMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, - ARKLsMem* arkls_mem) +int arkLs_AccessARKODELMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKLsMem* arkls_mem) { void* ark_step_lmem; if (arkode_mem == NULL) @@ -3708,7 +3696,7 @@ int arkLs_AccessLMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, return (ARKLS_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; - ark_step_lmem = (*ark_mem)->step_getlinmem(arkode_mem); + ark_step_lmem = (*ark_mem)->step_getlinmem(*ark_mem); if (ark_step_lmem == NULL) { arkProcessError(*ark_mem, ARKLS_LMEM_NULL, __LINE__, fname, __FILE__, @@ -3719,8 +3707,22 @@ int arkLs_AccessLMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, return (ARKLS_SUCCESS); } -int arkLs_AccessMassMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, - ARKLsMassMem* arkls_mem) +int arkLs_AccessLMem(ARKodeMem ark_mem, const char* fname, ARKLsMem* arkls_mem) +{ + void* ark_step_lmem; + ark_step_lmem = ark_mem->step_getlinmem(ark_mem); + if (ark_step_lmem == NULL) + { + arkProcessError(ark_mem, ARKLS_LMEM_NULL, __LINE__, fname, __FILE__, + MSG_LS_LMEM_NULL); + return (ARKLS_LMEM_NULL); + } + *arkls_mem = (ARKLsMem)ark_step_lmem; + return (ARKLS_SUCCESS); +} + +int arkLs_AccessARKODEMassMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKLsMassMem* arkls_mem) { void* ark_step_massmem; if (arkode_mem == NULL) @@ -3730,7 +3732,7 @@ int arkLs_AccessMassMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, return (ARKLS_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; - ark_step_massmem = (*ark_mem)->step_getmassmem(arkode_mem); + ark_step_massmem = (*ark_mem)->step_getmassmem(*ark_mem); if (ark_step_massmem == NULL) { arkProcessError(*ark_mem, ARKLS_MASSMEM_NULL, __LINE__, fname, __FILE__, @@ -3741,6 +3743,21 @@ int arkLs_AccessMassMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, return (ARKLS_SUCCESS); } +int arkLs_AccessMassMem(ARKodeMem ark_mem, const char* fname, + ARKLsMassMem* arkls_mem) +{ + void* ark_step_massmem; + ark_step_massmem = ark_mem->step_getmassmem(ark_mem); + if (ark_step_massmem == NULL) + { + arkProcessError(ark_mem, ARKLS_MASSMEM_NULL, __LINE__, fname, __FILE__, + MSG_LS_MASSMEM_NULL); + return (ARKLS_MASSMEM_NULL); + } + *arkls_mem = (ARKLsMassMem)ark_step_massmem; + return (ARKLS_SUCCESS); +} + /*--------------------------------------------------------------- EOF ---------------------------------------------------------------*/ diff --git a/src/arkode/arkode_ls_impl.h b/src/arkode/arkode_ls_impl.h index c13797391e..21c869536e 100644 --- a/src/arkode/arkode_ls_impl.h +++ b/src/arkode/arkode_ls_impl.h @@ -217,51 +217,56 @@ int arkLsBandDQJac(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, N_Vector tmp1, N_Vector tmp2); /* Generic linit/lsetup/lsolve/lfree interface routines for ARKODE to call */ -int arkLsInitialize(void* arkode_mem); +int arkLsInitialize(ARKodeMem ark_mem); -int arkLsSetup(void* arkode_mem, int convfail, sunrealtype tpred, +int arkLsSetup(ARKodeMem ark_mem, int convfail, sunrealtype tpred, N_Vector ypred, N_Vector fpred, sunbooleantype* jcurPtr, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3); -int arkLsSolve(void* arkode_mem, N_Vector b, sunrealtype tcur, N_Vector ycur, +int arkLsSolve(ARKodeMem ark_mem, N_Vector b, sunrealtype tcur, N_Vector ycur, N_Vector fcur, sunrealtype eRnrm, int mnewt); -int arkLsFree(void* arkode_mem); +int arkLsFree(ARKodeMem ark_mem); /* Generic minit/msetup/mmult/msolve/mfree routines for ARKODE to call */ -int arkLsMassInitialize(void* arkode_mem); +int arkLsMassInitialize(ARKodeMem ark_mem); -int arkLsMassSetup(void* arkode_mem, sunrealtype t, N_Vector vtemp1, +int arkLsMassSetup(ARKodeMem ark_mem, sunrealtype t, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3); int arkLsMassMult(void* arkode_mem, N_Vector v, N_Vector Mv); -int arkLsMassSolve(void* arkode_mem, N_Vector b, sunrealtype nlscoef); +int arkLsMassSolve(ARKodeMem ark_mem, N_Vector b, sunrealtype nlscoef); -int arkLsMassFree(void* arkode_mem); +int arkLsMassFree(ARKodeMem ark_mem); /* Auxilliary functions */ int arkLsInitializeCounters(ARKLsMem arkls_mem); int arkLsInitializeMassCounters(ARKLsMassMem arkls_mem); -int arkLs_AccessLMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, - ARKLsMem* arkls_mem); +int arkLs_AccessARKODELMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKLsMem* arkls_mem); -int arkLs_AccessMassMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, +int arkLs_AccessLMem(ARKodeMem ark_mem, const char* fname, ARKLsMem* arkls_mem); + +int arkLs_AccessARKODEMassMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKLsMassMem* arkls_mem); + +int arkLs_AccessMassMem(ARKodeMem ark_mem, const char* fname, ARKLsMassMem* arkls_mem); /* Set/get routines called by time-stepper module */ -int arkLSSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); +int arkLSSetLinearSolver(ARKodeMem ark_mem, SUNLinearSolver LS, SUNMatrix A); -int arkLSSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, +int arkLSSetMassLinearSolver(ARKodeMem ark_mem, SUNLinearSolver LS, SUNMatrix M, sunbooleantype time_dep); -int arkLSSetUserData(void* arkode_mem, void* user_data); +int arkLSSetUserData(ARKodeMem ark_mem, void* user_data); -int arkLSSetMassUserData(void* arkode_mem, void* user_data); +int arkLSSetMassUserData(ARKodeMem ark_mem, void* user_data); -int arkLSGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); +int arkLSGetCurrentMassMatrix(ARKodeMem ark_mem, SUNMatrix* M); /*--------------------------------------------------------------- Error Messages diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 3bc477e217..8485b85eb7 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -252,17 +252,16 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, This routine resizes the memory within the MRIStep module. ---------------------------------------------------------------*/ -int mriStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int mriStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; SUNNonlinearSolver NLS; sunindextype lrw1, liw1, lrw_diff, liw_diff; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determine change in vector sizes */ @@ -395,8 +394,8 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, SUNNonlinearSolver NLS; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ @@ -481,14 +480,13 @@ int MRIStepReInit(void* arkode_mem, ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, values are retained). It is called after the main ARKODE infrastructure is reset. ---------------------------------------------------------------*/ -int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) +int mriStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Reset the inner integrator with this same state */ @@ -503,14 +501,13 @@ int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) Computes y based on the current prediction and given correction. ---------------------------------------------------------------*/ -int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) +int mriStep_ComputeState(ARKodeMem ark_mem, N_Vector zcor, N_Vector z) { int retval; - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } N_VLinearSum(ONE, step_mem->zpred, ONE, zcor, z); @@ -521,17 +518,15 @@ int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) /*--------------------------------------------------------------- mriStep_Free frees all MRIStep memory. ---------------------------------------------------------------*/ -void mriStep_Free(void* arkode_mem) +void mriStep_Free(ARKodeMem ark_mem) { sunindextype Cliw, Clrw; - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; - /* nothing to do if arkode_mem is already NULL */ - if (arkode_mem == NULL) { return; } + /* nothing to do if ark_mem is already NULL */ + if (ark_mem == NULL) { return; } /* conditional frees on non-NULL MRIStep module */ - ark_mem = (ARKodeMem)arkode_mem; if (ark_mem->step_mem != NULL) { step_mem = (ARKodeMRIStepMem)ark_mem->step_mem; @@ -644,14 +639,13 @@ void mriStep_Free(void* arkode_mem) This routine outputs the memory from the MRIStep structure to a specified file pointer (useful when debugging). ---------------------------------------------------------------*/ -void mriStep_PrintMem(void* arkode_mem, FILE* outfile) +void mriStep_PrintMem(ARKodeMem ark_mem, FILE* outfile) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int i, retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return; } /* output integer quantities */ @@ -755,21 +749,20 @@ void mriStep_PrintMem(void* arkode_mem, FILE* outfile) interface routines, data structure, and solver type to the MRIStep module. ---------------------------------------------------------------*/ -int mriStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, +int mriStep_AttachLinsol(ARKodeMem ark_mem, ARKLinsolInitFn linit, ARKLinsolSetupFn lsetup, ARKLinsolSolveFn lsolve, ARKLinsolFreeFn lfree, SUNLinearSolver_Type lsolve_type, void* lmem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* free any existing system solver */ - if (step_mem->lfree != NULL) { step_mem->lfree(arkode_mem); } + if (step_mem->lfree != NULL) { step_mem->lfree(ark_mem); } /* Attach the provided routines, data structure and solve type */ step_mem->linit = linit; @@ -791,14 +784,13 @@ int mriStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, This routine NULLifies the lsetup function pointer in the MRIStep module. ---------------------------------------------------------------*/ -void mriStep_DisableLSetup(void* arkode_mem) +void mriStep_DisableLSetup(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return; } /* nullify the lsetup function pointer */ @@ -811,14 +803,13 @@ void mriStep_DisableLSetup(void* arkode_mem) This routine returns the system linear solver interface memory structure, lmem. ---------------------------------------------------------------*/ -void* mriStep_GetLmem(void* arkode_mem) +void* mriStep_GetLmem(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure, and return lmem */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } return (step_mem->lmem); } @@ -828,14 +819,13 @@ void* mriStep_GetLmem(void* arkode_mem) This routine returns the implicit RHS function pointer, fi. ---------------------------------------------------------------*/ -ARKRhsFn mriStep_GetImplicitRHS(void* arkode_mem) +ARKRhsFn mriStep_GetImplicitRHS(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure, and return fi */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (NULL); } if (step_mem->implicit_rhs) { return (step_mem->fsi); } else { return (NULL); } @@ -847,15 +837,14 @@ ARKRhsFn mriStep_GetImplicitRHS(void* arkode_mem) This routine fills the current value of gamma, and states whether the gamma ratio fails the dgmax criteria. ---------------------------------------------------------------*/ -int mriStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, +int mriStep_GetGammas(ARKodeMem ark_mem, sunrealtype* gamma, sunrealtype* gamrat, sunbooleantype** jcur, sunbooleantype* dgamma_fail) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set outputs */ @@ -881,15 +870,14 @@ int mriStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, With other initialization types, this routine does nothing. ---------------------------------------------------------------*/ -int mriStep_Init(void* arkode_mem, int init_type) +int mriStep_Init(ARKodeMem ark_mem, int init_type) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval, j; sunbooleantype reset_efun; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -1181,15 +1169,14 @@ int mriStep_Init(void* arkode_mem, int init_type) Presently ff(t,y) is always called with ARK_FULLRHS_OTHER mode. ----------------------------------------------------------------------------*/ -int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int mriStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* ensure that inner stepper provides fullrhs function */ @@ -1420,9 +1407,8 @@ int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, reduce step and retry (if possible) <0 => step encountered unrecoverable failure ---------------------------------------------------------------*/ -int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) +int mriStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) { - ARKodeMem ark_mem; /* outer ARKODE memory */ ARKodeMRIStepMem step_mem; /* outer stepper memory */ int is; /* current stage index */ int retval; /* reusable return flag */ @@ -1433,7 +1419,7 @@ int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) *dsmPtr = ZERO; /* access the MRIStep mem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* call nonlinear solver setup if it exists */ @@ -1639,13 +1625,13 @@ int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) ---------------------------------------------------------------*/ /*--------------------------------------------------------------- - mriStep_AccessStepMem: + mriStep_AccessARKODEStepMem: Shortcut routine to unpack ark_mem and step_mem structures from void* pointer. If either is missing it returns ARK_MEM_NULL. ---------------------------------------------------------------*/ -int mriStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeMRIStepMem* step_mem) +int mriStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeMRIStepMem* step_mem) { /* access ARKodeMem structure */ if (arkode_mem == NULL) @@ -1655,6 +1641,8 @@ int mriStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; + + /* access ARKodeMRIStepMem structure */ if ((*ark_mem)->step_mem == NULL) { arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, @@ -1665,6 +1653,26 @@ int mriStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_SUCCESS); } +/*--------------------------------------------------------------- + mriStep_AccessStepMem: + + Shortcut routine to unpack step_mem structure from ark_mem. + If missing it returns ARK_MEM_NULL. + ---------------------------------------------------------------*/ +int mriStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeMRIStepMem* step_mem) +{ + /* access ARKodeMRIStepMem structure */ + if (ark_mem->step_mem == NULL) + { + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_MRISTEP_NO_MEM); + return (ARK_MEM_NULL); + } + *step_mem = (ARKodeMRIStepMem)ark_mem->step_mem; + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- mriStep_CheckNVector: diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index 4db2c5f9ee..f875810246 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -186,57 +186,59 @@ struct _MRIStepInnerStepper ===============================================================*/ /* Interface routines supplied to ARKODE */ -int mriStep_AttachLinsol(void* arkode_mem, ARKLinsolInitFn linit, +int mriStep_AttachLinsol(ARKodeMem ark_mem, ARKLinsolInitFn linit, ARKLinsolSetupFn lsetup, ARKLinsolSolveFn lsolve, ARKLinsolFreeFn lfree, SUNLinearSolver_Type lsolve_type, void* lmem); -void mriStep_DisableLSetup(void* arkode_mem); -int mriStep_Init(void* arkode_mem, int init_type); -void* mriStep_GetLmem(void* arkode_mem); -ARKRhsFn mriStep_GetImplicitRHS(void* arkode_mem); -int mriStep_GetGammas(void* arkode_mem, sunrealtype* gamma, sunrealtype* gamrat, +void mriStep_DisableLSetup(ARKodeMem ark_mem); +int mriStep_Init(ARKodeMem ark_mem, int init_type); +void* mriStep_GetLmem(ARKodeMem ark_mem); +ARKRhsFn mriStep_GetImplicitRHS(ARKodeMem ark_mem); +int mriStep_GetGammas(ARKodeMem ark_mem, sunrealtype* gamma, sunrealtype* gamrat, sunbooleantype** jcur, sunbooleantype* dgamma_fail); -int mriStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int mriStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); -int mriStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); -int mriStep_SetUserData(void* arkode_mem, void* user_data); -int mriStep_SetDefaults(void* arkode_mem); -int mriStep_SetOrder(void* arkode_mem, int ord); -int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); -int mriStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); -int mriStep_SetLinear(void* arkode_mem, int timedepend); -int mriStep_SetNonlinear(void* arkode_mem); -int mriStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -int mriStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -int mriStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -int mriStep_SetLSetupFrequency(void* arkode_mem, int msbp); -int mriStep_SetPredictorMethod(void* arkode_mem, int pred_method); -int mriStep_SetMaxNonlinIters(void* arkode_mem, int maxcor); -int mriStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); -int mriStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -int mriStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); -int mriStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -int mriStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, +int mriStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr); +int mriStep_SetUserData(ARKodeMem ark_mem, void* user_data); +int mriStep_SetDefaults(ARKodeMem ark_mem); +int mriStep_SetOrder(ARKodeMem ark_mem, int ord); +int mriStep_SetNonlinearSolver(ARKodeMem ark_mem, SUNNonlinearSolver NLS); +int mriStep_SetNlsRhsFn(ARKodeMem ark_mem, ARKRhsFn nls_fi); +int mriStep_SetLinear(ARKodeMem ark_mem, int timedepend); +int mriStep_SetNonlinear(ARKodeMem ark_mem); +int mriStep_SetNonlinCRDown(ARKodeMem ark_mem, sunrealtype crdown); +int mriStep_SetNonlinRDiv(ARKodeMem ark_mem, sunrealtype rdiv); +int mriStep_SetDeltaGammaMax(ARKodeMem ark_mem, sunrealtype dgmax); +int mriStep_SetLSetupFrequency(ARKodeMem ark_mem, int msbp); +int mriStep_SetPredictorMethod(ARKodeMem ark_mem, int pred_method); +int mriStep_SetMaxNonlinIters(ARKodeMem ark_mem, int maxcor); +int mriStep_SetNonlinConvCoef(ARKodeMem ark_mem, sunrealtype nlscoef); +int mriStep_SetStagePredictFn(ARKodeMem ark_mem, ARKStagePredictFn PredictStage); +int mriStep_SetDeduceImplicitRhs(ARKodeMem ark_mem, sunbooleantype deduce); +int mriStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma); +int mriStep_GetNonlinearSystemData(ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* Fi, sunrealtype* gamma, N_Vector* sdata, void** user_data); -int mriStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); -int mriStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters); -int mriStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); -int mriStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, +int mriStep_GetNumLinSolvSetups(ARKodeMem ark_mem, long int* nlinsetups); +int mriStep_GetNumNonlinSolvIters(ARKodeMem ark_mem, long int* nniters); +int mriStep_GetNumNonlinSolvConvFails(ARKodeMem ark_mem, long int* nnfails); +int mriStep_GetNonlinSolvStats(ARKodeMem ark_mem, long int* nniters, long int* nnfails); -int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -int mriStep_WriteParameters(void* arkode_mem, FILE* fp); -int mriStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); -int mriStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int mriStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt); +int mriStep_WriteParameters(ARKodeMem ark_mem, FILE* fp); +int mriStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR); +int mriStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -int mriStep_ComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -void mriStep_Free(void* arkode_mem); -void mriStep_PrintMem(void* arkode_mem, FILE* outfile); +int mriStep_ComputeState(ARKodeMem ark_mem, N_Vector zcor, N_Vector z); +void mriStep_Free(ARKodeMem ark_mem); +void mriStep_PrintMem(ARKodeMem ark_mem, FILE* outfile); /* Internal utility routines */ -int mriStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeMRIStepMem* step_mem); +int mriStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeMRIStepMem* step_mem); +int mriStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeMRIStepMem* step_mem); sunbooleantype mriStep_CheckNVector(N_Vector tmpl); int mriStep_SetCoupling(ARKodeMem ark_mem); int mriStep_CheckCoupling(ARKodeMem ark_mem); diff --git a/src/arkode/arkode_mristep_io.c b/src/arkode/arkode_mristep_io.c index e7267cfe02..a17e98c910 100644 --- a/src/arkode/arkode_mristep_io.c +++ b/src/arkode/arkode_mristep_io.c @@ -470,20 +470,19 @@ char* MRIStepGetLinReturnFlagName(long int flag) MRIStep optional input functions -- stepper-specific ===============================================================*/ -int mriStep_SetUserData(void* arkode_mem, void* user_data) +int mriStep_SetUserData(ARKodeMem ark_mem, void* user_data) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set user data in ARKODELS mem */ if (step_mem->lmem != NULL) { - retval = arkLSSetUserData(arkode_mem, user_data); + retval = arkLSSetUserData(ark_mem, user_data); if (retval != ARKLS_SUCCESS) { return (retval); } } @@ -497,14 +496,13 @@ int mriStep_SetUserData(void* arkode_mem, void* user_data) Does not change problem-defining function pointers or user_data pointer. ---------------------------------------------------------------*/ -int mriStep_SetDefaults(void* arkode_mem) +int mriStep_SetDefaults(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set default values for integrator optional inputs */ @@ -545,14 +543,13 @@ int mriStep_SetDefaults(void* arkode_mem) using an iterative linear solver this flag denotes time dependence of the preconditioner. ---------------------------------------------------------------*/ -int mriStep_SetLinear(void* arkode_mem, int timedepend) +int mriStep_SetLinear(ARKodeMem ark_mem, int timedepend) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -571,14 +568,13 @@ int mriStep_SetLinear(void* arkode_mem, int timedepend) mriStep_SetLinear. Automatically loosens DeltaGammaMax back to default value. ---------------------------------------------------------------*/ -int mriStep_SetNonlinear(void* arkode_mem) +int mriStep_SetNonlinear(ARKodeMem ark_mem) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameters */ @@ -594,15 +590,14 @@ int mriStep_SetNonlinear(void* arkode_mem) Specifies the method order ---------------------------------------------------------------*/ -int mriStep_SetOrder(void* arkode_mem, int ord) +int mriStep_SetOrder(ARKodeMem ark_mem, int ord) { int retval; - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; sunindextype Tlrw, Tliw; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval) { return (retval); } /* check for illegal inputs */ @@ -635,8 +630,8 @@ int MRIStepSetCoupling(void* arkode_mem, MRIStepCoupling MRIC) ARKodeMRIStepMem step_mem; sunindextype Tlrw, Tliw; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check for illegal inputs */ @@ -688,8 +683,8 @@ int MRIStepSetPreInnerFn(void* arkode_mem, MRIStepPreInnerFn prefn) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set pre inner evolve function */ @@ -709,8 +704,8 @@ int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Set pre inner evolve function */ @@ -726,14 +721,13 @@ int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn) crdown. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int mriStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) +int mriStep_SetNonlinCRDown(ARKodeMem ark_mem, sunrealtype crdown) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -750,14 +744,13 @@ int mriStep_SetNonlinCRDown(void* arkode_mem, sunrealtype crdown) rdiv. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int mriStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) +int mriStep_SetNonlinRDiv(ARKodeMem ark_mem, sunrealtype rdiv) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -774,14 +767,13 @@ int mriStep_SetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) dgmax. Legal values are strictly positive; illegal values imply a reset to the default. ---------------------------------------------------------------*/ -int mriStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) +int mriStep_SetDeltaGammaMax(ARKodeMem ark_mem, sunrealtype dgmax) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -799,14 +791,13 @@ int mriStep_SetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) negative values imply recomputation of lsetup at each nonlinear solve; a zero value implies a reset to the default. ---------------------------------------------------------------*/ -int mriStep_SetLSetupFrequency(void* arkode_mem, int msbp) +int mriStep_SetLSetupFrequency(ARKodeMem ark_mem, int msbp) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if argument legal set it, otherwise set default */ @@ -823,14 +814,13 @@ int mriStep_SetLSetupFrequency(void* arkode_mem, int msbp) Non-default choices are {1,2,3,4}, all others will use default (trivial) predictor. ---------------------------------------------------------------*/ -int mriStep_SetPredictorMethod(void* arkode_mem, int pred_method) +int mriStep_SetPredictorMethod(ARKodeMem ark_mem, int pred_method) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set parameter */ @@ -846,14 +836,13 @@ int mriStep_SetPredictorMethod(void* arkode_mem, int pred_method) one solve. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int mriStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) +int mriStep_SetMaxNonlinIters(ARKodeMem ark_mem, int maxcor) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return error message if no NLS module is present */ @@ -886,14 +875,13 @@ int mriStep_SetMaxNonlinIters(void* arkode_mem, int maxcor) Specifies the coefficient in the nonlinear solver convergence test. A non-positive input implies a reset to the default value. ---------------------------------------------------------------*/ -int mriStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) +int mriStep_SetNonlinConvCoef(ARKodeMem ark_mem, sunrealtype nlscoef) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* argument <= 0 sets default, otherwise set input */ @@ -908,14 +896,13 @@ int mriStep_SetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) predictor function having type ARKStagePredictFn. A NULL input function disables calls to this routine. ---------------------------------------------------------------*/ -int mriStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) +int mriStep_SetStagePredictFn(ARKodeMem ark_mem, ARKStagePredictFn PredictStage) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure and set function pointer */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->stage_predict = PredictStage; @@ -934,14 +921,13 @@ int mriStep_SetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) fi(z_i), and SUNFALSE indicates that fi(z_i) is computed with an additional evaluation of fi. ---------------------------------------------------------------*/ -int mriStep_SetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) +int mriStep_SetDeduceImplicitRhs(ARKodeMem ark_mem, sunbooleantype deduce) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure and set function pointer */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->deduce_rhs = deduce; @@ -963,8 +949,8 @@ int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get the last return value from the inner stepper */ @@ -976,12 +962,11 @@ int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag) /*--------------------------------------------------------------- mriStep_GetCurrentGamma: Returns the current value of gamma ---------------------------------------------------------------*/ -int mriStep_GetCurrentGamma(void* arkode_mem, sunrealtype* gamma) +int mriStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma) { int retval; - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *gamma = step_mem->gamma; return (retval); @@ -999,8 +984,8 @@ int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get number of fse and fsi evals from step_mem */ @@ -1015,14 +1000,13 @@ int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, Returns the current number of calls to the lsetup routine ---------------------------------------------------------------*/ -int mriStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) +int mriStep_GetNumLinSolvSetups(ARKodeMem ark_mem, long int* nlinsetups) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get value from step_mem */ @@ -1036,14 +1020,13 @@ int mriStep_GetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) Returns the current number of nonlinear solver iterations ---------------------------------------------------------------*/ -int mriStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) +int mriStep_GetNumNonlinSolvIters(ARKodeMem ark_mem, long int* nniters) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -1056,14 +1039,13 @@ int mriStep_GetNumNonlinSolvIters(void* arkode_mem, long int* nniters) Returns the current number of nonlinear solver convergence fails ---------------------------------------------------------------*/ -int mriStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) +int mriStep_GetNumNonlinSolvConvFails(ARKodeMem ark_mem, long int* nnfails) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set output from step_mem */ @@ -1077,15 +1059,14 @@ int mriStep_GetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) Returns nonlinear solver statistics ---------------------------------------------------------------*/ -int mriStep_GetNonlinSolvStats(void* arkode_mem, long int* nniters, +int mriStep_GetNonlinSolvStats(ARKodeMem ark_mem, long int* nniters, long int* nnfails) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nniters = step_mem->nls_iters; @@ -1105,8 +1086,8 @@ int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling* MRIC) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get coupling structure from step_mem */ @@ -1120,15 +1101,14 @@ int MRIStepGetCurrentCoupling(void* arkode_mem, MRIStepCoupling* MRIC) Prints integrator statistics ---------------------------------------------------------------*/ -int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int mriStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; ARKLsMem arkls_mem; int retval; /* access ARKode MRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } switch (fmt) @@ -1149,9 +1129,9 @@ int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) /* linear solver stats */ fprintf(outfile, "LS setups = %ld\n", step_mem->nsetups); - if (ark_mem->step_getlinmem(arkode_mem)) + if (ark_mem->step_getlinmem(ark_mem)) { - arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(arkode_mem)); + arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(ark_mem)); fprintf(outfile, "Jac fn evals = %ld\n", arkls_mem->nje); fprintf(outfile, "LS RHS fn evals = %ld\n", arkls_mem->nfeDQ); fprintf(outfile, "Prec setup evals = %ld\n", arkls_mem->npe); @@ -1191,9 +1171,9 @@ int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) /* linear solver stats */ fprintf(outfile, ",LS setups,%ld", step_mem->nsetups); - if (ark_mem->step_getlinmem(arkode_mem)) + if (ark_mem->step_getlinmem(ark_mem)) { - arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(arkode_mem)); + arkls_mem = (ARKLsMem)(ark_mem->step_getlinmem(ark_mem)); fprintf(outfile, ",Jac fn evals,%ld", arkls_mem->nje); fprintf(outfile, ",LS RHS fn evals,%ld", arkls_mem->nfeDQ); fprintf(outfile, ",Prec setup evals,%ld", arkls_mem->npe); @@ -1239,14 +1219,13 @@ int mriStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int mriStep_WriteParameters(void* arkode_mem, FILE* fp) +int mriStep_WriteParameters(ARKodeMem ark_mem, FILE* fp) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* print integrator parameters to file */ @@ -1300,8 +1279,8 @@ int MRIStepWriteCoupling(void* arkode_mem, FILE* fp) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* check that coupling structure is non-NULL (otherwise report error) */ diff --git a/src/arkode/arkode_mristep_nls.c b/src/arkode/arkode_mristep_nls.c index a309894170..aeb450b95a 100644 --- a/src/arkode/arkode_mristep_nls.c +++ b/src/arkode/arkode_mristep_nls.c @@ -33,14 +33,13 @@ This routine attaches a SUNNonlinearSolver object to the MRIStep module. ---------------------------------------------------------------*/ -int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) +int mriStep_SetNonlinearSolver(ARKodeMem ark_mem, SUNNonlinearSolver NLS) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Return immediately if NLS input is NULL */ @@ -94,7 +93,7 @@ int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) /* set convergence test function */ retval = SUNNonlinSolSetConvTestFn(step_mem->NLS, mriStep_NlsConvTest, - arkode_mem); + (void*)ark_mem); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -135,14 +134,13 @@ int mriStep_SetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) right-hand side function to use in the evaluation of nonlinear system functions. ---------------------------------------------------------------*/ -int mriStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) +int mriStep_SetNlsRhsFn(ARKodeMem ark_mem, ARKRhsFn nls_fsi) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (nls_fsi) { step_mem->nls_fsi = nls_fsi; } @@ -157,17 +155,16 @@ int mriStep_SetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fsi) This routine provides access to the relevant data needed to compute the nonlinear system function. ---------------------------------------------------------------*/ -int mriStep_GetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, +int mriStep_GetNonlinearSystemData(ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* F, sunrealtype* gamma, N_Vector* sdata, void** user_data) { - ARKodeMem ark_mem; ARKodeMRIStepMem step_mem; int retval; /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = mriStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *tcur = ark_mem->tcur; @@ -372,8 +369,8 @@ int mriStep_NlsLSetup(sunbooleantype jbad, sunbooleantype* jcur, void* arkode_me ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update convfail based on jbad flag */ @@ -415,8 +412,8 @@ int mriStep_NlsLSolve(N_Vector b, void* arkode_mem) ARKodeMRIStepMem step_mem; int retval, nonlin_iter; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* retrieve nonlinear solver iteration from module */ @@ -462,8 +459,8 @@ int mriStep_NlsResidual(N_Vector zcor, N_Vector r, void* arkode_mem) sunrealtype c[3]; N_Vector X[3]; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -517,8 +514,8 @@ int mriStep_NlsFPFunction(N_Vector zcor, N_Vector g, void* arkode_mem) ARKodeMRIStepMem step_mem; int retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* update 'ycur' value as stored predictor + current corrector */ @@ -568,8 +565,8 @@ int mriStep_NlsConvTest(SUNNonlinearSolver NLS, N_Vector y, N_Vector del, sunrealtype delnrm, dcon; int m, retval; - /* access ARKodeMRIStepMem structure */ - retval = mriStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeMRIStepMem structures */ + retval = mriStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* if the problem is linearly implicit, just return success */ diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index 29cb246340..b59c85604e 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -815,21 +815,10 @@ int arkRelaxPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) * ===========================================================================*/ /* Constructor called by stepper */ -int arkRelaxCreate(void* arkode_mem, ARKRelaxFn relax_fn, +int arkRelaxCreate(ARKodeMem ark_mem, ARKRelaxFn relax_fn, ARKRelaxJacFn relax_jac_fn, ARKRelaxDeltaEFn delta_e_fn, ARKRelaxGetOrderFn get_order_fn) { - ARKodeMem ark_mem; - - /* Check inputs */ - if (!arkode_mem) - { - arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_ARK_NO_MEM); - return ARK_MEM_NULL; - } - ark_mem = (ARKodeMem)arkode_mem; - /* Disable relaxation if both user inputs are NULL */ if (!relax_fn && !relax_jac_fn) { diff --git a/src/arkode/arkode_relaxation_impl.h b/src/arkode/arkode_relaxation_impl.h index cc116193ff..a8c9001ed0 100644 --- a/src/arkode/arkode_relaxation_impl.h +++ b/src/arkode/arkode_relaxation_impl.h @@ -99,7 +99,7 @@ struct ARKodeRelaxMemRec * ---------------------------------------------------------------------------*/ /* Driver and Stepper Functions */ -int arkRelaxCreate(void* arkode_mem, ARKRelaxFn relax_fn, +int arkRelaxCreate(ARKodeMem ark_mem, ARKRelaxFn relax_fn, ARKRelaxJacFn relax_jac_fn, ARKRelaxDeltaEFn delta_e_fn, ARKRelaxGetOrderFn get_order_fn); int arkRelaxDestroy(ARKodeRelaxMem relax_mem); diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index 1672835360..4cf245d5e0 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -171,16 +171,15 @@ void* SPRKStepCreate(ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0, This routine resizes the memory within the SPRKStep module. ---------------------------------------------------------------*/ -int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int sprkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; sunindextype lrw1, liw1, lrw_diff, liw_diff; int retval; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Determine change in vector sizes */ @@ -232,8 +231,9 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Check if ark_mem was allocated */ @@ -291,14 +291,13 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, problem from the given time with the input state (all counter values are retained). ---------------------------------------------------------------*/ -int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) +int sprkStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } N_VConst(SUN_RCONST(0.0), step_mem->yerr); @@ -308,16 +307,14 @@ int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR) /*--------------------------------------------------------------- sprkStep_Free frees all SPRKStep memory. ---------------------------------------------------------------*/ -void sprkStep_Free(void* arkode_mem) +void sprkStep_Free(ARKodeMem ark_mem) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; - /* nothing to do if arkode_mem is already NULL */ - if (arkode_mem == NULL) { return; } + /* nothing to do if ark_mem is already NULL */ + if (ark_mem == NULL) { return; } /* conditional frees on non-NULL SPRKStep module */ - ark_mem = (ARKodeMem)(arkode_mem); if (ark_mem->step_mem != NULL) { step_mem = (ARKodeSPRKStepMem)ark_mem->step_mem; @@ -365,14 +362,13 @@ void sprkStep_Free(void* arkode_mem) With initialization type RESET_INIT, this routine does nothing. ---------------------------------------------------------------*/ -int sprkStep_Init(void* arkode_mem, int init_type) +int sprkStep_Init(ARKodeMem ark_mem, int init_type) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* immediately return if reset */ @@ -486,15 +482,14 @@ inline int sprkStep_f2(ARKodeSPRKStepMem step_mem, sunrealtype tcur, Since RHS values are not stored in SPRKStep we evaluate the RHS functions for all modes. ----------------------------------------------------------------------------*/ -int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int sprkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode) { int retval = 0; - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* perform RHS functions contingent on 'mode' argument */ @@ -539,9 +534,8 @@ int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, This requires only 2 vectors in principle, but we use three since we persist the stage data. Only the stage data vector belongs to SPRKStep, the other two are reused from the ARKODE core. */ -int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) +int sprkStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; N_Vector prev_stage = NULL; N_Vector curr_stage = NULL; @@ -551,7 +545,7 @@ int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } prev_stage = ark_mem->yn; @@ -615,10 +609,9 @@ int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr) /* Increment SPRK algorithm with compensated summation. This algorithm requires 6 vectors, but 5 of them are reused from the ARKODE core. */ -int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, +int sprkStep_TakeStep_Compensated(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; N_Vector delta_Yi = NULL; N_Vector yn_plus_delta_Yi = NULL; @@ -629,7 +622,7 @@ int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Vector shortcuts */ @@ -721,13 +714,13 @@ int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, ---------------------------------------------------------------*/ /*--------------------------------------------------------------- - sprkStep_AccessStepMem: + sprkStep_AccessARKODEStepMem: Shortcut routine to unpack ark_mem and step_mem structures from void* pointer. If either is missing it returns ARK_MEM_NULL. ---------------------------------------------------------------*/ -int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeSPRKStepMem* step_mem) +int sprkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeSPRKStepMem* step_mem) { /* access ARKodeMem structure */ if (arkode_mem == NULL) @@ -737,6 +730,8 @@ int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_MEM_NULL); } *ark_mem = (ARKodeMem)arkode_mem; + + /* access ARKodeSPRKStepMem structure */ if ((*ark_mem)->step_mem == NULL) { arkProcessError(*ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, @@ -747,6 +742,26 @@ int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, return (ARK_SUCCESS); } +/*--------------------------------------------------------------- + sprkStep_AccessStepMem: + + Shortcut routine to unpack step_mem structure from ark_mem. + If missing it returns ARK_MEM_NULL. + ---------------------------------------------------------------*/ +int sprkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeSPRKStepMem* step_mem) +{ + /* access ARKodeSPRKStepMem structure */ + if (ark_mem->step_mem == NULL) + { + arkProcessError(ark_mem, ARK_MEM_NULL, __LINE__, fname, __FILE__, + MSG_SPRKSTEP_NO_MEM); + return (ARK_MEM_NULL); + } + *step_mem = (ARKodeSPRKStepMem)ark_mem->step_mem; + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- sprkStep_CheckNVector: diff --git a/src/arkode/arkode_sprkstep_impl.h b/src/arkode/arkode_sprkstep_impl.h index 48250ea92e..3f7928dbc7 100644 --- a/src/arkode/arkode_sprkstep_impl.h +++ b/src/arkode/arkode_sprkstep_impl.h @@ -66,26 +66,28 @@ typedef struct ARKodeSPRKStepMemRec SPRK time step module private function prototypes ===============================================================*/ -int sprkStep_Init(void* arkode_mem, int init_type); -int sprkStep_FullRHS(void* arkode_mem, sunrealtype t, N_Vector y, N_Vector f, +int sprkStep_Init(ARKodeMem ark_mem, int init_type); +int sprkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, int mode); -int sprkStep_TakeStep(void* arkode_mem, sunrealtype* dsmPtr, int* nflagPtr); -int sprkStep_TakeStep_Compensated(void* arkode_mem, sunrealtype* dsmPtr, +int sprkStep_TakeStep(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr); +int sprkStep_TakeStep_Compensated(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr); -int sprkStep_SetUserData(void* arkode_mem, void* user_data); -int sprkStep_SetDefaults(void* arkode_mem); -int sprkStep_SetOrder(void* arkode_mem, int ord); -int sprkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -int sprkStep_WriteParameters(void* arkode_mem, FILE* fp); -int sprkStep_Reset(void* arkode_mem, sunrealtype tR, N_Vector yR); -int sprkStep_Resize(void* arkode_mem, N_Vector y0, sunrealtype hscale, +int sprkStep_SetUserData(ARKodeMem ark_mem, void* user_data); +int sprkStep_SetDefaults(ARKodeMem ark_mem); +int sprkStep_SetOrder(ARKodeMem ark_mem, int ord); +int sprkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt); +int sprkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp); +int sprkStep_Reset(ARKodeMem ark_mem, sunrealtype tR, N_Vector yR); +int sprkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -void sprkStep_Free(void* arkode_mem); -void sprkStep_PrintMem(void* arkode_mem, FILE* outfile); +void sprkStep_Free(ARKodeMem ark_mem); +void sprkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile); /* Internal utility routines */ -int sprkStep_AccessStepMem(void* arkode_mem, const char* fname, - ARKodeMem* ark_mem, ARKodeSPRKStepMem* step_mem); +int sprkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, + ARKodeMem* ark_mem, ARKodeSPRKStepMem* step_mem); +int sprkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, + ARKodeSPRKStepMem* step_mem); sunbooleantype sprkStep_CheckNVector(N_Vector tmpl); /* f1 = p' (Force evaluation) */ int sprkStep_f1(ARKodeSPRKStepMem step_mem, sunrealtype tcur, N_Vector ycur, diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index ac8d979bfd..bfa793145d 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -216,20 +216,10 @@ int SPRKStepWriteParameters(void* arkode_mem, FILE* fp) structures/options related to the ARKODE infrastructure itself (e.g., root-finding and post-process step). ---------------------------------------------------------------*/ -int sprkStep_SetDefaults(void* arkode_mem) +int sprkStep_SetDefaults(ARKodeMem ark_mem) { - ARKodeMem ark_mem = NULL; - ARKodeSPRKStepMem step_mem = NULL; - int retval = 0; - - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - /* use the default method order */ - sprkStep_SetOrder(arkode_mem, 0); - - return (ARK_SUCCESS); + return (sprkStep_SetOrder(ark_mem, 0)); } /*--------------------------------------------------------------- @@ -243,14 +233,15 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (onoff) { - retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNTRUE); - ark_mem->step = sprkStep_TakeStep_Compensated; + ark_mem->use_compensated_sums = SUNTRUE; + ark_mem->step = sprkStep_TakeStep_Compensated; if (!step_mem->yerr) { if (!arkAllocVec(ark_mem, ark_mem->yn, &(step_mem->yerr))) @@ -261,8 +252,8 @@ int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff) } else { - retval = ARKodeSetUseCompensatedSums(arkode_mem, SUNFALSE); - ark_mem->step = sprkStep_TakeStep; + ark_mem->use_compensated_sums = SUNFALSE; + ark_mem->step = sprkStep_TakeStep; } return (retval); @@ -282,8 +273,9 @@ int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage) ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (step_mem->method) @@ -308,8 +300,9 @@ int SPRKStepSetMethodName(void* arkode_mem, const char* method) ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } if (step_mem->method) @@ -328,14 +321,13 @@ int SPRKStepSetMethodName(void* arkode_mem, const char* method) Specifies the method order ---------------------------------------------------------------*/ -int sprkStep_SetOrder(void* arkode_mem, int ord) +int sprkStep_SetOrder(ARKodeMem ark_mem, int ord) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* Invalid orders result in the default order being used. */ @@ -369,8 +361,9 @@ int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2) ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *nf1 = step_mem->nf1; @@ -390,8 +383,9 @@ int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage) ARKodeSPRKStepMem step_mem = NULL; int retval = 0; - /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + /* access ARKodeMem and ARKodeSPRKStepMem structures */ + retval = sprkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } *sprk_storage = step_mem->method; @@ -404,14 +398,13 @@ int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage) Prints integrator statistics ---------------------------------------------------------------*/ -int sprkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) +int sprkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } switch (fmt) @@ -444,14 +437,13 @@ int sprkStep_PrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) Outputs all solver parameters to the provided file pointer. ---------------------------------------------------------------*/ -int sprkStep_WriteParameters(void* arkode_mem, FILE* fp) +int sprkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp) { - ARKodeMem ark_mem = NULL; ARKodeSPRKStepMem step_mem = NULL; int retval = 0; /* access ARKodeSPRKStepMem structure */ - retval = sprkStep_AccessStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* print integrator parameters to file */ diff --git a/src/arkode/fmod/farkode_mod.c b/src/arkode/fmod/farkode_mod.c index dc0299d451..1d9bf58f1f 100644 --- a/src/arkode/fmod/farkode_mod.c +++ b/src/arkode/fmod/farkode_mod.c @@ -1069,20 +1069,6 @@ SWIGEXPORT int _wrap_FARKodeSetMaxNumConstrFails(void *farg1, int const *farg2) } -SWIGEXPORT int _wrap_FARKodeSetUseCompensatedSums(void *farg1, int const *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - result = (int)ARKodeSetUseCompensatedSums(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FARKodeSetUserData(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod/farkode_mod.f90 b/src/arkode/fmod/farkode_mod.f90 index 6dc40bb8c2..71bfe0e030 100644 --- a/src/arkode/fmod/farkode_mod.f90 +++ b/src/arkode/fmod/farkode_mod.f90 @@ -154,7 +154,6 @@ module farkode_mod public :: FARKodeClearStopTime public :: FARKodeSetFixedStep public :: FARKodeSetMaxNumConstrFails - public :: FARKodeSetUseCompensatedSums public :: FARKodeSetUserData public :: FARKodeSetPostprocessStepFn public :: FARKodeSetPostprocessStageFn @@ -931,15 +930,6 @@ function swigc_FARKodeSetMaxNumConstrFails(farg1, farg2) & integer(C_INT) :: fresult end function -function swigc_FARKodeSetUseCompensatedSums(farg1, farg2) & -bind(C, name="_wrap_FARKodeSetUseCompensatedSums") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -integer(C_INT) :: fresult -end function - function swigc_FARKodeSetUserData(farg1, farg2) & bind(C, name="_wrap_FARKodeSetUserData") & result(fresult) @@ -3207,22 +3197,6 @@ function FARKodeSetMaxNumConstrFails(arkode_mem, maxfails) & swig_result = fresult end function -function FARKodeSetUseCompensatedSums(arkode_mem, onoff) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -integer(C_INT), intent(in) :: onoff -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 - -farg1 = arkode_mem -farg2 = onoff -fresult = swigc_FARKodeSetUseCompensatedSums(farg1, farg2) -swig_result = fresult -end function - function FARKodeSetUserData(arkode_mem, user_data) & result(swig_result) use, intrinsic :: ISO_C_BINDING From 92eb0b96ba5954125a7ad706d71b975162f74395 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 12:16:18 -0500 Subject: [PATCH 13/39] Updated one .out file to match new workspace sizes --- .../F2003_serial/ark_diurnal_kry_bp_f2003.out | 34 +++++++++---------- test/answers | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out index 4bc5495c61..90517794f0 100644 --- a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out +++ b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out @@ -8,25 +8,25 @@ 4.440310E+11 7.263637E+11 3.820591E+11 1.440000E+04 1.149716E+07 1.249098E+07 1.329954E+07 2780 2784 1.022085E+01 4.473684E+11 4.862283E+11 5.178450E+11 - 2.160000E+04 2.525270E+07 7.837587E+07 3.018990E+07 3325 3329 1.467507E+01 + 2.160000E+04 2.525270E+07 7.837587E+07 3.018990E+07 3325 3329 1.467514E+01 2.824256E+11 9.233209E+11 3.419869E+11 - 2.880000E+04 1.189287E+07 2.395791E+07 1.042605E+07 3816 3820 1.467507E+01 + 2.880000E+04 1.189287E+07 2.395791E+07 1.042605E+07 3816 3820 1.467514E+01 4.627840E+11 9.345089E+11 4.054359E+11 - 3.600000E+04 2.342948E+04 2.291472E+04 2.522324E+04 4629 4633 4.334128E+00 + 3.600000E+04 2.342949E+04 2.291472E+04 2.522325E+04 4629 4633 4.333728E+00 5.651673E+11 5.527495E+11 6.084385E+11 - 4.320000E+04 1.194709E-04 5.892092E-05 -1.674879E-04 5635 5639 6.277419E+02 + 4.320000E+04 -3.718382E-05 -1.465487E-05 2.611385E-05 5635 5639 6.272609E+02 3.689222E+11 8.238330E+11 4.623703E+11 - 5.040000E+04 -8.456488E-06 -9.187620E-06 3.659273E-05 5647 5651 6.277419E+02 - 3.862510E+11 1.017897E+12 3.536889E+11 - 5.760000E+04 -1.301882E-05 -3.846503E-06 5.896852E-06 5658 5662 6.277419E+02 - 5.832932E+11 6.187928E+11 5.788981E+11 - 6.480000E+04 3.467015E-05 1.276786E-05 -3.337236E-05 5670 5674 6.277419E+02 - 4.274401E+11 6.788806E+11 5.386844E+11 - 7.200000E+04 -7.456958E-06 8.227805E-17 3.511631E-10 5681 5685 6.277419E+02 + 5.040000E+04 5.522194E-07 -9.160075E-06 4.014494E-05 5647 5651 6.272609E+02 + 3.862509E+11 1.017897E+12 3.536890E+11 + 5.760000E+04 -1.084359E-05 -3.724411E-06 1.288549E-06 5658 5662 6.272609E+02 + 5.832933E+11 6.187928E+11 5.788981E+11 + 6.480000E+04 2.972416E-05 1.471335E-05 -3.876329E-05 5670 5674 6.272609E+02 + 4.274400E+11 6.788806E+11 5.386844E+11 + 7.200000E+04 -2.141097E-16 6.301814E-17 1.652460E-15 5681 5685 6.272609E+02 3.453624E+11 1.030182E+12 3.448304E+11 - 7.920000E+04 -1.368994E-06 2.401515E-15 -7.272100E-13 5693 5697 6.277419E+02 + 7.920000E+04 2.795850E-14 6.145328E-15 1.996900E-14 5693 5697 6.272609E+02 5.450919E+11 7.330919E+11 5.109883E+11 - 8.640000E+04 8.946777E-06 2.191861E-15 1.700622E-10 5704 5708 6.277419E+02 + 8.640000E+04 4.560340E-15 2.221125E-15 1.793820E-14 5704 5708 6.272609E+02 5.090704E+11 5.755864E+11 5.984224E+11 ---------------------------------------------------------------------------------------- @@ -36,14 +36,14 @@ Total rhs exp function call = 0 Total rhs imp function call = 59357 Total num preconditioner evals = 96 - Total num preconditioner solves = 89026 + Total num preconditioner solves = 89028 Num error test failures = 4 Num nonlinear solver iters = 30814 - Num linear solver iters = 59967 - Avg Krylov subspace dim = 1.946096E+00 + Num linear solver iters = 59966 + Avg Krylov subspace dim = 1.946063E+00 Num nonlinear solver fails = 0 Num linear solver fails = 0 - main solver real/int workspace sizes = 3702 133 + main solver real/int workspace sizes = 3702 145 linear solver real/int workspace sizes = 2455 42 ARKBandPre real/int workspace sizes = 2800 622 ARKBandPre number of f evaluations = 480 diff --git a/test/answers b/test/answers index 91127b12f3..ea6ac15fdc 160000 --- a/test/answers +++ b/test/answers @@ -1 +1 @@ -Subproject commit 91127b12f327b11301c62d4732f9c94c1dd1b03e +Subproject commit ea6ac15fdcd8615e25e52692bcd453e2f003f46b From 5ecb8833f127b6bbfe429f2eabb1dd15a5142c98 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 13:26:57 -0500 Subject: [PATCH 14/39] Apply suggestions from code review Fixed comment capitalization errors --- examples/arkode/CXX_parallel/ark_heat2D_p.cpp | 4 ++-- examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp | 4 ++-- examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp | 4 ++-- examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp | 4 ++-- examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp | 2 +- .../CXX_serial/ark_advection_diffusion_reaction.cpp | 2 +- examples/arkode/CXX_serial/ark_heat2D.cpp | 4 ++-- examples/arkode/CXX_serial/ark_kpr_Mt.cpp | 4 ++-- examples/arkode/CXX_serial/ark_pendulum.cpp | 2 +- .../CXX_superludist/ark_brusselator1D_FEM_sludist.cpp | 4 ++-- .../arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp | 2 +- examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp | 2 +- examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp | 4 ++-- examples/arkode/C_openmp/ark_heat1D_omp.c | 4 ++-- examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c | 2 +- examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c | 4 ++-- examples/arkode/C_openmpdev/ark_heat1D_ompdev.c | 2 +- examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c | 2 +- examples/arkode/C_parallel/ark_diurnal_kry_p.c | 2 +- examples/arkode/C_parhyp/ark_diurnal_kry_ph.c | 2 +- examples/arkode/C_petsc/ark_petsc_ex25.c | 8 ++++---- examples/arkode/C_serial/ark_analytic_mels.c | 4 ++-- examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c | 2 +- examples/arkode/C_serial/ark_brusselator1D_klu.c | 2 +- examples/arkode/C_serial/ark_brusselator_fp.c | 2 +- examples/arkode/C_serial/ark_dissipated_exp_entropy.c | 2 +- examples/arkode/C_serial/ark_heat1D.c | 2 +- examples/arkode/C_serial/ark_heat1D_adapt.c | 4 ++-- examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 | 2 +- 29 files changed, 44 insertions(+), 44 deletions(-) diff --git a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp index a44d27022d..78a25fa210 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 ARKode 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp index f3cb4a54fa..09e95bc328 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 ARKode 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp index 3b16818670..bb541e41d6 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 ARKode 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 ARKode + // Setup ARKODE // -------------- // Create integrator 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 dc57e33c2f..8410570911 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 ARKode 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 ARKode integrator and set options + // Setup ARKODE integrator and set options // ---------------------------------------------- // Create integrator 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 3f1d1d8b35..1f90ddcc7a 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 ARKode settings. Use the flag + * available to change the problem parameters and ARKODE settings. Use the flag * --help for more information. * ---------------------------------------------------------------------------*/ diff --git a/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp b/examples/arkode/CXX_serial/ark_advection_diffusion_reaction.cpp index bff4c2aba8..9afe3e1ac3 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 // -------------------- - // ARKode memory structure + // ARKODE memory structure void* arkode_mem = nullptr; // Matrix and linear solver for DIRK, IMEX, or MRI slow integrators diff --git a/examples/arkode/CXX_serial/ark_heat2D.cpp b/examples/arkode/CXX_serial/ark_heat2D.cpp index d0da950bd6..bf18a6fbb0 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 ARKode 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/CXX_serial/ark_kpr_Mt.cpp b/examples/arkode/CXX_serial/ark_kpr_Mt.cpp index 74de1a344d..ff1d6daa05 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 ARKode 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 @@ -667,7 +667,7 @@ static int check_order(void* arkode_mem, N_Vector y, sunrealtype T0, cout << " -----------------------------------------------------\n"; for (size_t ih = 0; ih < hvals.size(); ih++) { - // Reset ARKode for this run + // Reset ARKODE for this run retval = Ytrue(T0, y); if (check_retval(&retval, "Ytrue", 1)) { return 1; } retval = ARKodeReset(arkode_mem, T0, y); diff --git a/examples/arkode/CXX_serial/ark_pendulum.cpp b/examples/arkode/CXX_serial/ark_pendulum.cpp index d351f38239..be36be088c 100644 --- a/examples/arkode/CXX_serial/ark_pendulum.cpp +++ b/examples/arkode/CXX_serial/ark_pendulum.cpp @@ -370,7 +370,7 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - // Free ARKode integrator and SUNDIALS objects + // Free ARKODE integrator and SUNDIALS objects ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNMatDestroy(A); diff --git a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp index b41e69e82b..25b366c677 100644 --- a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp +++ b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp @@ -481,7 +481,7 @@ int main(int argc, char* argv[]) MPI_Abort(grid.comm, 1); } - /* Attach the matrix, linear solver, and Jacobian construction routine to ARKode */ + /* Attach the matrix, linear solver, and Jacobian construction routine to ARKODE */ retval = ARKodeSetLinearSolver(arkode_mem, LS, A); if (check_retval(&retval, "ARKodeSetLinearSolver", 1)) { @@ -492,7 +492,7 @@ int main(int argc, char* argv[]) 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 ARKode; + /* 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)) 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 f10509ed43..3d11f6a539 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp index 8db37df9d0..686862ea5a 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp index f1f1bd23da..3ca94f8fcf 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 ARKode 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 ARKode + // Setup ARKODE // -------------- // Create integrator diff --git a/examples/arkode/C_openmp/ark_heat1D_omp.c b/examples/arkode/C_openmp/ark_heat1D_omp.c index 74bc2bb27e..4fc8eb998b 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 ARKode memory structure */ + void* arkode_mem = NULL; /* empty ARKODE memory structure */ FILE *FID, *UFID; sunrealtype t, dTout, tout; int iout, num_threads; @@ -156,7 +156,7 @@ int main(int argc, char* argv[]) /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ flag = ARKodeSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKode */ + 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; } diff --git a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c index 9e76e3ce9b..1f847e9dfe 100644 --- a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c @@ -116,7 +116,7 @@ int main(void) while (Tf - t > 1.0e-15) { flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */ - if (check_flag(&flag, "ARKode", 1)) { break; } + if (check_flag(&flag, "ARKodeEvolve", 1)) { break; } N_VCopyFromDevice_OpenMPDEV(y); printf(" %10.6" FSYM " %10.6" FSYM "\n", t, y_data[0]); /* access/print solution */ diff --git a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c index 02669d9e5e..7d12f225f8 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c @@ -213,7 +213,7 @@ int main(void) /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ flag = ARKodeSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKode */ + 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; } @@ -311,7 +311,7 @@ int main(void) 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 ARKode 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; } diff --git a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c index 3e252f2f49..82e13c66a7 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 ARKode memory structure */ + void* arkode_mem = NULL; /* empty ARKODE memory structure */ FILE *FID, *UFID; sunrealtype t, dTout, tout; int iout; 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 2769ced1b8..97802077ee 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c @@ -241,7 +241,7 @@ int main(int argc, char* argv[]) flag = ARKodeSStolerances(arkode_mem, reltol, abstol); if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKode interface */ + /* Attach SPGMR solver structure to ARKODE interface */ flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_p.c index ade42769dc..b7b08ab4c3 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.c @@ -255,7 +255,7 @@ int main(int argc, char* argv[]) flag = ARKodeSStolerances(arkode_mem, reltol, abstol); if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKode interface */ + /* Attach SPGMR solver structure to ARKODE interface */ flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index 5c90a93281..ab5090e86f 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -263,7 +263,7 @@ int main(int argc, char* argv[]) flag = ARKodeSStolerances(arkode_mem, reltol, abstol); if (check_flag(&flag, "ARKodeSStolerances", 1, my_pe)) { return (1); } - /* Attach SPGMR solver structure to ARKode interface */ + /* Attach SPGMR solver structure to ARKODE interface */ flag = ARKodeSetLinearSolver(arkode_mem, LS, NULL); if (check_flag(&flag, "ARKodeSetLinearSolver", 1, my_pe)) { diff --git a/examples/arkode/C_petsc/ark_petsc_ex25.c b/examples/arkode/C_petsc/ark_petsc_ex25.c index 180be37843..0c0bf03fba 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 ARKode */ +/* 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 ARKode time stepper + Create ARKODE time stepper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Call ARKStepCreate to initialize the ARK timestepper module and @@ -225,7 +225,7 @@ int main(int argc, char** argv) CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set ARKode options + Set ARKODE options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = ARKodeSStolerances(arkode_mem, rtol, atol); @@ -305,7 +305,7 @@ int main(int argc, char** argv) } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - User provided functions in ARKode format + User provided functions in ARKODE format - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Implicit component of RHS */ diff --git a/examples/arkode/C_serial/ark_analytic_mels.c b/examples/arkode/C_serial/ark_analytic_mels.c index 334323a9bf..08d0fa5884 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 ARKode */ +/* 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 */ @@ -249,7 +249,7 @@ static int MatrixEmbeddedLSSolve(SUNLinearSolver LS, SUNMatrix A, N_Vector x, sunrealtype* rdata; sunrealtype lamda; - /* retrieve implicit system data from ARKode */ + /* 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)) diff --git a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c index 09dcea4b6b..a79e142eea 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c @@ -311,7 +311,7 @@ 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 ARKode */ + /* Attach the matrix, linear solver, and Jacobian construction routine to ARKODE */ /* Attach matrix and LS */ retval = ARKodeSetLinearSolver(arkode_mem, LS, A); diff --git a/examples/arkode/C_serial/ark_brusselator1D_klu.c b/examples/arkode/C_serial/ark_brusselator1D_klu.c index 07d151ac8c..208acb9a92 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_klu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_klu.c @@ -236,7 +236,7 @@ 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 ARKode */ + /* 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 */ diff --git a/examples/arkode/C_serial/ark_brusselator_fp.c b/examples/arkode/C_serial/ark_brusselator_fp.c index f3e2664f07..96b6e2fff6 100644 --- a/examples/arkode/C_serial/ark_brusselator_fp.c +++ b/examples/arkode/C_serial/ark_brusselator_fp.c @@ -185,7 +185,7 @@ 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 ARKode */ + /* 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; } diff --git a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c index 1b4bd469a5..5b071b61ae 100644 --- a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c +++ b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c @@ -383,7 +383,7 @@ int main(int argc, char* argv[]) * Clean up * * -------- */ - /* Free ARKode integrator and SUNDIALS objects */ + /* Free ARKODE integrator and SUNDIALS objects */ ARKodeFree(&arkode_mem); SUNLinSolFree(LS); SUNMatDestroy(A); diff --git a/examples/arkode/C_serial/ark_heat1D.c b/examples/arkode/C_serial/ark_heat1D.c index e47c614ac8..c5e7597ecb 100644 --- a/examples/arkode/C_serial/ark_heat1D.c +++ b/examples/arkode/C_serial/ark_heat1D.c @@ -141,7 +141,7 @@ int main(void) /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ flag = ARKodeSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKode */ + 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; } diff --git a/examples/arkode/C_serial/ark_heat1D_adapt.c b/examples/arkode/C_serial/ark_heat1D_adapt.c index 415b878d8a..3f9e349073 100644 --- a/examples/arkode/C_serial/ark_heat1D_adapt.c +++ b/examples/arkode/C_serial/ark_heat1D_adapt.c @@ -184,7 +184,7 @@ int main(void) /* Linear solver interface -- set user-supplied J*v routine (no 'jtsetup' required) */ flag = ARKodeSetLinearSolver(arkode_mem, LS, - NULL); /* Attach linear solver to ARKode */ + 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; } @@ -266,7 +266,7 @@ int main(void) 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 ARKode 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; } diff --git a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 index ad0e815ae0..579d70479c 100644 --- a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 @@ -334,7 +334,7 @@ program main stop 1 end if - ! initialize custom matrix data structure and solver; attach to ARKode + ! 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' From 62f786b7d84a15b9ac1f59823117ebcae8e4a9d4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 13:33:18 -0500 Subject: [PATCH 15/39] Apply suggestions from code review Co-authored-by: Cody Balos --- src/arkode/arkode_io.c | 2 +- src/arkode/arkode_ls.c | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index f09db2c998..00d5fca6e8 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -1191,7 +1191,7 @@ int ARKodeSetFixedStep(void* arkode_mem, sunrealtype hfixed) /* ensure that when hfixed=0, the time step module supports adaptivity */ if ((hfixed == ZERO) && (!ark_mem->step_supports_adaptive)) { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "temporal adaptivity is not supported by this time step module"); return (ARK_STEPPER_UNSUPPORTED); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index a9198a5c7a..976159976a 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -328,7 +328,7 @@ int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -607,7 +607,7 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1363,7 +1363,7 @@ int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1446,7 +1446,7 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1475,7 +1475,7 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1572,7 +1572,7 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1650,7 +1650,7 @@ int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1712,7 +1712,7 @@ int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1739,7 +1739,7 @@ int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1766,7 +1766,7 @@ int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1793,7 +1793,7 @@ int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1820,7 +1820,7 @@ int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1847,7 +1847,7 @@ int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1874,7 +1874,7 @@ int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1900,7 +1900,7 @@ int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1927,7 +1927,7 @@ int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -1954,7 +1954,7 @@ int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } From 8549ed616ed388efe7e14eae37f7d621c62a5c36 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 13:37:15 -0500 Subject: [PATCH 16/39] Apply suggestions from code review Co-authored-by: Cody Balos --- src/arkode/arkode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 95675b448e..85b41a03c7 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -611,7 +611,7 @@ int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -676,7 +676,7 @@ int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } @@ -761,7 +761,7 @@ int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } From fa63d114edf8e96bea319e181de642d4afb9a8b7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 22:26:22 -0500 Subject: [PATCH 17/39] Apply suggestions from code review Co-authored-by: David Gardner --- include/arkode/arkode_arkstep.h | 2 +- include/arkode/arkode_erkstep.h | 2 +- include/arkode/arkode_mristep.h | 2 +- src/arkode/arkode.c | 1 + src/arkode/arkode_erkstep_io.c | 1 - src/arkode/arkode_ls.c | 2 +- src/arkode/arkode_mristep_io.c | 1 - src/arkode/arkode_sprkstep_io.c | 1 - 8 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 0406ca44f3..ff00f4ffe8 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -115,7 +115,7 @@ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") int ARKStepSetInterpolantType(void* arkode_mem, int itype); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int ARKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int ARKStepSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index 7781de0600..847a2b4447 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -80,7 +80,7 @@ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") int ERKStepSetInterpolantType(void* arkode_mem, int itype); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int ERKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int ERKStepSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_EXPORT int ERKStepSetTable(void* arkode_mem, ARKodeButcherTable B); SUNDIALS_EXPORT int ERKStepSetTableNum(void* arkode_mem, diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index 84c18d42c4..c1162b0630 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -170,7 +170,7 @@ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") int MRIStepSetInterpolantType(void* arkode_mem, int itype); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int MRIStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDenseOrder instead") +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") int MRIStepSetDenseOrder(void* arkode_mem, int dord); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 85b41a03c7..88c46adf18 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -558,6 +558,7 @@ int ARKodeWFtolerances(void* arkode_mem, ARKEwtFn efun) return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; + if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index dece670718..1bbb0929ee 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -86,7 +86,6 @@ int ERKStepSetDenseOrder(void* arkode_mem, int dord) int ERKStepSetInterpolantDegree(void* arkode_mem, int degree) { - if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 976159976a..80da4eeaf5 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -1521,7 +1521,7 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_ILL_INPUT); } diff --git a/src/arkode/arkode_mristep_io.c b/src/arkode/arkode_mristep_io.c index a17e98c910..116266fea1 100644 --- a/src/arkode/arkode_mristep_io.c +++ b/src/arkode/arkode_mristep_io.c @@ -173,7 +173,6 @@ int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) int MRIStepSetInterpolantDegree(void* arkode_mem, int degree) { - if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index bfa793145d..0d4760fd17 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -78,7 +78,6 @@ int SPRKStepSetOrder(void* arkode_mem, int ord) int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree) { - if (degree < 0) { degree = ARK_INTERP_MAX_DEGREE; } return (ARKodeSetInterpolantDegree(arkode_mem, degree)); } From dbbc8166bf53822347ca7638235a70fa8c888e13 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 22:32:26 -0500 Subject: [PATCH 18/39] Apply suggestions from code review --- include/arkode/arkode_mristep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index c1162b0630..b4cb0c8101 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -223,8 +223,8 @@ SUNDIALS_EXPORT int MRIStepSetPostInnerFn(void* arkode_mem, MRIStepPostInnerFn postfn); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -SUNDIALS_EXPORT int MRIStepSetDeduceImplicitRhs(void* arkode_mem, - sunbooleantype deduce); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") +int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); /* Linear solver interface optional input functions -- must be called AFTER MRIStepSetLinearSolver */ From 24e7e8fe9fcf84597d10b6d8e0ed487a2a0c6427 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Fri, 26 Apr 2024 23:03:42 -0500 Subject: [PATCH 19/39] Ran formatter --- src/arkode/arkode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 88c46adf18..bad7af1c1f 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -558,7 +558,7 @@ int ARKodeWFtolerances(void* arkode_mem, ARKEwtFn efun) return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; - + if (ark_mem->MallocDone == SUNFALSE) { arkProcessError(ark_mem, ARK_NO_MALLOC, __LINE__, __func__, __FILE__, From e0814d3a76046f19c1dbaa772358c0b3f5e82985 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sat, 27 Apr 2024 10:54:55 -0500 Subject: [PATCH 20/39] Deprecated ARKStepWriteButcher --- .../guide/source/Usage/ARKStep_c_interface/User_callable.rst | 4 +++- include/arkode/arkode_arkstep.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index 4a8da0e5a5..29e6be477b 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -4030,8 +4030,10 @@ General usability functions for this pointer, since tables for all processes would be identical. + .. deprecated:: x.y.z - + Use :c:func:`ARKStepGetCurrentButcherTables` and :c:func:`ARKodeButcherTable_Write` + instead. diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index ff00f4ffe8..724f345cbb 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -331,7 +331,8 @@ char* ARKStepGetReturnFlagName(long int flag); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") int ARKStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_EXPORT int ARKStepWriteButcher(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKStepGetCurrentButcherTables and ARKodeButcherTable_Write instead") +int ARKStepWriteButcher(void* arkode_mem, FILE* fp); /* Grouped optional output functions */ SUNDIALS_EXPORT int ARKStepGetTimestepperStats( From 51ff84092db911e6b271ea967e73d17ba4e19b29 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sat, 27 Apr 2024 10:58:30 -0500 Subject: [PATCH 21/39] Renamed step_supports_algebraic as step_supports_implicit --- src/arkode/arkode.c | 2 +- src/arkode/arkode_arkstep.c | 2 +- src/arkode/arkode_impl.h | 2 +- src/arkode/arkode_io.c | 44 +++++++++++++++++------------------ src/arkode/arkode_ls.c | 46 ++++++++++++++++++------------------- src/arkode/arkode_mristep.c | 2 +- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index bad7af1c1f..dc9b79c288 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -127,7 +127,7 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->step_getnonlinsolvstats = NULL; ark_mem->step_mem = NULL; ark_mem->step_supports_adaptive = SUNFALSE; - ark_mem->step_supports_algebraic = SUNFALSE; + ark_mem->step_supports_implicit = SUNFALSE; ark_mem->step_supports_massmatrix = SUNFALSE; ark_mem->step_supports_relaxation = SUNFALSE; diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 6774f0bd76..8d7440f19a 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -137,7 +137,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, ark_mem->step_getnumnonlinsolvconvfails = arkStep_GetNumNonlinSolvConvFails; ark_mem->step_getnonlinsolvstats = arkStep_GetNonlinSolvStats; ark_mem->step_supports_adaptive = SUNTRUE; - ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_supports_implicit = SUNTRUE; ark_mem->step_supports_massmatrix = SUNTRUE; ark_mem->step_supports_relaxation = SUNTRUE; ark_mem->step_mem = (void*)step_mem; diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 2f4b33518d..353d250cff 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -384,7 +384,7 @@ struct ARKodeMemRec ARKTimestepGetNumNonlinSolvConvFails step_getnumnonlinsolvconvfails; ARKTimestepGetNonlinSolvStats step_getnonlinsolvstats; sunbooleantype step_supports_adaptive; - sunbooleantype step_supports_algebraic; + sunbooleantype step_supports_implicit; sunbooleantype step_supports_massmatrix; sunbooleantype step_supports_relaxation; void* step_mem; diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 00d5fca6e8..4dadd4e8d9 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -277,7 +277,7 @@ int ARKodeSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -325,7 +325,7 @@ int ARKodeSetLinear(void* arkode_mem, int timedepend) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -364,7 +364,7 @@ int ARKodeSetNonlinear(void* arkode_mem) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -404,7 +404,7 @@ int ARKodeSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -449,7 +449,7 @@ int ARKodeSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -489,7 +489,7 @@ int ARKodeSetNonlinCRDown(void* arkode_mem, sunrealtype crdown) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -529,7 +529,7 @@ int ARKodeSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -569,7 +569,7 @@ int ARKodeSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -610,7 +610,7 @@ int ARKodeSetLSetupFrequency(void* arkode_mem, int msbp) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -648,7 +648,7 @@ int ARKodeSetPredictorMethod(void* arkode_mem, int pred_method) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -688,7 +688,7 @@ int ARKodeSetMaxNonlinIters(void* arkode_mem, int maxcor) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -727,7 +727,7 @@ int ARKodeSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -765,7 +765,7 @@ int ARKodeSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2206,7 +2206,7 @@ int ARKodeSetMaxConvFails(void* arkode_mem, int maxncf) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2400,7 +2400,7 @@ int ARKodeGetCurrentGamma(void* arkode_mem, sunrealtype* gamma) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2723,7 +2723,7 @@ int ARKodeComputeState(void* arkode_mem, N_Vector zcor, N_Vector z) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for incompatible time stepper modules */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, @@ -2766,7 +2766,7 @@ int ARKodeGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for incompatible time stepper modules */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, @@ -2806,7 +2806,7 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for incompatible time stepper modules */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, @@ -2845,7 +2845,7 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2884,7 +2884,7 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2923,7 +2923,7 @@ int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -2951,7 +2951,7 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 80da4eeaf5..78b3a3a696 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -64,7 +64,7 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -554,7 +554,7 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -648,7 +648,7 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -677,7 +677,7 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -720,7 +720,7 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -748,7 +748,7 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -782,7 +782,7 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -833,7 +833,7 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -892,7 +892,7 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -936,7 +936,7 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) if (retval != ARKLS_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1008,7 +1008,7 @@ int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1031,7 +1031,7 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1054,7 +1054,7 @@ int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) if (retval != ARKLS_SUCCESS) { return retval; } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1083,7 +1083,7 @@ int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1144,7 +1144,7 @@ int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1172,7 +1172,7 @@ int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1199,7 +1199,7 @@ int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1226,7 +1226,7 @@ int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1253,7 +1253,7 @@ int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1280,7 +1280,7 @@ int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1307,7 +1307,7 @@ int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1334,7 +1334,7 @@ int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); @@ -1388,7 +1388,7 @@ int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) if (retval != ARK_SUCCESS) { return (retval); } /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_algebraic) + if (!ark_mem->step_supports_implicit) { arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not require an algebraic solver"); diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 8485b85eb7..b84e417e99 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -142,7 +142,7 @@ void* MRIStepCreate(ARKRhsFn fse, ARKRhsFn fsi, sunrealtype t0, N_Vector y0, ark_mem->step_getnumnonlinsolviters = mriStep_GetNumNonlinSolvIters; ark_mem->step_getnumnonlinsolvconvfails = mriStep_GetNumNonlinSolvConvFails; ark_mem->step_getnonlinsolvstats = mriStep_GetNonlinSolvStats; - ark_mem->step_supports_algebraic = SUNTRUE; + ark_mem->step_supports_implicit = SUNTRUE; ark_mem->step_mem = (void*)step_mem; /* Set default values for optional inputs */ From 71de28607347ddd79db0a953445575fb6864cc82 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sat, 27 Apr 2024 11:09:00 -0500 Subject: [PATCH 22/39] Fixed inconsistencies in reporting ARK_ILL_INPUT instead of ARK_STEPPER_UNSUPPORTED --- src/arkode/arkode.c | 14 +++---- src/arkode/arkode_ls.c | 72 +++++++++++++++++----------------- src/arkode/arkode_relaxation.c | 58 +++++++++++++-------------- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index dc9b79c288..24008bddcd 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -612,9 +612,9 @@ int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + "time-stepping module does not support non-identity mass matrices"); + return (ARK_STEPPER_UNSUPPORTED); } /* Check inputs */ @@ -677,9 +677,9 @@ int ARKodeResVtolerance(void* arkode_mem, N_Vector rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* Check inputs */ @@ -762,9 +762,9 @@ int ARKodeResFtolerance(void* arkode_mem, ARKRwtFn rfun) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (ark_mem->MallocDone == SUNFALSE) diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 78b3a3a696..5f982f6758 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -328,9 +328,9 @@ int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (LS == NULL) @@ -607,9 +607,9 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* return with failure if mass cannot be used */ @@ -1363,9 +1363,9 @@ int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1446,9 +1446,9 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* store input and return */ @@ -1475,9 +1475,9 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* store input and return */ @@ -1521,9 +1521,9 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* issue error if LS object does not allow user-supplied preconditioning */ @@ -1572,9 +1572,9 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* issue error if mtimes function is unusable */ @@ -1650,9 +1650,9 @@ int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* start with fixed sizes plus vector/matrix pointers */ @@ -1712,9 +1712,9 @@ int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1739,9 +1739,9 @@ int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1766,9 +1766,9 @@ int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1793,9 +1793,9 @@ int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1820,9 +1820,9 @@ int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1847,9 +1847,9 @@ int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1874,9 +1874,9 @@ int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1900,9 +1900,9 @@ int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ @@ -1927,9 +1927,9 @@ int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output value and return */ @@ -1954,9 +1954,9 @@ int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } /* set output and return */ diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index b59c85604e..c57b8cfa49 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -433,7 +433,7 @@ int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) } else { - arkProcessError(NULL, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -451,9 +451,9 @@ int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_fail) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (eta_fail > ZERO && eta_fail < ONE) { relax_mem->eta_fail = eta_fail; } @@ -474,9 +474,9 @@ int ARKodeSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (lower > ZERO && lower < ONE) { relax_mem->lower_bound = lower; } @@ -497,9 +497,9 @@ int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (max_fails > 0) { relax_mem->max_fails = max_fails; } @@ -520,9 +520,9 @@ int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (max_iters > 0) { relax_mem->max_iters = max_iters; } @@ -543,9 +543,9 @@ int ARKodeSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (solver != ARK_RELAX_BRENT && solver != ARK_RELAX_NEWTON) @@ -572,9 +572,9 @@ int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (res_tol > ZERO) { relax_mem->res_tol = res_tol; } @@ -595,9 +595,9 @@ int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (rel_tol > ZERO) { relax_mem->rel_tol = rel_tol; } @@ -621,9 +621,9 @@ int ARKodeSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } if (upper > ONE) { relax_mem->upper_bound = upper; } @@ -648,9 +648,9 @@ int ARKodeGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *r_evals = relax_mem->num_relax_fn_evals; @@ -670,9 +670,9 @@ int ARKodeGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *J_evals = relax_mem->num_relax_jac_evals; @@ -692,9 +692,9 @@ int ARKodeGetNumRelaxFails(void* arkode_mem, long int* relax_fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *relax_fails = relax_mem->num_fails; @@ -714,9 +714,9 @@ int ARKodeGetNumRelaxSolveFails(void* arkode_mem, long int* fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *fails = relax_mem->nls_fails; @@ -736,9 +736,9 @@ int ARKodeGetNumRelaxBoundFails(void* arkode_mem, long int* fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *fails = relax_mem->bound_fails; @@ -758,9 +758,9 @@ int ARKodeGetNumRelaxSolveIters(void* arkode_mem, long int* iters) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, "time-stepping module does not support relaxation"); - return (ARK_ILL_INPUT); + return (ARK_STEPPER_UNSUPPORTED); } *iters = relax_mem->nls_iters; From d8ca04bbc87ec396d70a308846f9cc8c336f48d7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sat, 27 Apr 2024 11:15:12 -0500 Subject: [PATCH 23/39] Ran formatter --- include/arkode/arkode_arkstep.h | 3 +- src/arkode/arkode.c | 4 +-- src/arkode/arkode_relaxation.c | 60 ++++++++++++++++----------------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 724f345cbb..3ccf06e058 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -331,7 +331,8 @@ char* ARKStepGetReturnFlagName(long int flag); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") int ARKStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKStepGetCurrentButcherTables and ARKodeButcherTable_Write instead") +SUNDIALS_DEPRECATED_EXPORT_MSG( + "use ARKStepGetCurrentButcherTables and ARKodeButcherTable_Write instead") int ARKStepWriteButcher(void* arkode_mem, FILE* fp); /* Grouped optional output functions */ diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 24008bddcd..f6beb0bf01 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -612,8 +612,8 @@ int ARKodeResStolerance(void* arkode_mem, sunrealtype rabstol) /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support non-identity mass matrices"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support non-identity mass matrices"); return (ARK_STEPPER_UNSUPPORTED); } diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index c57b8cfa49..d5619e7757 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -433,8 +433,8 @@ int ARKodeSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } } @@ -451,8 +451,8 @@ int ARKodeSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_fail) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -474,8 +474,8 @@ int ARKodeSetRelaxLowerBound(void* arkode_mem, sunrealtype lower) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -497,8 +497,8 @@ int ARKodeSetRelaxMaxFails(void* arkode_mem, int max_fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -520,8 +520,8 @@ int ARKodeSetRelaxMaxIters(void* arkode_mem, int max_iters) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -543,8 +543,8 @@ int ARKodeSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -572,8 +572,8 @@ int ARKodeSetRelaxResTol(void* arkode_mem, sunrealtype res_tol) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -595,8 +595,8 @@ int ARKodeSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, sunrealtype abs_tol /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -621,8 +621,8 @@ int ARKodeSetRelaxUpperBound(void* arkode_mem, sunrealtype upper) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -648,8 +648,8 @@ int ARKodeGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -670,8 +670,8 @@ int ARKodeGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -692,8 +692,8 @@ int ARKodeGetNumRelaxFails(void* arkode_mem, long int* relax_fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -714,8 +714,8 @@ int ARKodeGetNumRelaxSolveFails(void* arkode_mem, long int* fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -736,8 +736,8 @@ int ARKodeGetNumRelaxBoundFails(void* arkode_mem, long int* fails) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } @@ -758,8 +758,8 @@ int ARKodeGetNumRelaxSolveIters(void* arkode_mem, long int* iters) /* Guard against use for time steppers that do not allow relaxation */ if (!ark_mem->step_supports_relaxation) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, __FILE__, - "time-stepping module does not support relaxation"); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not support relaxation"); return (ARK_STEPPER_UNSUPPORTED); } From 3e8f67b0bcb83d768e5767767c109bef796aa528 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Sat, 27 Apr 2024 14:40:02 -0500 Subject: [PATCH 24/39] Updated RecentChanges.rst and CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ doc/shared/RecentChanges.rst | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 588038928e..c223fb6ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## Changes to SUNDIALS in release X.Y.Z +Created shared user interface for ARKODE user-callable routines, to allow more +uniform control over time-stepping algorithms, improved extensibility, and +simplified code maintenance. Marked the corresponding stepper-specific +user-callable routines as deprecated; these will be removed in a future major +release. + +Added "Resize" capability to ARKODE's SPRKStep time-stepping module. + Updated the CMake variable `HIP_PLATFORM` default to `amd` as the previous default, `hcc`, is no longer recognized in ROCm 5.7.0 or newer. The new default is also valid in older version of ROCm (at least back to version 4.3.1). diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index f8e4a1c045..26c377eed8 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -1,5 +1,13 @@ **New Features** +Created shared user interface for ARKODE user-callable routines, to allow more +uniform control over time-stepping algorithms, improved extensibility, and +simplified code maintenance. Marked the corresponding stepper-specific +user-callable routines as deprecated; these will be removed in a future major +release. + +Added "Resize" capability to ARKODE's SPRKStep time-stepping module. + Added CMake infrastructure that enables externally maintained addons/plugins to be *optionally* built with SUNDIALS. See :ref:`Contributing` for details. From e4af30694109051d6b93aef81135b5f083030be3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 29 Apr 2024 09:46:31 -0500 Subject: [PATCH 25/39] Added step_getestlocalerrors function to ARKODE v-table; ran code formatter --- src/arkode/arkode.c | 1 + src/arkode/arkode_arkstep.c | 1 + src/arkode/arkode_arkstep_impl.h | 1 + src/arkode/arkode_arkstep_io.c | 19 +++++++++++++++++++ src/arkode/arkode_erkstep.c | 1 + src/arkode/arkode_erkstep_impl.h | 1 + src/arkode/arkode_erkstep_io.c | 19 +++++++++++++++++++ src/arkode/arkode_impl.h | 2 ++ src/arkode/arkode_io.c | 14 +++++++++++--- 9 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index f6beb0bf01..d22871dba4 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -120,6 +120,7 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->step_setnonlinconvcoef = NULL; ark_mem->step_setstagepredictfn = NULL; ark_mem->step_getnumlinsolvsetups = NULL; + ark_mem->step_getestlocalerrors = NULL; ark_mem->step_getcurrentgamma = NULL; ark_mem->step_getnonlinearsystemdata = NULL; ark_mem->step_getnumnonlinsolviters = NULL; diff --git a/src/arkode/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 8d7440f19a..81a4a12b3f 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -132,6 +132,7 @@ void* ARKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, ark_mem->step_setstagepredictfn = arkStep_SetStagePredictFn; ark_mem->step_getnumlinsolvsetups = arkStep_GetNumLinSolvSetups; ark_mem->step_getcurrentgamma = arkStep_GetCurrentGamma; + ark_mem->step_getestlocalerrors = arkStep_GetEstLocalErrors; ark_mem->step_getnonlinearsystemdata = arkStep_GetNonlinearSystemData; ark_mem->step_getnumnonlinsolviters = arkStep_GetNumNonlinSolvIters; ark_mem->step_getnumnonlinsolvconvfails = arkStep_GetNumNonlinSolvConvFails; diff --git a/src/arkode/arkode_arkstep_impl.h b/src/arkode/arkode_arkstep_impl.h index b8d091c424..f1e2fb1715 100644 --- a/src/arkode/arkode_arkstep_impl.h +++ b/src/arkode/arkode_arkstep_impl.h @@ -202,6 +202,7 @@ int arkStep_SetMaxNonlinIters(ARKodeMem ark_mem, int maxcor); int arkStep_SetNonlinConvCoef(ARKodeMem ark_mem, sunrealtype nlscoef); int arkStep_SetStagePredictFn(ARKodeMem ark_mem, ARKStagePredictFn PredictStage); int arkStep_SetDeduceImplicitRhs(ARKodeMem ark_mem, sunbooleantype deduce); +int arkStep_GetEstLocalErrors(ARKodeMem ark_mem, N_Vector ele); int arkStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma); int arkStep_GetNonlinearSystemData(ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, N_Vector* Fi, diff --git a/src/arkode/arkode_arkstep_io.c b/src/arkode/arkode_arkstep_io.c index 65d0474f2d..66e1a5bb87 100644 --- a/src/arkode/arkode_arkstep_io.c +++ b/src/arkode/arkode_arkstep_io.c @@ -2024,6 +2024,25 @@ int arkStep_GetCurrentGamma(ARKodeMem ark_mem, sunrealtype* gamma) return (retval); } +/*--------------------------------------------------------------- + arkStep_GetEstLocalErrors: Returns the current local truncation + error estimate vector + ---------------------------------------------------------------*/ +int arkStep_GetEstLocalErrors(ARKodeMem ark_mem, N_Vector ele) +{ + int retval; + ARKodeARKStepMem step_mem; + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); + if (retval != ARK_SUCCESS) { return (retval); } + + /* return an error if local truncation error is not computed */ + if (ark_mem->fixedstep) { return (ARK_STEPPER_UNSUPPORTED); } + + /* otherwise, copy local truncation error vector to output */ + N_VScale(ONE, ark_mem->tempv1, ele); + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- ARKStepGetNumRhsEvals: diff --git a/src/arkode/arkode_erkstep.c b/src/arkode/arkode_erkstep.c index 8fdaa5047c..d9fa09c041 100644 --- a/src/arkode/arkode_erkstep.c +++ b/src/arkode/arkode_erkstep.c @@ -102,6 +102,7 @@ void* ERKStepCreate(ARKRhsFn f, sunrealtype t0, N_Vector y0, SUNContext sunctx) ark_mem->step_setdefaults = erkStep_SetDefaults; ark_mem->step_setrelaxfn = erkStep_SetRelaxFn; ark_mem->step_setorder = erkStep_SetOrder; + ark_mem->step_getestlocalerrors = erkStep_GetEstLocalErrors; ark_mem->step_supports_adaptive = SUNTRUE; ark_mem->step_supports_relaxation = SUNTRUE; ark_mem->step_mem = (void*)step_mem; diff --git a/src/arkode/arkode_erkstep_impl.h b/src/arkode/arkode_erkstep_impl.h index e3ecdc7baf..794f112550 100644 --- a/src/arkode/arkode_erkstep_impl.h +++ b/src/arkode/arkode_erkstep_impl.h @@ -82,6 +82,7 @@ int erkStep_Resize(ARKodeMem ark_mem, N_Vector y0, sunrealtype hscale, sunrealtype t0, ARKVecResizeFn resize, void* resize_data); void erkStep_Free(ARKodeMem ark_mem); void erkStep_PrintMem(ARKodeMem ark_mem, FILE* outfile); +int erkStep_GetEstLocalErrors(ARKodeMem ark_mem, N_Vector ele); /* Internal utility routines */ int erkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index 1bbb0929ee..ad22fe9563 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -713,6 +713,25 @@ int ERKStepSetTableName(void* arkode_mem, const char* etable) ERKStep optional output functions -- stepper-specific ===============================================================*/ +/*--------------------------------------------------------------- + erkStep_GetEstLocalErrors: Returns the current local truncation + error estimate vector + ---------------------------------------------------------------*/ +int erkStep_GetEstLocalErrors(ARKodeMem ark_mem, N_Vector ele) +{ + int retval; + ARKodeARKStepMem step_mem; + retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); + if (retval != ARK_SUCCESS) { return (retval); } + + /* return an error if local truncation error is not computed */ + if (ark_mem->fixedstep) { return (ARK_STEPPER_UNSUPPORTED); } + + /* otherwise, copy local truncation error vector to output */ + N_VScale(ONE, ark_mem->tempv1, ele); + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- ERKStepGetNumRhsEvals: diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index 353d250cff..271ca1b309 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -224,6 +224,7 @@ typedef int (*ARKTimestepSetStagePredictFn)(ARKodeMem ark_mem, ARKStagePredictFn PredictStage); typedef int (*ARKTimestepGetNumLinSolvSetups)(ARKodeMem ark_mem, long int* nlinsetups); +typedef int (*ARKTimestepGetEstLocalErrors)(ARKodeMem ark_mem, N_Vector ele); typedef int (*ARKTimestepGetCurrentGamma)(ARKodeMem ark_mem, sunrealtype* gamma); typedef int (*ARKTimestepGetNonlinearSystemData)( ARKodeMem ark_mem, sunrealtype* tcur, N_Vector* zpred, N_Vector* z, @@ -377,6 +378,7 @@ struct ARKodeMemRec ARKTimestepSetMaxNonlinIters step_setmaxnonliniters; ARKTimestepSetNonlinConvCoef step_setnonlinconvcoef; ARKTimestepSetStagePredictFn step_setstagepredictfn; + ARKTimestepGetEstLocalErrors step_getestlocalerrors; ARKTimestepGetNumLinSolvSetups step_getnumlinsolvsetups; ARKTimestepGetCurrentGamma step_getcurrentgamma; ARKTimestepGetNonlinearSystemData step_getnonlinearsystemdata; diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 4dadd4e8d9..0054222e82 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -2360,9 +2360,17 @@ int ARKodeGetEstLocalErrors(void* arkode_mem, N_Vector ele) } ark_mem = (ARKodeMem)arkode_mem; - /* copy vector to output */ - N_VScale(ONE, ark_mem->tempv1, ele); - return (ARK_SUCCESS); + /* Call stepper-specific routine (if provided); otherwise return an error */ + if (ark_mem->step_getestlocalerrors) + { + return (ark_mem->step_getestlocalerrors(ark_mem, ele)); + } + else + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does provide a temporal error estimate"); + return (ARK_STEPPER_UNSUPPORTED); + } } /*--------------------------------------------------------------- From 58ac0bce177567c7877fc69b536efd5cd8a8cf59 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 29 Apr 2024 09:47:34 -0500 Subject: [PATCH 26/39] Fixed copy/paste error --- src/arkode/arkode_erkstep_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arkode/arkode_erkstep_io.c b/src/arkode/arkode_erkstep_io.c index ad22fe9563..f8c1711228 100644 --- a/src/arkode/arkode_erkstep_io.c +++ b/src/arkode/arkode_erkstep_io.c @@ -720,8 +720,8 @@ int ERKStepSetTableName(void* arkode_mem, const char* etable) int erkStep_GetEstLocalErrors(ARKodeMem ark_mem, N_Vector ele) { int retval; - ARKodeARKStepMem step_mem; - retval = arkStep_AccessStepMem(ark_mem, __func__, &step_mem); + ARKodeERKStepMem step_mem; + retval = erkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* return an error if local truncation error is not computed */ From abf334fb12db9ab76718d1d17943b5a2ad0dce3e Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 29 Apr 2024 10:03:07 -0500 Subject: [PATCH 27/39] Set guards on ARKodeGetTolScaleFactor --- src/arkode/arkode_io.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 0054222e82..a872f4b101 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -2445,6 +2445,15 @@ int ARKodeGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfact) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not use tolerances + (i.e., neither supports adaptivity nor needs an algebraic solver) */ + if ((!ark_mem->step_supports_implicit) && (!ark_mem->step_supports_adaptive)) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not use tolerances"); + return (ARK_STEPPER_UNSUPPORTED); + } + *tolsfact = ark_mem->tolsf; return (ARK_SUCCESS); } From 1eb2b41432e813df3ee9fe8eeacb3d1ff5ad9150 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 29 Apr 2024 10:04:16 -0500 Subject: [PATCH 28/39] Set guards on ARKodeGetErrWeights --- src/arkode/arkode_io.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index a872f4b101..41df9ba4e5 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -2474,6 +2474,15 @@ int ARKodeGetErrWeights(void* arkode_mem, N_Vector eweight) } ark_mem = (ARKodeMem)arkode_mem; + /* Guard against use for time steppers that do not use tolerances + (i.e., neither supports adaptivity nor needs an algebraic solver) */ + if ((!ark_mem->step_supports_implicit) && (!ark_mem->step_supports_adaptive)) + { + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not use tolerances"); + return (ARK_STEPPER_UNSUPPORTED); + } + N_VScale(ONE, ark_mem->ewt, eweight); return (ARK_SUCCESS); } From 7fcfafbf62f8be6df58a0199da9ba6b779ae2b27 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 30 Apr 2024 12:40:59 -0500 Subject: [PATCH 29/39] Deprecated ARKStepSetOptimalParams --- .../ARKStep_c_interface/User_callable.rst | 142 ++++++++++++++++++ include/arkode/arkode_arkstep.h | 3 +- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index 29e6be477b..de6dbff5ec 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -997,6 +997,148 @@ Optional inputs for ARKStep all problems are different, so these values may not be optimal for all users. + .. deprecated:: x.y.z + + Adjust solver parameters individually instead. For reference, this routine + sets the following non-default parameters: + + * Explicit methods: + + * :c:func:`SUNAdaptController_PI` with :c:func:`SUNAdaptController_SetErrorBias` of 1.2 and :c:func:`SUNAdaptController_SetParams_PI` of :math:`k_1=0.8` and :math:`k_2=-0.31` + + * :c:func:`ARKodeSetSafetyFactor` of 0.99 + + * :c:func:`ARKodeSetMaxGrowth` of 25.0 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.3 + + * Implicit methods: + + * Order 3: + + * :c:func:`SUNAdaptController_I` with :c:func:`SUNAdaptController_SetErrorBias` of 1.9 + + * :c:func:`ARKodeSetSafetyFactor` of 0.957 + + * :c:func:`ARKodeSetMaxGrowth` of 17.6 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.45 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.22 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.17 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.19 + + * Order 4: + + * :c:func:`SUNAdaptController_PID` with :c:func:`SUNAdaptController_SetErrorBias` of 1.2 and :c:func:`SUNAdaptController_SetParams_PID` of :math:`k_1=0.535`, :math:`k_2=-0.209`, and :math:`k_3=0.148` + + * :c:func:`ARKodeSetSafetyFactor` of 0.988 + + * :c:func:`ARKodeSetMaxGrowth` of 31.5 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.33 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.24 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.26 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.16 + + * :c:func:`ARKodeSetLSetupFrequency` of 31 + + * Order 5: + + * :c:func:`SUNAdaptController_PID` with :c:func:`SUNAdaptController_SetErrorBias` of 3.3 and :c:func:`SUNAdaptController_SetParams_PID` of :math:`k_1=0.56`, :math:`k_2=-0.338`, and :math:`k_3=0.14` + + * :c:func:`ARKodeSetSafetyFactor` of 0.937 + + * :c:func:`ARKodeSetMaxGrowth` of 22.0 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.44 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.25 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.4 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.32 + + * :c:func:`ARKodeSetLSetupFrequency` of 31 + + * ImEx methods: + + * Order 2: + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.001 + + * :c:func:`ARKodeSetMaxNonlinIters` of 5 + + * Order 3: + + * :c:func:`SUNAdaptController_PID` with :c:func:`SUNAdaptController_SetErrorBias` of 1.42 and :c:func:`SUNAdaptController_SetParams_PID` of :math:`k_1=0.54`, :math:`k_2=-0.36`, and :math:`k_3=0.14` + + * :c:func:`ARKodeSetSafetyFactor` of 0.965 + + * :c:func:`ARKodeSetMaxGrowth` of 28.7 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.46 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.22 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.17 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.19 + + * :c:func:`ARKodeSetLSetupFrequency` of 60 + + * Order 4: + + * :c:func:`SUNAdaptController_PID` with :c:func:`SUNAdaptController_SetErrorBias` of 1.35 and :c:func:`SUNAdaptController_SetParams_PID` of :math:`k_1=0.543`, :math:`k_2=-0.297`, and :math:`k_3=0.14` + + * :c:func:`ARKodeSetSafetyFactor` of 0.97 + + * :c:func:`ARKodeSetMaxGrowth` of 25.0 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.47 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.24 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.26 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.16 + + * :c:func:`ARKodeSetLSetupFrequency` of 31 + + * Order 5: + + * :c:func:`SUNAdaptController_PI` with :c:func:`SUNAdaptController_SetErrorBias` of 1.15 and :c:func:`SUNAdaptController_SetParams_PI` of :math:`k_1=0.8` and :math:`k_2=-0.35` + + * :c:func:`ARKodeSetSafetyFactor` of 0.993 + + * :c:func:`ARKodeSetMaxGrowth` of 28.5 + + * :c:func:`ARKodeSetMaxEFailGrowth` of 0.3 + + * :c:func:`ARKodeSetNonlinConvCoef` of 0.25 + + * :c:func:`ARKodeSetNonlinCRDown` of 0.4 + + * :c:func:`ARKodeSetNonlinRDiv` of 2.3 + + * :c:func:`ARKodeSetDeltaGammaMax` of 0.32 + + * :c:func:`ARKodeSetLSetupFrequency` of 31 .. c:function:: int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints) diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 3ccf06e058..10477c033b 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -108,7 +108,8 @@ int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); /* Optional input functions -- must be called AFTER ARKStepCreate */ SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") int ARKStepSetDefaults(void* arkode_mem); -SUNDIALS_EXPORT int ARKStepSetOptimalParams(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("adjust parameters individually instead") +int ARKStepSetOptimalParams(void* arkode_mem); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") int ARKStepSetOrder(void* arkode_mem, int maxord); SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") From 31ace7b4bc6694b1ff74dce9d8ab451ba6bd49b8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 30 Apr 2024 13:18:55 -0500 Subject: [PATCH 30/39] Applied suggestions from code review discussion --- src/arkode/arkode_io.c | 97 +----- src/arkode/arkode_ls.c | 776 +++++++++++++++++++++++++++++------------ 2 files changed, 559 insertions(+), 314 deletions(-) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 41df9ba4e5..98dc8b2cb1 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -2635,14 +2635,6 @@ int ARKodeGetNumConstrFails(void* arkode_mem, long int* nconstrfails) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for non-adaptive time stepper modules */ - if (!ark_mem->step_supports_adaptive) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_STEPPER_UNSUPPORTED); - } - *nconstrfails = ark_mem->nconstrfails; return (ARK_SUCCESS); } @@ -2663,14 +2655,6 @@ int ARKodeGetNumExpSteps(void* arkode_mem, long int* nsteps) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for non-adaptive time stepper modules */ - if (!ark_mem->step_supports_adaptive) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_STEPPER_UNSUPPORTED); - } - *nsteps = ark_mem->hadapt_mem->nst_exp; return (ARK_SUCCESS); } @@ -2691,14 +2675,6 @@ int ARKodeGetNumAccSteps(void* arkode_mem, long int* nsteps) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for non-adaptive time stepper modules */ - if (!ark_mem->step_supports_adaptive) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_STEPPER_UNSUPPORTED); - } - *nsteps = ark_mem->hadapt_mem->nst_acc; return (ARK_SUCCESS); } @@ -2719,14 +2695,6 @@ int ARKodeGetNumErrTestFails(void* arkode_mem, long int* netfails) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for non-adaptive time stepper modules */ - if (!ark_mem->step_supports_adaptive) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support temporal adaptivity"); - return (ARK_STEPPER_UNSUPPORTED); - } - *netfails = ark_mem->netf; return (ARK_SUCCESS); } @@ -2831,15 +2799,6 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for incompatible time stepper modules */ - if (!ark_mem->step_supports_implicit) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, - "time-stepping module does not support algebraic solvers"); - return (ARK_STEPPER_UNSUPPORTED); - } - /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolviters) { @@ -2847,10 +2806,8 @@ int ARKodeGetNumNonlinSolvIters(void* arkode_mem, long int* nniters) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, - "time-stepping module does not support this function"); - return (ARK_STEPPER_UNSUPPORTED); + *nniters = 0; + return (ARK_SUCCESS); } } @@ -2870,14 +2827,6 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_implicit) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); - } - /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumnonlinsolvconvfails) { @@ -2885,10 +2834,8 @@ int ARKodeGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, - "time-stepping module does not support this function"); - return (ARK_STEPPER_UNSUPPORTED); + *nnfails = 0; + return (ARK_SUCCESS); } } @@ -2909,14 +2856,6 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_implicit) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); - } - /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnonlinsolvstats) { @@ -2924,10 +2863,8 @@ int ARKodeGetNonlinSolvStats(void* arkode_mem, long int* nniters, } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, - "time-stepping module does not support this function"); - return (ARK_STEPPER_UNSUPPORTED); + *nniters = *nnfails = 0; + return (ARK_SUCCESS); } } @@ -2948,14 +2885,6 @@ int ARKodeGetNumStepSolveFails(void* arkode_mem, long int* nncfails) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_implicit) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); - } - *nncfails = ark_mem->ncfn; return (ARK_SUCCESS); } @@ -2976,14 +2905,6 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) } ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_implicit) - { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); - } - /* Call stepper routine to compute the state (if provided) */ if (ark_mem->step_getnumlinsolvsetups) { @@ -2991,10 +2912,8 @@ int ARKodeGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups) } else { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, - "time-stepping module does not support this function"); - return (ARK_STEPPER_UNSUPPORTED); + *nlinsetups = 0; + return (ARK_SUCCESS); } } diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 5f982f6758..68bf08f441 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -57,9 +57,9 @@ int ARKodeSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A) /* Return immediately if either arkode_mem or LS inputs are NULL */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_LS_ARKMEM_NULL); - return (ARKLS_MEM_NULL); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -319,9 +319,9 @@ int ARKodeSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix M, /* Return immediately if either arkode_mem or LS inputs are NULL */ if (arkode_mem == NULL) { - arkProcessError(NULL, ARKLS_MEM_NULL, __LINE__, __func__, __FILE__, - MSG_LS_ARKMEM_NULL); - return (ARKLS_MEM_NULL); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); } ark_mem = (ARKodeMem)arkode_mem; @@ -549,9 +549,14 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -561,6 +566,10 @@ int ARKodeSetJacFn(void* arkode_mem, ARKLsJacFn jac) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* return with failure if jac cannot be used */ if ((jac != NULL) && (arkls_mem->A == NULL)) { @@ -600,9 +609,14 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) @@ -612,6 +626,10 @@ int ARKodeSetMassFn(void* arkode_mem, ARKLsMassFn mass) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* return with failure if mass cannot be used */ if (mass == NULL) { @@ -643,9 +661,14 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -655,6 +678,10 @@ int ARKodeSetEpsLin(void* arkode_mem, sunrealtype eplifac) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* store input and return */ arkls_mem->eplifac = (eplifac <= ZERO) ? ARKLS_EPLIN : eplifac; @@ -672,9 +699,14 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -684,6 +716,10 @@ int ARKodeSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* store input and return */ if (nrmfac > ZERO) { @@ -715,9 +751,14 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -727,6 +768,10 @@ int ARKodeSetJacEvalFrequency(void* arkode_mem, long int msbj) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* store input and return */ arkls_mem->msbj = (msbj <= ZERO) ? ARKLS_MSBJ : msbj; @@ -743,9 +788,14 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -755,6 +805,10 @@ int ARKodeSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* check for valid solver type */ if (!(arkls_mem->matrixbased)) { return (ARKLS_ILL_INPUT); } @@ -777,9 +831,14 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, SUNPSolveFn arkls_psolve; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -789,6 +848,10 @@ int ARKodeSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { @@ -828,9 +891,14 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -840,6 +908,10 @@ int ARKodeSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* issue error if LS object does not allow user-supplied ATimes */ if (arkls_mem->LS->ops->setatimes == NULL) { @@ -887,9 +959,14 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -899,6 +976,10 @@ int ARKodeSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* check if using internal finite difference approximation */ if (!(arkls_mem->jtimesDQ)) { @@ -931,9 +1012,14 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARKLS_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not need an algebraic solver */ if (!ark_mem->step_supports_implicit) @@ -943,6 +1029,10 @@ int ARKodeSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARKLS_SUCCESS) { return (retval); } + /* return with failure if linsys cannot be used */ if ((linsys != NULL) && (arkls_mem->A == NULL)) { @@ -1003,18 +1093,26 @@ int ARKodeGetJac(void* arkode_mem, SUNMatrix* J) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARKLS_SUCCESS) { return retval; } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return NULL for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *J = NULL; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARKLS_SUCCESS) { return retval; } + /* set output and return */ *J = arkls_mem->savedJ; return ARKLS_SUCCESS; @@ -1026,18 +1124,26 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARKLS_SUCCESS) { return retval; } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *t_J = ZERO; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARKLS_SUCCESS) { return retval; } + /* set output and return */ *t_J = arkls_mem->tnlj; return ARKLS_SUCCESS; @@ -1049,18 +1155,26 @@ int ARKodeGetJacNumSteps(void* arkode_mem, long int* nst_J) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARKLS_SUCCESS) { return retval; } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *nst_J = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARKLS_SUCCESS) { return retval; } + /* set output and return */ *nst_J = arkls_mem->nstlj; return ARKLS_SUCCESS; @@ -1078,18 +1192,26 @@ int ARKodeGetLinWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) long int lrw, liw; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *lenrw = *leniw = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* start with fixed sizes plus vector/matrix pointers */ *lenrw = 3; *leniw = 30; @@ -1139,18 +1261,26 @@ int ARKodeGetNumJacEvals(void* arkode_mem, long int* njevals) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *njevals = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *njevals = arkls_mem->nje; return (ARKLS_SUCCESS); @@ -1167,18 +1297,26 @@ int ARKodeGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *nfevalsLS = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nfevalsLS = arkls_mem->nfeDQ; return (ARKLS_SUCCESS); @@ -1194,18 +1332,26 @@ int ARKodeGetNumPrecEvals(void* arkode_mem, long int* npevals) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *npevals = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *npevals = arkls_mem->npe; return (ARKLS_SUCCESS); @@ -1221,18 +1367,26 @@ int ARKodeGetNumPrecSolves(void* arkode_mem, long int* npsolves) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *npsolves = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *npsolves = arkls_mem->nps; return (ARKLS_SUCCESS); @@ -1248,18 +1402,26 @@ int ARKodeGetNumLinIters(void* arkode_mem, long int* nliters) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *nliters = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nliters = arkls_mem->nli; return (ARKLS_SUCCESS); @@ -1275,17 +1437,25 @@ int ARKodeGetNumLinConvFails(void* arkode_mem, long int* nlcfails) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - /* Guard against use for time steppers that do not need an algebraic solver */ - if (!ark_mem->step_supports_implicit) + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); } + ark_mem = (ARKodeMem)arkode_mem; + + /* Return 0 for incompatible steppers */ + if (!ark_mem->step_supports_implicit) + { + *nlcfails = 0; + return (ARK_SUCCESS); + } + + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } /* set output and return */ *nlcfails = arkls_mem->ncfl; @@ -1302,18 +1472,26 @@ int ARKodeGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *njtsetups = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *njtsetups = arkls_mem->njtsetup; return (ARKLS_SUCCESS); @@ -1329,18 +1507,26 @@ int ARKodeGetNumJtimesEvals(void* arkode_mem, long int* njvevals) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *njvevals = 0; + return (ARK_SUCCESS); } + /* access ARKLsMem structures */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *njvevals = arkls_mem->njtimes; return (ARKLS_SUCCESS); @@ -1356,18 +1542,26 @@ int ARKodeGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmvsetups = 0; + return (ARK_SUCCESS); } + /* access ARKMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmvsetups = arkls_mem->nmvsetup; return (ARKLS_SUCCESS); @@ -1383,18 +1577,26 @@ int ARKodeGetLastLinFlag(void* arkode_mem, long int* flag) ARKLsMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODELMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not need an algebraic solver */ + /* Return success for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not require an algebraic solver"); - return (ARK_STEPPER_UNSUPPORTED); + *flag = ARKLS_SUCCESS; + return (ARK_SUCCESS); } + /* access ARKLsMem structure */ + retval = arkLs_AccessLMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *flag = arkls_mem->last_flag; return (ARKLS_SUCCESS); @@ -1439,9 +1641,14 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) @@ -1451,6 +1658,10 @@ int ARKodeSetMassEpsLin(void* arkode_mem, sunrealtype eplifac) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* store input and return */ arkls_mem->eplifac = (eplifac <= ZERO) ? ARKLS_EPLIN : eplifac; @@ -1468,9 +1679,14 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) @@ -1480,6 +1696,10 @@ int ARKodeSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac) return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMem structures */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* store input and return */ if (nrmfac > ZERO) { @@ -1514,9 +1734,14 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, SUNPSolveFn arkls_mpsolve; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) @@ -1526,6 +1751,10 @@ int ARKodeSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* issue error if LS object does not allow user-supplied preconditioning */ if (arkls_mem->LS->ops->setpreconditioner == NULL) { @@ -1565,9 +1794,14 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; /* Guard against use for time steppers that do not support mass matrices */ if (!ark_mem->step_supports_massmatrix) @@ -1577,6 +1811,10 @@ int ARKodeSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn mtsetup, return (ARK_STEPPER_UNSUPPORTED); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* issue error if mtimes function is unusable */ if (mtimes == NULL) { @@ -1643,18 +1881,26 @@ int ARKodeGetMassWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw) long int lrw, liw; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *lenrw = *leniw = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* start with fixed sizes plus vector/matrix pointers */ *lenrw = 2; *leniw = 23; @@ -1705,18 +1951,26 @@ int ARKodeGetNumMassSetups(void* arkode_mem, long int* nmsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmsetups = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmsetups = arkls_mem->nmsetups; return (ARKLS_SUCCESS); @@ -1732,18 +1986,26 @@ int ARKodeGetNumMassMult(void* arkode_mem, long int* nmvevals) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmvevals = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmvevals = arkls_mem->nmtimes; return (ARKLS_SUCCESS); @@ -1759,18 +2021,26 @@ int ARKodeGetNumMassSolves(void* arkode_mem, long int* nmsolves) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmsolves = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmsolves = arkls_mem->nmsolves; return (ARKLS_SUCCESS); @@ -1786,18 +2056,26 @@ int ARKodeGetNumMassPrecEvals(void* arkode_mem, long int* npevals) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *npevals = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *npevals = arkls_mem->npe; return (ARKLS_SUCCESS); @@ -1813,18 +2091,26 @@ int ARKodeGetNumMassPrecSolves(void* arkode_mem, long int* npsolves) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *npsolves = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *npsolves = arkls_mem->nps; return (ARKLS_SUCCESS); @@ -1840,18 +2126,26 @@ int ARKodeGetNumMassIters(void* arkode_mem, long int* nmiters) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmiters = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmiters = arkls_mem->nli; return (ARKLS_SUCCESS); @@ -1867,18 +2161,26 @@ int ARKodeGetNumMassConvFails(void* arkode_mem, long int* nmcfails) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmcfails = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *nmcfails = arkls_mem->ncfl; return (ARKLS_SUCCESS); @@ -1893,18 +2195,26 @@ int ARKodeGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return NULL for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *M = NULL; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *M = arkls_mem->M; return (ARKLS_SUCCESS); @@ -1920,18 +2230,26 @@ int ARKodeGetNumMTSetups(void* arkode_mem, long int* nmtsetups) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return 0 for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *nmtsetups = 0; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output value and return */ *nmtsetups = arkls_mem->nmtsetup; return (ARKLS_SUCCESS); @@ -1947,18 +2265,26 @@ int ARKodeGetLastMassFlag(void* arkode_mem, long int* flag) ARKLsMassMem arkls_mem; int retval; - /* access ARKodeMem and ARKLsMassMem structures */ - retval = arkLs_AccessARKODEMassMem(arkode_mem, __func__, &ark_mem, &arkls_mem); - if (retval != ARK_SUCCESS) { return (retval); } + /* Return immediately if arkode_mem is NULL */ + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; - /* Guard against use for time steppers that do not support mass matrices */ + /* Return ARKLS_SUCCESS for incompatible steppers */ if (!ark_mem->step_supports_massmatrix) { - arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, - __FILE__, "time-stepping module does not support non-identity mass matrices"); - return (ARK_STEPPER_UNSUPPORTED); + *flag = ARKLS_SUCCESS; + return (ARK_SUCCESS); } + /* access ARKLsMassMem structure */ + retval = arkLs_AccessMassMem(ark_mem, __func__, &arkls_mem); + if (retval != ARK_SUCCESS) { return (retval); } + /* set output and return */ *flag = arkls_mem->last_flag; return (ARKLS_SUCCESS); From 2e86b60a66b3c86ec61f5048388891b411b29b87 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Tue, 30 Apr 2024 13:42:29 -0500 Subject: [PATCH 31/39] Updated CHANGELOG and RecentChanges files to note deprecation of ARKStepSetOptimalParams --- CHANGELOG.md | 3 +++ doc/shared/RecentChanges.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c223fb6ad3..274003be29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ release. Added "Resize" capability to ARKODE's SPRKStep time-stepping module. +Deprecated `ARKStepSetOptimalParams` function; added instructions to user guide +for users who wish to retain the current functionality. + Updated the CMake variable `HIP_PLATFORM` default to `amd` as the previous default, `hcc`, is no longer recognized in ROCm 5.7.0 or newer. The new default is also valid in older version of ROCm (at least back to version 4.3.1). diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 26c377eed8..eaf2517602 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -8,6 +8,9 @@ release. Added "Resize" capability to ARKODE's SPRKStep time-stepping module. +Deprecated `ARKStepSetOptimalParams` function; added instructions to user guide +for users who wish to retain the current functionality. + Added CMake infrastructure that enables externally maintained addons/plugins to be *optionally* built with SUNDIALS. See :ref:`Contributing` for details. From 3b22f4726b9df59c34d640e90bdd73042a981d6f Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Thu, 2 May 2024 09:10:58 -0500 Subject: [PATCH 32/39] Fixed erroneous table directive --- .../guide/source/Usage/SPRKStep_c_interface/User_callable.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index f9e8ae12ef..871fdb7420 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -217,9 +217,6 @@ Optional input functions Optional inputs for SPRKStep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. _ARKODE.Usage.SPRKStep.SPRKStepInputTable: -.. table:: Optional inputs for SPRKStep - .. c:function:: int SPRKStepSetDefaults(void* arkode_mem) From 0e8ca29b10d2d9ff320c5c4ec810418c2a9631d3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 13:10:31 -0500 Subject: [PATCH 33/39] Applied changes from PR review --- .../Usage/ARKStep_c_interface/XBraid.rst | 48 ++++++++----------- .../ERKStep_c_interface/User_callable.rst | 4 ++ .../Usage/MRIStep_c_interface/Skeleton.rst | 13 +++-- .../MRIStep_c_interface/User_callable.rst | 4 ++ .../guide/source/Usage/Preconditioners.rst | 10 ++-- .../guide/source/Usage/User_callable.rst | 6 ++- doc/shared/RecentChanges.rst | 2 +- src/arkode/arkode_ls.c | 7 +-- 8 files changed, 51 insertions(+), 43 deletions(-) diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst index 34bc5257c6..24633e9fb4 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/XBraid.rst @@ -166,13 +166,11 @@ example usage of the function. return codes defined in ``sundials/sundials_xbraid.h`` and listed in :numref:`ARKODE.Usage.ARKStep.SUNBraidReturnCodes.Table`. - .. admonition:: Usage + .. code-block:: C - .. code-block:: C - - /* Get template vector */ - flag = SUNBraidApp_GetVecTmpl(app, y_ptr); - if (flag != SUNBRAID_SUCCESS) return flag; + /* Get template vector */ + flag = SUNBraidApp_GetVecTmpl(app, y_ptr); + if (flag != SUNBRAID_SUCCESS) return flag; @@ -195,13 +193,11 @@ instance. :retval SUNBRAID_SUCCESS: if successful. :retval SUNBRAID_ALLOCFAIL: if a memory allocation failed. - .. admonition:: Usage - - .. code-block:: C + .. code-block:: C - /* Create empty XBraid interface object */ - flag = SUNBraidApp_NewEmpty(app_ptr); - if (flag != SUNBRAID_SUCCESS) return flag; + /* Create empty XBraid interface object */ + flag = SUNBraidApp_NewEmpty(app_ptr); + if (flag != SUNBRAID_SUCCESS) return flag; @@ -213,12 +209,10 @@ instance. :retval SUNBRAID_SUCCESS: if successful. - .. admonition:: Usage - - .. code-block:: C + .. code-block:: C - /* Free empty XBraid interface object */ - flag = SUNBraidApp_FreeEmpty(app_ptr); + /* Free empty XBraid interface object */ + flag = SUNBraidApp_FreeEmpty(app_ptr); .. warning:: @@ -264,13 +258,11 @@ utility functions are provided. :retval SUNBRAID_ILLINPUT: if *y* is ``NULL``. :retval SUNBRAID_ALLOCFAIL: if a memory allocation fails. - .. admonition:: Usage + .. code-block:: C - .. code-block:: C - - /* Create new vector wrapper */ - flag = SUNBraidVector_New(y, u_ptr); - if (flag != SUNBRAID_SUCCESS) return flag; + /* Create new vector wrapper */ + flag = SUNBraidVector_New(y, u_ptr); + if (flag != SUNBRAID_SUCCESS) return flag; .. warning:: @@ -291,13 +283,11 @@ utility functions are provided. :retval SUNBRAID_ILLINPUT: if *u* is ``NULL``. :retval SUNBRAID_MEMFAIL: if *y* is ``NULL``. - .. admonition:: Usage - - .. code-block:: C + .. code-block:: C - /* Create new vector wrapper */ - flag = SUNBraidVector_GetNVector(u, y_ptr); - if (flag != SUNBRAID_SUCCESS) return flag; + /* Create new vector wrapper */ + flag = SUNBraidVector_GetNVector(u, y_ptr); + if (flag != SUNBRAID_SUCCESS) return flag; diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index c60c511373..b3e9f2b274 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -2022,6 +2022,10 @@ General usability functions for this pointer, since tables for all processes would be identical. + .. deprecated:: x.y.z + + Use :c:func:`ARKStepGetCurrentButcherTables` and :c:func:`ARKodeButcherTable_Write` + instead. diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst index 1057a0cc22..f1275b0ae3 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/Skeleton.rst @@ -20,7 +20,12 @@ A skeleton of the user's main program ============================================ -While MRIStep usage generally follows the same pattern as the rest of ARKODE, since it involves the solution of both MRIStep for the slow time scale and another time integrator for the fast time scale, we summarize the differences in using MRIStep here. Steps that are unchanged from the skeleton program presented in :numref:`ARKODE.Usage.Skeleton` are *italicized*. +While MRIStep usage generally follows the same pattern as the rest of +ARKODE, since it involves the solution of both MRIStep for the slow +time scale and another time integrator for the fast time scale, we +summarize the differences in using MRIStep here. Steps that are +unchanged from the skeleton program presented in +:numref:`ARKODE.Usage.Skeleton` are *italicized*. .. index:: MRIStep user main program @@ -37,7 +42,7 @@ While MRIStep usage generally follows the same pattern as the rest of ARKODE, si * If using ARKStep as the fast (inner) integrator, create the ARKStep object with :c:func:`ARKStepCreate` and configure the integrator as desired for evolving the fast time scale. See sections :numref:`ARKODE.Usage.Skeleton`, - :numref:`ARKODE.Usage.OptionalInputs`, and + :numref:`ARKODE.Usage.OptionalInputs`, and :numref:`ARKODE.Usage.ARKStep.OptionalInputs` for details on configuring ARKStep. @@ -85,7 +90,7 @@ While MRIStep usage generally follows the same pattern as the rest of ARKODE, si #. Set the slow step size - Call :c:func:`ARKodeSetFixedStep()` on the MRIStep object to specify the + Call :c:func:`ARKodeSetFixedStep()` on the MRIStep object to specify the slow time step size. #. Create and configure implicit solvers (*as appropriate*) @@ -129,7 +134,7 @@ While MRIStep usage generally follows the same pattern as the rest of ARKODE, si content and call :c:func:`MRIStepInnerStepper_Free` to free the ``MRIStepInnerStepper`` object. - * Call :c:func:`ARKodeFree` to free the memory allocated for the MRIStep + * Call :c:func:`ARKodeFree` to free the memory allocated for the MRIStep slow integration object. #. *Free linear solver and matrix memory (as appropriate)* diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst index 230eb30113..0aa08d6fc3 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst @@ -2661,6 +2661,10 @@ General usability functions for this pointer, since tables for all processes would be identical. + .. deprecated:: x.y.z + + Use :c:func:`MRIStepGetCurrentCoupling` and :c:func:`MRIStepCoupling_Write` + instead. .. _ARKODE.Usage.MRIStep.Reinitialization: diff --git a/doc/arkode/guide/source/Usage/Preconditioners.rst b/doc/arkode/guide/source/Usage/Preconditioners.rst index 9e47fc4d81..62bdb966b0 100644 --- a/doc/arkode/guide/source/Usage/Preconditioners.rst +++ b/doc/arkode/guide/source/Usage/Preconditioners.rst @@ -88,13 +88,13 @@ skeleton program presented in :numref:`ARKODE.Usage.Skeleton` are #. Initialize the ARKBANDPRE preconditioner module - Specify the upper and lower half-bandwidths (``mu`` and ``ml``, - respectively) and call + Specify the upper and lower half-bandwidths (``mu`` and ``ml``, + respectively) and call - ``ier = ARKBandPrecInit(arkode_mem, N, mu, ml);`` + ``ier = ARKBandPrecInit(arkode_mem, N, mu, ml);`` - to allocate memory and initialize the internal preconditioner - data. + to allocate memory and initialize the internal preconditioner + data. #. *Create nonlinear solver object* diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index 34af1d3284..290efd534b 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -45,7 +45,11 @@ D. functions that apply for time-stepping modules that support non-identity mass E. functions that apply for time-stepping modules that support relaxation Runge--Kutta methods. -In the function descriptions below, we identify those that have any of the restrictions B-E above. Then in the introduction for each of the stepper-specific documentation sections (:numref:`ARKODE.Usage.ARKStep.UserCallable`, :numref:`ARKODE.Usage.ERKStep.UserCallable`, :numref:`ARKODE.Usage.MRIStep.UserCallable`, and :numref:`ARKODE.Usage.SPRKStep.UserCallable`) we clarify the categories of these functions that are supported. +In the function descriptions below, we identify those that have any of the restrictions B-E above. +Then in the introduction for each of the stepper-specific documentation sections +(:numref:`ARKODE.Usage.ARKStep.UserCallable`, :numref:`ARKODE.Usage.ERKStep.UserCallable`, +:numref:`ARKODE.Usage.MRIStep.UserCallable`, and :numref:`ARKODE.Usage.SPRKStep.UserCallable`) +we clarify the categories of these functions that are supported. diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index eaf2517602..ccace127f9 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -8,7 +8,7 @@ release. Added "Resize" capability to ARKODE's SPRKStep time-stepping module. -Deprecated `ARKStepSetOptimalParams` function; added instructions to user guide +Deprecated ``ARKStepSetOptimalParams`` function; added instructions to user guide for users who wish to retain the current functionality. Added CMake infrastructure that enables externally maintained addons/plugins diff --git a/src/arkode/arkode_ls.c b/src/arkode/arkode_ls.c index 68bf08f441..352fe183cc 100644 --- a/src/arkode/arkode_ls.c +++ b/src/arkode/arkode_ls.c @@ -1133,11 +1133,12 @@ int ARKodeGetJacTime(void* arkode_mem, sunrealtype* t_J) } ark_mem = (ARKodeMem)arkode_mem; - /* Return 0 for incompatible steppers */ + /* Return an error for incompatible steppers */ if (!ark_mem->step_supports_implicit) { - *t_J = ZERO; - return (ARK_SUCCESS); + arkProcessError(ark_mem, ARK_STEPPER_UNSUPPORTED, __LINE__, __func__, + __FILE__, "time-stepping module does not require an algebraic solver"); + return (ARK_STEPPER_UNSUPPORTED); } /* access ARKLsMem structure */ From 391d30d81f828dbf104ff9ee6b5c338d13f14c14 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 13:13:06 -0500 Subject: [PATCH 34/39] Apply suggestions from code review Co-authored-by: David Gardner --- .../guide/source/Usage/ARKStep_c_interface/User_callable.rst | 4 ++-- .../guide/source/Usage/ERKStep_c_interface/User_callable.rst | 4 ++-- .../guide/source/Usage/MRIStep_c_interface/User_callable.rst | 4 ++-- .../guide/source/Usage/SPRKStep_c_interface/User_callable.rst | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst index de6dbff5ec..dcd7339a97 100644 --- a/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep_c_interface/User_callable.rst @@ -20,8 +20,8 @@ ARKStep User-callable functions This section describes the ARKStep-specific functions that may be called by the user to setup and then solve an IVP using the ARKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying -ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked. However, some +ARKODE functions `, and are now deprecated +-- each of these are clearly marked. However, some of these user-callable functions are specific to ARKStep, as explained below. diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index b3e9f2b274..c9a27cbc34 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -20,8 +20,8 @@ ERKStep User-callable functions This section describes the ERKStep-specific functions that may be called by the user to setup and then solve an IVP using the ERKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying -ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked. However, some +ARKODE functions `, and are now deprecated +-- each of these are clearly marked. However, some of these user-callable functions are specific to ERKStep, as explained below. diff --git a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst index 0aa08d6fc3..3719395f66 100644 --- a/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep_c_interface/User_callable.rst @@ -21,8 +21,8 @@ MRIStep User-callable functions This section describes the MRIStep-specific functions that may be called by the user to setup and then solve an IVP using the MRIStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying -ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked. However, some +ARKODE functions `, and are now deprecated +-- each of these are clearly marked. However, some of these user-callable functions are specific to ERKStep, as explained below. diff --git a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst index 871fdb7420..45996860cf 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep_c_interface/User_callable.rst @@ -18,8 +18,8 @@ SPRKStep User-callable functions This section describes the SPRKStep-specific functions that may be called by the user to setup and then solve an IVP using the SPRKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying -ARKODE functions `, and will be deprecated in an -upcoming release -- each of these are clearly marked. However, some +ARKODE functions `, and are now deprecated +-- each of these are clearly marked. However, some of these user-callable functions are specific to ERKStep, as explained below. From f98ac0d532a0bf032e4dee3a35b3ecf9a0e66327 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 13:26:46 -0500 Subject: [PATCH 35/39] Fixed nrmfac, and added default interpolation type for SPRKStep --- doc/arkode/guide/source/Usage/User_callable.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index 290efd534b..96d4f5eddd 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -849,7 +849,8 @@ Optional input Function name ================================================ ======================================= ======================= Return ARKODE parameters to their defaults :c:func:`ARKodeSetDefaults` internal Set integrator method order :c:func:`ARKodeSetOrder` 4 -Set dense output interpolation type :c:func:`ARKodeSetInterpolantType` ``ARK_INTERP_HERMITE`` +Set dense output interpolation type (SPRKStep) :c:func:`ARKodeSetInterpolantType` ``ARK_INTERP_LAGRANGE`` +Set dense output interpolation type (others) :c:func:`ARKodeSetInterpolantType` ``ARK_INTERP_HERMITE`` Set dense output polynomial degree :c:func:`ARKodeSetInterpolantDegree` 5 Supply a pointer to a diagnostics output file :c:func:`ARKodeSetDiagnostics` ``NULL`` Disable time step adaptivity (fixed-step mode) :c:func:`ARKodeSetFixedStep` disabled @@ -2771,7 +2772,7 @@ measured in the WRMS norm :eq:`ARKODE_WRMS_NORM`, the ARKLS interface internally converts between these quantities when interfacing with linear solvers, .. math:: - \text{tol}_{L2} = \text{\em nrmfac}\; \text{tol}_{WRMS}. + \text{tol}_{L2} = \textit{nrmfac}\ \ \text{tol}_{WRMS}. :label: ARKODE_NRMFAC Prior to the introduction of :c:func:`N_VGetLength` in SUNDIALS v5.0.0 the From 57b00edf8c9c3a345eece36c236d124185b06f16 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 13:45:13 -0500 Subject: [PATCH 36/39] Update doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst Co-authored-by: David Gardner --- .../guide/source/Usage/ERKStep_c_interface/User_callable.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst index c9a27cbc34..8984b67a9b 100644 --- a/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep_c_interface/User_callable.rst @@ -2024,7 +2024,7 @@ General usability functions .. deprecated:: x.y.z - Use :c:func:`ARKStepGetCurrentButcherTables` and :c:func:`ARKodeButcherTable_Write` + Use :c:func:`ERKStepGetCurrentButcherTable` and :c:func:`ARKodeButcherTable_Write` instead. From c11d38cd90206280d8dd720e8b0863c6544b07c1 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 14:45:30 -0500 Subject: [PATCH 37/39] Updated integer workspace sizes in a few more .out files --- .../C_parallel/ark_diurnal_kry_bbd_p.out | 104 +++++++++--------- .../arkode/C_parallel/ark_diurnal_kry_p.out | 47 ++++---- .../arkode/C_parhyp/ark_diurnal_kry_ph.out | 46 ++++---- 3 files changed, 98 insertions(+), 99 deletions(-) diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.out b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.out index df7478fcae..6ec12802af 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.out +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.out @@ -8,57 +8,57 @@ Preconditioner type is: jpre = SUN_PREC_LEFT t = 7.20e+03 no. steps = 980 stepsize = 3.07e+00 -At bottom left: c1, c2 = 1.047e+04 2.527e+11 -At top right: c1, c2 = 1.119e+04 2.700e+11 +At bottom left: c1, c2 = 1.047e+04 2.527e+11 +At top right: c1, c2 = 1.119e+04 2.700e+11 t = 1.44e+04 no. steps = 2730 stepsize = 6.90e+00 -At bottom left: c1, c2 = 6.659e+06 2.582e+11 -At top right: c1, c2 = 7.301e+06 2.833e+11 +At bottom left: c1, c2 = 6.659e+06 2.582e+11 +At top right: c1, c2 = 7.301e+06 2.833e+11 t = 2.16e+04 no. steps = 3533 stepsize = 1.04e+01 -At bottom left: c1, c2 = 2.665e+07 2.993e+11 -At top right: c1, c2 = 2.931e+07 3.313e+11 +At bottom left: c1, c2 = 2.665e+07 2.993e+11 +At top right: c1, c2 = 2.931e+07 3.313e+11 t = 2.88e+04 no. steps = 4681 stepsize = 4.32e+00 -At bottom left: c1, c2 = 8.702e+06 3.380e+11 -At top right: c1, c2 = 9.650e+06 3.751e+11 +At bottom left: c1, c2 = 8.702e+06 3.380e+11 +At top right: c1, c2 = 9.650e+06 3.751e+11 t = 3.60e+04 no. steps = 5975 stepsize = 2.55e+00 -At bottom left: c1, c2 = 1.404e+04 3.387e+11 -At top right: c1, c2 = 1.561e+04 3.765e+11 +At bottom left: c1, c2 = 1.404e+04 3.387e+11 +At top right: c1, c2 = 1.561e+04 3.765e+11 t = 4.32e+04 no. steps = 7163 stepsize = 4.64e+02 -At bottom left: c1, c2 = 2.125e-08 3.382e+11 -At top right: c1, c2 = 4.245e-08 3.804e+11 +At bottom left: c1, c2 = 2.125e-08 3.382e+11 +At top right: c1, c2 = 4.245e-08 3.804e+11 t = 5.04e+04 no. steps = 7179 stepsize = 4.64e+02 -At bottom left: c1, c2 = -4.072e-07 3.358e+11 -At top right: c1, c2 = 4.005e-11 3.864e+11 +At bottom left: c1, c2 = -4.072e-07 3.358e+11 +At top right: c1, c2 = 4.005e-11 3.864e+11 t = 5.76e+04 no. steps = 7195 stepsize = 3.44e+02 -At bottom left: c1, c2 = 3.487e-08 3.320e+11 -At top right: c1, c2 = 3.658e-18 3.909e+11 +At bottom left: c1, c2 = 3.487e-08 3.320e+11 +At top right: c1, c2 = 3.658e-18 3.909e+11 t = 6.48e+04 no. steps = 7210 stepsize = 5.15e+02 -At bottom left: c1, c2 = 2.253e-07 3.313e+11 -At top right: c1, c2 = -2.680e-19 3.963e+11 +At bottom left: c1, c2 = 2.253e-07 3.313e+11 +At top right: c1, c2 = -2.680e-19 3.963e+11 t = 7.20e+04 no. steps = 7224 stepsize = 5.15e+02 -At bottom left: c1, c2 = 8.966e-08 3.330e+11 -At top right: c1, c2 = -1.036e-18 4.039e+11 +At bottom left: c1, c2 = 8.966e-08 3.330e+11 +At top right: c1, c2 = -1.036e-18 4.039e+11 t = 7.92e+04 no. steps = 7238 stepsize = 5.15e+02 -At bottom left: c1, c2 = 2.038e-08 3.334e+11 -At top right: c1, c2 = -2.330e-18 4.120e+11 +At bottom left: c1, c2 = 2.038e-08 3.334e+11 +At top right: c1, c2 = -2.330e-18 4.120e+11 t = 8.64e+04 no. steps = 7252 stepsize = 5.15e+02 -At bottom left: c1, c2 = -3.746e-21 3.352e+11 -At top right: c1, c2 = -2.537e-27 4.163e+11 +At bottom left: c1, c2 = -3.746e-21 3.352e+11 +At top right: c1, c2 = -2.537e-27 4.163e+11 -Final Statistics: +Final Statistics: -lenrw = 3902 leniw = 267 +lenrw = 3902 leniw = 279 lenrwls = 2455 leniwls = 126 nst = 7252 nfe = 0 nfe = 76929 nfels = 102816 @@ -77,57 +77,57 @@ In ARKBBDPRE: real/integer local work space sizes = 1300, 192 Preconditioner type is: jpre = SUN_PREC_RIGHT t = 7.20e+03 no. steps = 980 stepsize = 3.07e+00 -At bottom left: c1, c2 = 1.047e+04 2.527e+11 -At top right: c1, c2 = 1.119e+04 2.700e+11 +At bottom left: c1, c2 = 1.047e+04 2.527e+11 +At top right: c1, c2 = 1.119e+04 2.700e+11 t = 1.44e+04 no. steps = 2730 stepsize = 6.90e+00 -At bottom left: c1, c2 = 6.659e+06 2.582e+11 -At top right: c1, c2 = 7.301e+06 2.833e+11 +At bottom left: c1, c2 = 6.659e+06 2.582e+11 +At top right: c1, c2 = 7.301e+06 2.833e+11 t = 2.16e+04 no. steps = 3533 stepsize = 1.04e+01 -At bottom left: c1, c2 = 2.665e+07 2.993e+11 -At top right: c1, c2 = 2.931e+07 3.313e+11 +At bottom left: c1, c2 = 2.665e+07 2.993e+11 +At top right: c1, c2 = 2.931e+07 3.313e+11 t = 2.88e+04 no. steps = 4705 stepsize = 3.57e+00 -At bottom left: c1, c2 = 8.702e+06 3.380e+11 -At top right: c1, c2 = 9.650e+06 3.751e+11 +At bottom left: c1, c2 = 8.702e+06 3.380e+11 +At top right: c1, c2 = 9.650e+06 3.751e+11 t = 3.60e+04 no. steps = 6160 stepsize = 2.56e+00 -At bottom left: c1, c2 = 1.404e+04 3.387e+11 -At top right: c1, c2 = 1.561e+04 3.765e+11 +At bottom left: c1, c2 = 1.404e+04 3.387e+11 +At top right: c1, c2 = 1.561e+04 3.765e+11 t = 4.32e+04 no. steps = 7347 stepsize = 4.30e+02 -At bottom left: c1, c2 = 4.255e-12 3.382e+11 -At top right: c1, c2 = -2.358e-07 3.804e+11 +At bottom left: c1, c2 = 4.255e-12 3.382e+11 +At top right: c1, c2 = -2.358e-07 3.804e+11 t = 5.04e+04 no. steps = 7364 stepsize = 4.81e+02 -At bottom left: c1, c2 = -1.312e-17 3.358e+11 -At top right: c1, c2 = 2.130e-11 3.864e+11 +At bottom left: c1, c2 = -1.312e-17 3.358e+11 +At top right: c1, c2 = 2.130e-11 3.864e+11 t = 5.76e+04 no. steps = 7380 stepsize = 2.39e+02 -At bottom left: c1, c2 = -6.762e-21 3.320e+11 -At top right: c1, c2 = -4.330e-12 3.909e+11 +At bottom left: c1, c2 = -6.762e-21 3.320e+11 +At top right: c1, c2 = -4.330e-12 3.909e+11 t = 6.48e+04 no. steps = 7393 stepsize = 6.42e+02 -At bottom left: c1, c2 = -3.898e-25 3.313e+11 -At top right: c1, c2 = -4.918e-07 3.963e+11 +At bottom left: c1, c2 = -3.898e-25 3.313e+11 +At top right: c1, c2 = -4.918e-07 3.963e+11 t = 7.20e+04 no. steps = 7405 stepsize = 6.42e+02 -At bottom left: c1, c2 = 5.173e-25 3.330e+11 -At top right: c1, c2 = -1.031e-06 4.039e+11 +At bottom left: c1, c2 = 5.173e-25 3.330e+11 +At top right: c1, c2 = -1.031e-06 4.039e+11 t = 7.92e+04 no. steps = 7416 stepsize = 6.42e+02 -At bottom left: c1, c2 = 5.441e-26 3.334e+11 -At top right: c1, c2 = -1.290e-06 4.120e+11 +At bottom left: c1, c2 = 5.441e-26 3.334e+11 +At top right: c1, c2 = -1.290e-06 4.120e+11 t = 8.64e+04 no. steps = 7427 stepsize = 6.42e+02 -At bottom left: c1, c2 = 1.538e-27 3.352e+11 -At top right: c1, c2 = -5.134e-07 4.163e+11 +At bottom left: c1, c2 = 1.538e-27 3.352e+11 +At top right: c1, c2 = -5.134e-07 4.163e+11 -Final Statistics: +Final Statistics: -lenrw = 3902 leniw = 272 +lenrw = 3902 leniw = 284 lenrwls = 2455 leniwls = 126 nst = 7427 nfe = 0 nfe = 78794 nfels = 111450 diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.out b/examples/arkode/C_parallel/ark_diurnal_kry_p.out index a2db3d9006..b2a0ee2812 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.out +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.out @@ -2,57 +2,57 @@ 2-species diurnal advection-diffusion problem t = 7.20e+03 no. steps = 980 stepsize = 3.07e+00 -At bottom left: c1, c2 = 1.047e+04 2.527e+11 -At top right: c1, c2 = 1.119e+04 2.700e+11 +At bottom left: c1, c2 = 1.047e+04 2.527e+11 +At top right: c1, c2 = 1.119e+04 2.700e+11 t = 1.44e+04 no. steps = 2730 stepsize = 6.90e+00 -At bottom left: c1, c2 = 6.659e+06 2.582e+11 -At top right: c1, c2 = 7.301e+06 2.833e+11 +At bottom left: c1, c2 = 6.659e+06 2.582e+11 +At top right: c1, c2 = 7.301e+06 2.833e+11 t = 2.16e+04 no. steps = 3533 stepsize = 1.04e+01 At bottom left: c1, c2 = 2.665e+07 2.993e+11 At top right: c1, c2 = 2.931e+07 3.313e+11 t = 2.88e+04 no. steps = 4695 stepsize = 3.50e+00 -At bottom left: c1, c2 = 8.702e+06 3.380e+11 -At top right: c1, c2 = 9.650e+06 3.751e+11 +At bottom left: c1, c2 = 8.702e+06 3.380e+11 +At top right: c1, c2 = 9.650e+06 3.751e+11 t = 3.60e+04 no. steps = 6172 stepsize = 2.55e+00 -At bottom left: c1, c2 = 1.404e+04 3.387e+11 -At top right: c1, c2 = 1.561e+04 3.765e+11 +At bottom left: c1, c2 = 1.404e+04 3.387e+11 +At top right: c1, c2 = 1.561e+04 3.765e+11 t = 4.32e+04 no. steps = 7361 stepsize = 5.00e+02 -At bottom left: c1, c2 = 3.855e-13 3.382e+11 -At top right: c1, c2 = -1.439e-12 3.804e+11 +At bottom left: c1, c2 = 3.855e-13 3.382e+11 +At top right: c1, c2 = -1.439e-12 3.804e+11 t = 5.04e+04 no. steps = 7379 stepsize = 3.71e+02 -At bottom left: c1, c2 = -4.407e-14 3.358e+11 -At top right: c1, c2 = 1.551e-13 3.864e+11 +At bottom left: c1, c2 = -4.407e-14 3.358e+11 +At top right: c1, c2 = 1.551e-13 3.864e+11 t = 5.76e+04 no. steps = 7394 stepsize = 1.90e+02 -At bottom left: c1, c2 = 2.370e-12 3.320e+11 -At top right: c1, c2 = -4.013e-12 3.909e+11 +At bottom left: c1, c2 = 2.370e-12 3.320e+11 +At top right: c1, c2 = -4.013e-12 3.909e+11 t = 6.48e+04 no. steps = 7409 stepsize = 5.59e+02 -At bottom left: c1, c2 = 1.301e-12 3.313e+11 -At top right: c1, c2 = -4.849e-12 3.963e+11 +At bottom left: c1, c2 = 1.301e-12 3.313e+11 +At top right: c1, c2 = -4.849e-12 3.963e+11 t = 7.20e+04 no. steps = 7421 stepsize = 5.59e+02 -At bottom left: c1, c2 = -1.797e-23 3.330e+11 -At top right: c1, c2 = -3.890e-22 4.039e+11 +At bottom left: c1, c2 = -1.797e-23 3.330e+11 +At top right: c1, c2 = -3.890e-22 4.039e+11 t = 7.92e+04 no. steps = 7434 stepsize = 5.59e+02 -At bottom left: c1, c2 = -2.819e-27 3.334e+11 -At top right: c1, c2 = -1.209e-25 4.120e+11 +At bottom left: c1, c2 = -2.819e-27 3.334e+11 +At top right: c1, c2 = -1.209e-25 4.120e+11 t = 8.64e+04 no. steps = 7447 stepsize = 5.59e+02 -At bottom left: c1, c2 = -2.334e-27 3.352e+11 -At top right: c1, c2 = -8.983e-26 4.163e+11 +At bottom left: c1, c2 = -2.334e-27 3.352e+11 +At top right: c1, c2 = -8.983e-26 4.163e+11 Final Statistics: -lenrw = 3302 leniw = 243 +lenrw = 3302 leniw = 255 lenrwls = 2455 leniwls = 126 nst = 7447 nfe = 0 nfi = 79041 nfels = 108536 @@ -60,4 +60,3 @@ nni = 41643 nli = 108536 nsetups = 456 netf = 32 npe = 125 nps = 147035 ncfn = 0 ncfl = 83 - diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.out b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.out index ffb0e71104..a6c5f580fa 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.out +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.out @@ -6,53 +6,53 @@ At bottom left: c1, c2 = 1.047e+04 2.527e+11 At top right: c1, c2 = 1.119e+04 2.700e+11 t = 1.44e+04 no. steps = 2733 stepsize = 6.93e+00 -At bottom left: c1, c2 = 6.659e+06 2.582e+11 -At top right: c1, c2 = 7.301e+06 2.833e+11 +At bottom left: c1, c2 = 6.659e+06 2.582e+11 +At top right: c1, c2 = 7.301e+06 2.833e+11 t = 2.16e+04 no. steps = 3532 stepsize = 1.04e+01 -At bottom left: c1, c2 = 2.665e+07 2.993e+11 -At top right: c1, c2 = 2.931e+07 3.313e+11 +At bottom left: c1, c2 = 2.665e+07 2.993e+11 +At top right: c1, c2 = 2.931e+07 3.313e+11 t = 2.88e+04 no. steps = 4588 stepsize = 4.86e+00 -At bottom left: c1, c2 = 8.702e+06 3.380e+11 -At top right: c1, c2 = 9.650e+06 3.751e+11 +At bottom left: c1, c2 = 8.702e+06 3.380e+11 +At top right: c1, c2 = 9.650e+06 3.751e+11 t = 3.60e+04 no. steps = 5824 stepsize = 2.55e+00 -At bottom left: c1, c2 = 1.404e+04 3.387e+11 -At top right: c1, c2 = 1.561e+04 3.765e+11 +At bottom left: c1, c2 = 1.404e+04 3.387e+11 +At top right: c1, c2 = 1.561e+04 3.765e+11 t = 4.32e+04 no. steps = 7026 stepsize = 5.12e+02 -At bottom left: c1, c2 = 1.334e-12 3.382e+11 -At top right: c1, c2 = -4.825e-12 3.804e+11 +At bottom left: c1, c2 = 1.334e-12 3.382e+11 +At top right: c1, c2 = -4.825e-12 3.804e+11 t = 5.04e+04 no. steps = 7041 stepsize = 5.36e+02 -At bottom left: c1, c2 = 1.415e-13 3.358e+11 -At top right: c1, c2 = -1.712e-12 3.864e+11 +At bottom left: c1, c2 = 1.415e-13 3.358e+11 +At top right: c1, c2 = -1.712e-12 3.864e+11 t = 5.76e+04 no. steps = 7055 stepsize = 2.34e+02 -At bottom left: c1, c2 = -2.533e-12 3.320e+11 -At top right: c1, c2 = -5.401e-12 3.909e+11 +At bottom left: c1, c2 = -2.533e-12 3.320e+11 +At top right: c1, c2 = -5.401e-12 3.909e+11 t = 6.48e+04 no. steps = 7068 stepsize = 6.40e+02 -At bottom left: c1, c2 = -4.169e-12 3.313e+11 -At top right: c1, c2 = 1.665e-11 3.963e+11 +At bottom left: c1, c2 = -4.169e-12 3.313e+11 +At top right: c1, c2 = 1.665e-11 3.963e+11 t = 7.20e+04 no. steps = 7080 stepsize = 6.40e+02 -At bottom left: c1, c2 = -3.839e-12 3.330e+11 -At top right: c1, c2 = -3.434e-11 4.039e+11 +At bottom left: c1, c2 = -3.839e-12 3.330e+11 +At top right: c1, c2 = -3.434e-11 4.039e+11 t = 7.92e+04 no. steps = 7091 stepsize = 6.40e+02 -At bottom left: c1, c2 = 2.289e-26 3.334e+11 -At top right: c1, c2 = 4.220e-25 4.120e+11 +At bottom left: c1, c2 = 2.289e-26 3.334e+11 +At top right: c1, c2 = 4.220e-25 4.120e+11 t = 8.64e+04 no. steps = 7102 stepsize = 6.40e+02 -At bottom left: c1, c2 = -5.225e-26 3.352e+11 -At top right: c1, c2 = -5.452e-25 4.163e+11 +At bottom left: c1, c2 = -5.225e-26 3.352e+11 +At top right: c1, c2 = -5.452e-25 4.163e+11 Final Statistics: -lenrw = 3302 leniw = 243 +lenrw = 3302 leniw = 255 lenrwls = 2455 leniwls = 126 nst = 7102 nfe = 0 nfi = 74579 nfels = 87090 From ab8880566442904cae2ef5e4aaba5bcfff0cf590 Mon Sep 17 00:00:00 2001 From: "David J. Gardner" Date: Mon, 6 May 2024 13:21:02 -0700 Subject: [PATCH 38/39] update answers commit --- test/answers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/answers b/test/answers index ea6ac15fdc..ff3a29d594 160000 --- a/test/answers +++ b/test/answers @@ -1 +1 @@ -Subproject commit ea6ac15fdcd8615e25e52692bcd453e2f003f46b +Subproject commit ff3a29d5940bb540a7088cbbabc97f3bad2a3e78 From 1f62f48557c22ef720293c772746b0cfea012125 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Mon, 6 May 2024 17:05:16 -0500 Subject: [PATCH 39/39] Updated a couple of Fortran .out files --- .../F2003_parallel/ark_diag_kry_bbd_f2003.out | 21 +++++----- .../F2003_serial/ark_diurnal_kry_bp_f2003.out | 39 +++++++++---------- test/answers | 2 +- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.out b/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.out index 537ef428b9..0e09570888 100644 --- a/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.out +++ b/examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.out @@ -1,4 +1,4 @@ - + Diagonal test problem: neq = 40 nlocal = 10 @@ -9,7 +9,7 @@ ydot_i = -alpha*i * y_i (i = 1,...,neq) Method is DIRK/NEWTON/SPGMR Precond is band-block-diagonal, using ARKBBDPRE - + Preconditioning on left: t steps steps att. fe fi ------------------------------------------------- @@ -25,7 +25,7 @@ 1.000000 319 319 0 3410 ------------------------------------------------- Max. absolute error is 7.52E-11 - + Final Solver Statistics: Internal solver steps = 319 (attempted = 319) Total explicit RHS evals = 0 @@ -38,13 +38,13 @@ Max. absolute error is 7.52E-11 Total Convergence Failures - Nonlinear = 0 - Linear = 0 Total number of error test failures = 0 - Main solver real/int workspace sizes = 862 267 + Main solver real/int workspace sizes = 862 279 Linear solver real/int workspace sizes = 535 126 BBD preconditioner real/int workspace sizes = 160 72 Total number of g evals = 12 - - - + + + Preconditioning on right: t steps steps att. fe fi ------------------------------------------------- @@ -60,7 +60,7 @@ Max. absolute error is 7.52E-11 1.000000 319 319 0 3410 ------------------------------------------------- Max. absolute error is 7.52E-11 - + Final Solver Statistics: Internal solver steps = 319 (attempted = 319) Total explicit RHS evals = 0 @@ -73,10 +73,7 @@ Max. absolute error is 7.52E-11 Total Convergence Failures - Nonlinear = 0 - Linear = 0 Total number of error test failures = 0 - Main solver real/int workspace sizes = 862 272 + Main solver real/int workspace sizes = 862 284 Linear solver real/int workspace sizes = 535 126 BBD preconditioner real/int workspace sizes = 160 72 Total number of g evals = 12 - - - diff --git a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out index 90517794f0..68e0609dbb 100644 --- a/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out +++ b/examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.out @@ -1,6 +1,6 @@ - + Finished initialization, starting time steps - + t c1 (bottom left middle top right) | lnst lnst_att lh t c2 (bottom left middle top right) | lnst lnst_att lh ---------------------------------------------------------------------------------------- @@ -8,43 +8,42 @@ 4.440310E+11 7.263637E+11 3.820591E+11 1.440000E+04 1.149716E+07 1.249098E+07 1.329954E+07 2780 2784 1.022085E+01 4.473684E+11 4.862283E+11 5.178450E+11 - 2.160000E+04 2.525270E+07 7.837587E+07 3.018990E+07 3325 3329 1.467514E+01 + 2.160000E+04 2.525270E+07 7.837587E+07 3.018990E+07 3325 3329 1.467507E+01 2.824256E+11 9.233209E+11 3.419869E+11 - 2.880000E+04 1.189287E+07 2.395791E+07 1.042605E+07 3816 3820 1.467514E+01 + 2.880000E+04 1.189287E+07 2.395791E+07 1.042605E+07 3816 3820 1.467507E+01 4.627840E+11 9.345089E+11 4.054359E+11 - 3.600000E+04 2.342949E+04 2.291472E+04 2.522325E+04 4629 4633 4.333728E+00 + 3.600000E+04 2.342948E+04 2.291472E+04 2.522324E+04 4629 4633 4.334128E+00 5.651673E+11 5.527495E+11 6.084385E+11 - 4.320000E+04 -3.718382E-05 -1.465487E-05 2.611385E-05 5635 5639 6.272609E+02 + 4.320000E+04 1.194709E-04 5.892092E-05 -1.674879E-04 5635 5639 6.277419E+02 3.689222E+11 8.238330E+11 4.623703E+11 - 5.040000E+04 5.522194E-07 -9.160075E-06 4.014494E-05 5647 5651 6.272609E+02 - 3.862509E+11 1.017897E+12 3.536890E+11 - 5.760000E+04 -1.084359E-05 -3.724411E-06 1.288549E-06 5658 5662 6.272609E+02 - 5.832933E+11 6.187928E+11 5.788981E+11 - 6.480000E+04 2.972416E-05 1.471335E-05 -3.876329E-05 5670 5674 6.272609E+02 - 4.274400E+11 6.788806E+11 5.386844E+11 - 7.200000E+04 -2.141097E-16 6.301814E-17 1.652460E-15 5681 5685 6.272609E+02 + 5.040000E+04 -8.456488E-06 -9.187620E-06 3.659273E-05 5647 5651 6.277419E+02 + 3.862510E+11 1.017897E+12 3.536889E+11 + 5.760000E+04 -1.301882E-05 -3.846503E-06 5.896852E-06 5658 5662 6.277419E+02 + 5.832932E+11 6.187928E+11 5.788981E+11 + 6.480000E+04 3.467015E-05 1.276786E-05 -3.337236E-05 5670 5674 6.277419E+02 + 4.274401E+11 6.788806E+11 5.386844E+11 + 7.200000E+04 -7.456958E-06 8.227805E-17 3.511631E-10 5681 5685 6.277419E+02 3.453624E+11 1.030182E+12 3.448304E+11 - 7.920000E+04 2.795850E-14 6.145328E-15 1.996900E-14 5693 5697 6.272609E+02 + 7.920000E+04 -1.368994E-06 2.401515E-15 -7.272100E-13 5693 5697 6.277419E+02 5.450919E+11 7.330919E+11 5.109883E+11 - 8.640000E+04 4.560340E-15 2.221125E-15 1.793820E-14 5704 5708 6.272609E+02 + 8.640000E+04 8.946777E-06 2.191861E-15 1.700622E-10 5704 5708 6.277419E+02 5.090704E+11 5.755864E+11 5.984224E+11 ---------------------------------------------------------------------------------------- - + General Solver Stats: Total internal steps taken = 5704 Total internal steps attempts = 5708 Total rhs exp function call = 0 Total rhs imp function call = 59357 Total num preconditioner evals = 96 - Total num preconditioner solves = 89028 + Total num preconditioner solves = 89026 Num error test failures = 4 Num nonlinear solver iters = 30814 - Num linear solver iters = 59966 - Avg Krylov subspace dim = 1.946063E+00 + Num linear solver iters = 59967 + Avg Krylov subspace dim = 1.946096E+00 Num nonlinear solver fails = 0 Num linear solver fails = 0 main solver real/int workspace sizes = 3702 145 linear solver real/int workspace sizes = 2455 42 ARKBandPre real/int workspace sizes = 2800 622 ARKBandPre number of f evaluations = 480 - diff --git a/test/answers b/test/answers index ff3a29d594..ea6ac15fdc 160000 --- a/test/answers +++ b/test/answers @@ -1 +1 @@ -Subproject commit ff3a29d5940bb540a7088cbbabc97f3bad2a3e78 +Subproject commit ea6ac15fdcd8615e25e52692bcd453e2f003f46b