MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / CVAdjustAdams

Function CVAdjustAdams

externalpackages/PVODE/source/cvode.cpp:1430–1460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1428*****************************************************************/
1429
1430static void CVAdjustAdams(CVodeMem cv_mem, int deltaq)
1431{
1432 int i, j;
1433 real xi, hsum;
1434
1435 /* On an order increase, set new column of zn to zero and return */
1436
1437 if (deltaq==1) {
1438 N_VConst(ZERO, zn[L]);
1439 return;
1440 }
1441
1442 /* On an order decrease, each zn[j] is adjusted by a multiple
1443 of zn[q]. The coefficients in the adjustment are the
1444 coefficients of the polynomial x*x*(x+xi_1)*...*(x+xi_j),
1445 integrated, where xi_j = [t_n - t_(n-j)]/h. */
1446
1447 for (i=0; i <= qmax; i++) l[i] = ZERO;
1448 l[1] = ONE;
1449 hsum = ZERO;
1450 for (j=1; j <= q-2; j++) {
1451 hsum += tau[j];
1452 xi = hsum / hscale;
1453 for (i=j+1; i >= 1; i--) l[i] = l[i]*xi + l[i-1];
1454 }
1455
1456 for (j=1; j <= q-2; j++) l[j+1] = q * (l[j] / (j+1));
1457
1458 for (j=2; j < q; j++)
1459 N_VLinearSum(-l[j], zn[q], ONE, zn[j], zn[j]);
1460}
1461
1462/********************** CVAdjustBDF *******************************
1463

Callers 1

CVAdjustOrderFunction · 0.85

Calls 2

N_VConstFunction · 0.85
N_VLinearSumFunction · 0.85

Tested by

no test coverage detected