why does method sparse need converge?
Posted: Tue Mar 23, 2021 2:59 am
When using method sparse to solve kinetic schame, I found that the code in scopemath/sparse.c solved the coefficient matrix several times to get converge when linflag=0. I am really confused with that. If you call the (*fun) which is the state function in the c file compiled from mod file N times, doesn't that mean you go through N*dt time?
Code: Select all
for (err=1, j=0; err > CONVERGE; j++) {
init_coef_list();
(*fun)();
if((ierr = spar_matsol())) {
return ierr;
}
for (err=0.,i=1; i<=n; i++) {
s_(i-1) += rhs[i];
#if 1
if (!linflag && s_(i-1) < 0.) { s_(i-1) = 0.; }
#endif
err += fabs(rhs[i]);
}
if (j > MAXSTEPS) {
return EXCEED_ITERS;
}
if (linflag) break;
}