Skip to content

selah_nordsieck ​

SELAH, L2: the Nordsieck form, variable-step Adams and BDF methods driven stage by stage.

The Nordsieck array of order q holds the scaled derivatives z_j = h^j y^(j) / j!, j = 0 .. q, of the solution at t^n (Nordsieck 1962; Gear 1971): z_0 is q itself (the caller's array), z_1 .. z_q are registers. A step

  • predicts by the Pascal matrix, z_j <- sum_{i >= j} C(i, j) z_i, in place (one fused kernel, which also makes the predicted value y_p = sum_i z_i, the first stage's state, and E = y_p - l_0 z_1);
  • corrects: z_j <- z_j + l_j Delta, Delta = h R(y) - z_1 (the predicted z_1), the new solution q = E + gamma R(y), gamma = h l_0: y = E + gamma R(y) is the implicit stage, solved by fixed-point stages (the caller's residual at each, as the stepper's implicit multistep schemes) or by a solver of the caller's in stage 2 (stage_gamma, explicit_part: newton_solver, anderson_mixing, newton_krylov).

The coefficients are fixed per order (Byrne & Hindmarsh 1975): Adams of order q (1 .. 12) l = the coefficients of int_{-1}^{x} prod_{i=1}^{q-1} (s + i) ds / (q - 1)!, BDF of order q (1 .. 5) those of prod_{i=1}^{q} (1 + x/i) divided by their x coefficient (l_1 = 1 in both). A change of step is a rescaling of the columns, z_j <- eta^j z_j (set_step: local, no reduction, decision D5 of #11), a change of order one column more or less (set_order). The method is exact on polynomials of degree <= q whatever the step sequence, and at a constant step it is am-(q-1) (Adams) or bdf-q (BDF) (notes/nordsieck-check.py, in exact rationals).

Registers: z_1 .. z_qmax, the last correction Delta (the next step's estimate at order q + 1), the stage state, the stage's residual, E: qmax + 4 of the field's size. Fields of rank 5 (a field of lower rank as its rank-5 view, selah_box); every array device resident in a device build.

A step, the caller's loop (t the caller's):

 call ns%begin_step(bx, q)                ! the prediction
 do k=1, ns%stages()
    call ns%begin_stage(k, bx)            ! stage k's state (k >= 2: E + gamma R of the previous one)
    ... R(t + h, ns%stage_state()) into ns%rhs_register() ...
    call ns%end_stage(k)
 enddo
 call ns%finish_step(bx, q)              ! the correction: q = y^{n+1}

Source: src/lib/selah_nordsieck.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
NORDSIECK_ADAMScharacter(len=*)parameterThe Adams family (orders 1 .. 12).
NORDSIECK_BDFcharacter(len=*)parameterThe BDF family (orders 1 .. 5).
NORDSIECK_ADAMS_MAX_ORDERinteger(kind=I4P)parameterAdams' highest order.
NORDSIECK_BDF_MAX_ORDERinteger(kind=I4P)parameterBDF's highest order.

Derived Types ​

nordsieck_stepper ​

A variable-step, variable-order Adams or BDF method in the Nordsieck form.

Components

NameTypeAttributesDescription
familycharacter(len=5)NORDSIECK_ADAMS or NORDSIECK_BDF.
qmaxinteger(kind=I4P)The highest order (registers allocated for it).
qinteger(kind=I4P)The current order.
minteger(kind=I4P)Stages per step (residual evaluations).
hreal(kind=R_P)The current step.
lreal(kind=R_P)allocatablel(0:qmax, q): the corrector's vector of each order.
cerrreal(kind=R_P)allocatablecerr(q) = C_{q+1}: the error constant of order q (1 .. qmax+1).
l_dreal(kind=R_P)pointerThe current order's l(0:q), device resident.
regsreal(kind=R_P)pointerz_1 .. z_qmax, Delta, state, residual, E.
lbinteger(kind=I4P)The field's bounds.
ubinteger(kind=I4P)The field's bounds.
k_activeinteger(kind=I4P)The active stage (0 outside a step).
startedlogicalThe array holds a solution (start called).
in_steplogicalBetween begin_step and finish_step / reject_step.
betareal(kind=R_P)allocatableThe imaginary-axis bound of each order's step (stability cap).
rhoreal(kind=R_P)The caller's spectral-radius estimate (0: no cap).
sinceinteger(kind=I4P)Steps accepted since the last change of order.
failuresinteger(kind=I4P)Consecutive rejections.
acceptedinteger(kind=I4P)Steps accepted (statistics).
rejectedinteger(kind=I4P)Steps rejected (statistics).
stability_detectionlogicalBDF: detect steps limited by stability (orders 3-5).
q_stableinteger(kind=I4P)The highest order allowed after a detection (0: qmax).
detectionsinteger(kind=I4P)Detections (statistics).
zq_normreal(kind=R_P)||z_q|| of the last steps at a constant step and order.
nzinteger(kind=I4P)How many.

Type-Bound Procedures

NameAttributesDescription
initializepass(self)Family, highest order, field bounds, stages.
destroypass(self)Free the registers.
startpass(self)The array from q^0, h F(t^0, q^0) and the first step (order 1).
begin_steppass(self)The prediction.
stagespass(self)Stages per step.
begin_stagepass(self)A stage's state.
end_stagepass(self)A stage done.
finish_steppass(self)The correction.
reject_steppass(self)The prediction undone (a step to retry).
set_steppass(self)A new step: the columns rescaled.
set_orderpass(self)A new order: a column more or less.
stage_statepass(self)The active stage's state (rank-5 view).
rhs_registerpass(self)Where the caller writes the active stage's residual.
explicit_partpass(self)E (from begin_step to finish_step).
stage_gammapass(self)l_0 for the implicit stages (k >= 2), 0 for stage 1.
columnpass(self)z_j, j = 1 .. q (rank-5 view).
error_constantpass(self)C_{p+1} of order p.
error_sumspass(self)The local error estimates at q - 1, q, q + 1: the box's sums.
selectpass(self)Accept or reject; the next step and order (host).
set_spectral_radiuspass(self)The caller's spectral-radius estimate: the stability cap.
stability_boundpass(self)The imaginary-axis bound of order p's step.

nordsieck_stepper%initialize ​

family NORDSIECK_ADAMS or NORDSIECK_BDF, the field's bounds (rank 5, ghosts included), the highest order (default the family's), the stages per step (default 2: the prediction's residual, then one implicit stage).

fortran
subroutine initialize(self, family, lb, ub, qmax, stages)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
familycharacter(len=*)inFamily.
lbinteger(kind=I4P)inLower bounds.
ubinteger(kind=I4P)inUpper bounds.
qmaxinteger(kind=I4P)inoptionalHighest order.
stagesinteger(kind=I4P)inoptionalStages per step (>= 1).

Call graph

nordsieck_stepper%destroy ​

Free the registers.

fortran
subroutine destroy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.

nordsieck_stepper%start ​

The array at t^0 from q^0 (the caller's q, z_0) and hf0 = h F(t^0, q^0): z_1 = hf0, the higher columns 0; h the first step, order the starting order (default 1; a higher one needs its columns written by the caller, column(j), before the first step).

fortran
subroutine start(self, bx, h, hf0, order)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
hreal(kind=R_P)inFirst step.
hf0real(kind=R_P)inh F(t^0, q^0).
orderinteger(kind=I4P)inoptionalStarting order.

Call graph

nordsieck_stepper%begin_step ​

The prediction: the Pascal matrix on z_1 .. z_q in place, the predicted value (stage 1's state) and E.

fortran
subroutine begin_step(self, bx, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
qreal(kind=R_P)inSolution, q^n (z_0).

Call graph

nordsieck_stepper%stages ​

Stages (residual evaluations) per step.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function stages(self) result(s)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.

nordsieck_stepper%begin_stage ​

Stage k's state: the prediction for k = 1, E + gamma R(the previous state) after (in place).

fortran
subroutine begin_stage(self, k, bx)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
kinteger(kind=I4P)inStage.
bxtype(box)inBox.

Call graph

nordsieck_stepper%end_stage ​

Stage k done (its residual written).

fortran
subroutine end_stage(self, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
kinteger(kind=I4P)inStage.

nordsieck_stepper%finish_step ​

The correction from the last stage's residual R: Delta = h R - z_1, q = E + gamma R, z_j += l_j Delta, Delta kept.

fortran
subroutine finish_step(self, bx, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
qreal(kind=R_P)inout

Call graph

nordsieck_stepper%reject_step ​

The prediction undone (the inverse Pascal matrix on z_1 .. z_q): the array of t^n again, to rounding, for a step retried with another step or order (set_step, set_order). q was never written.

fortran
subroutine reject_step(self, bx)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.

Call graph

nordsieck_stepper%set_step ​

The next step h: z_j <- eta^j z_j, Delta <- eta^(q+1) Delta, eta = h / the current step. Between steps.

fortran
subroutine set_step(self, bx, h)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
hreal(kind=R_P)inNew step.

Call graph

nordsieck_stepper%set_order ​

The next order, the current one +- 1 (between steps, after an accepted step): up, z_{q+1} = l_q Delta / (q + 1) (h^{q+1} y^(q+1) / (q+1)! from the last correction); down, z_q dropped.

fortran
subroutine set_order(self, bx, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
qinteger(kind=I4P)inNew order.

Call graph

nordsieck_stepper%stage_state ​

The active stage's state, with the field's bounds.

Returns: real(kind=R_P)

fortran
function stage_state(self) result(u)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.

nordsieck_stepper%rhs_register ​

Where the caller writes the active stage's residual, with the field's bounds.

Returns: real(kind=R_P)

fortran
function rhs_register(self) result(r)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.

nordsieck_stepper%explicit_part ​

E = y_p - l_0 z_1 (from begin_step to finish_step): the implicit stage is U = E + gamma R(U), gamma = h l_0.

Returns: real(kind=R_P)

fortran
function explicit_part(self) result(e)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.

nordsieck_stepper%stage_gamma ​

The implicit coefficient of stage k as a fraction of the step: l_0 for k >= 2, 0 for stage 1 (the prediction).

Attributes: pure

Returns: real(kind=R_P)

fortran
function stage_gamma(self, k) result(g)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.
kinteger(kind=I4P)inStage.

nordsieck_stepper%column ​

The column z_j = h^j y^(j) / j!, j = 1 .. qmax, with the field's bounds (its Delta: j = qmax + 1).

Returns: real(kind=R_P)

fortran
function column(self, j) result(z)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.
jinteger(kind=I4P)inColumn.

nordsieck_stepper%error_constant ​

C_{p+1}, the local error constant of the family's method of order p (LTE = C_{p+1} h^{p+1} y^(p+1)).

Attributes: pure

Returns: real(kind=R_P)

fortran
function error_constant(self, p) result(c)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.
pinteger(kind=I4P)inOrder.

nordsieck_stepper%error_sums ​

After the last stage, before finish_step: the local error estimates of the step at the orders q - 1, q and q + 1, scaled by atol + rtol |y| (y the corrected value), summed over the box: sums(1:3) their squares, sums(4) the values counted, sums(5) the squares of the last stage's residual (unscaled: the stability-limit detection's measure of the solution's growth). The caller sums them over its boxes and ranks, then select. With h^{q+1} y^(q+1) = q! l_q Delta (z_q's correction) and C_{p+1} the error constant of order p: e_{q-1} = C_q q! z_q, e_q = C_{q+1} q! l_q Delta, e_{q+1} = C_{q+2} q! l_q (Delta - Delta_{n-1}).

fortran
subroutine error_sums(self, bx, q, atol, rtol, sums)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
bxtype(box)inBox.
qreal(kind=R_P)inSolution (q^n: unused but for the bounds).
atolreal(kind=R_P)inTolerances.
rtolreal(kind=R_P)inTolerances.
sumsreal(kind=R_P)outSums of squares at q - 1, q, q + 1; count; R.

Call graph

nordsieck_stepper%select ​

From the reduced sums: the step is accepted when the RMS estimate at q is <= 1; the next step and order. After q + 1 accepted steps at an order, the order of the largest step among q - 1, q, q + 1 is chosen (biases 1.3, 1.2, 1.4 on the estimates), and the step changes only when it grows by 10 % or shrinks; in between the step stays. Each candidate is capped at 0.9 beta(p) / rho when the caller gave a spectral radius rho, and an order whose step has no imaginary-axis interval (beta = 0: Adams 3, 4, 7, 8, 11, 12 with 2 stages) is then never moved to. A rejection shrinks the step (0.2 to 0.9 of it), and the order too from the third in a row.

fortran
subroutine select(self, sums, accept, h_next, q_next)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
sumsreal(kind=R_P)inReduced sums.
acceptlogicaloutThe step is accepted.
h_nextreal(kind=R_P)outThe next step.
q_nextinteger(kind=I4P)outThe next order.

Call graph

nordsieck_stepper%set_spectral_radius ​

The caller's estimate of the largest |lambda| of its residual's Jacobian, on the imaginary axis (an advection's a / dx): each order's step is capped at 0.9 beta(p) / rho (stability_bound), and select prefers the order with the largest capped step. 0 removes the cap.

fortran
subroutine set_spectral_radius(self, rho)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inoutStepper.
rhoreal(kind=R_P)inSpectral radius.

nordsieck_stepper%stability_bound ​

The imaginary-axis bound of order p's step (in h |lambda|): Adams, the P(EC)^m step from ab-p's prediction (selah_lmm fixed_point_imag_axis_bound, m the stages); BDF, the scheme's own (100: the scan's end, unbounded).

Attributes: pure

Returns: real(kind=R_P)

fortran
function stability_bound(self, p) result(b)

Arguments

NameTypeIntentAttributesDescription
selfclass(nordsieck_stepper)inStepper.
pinteger(kind=I4P)inOrder.