Restrict time step equalising: don't do it with next breakpoit

at TSTOP, as simulations with may fail with ever decreasing time step.
This commit is contained in:
Holger Vogt 2026-05-10 11:07:31 +02:00
parent b4ecedc616
commit 55dc72a01f
1 changed files with 3 additions and 2 deletions

View File

@ -586,11 +586,12 @@ resume:
}
/* Try to equalise the last two time steps before the breakpoint,
if the second step would be smaller than CKTdelta otherwise.*/
else if (ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) {
else if (!(ckt->CKTbreaks[0] == ckt->CKTfinalTime) && ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) {
ckt->CKTsaveDelta = ckt->CKTdelta;
ckt->CKTdelta = (ckt->CKTbreaks[0] - ckt->CKTtime) / 2.;
#ifdef STEPDEBUG
fprintf(stdout, "Delta equalising step at time %e with delta %e\n", ckt->CKTtime, ckt->CKTdelta);
fprintf(stdout, "Delta equalising step at time %e with delta %e and breakpoint at %e\n",
ckt->CKTtime, ckt->CKTdelta, ckt->CKTbreaks[0]);
#endif
}