Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arkode-fullrhs #293

Closed
wants to merge 12 commits into from
Closed

arkode-fullrhs #293

wants to merge 12 commits into from

Conversation

drreynolds
Copy link
Collaborator

This PR makes the necessary changes so that fullrhs is an optional routine for both an ARKODE time-stepping module, and for an MRIInnerStepper module. To test this, the PR also converts many ARKODE examples to request the Lagrange interpolation module.

The PR is not quite complete, but I'm submitting it now for 2 reasons:

  1. Get feedback from the team.
  2. Get the CI to generate answer .out files for the now-changed results.

In addition to missing the new .out files, this PR also needs updates to both the ARKODE documentation and CHANGELOG.md.

…ing module (and in turn, the MRIStepInnerStepper module).
…le (output files now differ due to reduced numbers of RHS calls, particularly for MRI).
@balos1 balos1 added this to the SUNDIALS Next milestone Jun 28, 2023
examples/arkode/C_serial/ark_brusselator_mri.c Outdated Show resolved Hide resolved
src/arkode/arkode.c Outdated Show resolved Hide resolved
MSG_ARK_RHSFUNC_FAILED);
return(ARK_RHSFUNC_FAIL);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be removed by adding || ark_mem->h == ZERO to if (ark_mem->call_fullrhs_start || ark_mem->call_fullrhs_end) in arkInitialSetup

Copy link
Member

Choose a reason for hiding this comment

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

@gardner48 Are you referring to this entire change block?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

src/arkode/arkode.c Outdated Show resolved Hide resolved
@@ -766,6 +766,18 @@ int erkStep_TakeStep(void* arkode_mem, realtype *dsmPtr, int *nflagPtr)
ark_mem->nst, ark_mem->h, ark_mem->tcur);
#endif

/* if fullrhs has not been called, fill in F[0] */
if (!ark_mem->call_fullrhs_start) {
Copy link
Member

Choose a reason for hiding this comment

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

This should not be possible, since nothing should set call_fullrhs_* to false and erkStep_Init sets both to true.

Copy link
Member

@balos1 balos1 Jul 25, 2023

Choose a reason for hiding this comment

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

It seems like it may be safer to handle this even though it is not currently possible to reach it. If it must always be a broken state to reach this, then an error should be thrown if it is reached.

Copy link
Member

Choose a reason for hiding this comment

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

It might be better to throw an error so we don't unintentionally end up with an extra RHS evaluation at the start of each step.

src/arkode/arkode_erkstep.c Show resolved Hide resolved
@@ -1462,6 +1465,30 @@ int mriStep_TakeStep(void* arkode_mem, realtype *dsmPtr, int *nflagPtr)
ark_mem->nst, ark_mem->h, ark_mem->tcur);
#endif

/* if fullrhs has not been called, fill in Fse[0] and Fsi[0] as applicable */
if (!ark_mem->call_fullrhs_start) {
Copy link
Member

Choose a reason for hiding this comment

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

Here call_fullrhs_start is at the start of each step but I think this could similarly be accomplished by

  1. Filling fse[0] and fsi[0] in the stepper init
  2. If FullRHS is called in arkInitialSetup it just copies form fse[0] and fsi[0] and adds on the fast time scale contribution
  3. At the end of a step fill fse[0] and fsi[0] for the next step unless call_fullrhs_end is true in which case the FullRHS call in arkCompleteStep will fill these

Copy link
Member

@balos1 balos1 Jul 25, 2023

Choose a reason for hiding this comment

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

@gardner48 What is the advantage of your proposal?

Copy link
Member

Choose a reason for hiding this comment

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

I think this would make the code more consistent. call_fullrhs_start is really more like call the full RHS at initialization and then this call (like in ERKStep) never actually happens and the full RHS is actually updated at the end of the step.

examples/arkode/C_serial/ark_kpr_mri.out Outdated Show resolved Hide resolved
@balos1 balos1 removed the dont-merge label Jul 20, 2023
@drreynolds
Copy link
Collaborator Author

Closing this PR (similar updates are included in an upcoming PR by @gardner48)

@drreynolds drreynolds closed this Aug 15, 2023
@gardner48 gardner48 deleted the feature/arkode-fullrhs branch November 8, 2023 15:21
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.

4 participants