From ff1647ce88f4a24b348a6afc773c4d7ddaa65879 Mon Sep 17 00:00:00 2001 From: "Daniel R. Reynolds" Date: Wed, 12 Jul 2023 14:30:04 -0500 Subject: [PATCH] Minor bugfixes --- src/arkode/arkode_mri_tables.def | 2 +- src/arkode/arkode_mristep.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/arkode/arkode_mri_tables.def b/src/arkode/arkode_mri_tables.def index 424abe58da..d7e41d9d5c 100644 --- a/src/arkode/arkode_mri_tables.def +++ b/src/arkode/arkode_mri_tables.def @@ -169,7 +169,7 @@ ARK_MRI_TABLE(ARKODE_MRI_GARK_ERK45a, { /* A. Sandu, SINUM 57:2300-2327, 2019 */ ARK_MRI_TABLE(ARKODE_MRI_GARK_IRK21a, { /* A. Sandu, SINUM 57:2300-2327, 2019 */ MRIStepCoupling C; - ARKodeButcherTable B = ARKodeButcherTable_Alloc(3, SUNFALSE); + ARKodeButcherTable B = ARKodeButcherTable_Alloc(3, SUNTRUE); B->q=2; B->p=1; diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index 8e5aeae2d9..4408e51acb 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -1232,10 +1232,14 @@ int mriStep_Init(void* arkode_mem, int init_type) return (ARK_ILL_INPUT); } } else if (adapt_type == SUNDIALS_CONTROL_MRI_TOL) { - /* TO-DO: Verify that - - ensure that the MRI method includes embedding coefficients. */ + /* Verify that the MRI method includes an embedding. */ + if (step_mem->MRIC->p == 0) { + arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + "Timestep adaptivity enabled, but non-embedded MRI table specified"); + return (ARK_ILL_INPUT); + } - /* verify that adaptivity type is supported by inner stepper */ + /* Verify that adaptivity type is supported by inner stepper */ if (!mriStepInnerStepper_SupportsRTolAdaptivity(step_mem->stepper)) { arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", "MRI-TOL SUNController provided, but unsupported by inner stepper"); @@ -1264,8 +1268,12 @@ int mriStep_Init(void* arkode_mem, int init_type) /* initialize fast stepper to use the same relative tolerance as MRIStep */ step_mem->inner_control = ONE; } else { - /* TO-DO: Verify that - - ensure that the MRI method includes embedding coefficients. */ + /* Verify that the MRI method includes an embedding. */ + if (step_mem->MRIC->p == 0) { + arkProcessError(ark_mem, ARK_ILL_INPUT, "ARKODE::MRIStep", "mriStep_Init", + "Timestep adaptivity enabled, but non-embedded MRI table specified"); + return (ARK_ILL_INPUT); + } /* verify that adaptivity type is supported by inner stepper */ if (!mriStepInnerStepper_SupportsStepAdaptivity(step_mem->stepper)) {