Control of Time-Step size in OrdinaryDiffEq

Hi,

I am trying to use OrdinaryDiffEq for the time integration of a hyperbolic PDE system in a finite-volume context. I want to control the size of the time-step through a CFL condition, rather than by some error norm. The calculation of this desired time-step is simple for a given state U, but I can’t see a way to specify that time-step to the solver.

There’s an implementation of a CFL-based stepsize controller via a DiscreteCallback in 12 Explicit time stepping · Trixi.jl.

Based on their implementation, it looks like one can simply set the “dt” attribute for the integrator in a callback function?

Yup, using the DiscreteCallback from the DiffEqCallbackLibrary should let you do this through the integrator interface.

This callback in the library specifically: GitHub - SciML/DiffEqCallbacks.jl: A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers

1 Like