Skip to content

Commit

Permalink
set h_j max iter
Browse files Browse the repository at this point in the history
  • Loading branch information
cguzman95 committed Nov 12, 2024
1 parent eaa0f47 commit e91e7fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/camp_solver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,13 +1296,23 @@ int guess_helper(const realtype t_n, const realtype h_n, N_Vector y_n,
for (; iter < GUESS_MAX_ITER && t_0 + t_j < t_n; iter++) {
// Calculate \f$h_j\f$
realtype h_j = t_n - (t_0 + t_j);
int i_fast = -1;
for (int i = 0; i < n_elem; i++) {
realtype t_star = -atmp1[i] / acorr[i];
if ((t_star > ZERO || (t_star == ZERO && acorr[i] < ZERO)) &&
t_star < h_j) {
h_j = t_star;
i_fast = i;
}
}

// Scale incomplete jumps
if (i_fast >= 0 && h_n > ZERO)
h_j *=
0.95 + 0.1 * iter /
(double)GUESS_MAX_ITER; // pending validation monarch long
// run mn5. remove for validation
// with MONARCH (experiment a7s4)
h_j = t_n < t_0 + t_j + h_j ? t_n - (t_0 + t_j) : h_j;

// Only make small changes to adjustment vectors used in Newton iteration
Expand Down

0 comments on commit e91e7fa

Please sign in to comment.