Skip to content

Feature: Extended Super Time Stepping (ExtSTS) Methods - #985

Open
drreynolds wants to merge 164 commits into
developfrom
feature/extsts
Open

Feature: Extended Super Time Stepping (ExtSTS) Methods#985
drreynolds wants to merge 164 commits into
developfrom
feature/extsts

Conversation

@drreynolds

@drreynolds drreynolds commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Updated the MRIStep module in ARKODE to support extended Super Time Stepping (ExtSTS) methods for multi-physics simulations involving parabolic components, through the MRIStepCreateExtSTS function. In addition to adding this "create" routine, this PR adds some Butcher tables and MRI coupling tables that can be used when creating ExtSTS methods -- essentially, these just correspond with embedded ImEx-MRI-GARK methods of order 2, that MRIStep did not already include.

There is one example problem that shows how these methods may be used.

The PR is relatively small, and if possible I'd like this to be included in the next release.

…h a boolean to indicate that the MRIStep is being used to implement an ExtSTS method.
…cing, thus simplifying the ExtSTS wrapper considerably. Notably, this allowed us to remove all wrappers to user-supplied functions and user-data pointers from the interface.
…TSGetSTS can return a pointer to the inner LSRKStep integrator without Python assuming ownership and causing a double free
…e-step function, instead of including entire ARKodeEvolve infrastructure. This allows an RKC or RKL failure due to an insufficient number of stages to propagate back up to MRIStep, who will limit the step size. Currently this step reduction is crude (the default reduction for a nonlinear convergence failure), but we could eventually upgrade MRIStepInnerSteppers to pass back a recommended step reduction factor when returning positive failure codes.
…d forgotten to remove it from arkode_mristep.h when removing the function).
…pace at the end of some lines; since my editor automatically removes these spaces then manual edits of the file induce a CI failure
@drreynolds

drreynolds commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

I just reran the full set of tests for the ExtSTS paper, and something in the commit "Updated extSTSInnerStepper_Evolve to directly call ..." broke some of the results from the paper. I'll need to take part of this weekend to unravel (and hopefully fix) the issue.


nb::class_<ARKodeBorrowedView>(m, "ARKodeBorrowedView")
.def("get", nb::overload_cast<>(&ARKodeBorrowedView::get, nb::const_),
nb::rv_policy::reference);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balos1 Could you take a look at ARKodeBorrowedView and handling the void** argument in MRIStepExtSTSGetSTS?

int ark_status = ARKodeSetUserData(ark_mem, ark_mem);
if (ark_status != ARK_SUCCESS)
{
free(fn_table);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
free(fn_table);
free(fn_table);
ARKodeFree(&ark_mem);

.value("ARKODE_MRI_GARK_EXP_ARS222", ARKODE_MRI_GARK_EXP_ARS222, "")
.value("ARKODE_IMEX_MRI_GARK_ARS222", ARKODE_IMEX_MRI_GARK_ARS222, "")
.value("ARKODE_MRI_GARK_EXP_GIRALDO2", ARKODE_MRI_GARK_EXP_GIRALDO2, "")
.value("ARKODE_IMEX_MRI_GARK_GIRALDO2", ARKODE_IMEX_MRI_GARK_GIRALDO2, "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ARKODE_IMEX_MRI_GARK_GIRALDO2 different from ARKODE_IMEX_MRI_GARK_ARK2? Similarly, is ARKODE_IMEX_MRI_GARK_ASCHER_ARK2 the same as ARKODE_IMEX_MRI_GARK_ARS222? I think these might be using the same base tables with different names.

Like ARS, maybe we should use GKC for Giraldo, Kelly, and Constantinescu in the names

1>(&arkode_user_supplied_fn_table::mristep_fsi, t, y, ydot, user_data);
}

inline int mristep_domeig_wrapper(sunrealtype t, N_Vector y, N_Vector fn,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't gotten to the source updates yet, but want to leave a note to double check if this wrapper is still needed. From the PR comments, it sounded like this might not be needed any more.

#. *Set vector of initial values*

#. Create the MRIStep object for ExtSTS methods by calling
:c:func:`MRIStepExtSTSCreate`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be MRIStepCreateExtSTS (and similarly MRIStepReInitExtSTS) to align with the LSRKStepCreate<X> (and LSRKStepReInit<X>) pattern

/* Call the user-supplied pre-step function (if supplied) */
ark_mem->tcur = ark_mem->tn;
if (ark_mem->ensure_ycur) { N_VScale(ONE, ark_mem->yn, ark_mem->ycur); }
if (retval == ARK_SUCCESS && ark_mem->PreStepFn)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retval is always ARK_SUCCESS at this point

Suggested change
if (retval == ARK_SUCCESS && ark_mem->PreStepFn)
if (ark_mem->PreStepFn)

retval = ark_mem->PreStepFn(ark_mem->tcur, ark_mem->ycur, ark_mem->nst, 1,
ark_mem->user_data);
/* Preserve the failure flag but continue to disable forcing below. */
if (retval != 0) { retval = ARK_PRESTEPFN_FAIL; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not return immediately on an error here?

Suggested change
if (retval != 0) { retval = ARK_PRESTEPFN_FAIL; }
if (retval != 0) { return ARK_PRESTEPFN_FAIL; }

Comment on lines +295 to +303
/* Take a single inner STS step */
if (retval == ARK_SUCCESS)
{
/* Let ExtSTS translate this recoverable failure after forcing is disabled. */
lsrkstep_mem->suppress_max_stage_limit_error = SUNTRUE;
retval = ark_mem->step(ark_mem, &dsm, &nflag);
lsrkstep_mem->suppress_max_stage_limit_error = SUNFALSE;
ark_mem->nst_attempts++;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the prestep error is returned above, the retval check here can be removed. Also nst_attempts is incremented before the step is attempted in evolve.

Suggested change
/* Take a single inner STS step */
if (retval == ARK_SUCCESS)
{
/* Let ExtSTS translate this recoverable failure after forcing is disabled. */
lsrkstep_mem->suppress_max_stage_limit_error = SUNTRUE;
retval = ark_mem->step(ark_mem, &dsm, &nflag);
lsrkstep_mem->suppress_max_stage_limit_error = SUNFALSE;
ark_mem->nst_attempts++;
}
/* Take a single inner STS step */
/* Let ExtSTS translate this recoverable failure after forcing is disabled. */
ark_mem->nst_attempts++;
lsrkstep_mem->suppress_max_stage_limit_error = SUNTRUE;
retval = ark_mem->step(ark_mem, &dsm, &nflag);
lsrkstep_mem->suppress_max_stage_limit_error = SUNFALSE;

/* Preserve the failure flag but continue to disable forcing below. */
if (retval != 0) { retval = ARK_PRESTEPFN_FAIL; }
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need SUNLogInfo logging statements similar to ARKodeEvolve to parse the logging output correctly

return retval;
}

int extSTSInnerStepper_Free(MRIStepInnerStepper* sts_mem)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see that this is called or attached anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants