Feature: Extended Super Time Stepping (ExtSTS) Methods - #985
Feature: Extended Super Time Stepping (ExtSTS) Methods#985drreynolds wants to merge 164 commits into
Conversation
…om ExtSTS solver object.
…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
|
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); |
There was a problem hiding this comment.
@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); |
There was a problem hiding this comment.
| 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, "") |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
retval is always ARK_SUCCESS at this point
| 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; } |
There was a problem hiding this comment.
Is there a reason to not return immediately on an error here?
| if (retval != 0) { retval = ARK_PRESTEPFN_FAIL; } | |
| if (retval != 0) { return ARK_PRESTEPFN_FAIL; } |
| /* 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++; | ||
| } |
There was a problem hiding this comment.
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.
| /* 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; } | ||
| } | ||
|
|
There was a problem hiding this comment.
Probably need SUNLogInfo logging statements similar to ARKodeEvolve to parse the logging output correctly
| return retval; | ||
| } | ||
|
|
||
| int extSTSInnerStepper_Free(MRIStepInnerStepper* sts_mem) |
There was a problem hiding this comment.
I don't see that this is called or attached anywhere
Updated the MRIStep module in ARKODE to support extended Super Time Stepping (ExtSTS) methods for multi-physics simulations involving parabolic components, through the
MRIStepCreateExtSTSfunction. 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.