diff --git a/examples/arkode/C_serial/lsrk_analytic.c b/examples/arkode/C_serial/lsrk_analytic.c index 33e0b560d6..5a6f949b6f 100644 --- a/examples/arkode/C_serial/lsrk_analytic.c +++ b/examples/arkode/C_serial/lsrk_analytic.c @@ -1,5 +1,5 @@ /*----------------------------------------------------------------- - * Programmer(s): Daniel R. Reynolds @ SMU + * Programmer(s): Mustafa Aggul @ SMU *--------------------------------------------------------------- * SUNDIALS Copyright Start * Copyright (c) 2002-2024, Lawrence Livermore National Security @@ -129,8 +129,8 @@ int main(void) if (check_flag(&flag, "LSRKodeSetMaxStageNum", 1)) { return 1; } /* Specify max number of steps allowed */ - flag = LSRKodeSetMaxStepNum(arkode_mem, 1000); - if (check_flag(&flag, "LSRKodeSetMaxStepNum", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 1000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Specify safety factor for user provided SprRad */ flag = LSRKodeSetSprRadSafetyFactor(arkode_mem, 1.01); diff --git a/examples/arkode/C_serial/lsrk_analytic.out b/examples/arkode/C_serial/lsrk_analytic.out index 902ace198d..9332337c39 100644 --- a/examples/arkode/C_serial/lsrk_analytic.out +++ b/examples/arkode/C_serial/lsrk_analytic.out @@ -1,32 +1,47 @@ Analytical ODE test problem: - reltol = 1.0e-06 - abstol = 1.0e-10 + lambda = -1e+06 + reltol = 1.0e-08 + abstol = 1.0e-08 + + +HARD CODED to set interpolation type = ARK_INTERP_LAGRANGE + + +Solving with RKL method t u --------------------- - 1.000000 0.916291 - 2.000000 1.609437 - 3.000000 2.140066 - 4.000000 2.564949 - 5.000000 2.917770 - 6.000000 3.218876 - 7.000000 3.481240 - 8.000000 3.713572 - 9.000000 3.921973 - 10.000000 4.110874 + 1.000000 0.785398 + 2.000000 1.107149 + 3.000000 1.249046 + 4.000000 1.325818 + 5.000000 1.373401 + 6.000000 1.405648 + 7.000000 1.428899 + 8.000000 1.446441 + 9.000000 1.460139 + 10.000000 1.471128 --------------------- Final Statistics: -Current time = 10.12157090914652 -Steps = 82 -Step attempts = 83 +Current time = 10.01061550413158 +Steps = 1681 +Step attempts = 1690 Stability limited steps = 0 -Accuracy limited steps = 83 -Error test fails = 1 +Accuracy limited steps = 1690 +Error test fails = 9 NLS step fails = 0 Inequality constraint fails = 0 -Initial step size = 6.103515625000001e-12 -Last step size = 0.4463519264234082 -Current step size = 0.4463519264234082 -RHS fn evals = 417 +Initial step size = 1.930101110942615e-10 +Last step size = 0.01627887578334304 +Current step size = 0.02442720680359409 +RHS fn evals = 174916 +RHS fn evals for spr = 0 +Number of SPR update calls = 1 +Max. num. of stages taken = 199 +Max. num. of stages allowed = 200 +Max. spectral radius = 1010000.00 +Min. spectral radius = 1010000.00 + +ACCURACY at the final time = 3.54383e-13 diff --git a/examples/arkode/C_serial/lsrk_analytic_VarJac.c b/examples/arkode/C_serial/lsrk_analytic_VarJac.c index 9ff066b3bb..8733317181 100644 --- a/examples/arkode/C_serial/lsrk_analytic_VarJac.c +++ b/examples/arkode/C_serial/lsrk_analytic_VarJac.c @@ -1,5 +1,5 @@ /*----------------------------------------------------------------- - * Programmer(s): Daniel R. Reynolds @ SMU + * Programmer(s): Mustafa Aggul @ SMU *--------------------------------------------------------------- * SUNDIALS Copyright Start * Copyright (c) 2002-2024, Lawrence Livermore National Security @@ -15,7 +15,8 @@ * * The following is a simple example problem with analytical * solution, - * dy/dt = lambda*y + 1/(1+t^2) - lambda*atan(t) + * dy/dt = (lambda - alpha*cos((10 - t)/10*pi)*y + 1/(1+t^2) + * - (lambda - alpha*cos((10 - t)/10*pi)*atan(t) * for t in the interval [0.0, 10.0], with initial condition: y=0. * * The stiffness of the problem is directly proportional to the @@ -120,10 +121,6 @@ int main(void) flag = LSRKodeSetSprRadFn(arkode_mem, spr); if (check_flag(&flag, "LSRKodeSetSprRadFn", 1)) { return 1; } - // /* Specify Constant Jacobian */ - // flag = LSRKodeSetConstJac(arkode_mem); - // if (check_flag(&flag, "LSRKodeSetConstJac", 1)) { return 1; } - /* Specify after how many successful steps SprRad is recomputed */ flag = LSRKodeSetSprRadFrequency(arkode_mem, 25); if (check_flag(&flag, "LSRKodeSetSprRadFrequency", 1)) { return 1; } @@ -133,15 +130,15 @@ int main(void) if (check_flag(&flag, "LSRKodeSetMaxStageNum", 1)) { return 1; } /* Specify max number of steps allowed */ - flag = LSRKodeSetMaxStepNum(arkode_mem, 1000); - if (check_flag(&flag, "LSRKodeSetMaxStepNum", 1)) { return 1; } + flag = ARKodeSetMaxNumSteps(arkode_mem, 1000); + if (check_flag(&flag, "ARKodeSetMaxNumSteps", 1)) { return 1; } /* Specify safety factor for user provided SprRad */ flag = LSRKodeSetSprRadSafetyFactor(arkode_mem, 1.01); if (check_flag(&flag, "LSRKodeSetSprRadSafetyFactor", 1)) { return 1; } /* Specify the LSRK method */ - flag = LSRKodeSetMethod(arkode_mem, 2); + flag = LSRKodeSetMethod(arkode_mem, 1); if (check_flag(&flag, "LSRKodeSetMethod", 1)) { return 1; } /* Open output stream for results, output comment line */ diff --git a/examples/arkode/C_serial/lsrk_analytic_VarJac.out b/examples/arkode/C_serial/lsrk_analytic_VarJac.out index 902ace198d..68bcaa41c4 100644 --- a/examples/arkode/C_serial/lsrk_analytic_VarJac.out +++ b/examples/arkode/C_serial/lsrk_analytic_VarJac.out @@ -1,32 +1,48 @@ Analytical ODE test problem: - reltol = 1.0e-06 - abstol = 1.0e-10 + lambda = -1e+06 + alpha = 100 + reltol = 1.0e-08 + abstol = 1.0e-08 + + +HARD CODED to set interpolation type = ARK_INTERP_LAGRANGE + + +Solving with RKC method t u --------------------- - 1.000000 0.916291 - 2.000000 1.609437 - 3.000000 2.140066 - 4.000000 2.564949 - 5.000000 2.917770 - 6.000000 3.218876 - 7.000000 3.481240 - 8.000000 3.713572 - 9.000000 3.921973 - 10.000000 4.110874 + 1.000000 0.785398 + 2.000000 1.107149 + 3.000000 1.249046 + 4.000000 1.325818 + 5.000000 1.373401 + 6.000000 1.405648 + 7.000000 1.428899 + 8.000000 1.446441 + 9.000000 1.460139 + 10.000000 1.471128 --------------------- Final Statistics: -Current time = 10.12157090914652 -Steps = 82 -Step attempts = 83 +Current time = 10.00091506153245 +Steps = 1990 +Step attempts = 1992 Stability limited steps = 0 -Accuracy limited steps = 83 -Error test fails = 1 +Accuracy limited steps = 1992 +Error test fails = 2 NLS step fails = 0 Inequality constraint fails = 0 -Initial step size = 6.103515625000001e-12 -Last step size = 0.4463519264234082 -Current step size = 0.4463519264234082 -RHS fn evals = 417 +Initial step size = 1.930101110942615e-10 +Last step size = 0.01744455979617476 +Current step size = 0.01744455979617476 +RHS fn evals = 165282 +RHS fn evals for spr = 0 +Number of SPR update calls = 81 +Max. num. of stages taken = 165 +Max. num. of stages allowed = 200 +Max. spectral radius = 1010101.00 +Min. spectral radius = 1009899.00 + +ACCURACY at the final time = 1.78968e-13 diff --git a/include/arkode/arkode_lsrkstep.h b/include/arkode/arkode_lsrkstep.h index 434321f383..b12f29f160 100644 --- a/include/arkode/arkode_lsrkstep.h +++ b/include/arkode/arkode_lsrkstep.h @@ -49,8 +49,6 @@ SUNDIALS_EXPORT int LSRKodeSetSprRadFrequency(void* arkode_mem, int nsteps); SUNDIALS_EXPORT int LSRKodeSetMaxStageNum(void* arkode_mem, int stagemaxlimit); -SUNDIALS_EXPORT int LSRKodeSetMaxStepNum(void* arkode_mem, int stepmaxlimit); - SUNDIALS_EXPORT int LSRKodeSetSprRadSafetyFactor(void* arkode_mem, sunrealtype sprsfty); SUNDIALS_EXPORT int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, diff --git a/src/arkode/arkode_lsrkstep_io.c b/src/arkode/arkode_lsrkstep_io.c index ef0c139e5a..47033ceff0 100644 --- a/src/arkode/arkode_lsrkstep_io.c +++ b/src/arkode/arkode_lsrkstep_io.c @@ -173,31 +173,6 @@ int LSRKodeSetMaxStageNum(void* arkode_mem, int stagemaxlimit) return (ARK_SUCCESS); } -/*--------------------------------------------------------------- - LSRKodeSetMaxStepNum sets the maximum number of steps allowed. - ---------------------------------------------------------------*/ -int LSRKodeSetMaxStepNum(void* arkode_mem, int stepmaxlimit) -{ - ARKodeMem ark_mem; - ARKodeLSRKStepMem step_mem; - int retval; - - /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); - if (retval != ARK_SUCCESS) { return (retval); } - - if(stepmaxlimit < 1) - { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "stepmaxlimit must be greater than or equal to 1"); - return (ARK_ILL_INPUT); - } - - ark_mem->mxstep = stepmaxlimit; - - return (ARK_SUCCESS); -} - /*--------------------------------------------------------------- LSRKodeSetSprRadSafetyFactor sets the maximum number of stages allowed. ---------------------------------------------------------------*/