Skip to content

Commit

Permalink
Fix time in ProcessStage
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Nov 13, 2024
1 parent ad16071 commit 72719ac
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/arkode/arkode_lsrkstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,17 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
retval = N_VLinearCombination(5, cvals, Xvecs, ark_mem->ycur);
if (retval != 0) { return ARK_VECTOROP_ERR; }

/* compute new stage time factor */
thj = mu * thjm1 + nu * thjm2 + mus * (ONE - ajm1);

/* apply user-supplied stage postprocessing function (if supplied) */
if (ark_mem->ProcessStage != NULL)
if (ark_mem->ProcessStage != NULL && j < step_mem->req_stages)
{
retval = ark_mem->ProcessStage(ark_mem->tcur + ark_mem->h * thjm1,
retval = ark_mem->ProcessStage(ark_mem->tcur + ark_mem->h * thj,
ark_mem->ycur, ark_mem->user_data);
if (retval != 0) { return ARK_POSTPROCESS_STAGE_FAIL; }
}

thj = mu * thjm1 + nu * thjm2 + mus * (ONE - ajm1);

/* Shift the data for the next stage */
if (j < step_mem->req_stages)
{
Expand Down Expand Up @@ -916,9 +917,9 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
if (retval != 0) { return ARK_VECTOROP_ERR; }

/* apply user-supplied stage postprocessing function (if supplied) */
if (ark_mem->ProcessStage != NULL)
if (ark_mem->ProcessStage != NULL && j < step_mem->req_stages)
{
retval = ark_mem->ProcessStage(ark_mem->tcur + ark_mem->h * cjm1,
retval = ark_mem->ProcessStage(ark_mem->tcur + ark_mem->h * cj,
ark_mem->ycur, ark_mem->user_data);
if (retval != 0) { return ARK_POSTPROCESS_STAGE_FAIL; }
}
Expand Down

0 comments on commit 72719ac

Please sign in to comment.