HICUM limitlog exchange

This commit is contained in:
dwarning 2020-11-02 10:34:57 +01:00 committed by Holger Vogt
parent af3d3c5230
commit 806d902a53
1 changed files with 1 additions and 31 deletions

View File

@ -1777,7 +1777,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt)
Vbpbi = DEVpnjlim(Vbpbi,*(ckt->CKTstate0 + here->HICUMvbpbi),here->HICUMvt.rpart,
here->HICUMtVcrit,&ichk5);
if (selfheat) {
Vrth = HICUMlimitlog(Vrth,
Vrth = DEVlimitlog(Vrth,
*(ckt->CKTstate0 + here->HICUMvrth),1,&ichk6);
}
if ((ichk1 == 1) || (ichk2 == 1) || (ichk3 == 1) || (ichk4 == 1) || (ichk5 == 1) || (ichk6 == 1)) icheck=1;
@ -3318,33 +3318,3 @@ load:
}
return(OK);
}
/* HICUMlimitlog(deltemp, deltemp_old, LIM_TOL, check)
* Logarithmic damping the per-iteration change of deltemp beyond LIM_TOL.
*/
static double
HICUMlimitlog(
double deltemp,
double deltemp_old,
double LIM_TOL,
int *check)
{
*check = 0;
if (isnan (deltemp) || isnan (deltemp_old))
{
fprintf(stderr, "Alberto says: YOU TURKEY! The limiting function received NaN.\n");
fprintf(stderr, "New prediction returns to 0.0!\n");
deltemp = 0.0;
*check = 1;
}
/* Logarithmic damping of deltemp beyond LIM_TOL */
if (deltemp > deltemp_old + LIM_TOL) {
deltemp = deltemp_old + LIM_TOL + log10((deltemp-deltemp_old)/LIM_TOL);
*check = 1;
}
else if (deltemp < deltemp_old - LIM_TOL) {
deltemp = deltemp_old - LIM_TOL - log10((deltemp_old-deltemp)/LIM_TOL);
*check = 1;
}
return deltemp;
}