Skip to content

Commit 5f5a8c3

Browse files
Bugfix: Add missing scaling to accumulated error (#763)
With MRI-HTol adaptivity, added missing scaling to accumulated error and remove upper limit on rtol factor --------- Co-authored-by: David Gardner <gardner48@llnl.gov>
1 parent b577f27 commit 5f5a8c3

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ in any order.
2323

2424
### Bug Fixes
2525

26+
Fixed a bug in how MRIStep interacts with an MRIHTol SUNAdaptController object
27+
(the previous version essentially just reverted to a decoupled multirate
28+
controller). Removed the upper limit on `inner_max_tolfac` in
29+
`SUNAdaptController_SetParams_MRIHTol`.
30+
2631
The shared library version numbers for the oneMKL dense linear solver and
2732
matrix as well as the PETSc SNES nonlinear solver have been corrected.
2833

doc/shared/RecentChanges.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ method after :c:func:`KINInit`. Additionally, :c:func:`KINSetMAA` and
2121

2222
**Bug Fixes**
2323

24+
Fixed a bug in how MRIStep interacts with an MRIHTol SUNAdaptController object
25+
(the previous version essentially just reverted to a decoupled multirate
26+
controller). Removed the upper limit on `inner_max_tolfac` in
27+
:c:func:`SUNAdaptController_SetParams_MRIHTol`.
28+
2429
The shared library version numbers for the oneMKL dense linear solver and
2530
matrix as well as the PETSc SNES nonlinear solver have been corrected.
2631

doc/shared/sunadaptcontroller/SUNAdaptController_MRIHTol.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,14 @@ also provides the following additional user-callable routines:
153153
:param C: the SUNAdaptController_MRIHTol object.
154154
:param inner_max_relch: the parameter :math:`relch_{\text{max}}` (must be :math:`\ge 1`).
155155
:param inner_min_tolfac: the parameter :math:`\text{tolfac}_{min}` (must be :math:`> 0`).
156-
:param inner_max_tolfac: the parameter :math:`\text{tolfac}_{max}` (must be :math:`> 0` and :math:`\le 1`).
156+
:param inner_max_tolfac: the parameter :math:`\text{tolfac}_{max}` (must be :math:`> 0`).
157157

158158
:returns: :c:type:`SUNErrCode` indicating success or failure.
159+
160+
.. versionchanged:: x.y.z
161+
162+
Removed the requirement that ``inner_max_tolfac`` must be :math:`\le 1`
163+
159164

160165
.. note::
161166

src/arkode/arkode_mristep.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,6 +3571,11 @@ int mriStep_StageERKFast(ARKodeMem ark_mem, ARKodeMRIStepMem step_mem,
35713571
__FILE__, "Unable to get accumulated error from the inner stepper");
35723572
return (ARK_INNERSTEP_FAIL);
35733573
}
3574+
3575+
/* scale the error estimate by 1/rtol to account for different inner/outer tolerances */
3576+
step_mem->inner_dsm /= ark_mem->reltol;
3577+
SUNLogInfo(ARK_LOGGER, "accumulated-fast-error", "inner_dsm = %e",
3578+
step_mem->inner_dsm);
35743579
}
35753580
}
35763581

src/sunadaptcontroller/mrihtol/sunadaptcontroller_mrihtol.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ SUNErrCode SUNAdaptController_SetParams_MRIHTol(SUNAdaptController C,
236236
MRIHTOL_INNER_MIN_TOLFAC(C) = INNER_MIN_TOLFAC;
237237
}
238238
else { MRIHTOL_INNER_MIN_TOLFAC(C) = inner_min_tolfac; }
239-
if ((inner_max_tolfac <= SUN_RCONST(0.0)) ||
240-
(inner_max_tolfac > SUN_RCONST(1.0)))
239+
if (inner_max_tolfac <= SUN_RCONST(0.0))
241240
{
242241
MRIHTOL_INNER_MAX_TOLFAC(C) = INNER_MAX_TOLFAC;
243242
}

0 commit comments

Comments
 (0)