BDF

class pathsim.solvers.bdf.BDF(*solver_args, **solver_kwargs)[source]

Bases: ImplicitSolver

Base class for the backward differentiation formula (BDF) integrators.

Notes

This solver class is not intended to be used directly

x

internal ‘working’ state

Type:

numeric, array[numeric]

n

order of integration scheme

Type:

int

s

number of internal intermediate stages

Type:

int

stage

counter for current intermediate stage

Type:

int

eval_stages

rations for evaluation times of intermediate stages

Type:

list[float]

opt

optimizer instance to solve the implicit update equation

Type:

NewtonAnderson, Anderson, etc.

K

bdf coefficients for the state buffer for each order

Type:

dict[int: list[float]]

F

bdf coefficients for the function ‘func’ for each order

Type:

dict[int: float]

history

internal history of past results

Type:

deque[numeric]

startup

internal solver instance for startup (building history) of multistep methods (using ‘DIRK3’ for ‘BDF’ methods)

Type:

Solver

classmethod cast(other, parent, **solver_kwargs)[source]

cast to this solver needs special handling of startup method

Parameters:
  • other (Solver) – solver instance to cast new instance of this class from

  • parent (None | Solver) – solver instance to use as parent

  • solver_kwargs (dict) – other args for the solver

Returns:

engine – instance of BDF solver with params and state from other

Return type:

BDF

classmethod create(initial_value, parent=None, from_engine=None, **solver_kwargs)[source]

Create a new BDF solver, properly initializing the startup solver.

Parameters:
  • initial_value (float, array) – initial condition / integration constant

  • parent (None | Solver) – parent solver instance for stage synchronization

  • from_engine (None | Solver) – existing solver to inherit state and settings from

  • solver_kwargs (dict) – additional args for the solver

Returns:

engine – new BDF solver instance

Return type:

BDF

stages(t, dt)[source]

Generator that yields the intermediate evaluation time during the timestep ‘t + ratio * dt’.

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

reset()[source]

“Resets integration engine to initial state.

buffer(dt)[source]

buffer the state for the multistep method

Parameters:

dt (float) – integration timestep

solve(f, J, dt)[source]

Solves the implicit update equation using the optimizer of the engine.

Parameters:
  • f (array_like) – evaluation of function

  • J (array_like) – evaluation of jacobian of function

  • dt (float) – integration timestep

Returns:

err – residual error of the fixed point update equation

Return type:

float

step(f, dt)[source]

Performs the explicit timestep for (t+dt) based on the state and input at (t).

Note

This is only required for the startup solver.

Parameters:
  • f (numeric, array[numeric]) – evaluation of rhs function

  • dt (float) – integration timestep

Returns:

  • success (bool) – True if the timestep was successful

  • error (float) – estimated error of the internal error controller

  • scale (float) – estimated timestep rescale factor for error control

class pathsim.solvers.bdf.BDF2(*solver_args, **solver_kwargs)[source]

Bases: BDF

Fixed-step 2nd order Backward Differentiation Formula (BDF).

Implicit linear multistep method using the previous two solution points. A-stable, making it excellent for stiff problems. Uses DIRK3 startup method for the first steps.

Characteristics

  • Order: 2

  • Implicit Multistep

  • Fixed timestep only

  • A-stable

When to Use

  • Stiff problems with fixed timestep: Classic choice for stiff ODEs

  • Long-time integration: Very stable for extended simulations

  • Known timestep: When timestep is predetermined

  • Efficient stiff solver: Lower overhead than higher-order BDFs

Recommended for fixed-timestep stiff problems. For adaptive stepping, use GEAR21 or ESDIRK methods.

References

class pathsim.solvers.bdf.BDF3(*solver_args, **solver_kwargs)[source]

Bases: BDF

Fixed-step 3rd order Backward Differentiation Formula (BDF).

Implicit linear multistep method using the previous three solution points. A(alpha)-stable with \(\alpha \approx 86^\circ\), providing excellent stability for stiff problems. Uses DIRK3 startup method for initial steps.

Characteristics

  • Order: 3

  • Implicit Multistep

  • Fixed timestep only

  • A(alpha)-stable (\(\alpha \approx 86^\circ\))

When to Use

  • Stiff problems with higher accuracy: 3rd order for better accuracy than BDF2

  • Fixed-timestep applications: When timestep is predetermined

  • Good stability/accuracy balance: Better accuracy with still-excellent stability

  • Chemical kinetics: Common in reaction-diffusion problems

Trade-off: Slightly less stable than BDF2, but more accurate. For adaptive stepping, use GEAR32 or ESDIRK43.

References

class pathsim.solvers.bdf.BDF4(*solver_args, **solver_kwargs)[source]

Bases: BDF

Fixed-step 4th order Backward Differentiation Formula (BDF).

Implicit linear multistep method using the previous four solution points. A(alpha)-stable with \(\alpha \approx 73^\circ\). Good for stiff problems requiring moderate-to-high accuracy. Uses DIRK3 startup method for initial steps.

Characteristics

  • Order: 4

  • Implicit Multistep

  • Fixed timestep only

  • A(alpha)-stable (\(\alpha \approx 73^\circ\))

When to Use

  • Moderate-to-high accuracy on stiff problems: 4th order with good stability

  • Fixed timestep: When timestep is predetermined

  • Accurate stiff solver: Higher accuracy than BDF3

  • Scientific computing: Common in engineering simulations

Note: Stability angle is smaller than BDF3. For very stiff problems, BDF2 or BDF3 may be more robust. For adaptive stepping, use GEAR43 or ESDIRK43.

References

class pathsim.solvers.bdf.BDF5(*solver_args, **solver_kwargs)[source]

Bases: BDF

Fixed-step 5th order Backward Differentiation Formula (BDF).

Implicit linear multistep method using the previous five solution points. A(alpha)-stable with \(\alpha \approx 51^\circ\). Suitable for stiff problems requiring high accuracy, but with reduced stability angle. Uses DIRK3 startup method for initial steps.

Characteristics

  • Order: 5

  • Implicit Multistep

  • Fixed timestep only

  • A(alpha)-stable (\(\alpha \approx 51^\circ\))

When to Use

  • High accuracy on mildly stiff problems: 5th order when stability angle is sufficient

  • Fixed timestep applications: When timestep is predetermined

  • Smooth stiff problems: Problems without extreme stiffness

  • High-precision requirements: Better accuracy than BDF4

Warning: Reduced stability compared to lower-order BDFs. For very stiff problems, use BDF2 or BDF3. For adaptive stepping, use GEAR54 or ESDIRK54.

References

class pathsim.solvers.bdf.BDF6(*solver_args, **solver_kwargs)[source]

Bases: BDF

Fixed-step 6th order Backward Differentiation Formula (BDF).

Implicit linear multistep method using the previous six solution points. Not A-stable; stability region does not contain the entire left half-plane (stability angle only \(\approx 18^\circ\)), severely limiting its use for stiff problems. Uses DIRK3 startup method for initial steps.

Characteristics

  • Order: 6

  • Implicit Multistep

  • Fixed timestep only

  • Not A-stable (stability angle approx \(18^\circ\))

When to Use

  • Very smooth, mildly stiff problems: Only when stiffness is minimal

  • High accuracy priority: When 6th order accuracy justifies poor stability

  • Specialized applications: Rarely used in practice

Warning: Very limited stability. Generally not recommended for stiff problems. For most applications requiring 6th order accuracy, use explicit methods like RKV65 on non-stiff problems, or lower-order BDFs with smaller timesteps on stiff problems.

References