Skip to content

Commit

Permalink
RHS evaluation logic with int
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Oct 28, 2024
1 parent 6413b13 commit b8550b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/arkode/arkode_lsrkstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)

/* Compute forcing function, if necessary. */
if ((!ark_mem->fn_is_current && ark_mem->initsetup) ||
(ark_mem->tn != step_mem->tnext))
(step_mem->step_nst != ark_mem->nst))
{
retval = step_mem->fe(ark_mem->tn, ark_mem->yn, ark_mem->fn,
ark_mem->user_data);
Expand All @@ -551,8 +551,8 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); }
}

/* Track the upcoming time level to determine whether the previous step has failed. */
step_mem->tnext = ark_mem->tn + ark_mem->h;
/* Track the number of successful steps to determine if the previous step failed. */
step_mem->step_nst = ark_mem->nst + 1;

#ifdef SUNDIALS_LOGGING_EXTRA_DEBUG
SUNLogger_QueueMsg(ARK_LOGGER, SUN_LOGLEVEL_DEBUG,
Expand Down Expand Up @@ -826,7 +826,7 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)

/* Compute forcing function, if necessary. */
if ((!ark_mem->fn_is_current && ark_mem->initsetup) ||
(ark_mem->tn != step_mem->tnext))
(step_mem->step_nst != ark_mem->nst))
{
retval = step_mem->fe(ark_mem->tn, ark_mem->yn, ark_mem->fn,
ark_mem->user_data);
Expand All @@ -835,8 +835,8 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); }
}

/* Track the upcoming time level to determine whether the previous step has failed. */
step_mem->tnext = ark_mem->tn + ark_mem->h;
/* Track the number of successful steps to determine if the previous step failed. */
step_mem->step_nst = ark_mem->nst + 1;

#ifdef SUNDIALS_LOGGING_EXTRA_DEBUG
SUNLogger_QueueMsg(ARK_LOGGER, SUN_LOGLEVEL_DEBUG,
Expand Down
3 changes: 1 addition & 2 deletions src/arkode/arkode_lsrkstep_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ typedef struct ARKodeLSRKStepMemRec

ARKODE_LSRKMethodType LSRKmethod;

sunrealtype tnext; /* time of the next step if this step is successful*/

/* Counters and stats*/
long int nfe; /* num fe calls */
long int dom_eig_num_evals; /* num of dom_eig computations */
int stage_max; /* num of max stages used */
int stage_max_limit; /* max allowed num of stages */
long int dom_eig_nst; /* num of step at which the last domainant eigenvalue was computed */
long int step_nst; /* The number of successful steps. */

/* Spectral info */
sunrealtype lambdaR; /* Real part of the dominated eigenvalue*/
Expand Down
5 changes: 3 additions & 2 deletions src/arkode/arkode_lsrkstep_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ int LSRKStepSetMethod(void* arkode_mem, ARKODE_LSRKMethodType method)
step_mem->nfusedopvecs = 5;
step_mem->q = ark_mem->hadapt_mem->q = 2;
step_mem->p = ark_mem->hadapt_mem->p = 2;
step_mem->tnext = ZERO;
step_mem->step_nst = 0;
break;
case ARKODE_LSRK_RKL_2:
ark_mem->step = lsrkStep_TakeStepRKL;
step_mem->is_SSP = SUNFALSE;
step_mem->nfusedopvecs = 5;
step_mem->q = ark_mem->hadapt_mem->q = 2;
step_mem->p = ark_mem->hadapt_mem->p = 2;
step_mem->tnext = ZERO;
step_mem->step_nst = 0;
break;
case ARKODE_LSRK_SSP_S_2:
ark_mem->step = lsrkStep_TakeStepSSPs2;
Expand Down Expand Up @@ -620,6 +620,7 @@ int lsrkStep_WriteParameters(ARKodeMem ark_mem, FILE* fp)
fprintf(fp, " Maximum number of stages used = %i\n", step_mem->stage_max);
fprintf(fp, " Num of step when the last dom eig call happened= %li\n",
step_mem->dom_eig_nst);
fprintf(fp, " Num of successful steps = %li\n", step_mem->step_nst);
fprintf(fp, " Current real part of the dom eig = %" RSYM "\n",
step_mem->lambdaR);
fprintf(fp, " Current imag part of the dom eig = %" RSYM "\n",
Expand Down

0 comments on commit b8550b8

Please sign in to comment.