Time discretization
The spatially discretized Navier-Stokes equations form a differential-algebraic system, with an ODE for the velocity
subject to the algebraic constraint formed by the mass equation
In the end of the previous section, we differentiated the mass equation in time to obtain a discrete pressure Poisson equation. This equation includes the term
Consider the interval
IncompressibleNavierStokes provides a collection of explicit and implicit Runge-Kutta methods, in addition to Adams-Bashforth Crank-Nicolson and one-leg beta method time steppers.
The code is currently not adapted to time steppers from DifferentialEquations.jl, but they may be integrated in the future.
abstract type AbstractODEMethod{T}
Abstract ODE method.
Fields
isexplicit(method)
Return true
if method
is explicit, i.e. the value at a certain time step is given explicitly as a function of the previous time steps only.
lambda_conv_max(method)
Get maximum value of stability region for the convection operator (not a very good indication for the methods that do not include the imaginary axis)
lambda_diff_max(method)
Get maximum value of stability region for the diffusion operator.
ode_method_cache(method, setup, u, temp)
Get time stepper cache for the given ODE method.
runge_kutta_method(
A,
b,
c,
r;
T,
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Get Runge Kutta method. The function checks whether the method is explicit.
p_add_solve
: whether to add a pressure solve step to the method.
For implicit RK methods: newton_type
, maxiter
, abstol
, reltol
.
timestep(method, stepper, Δt; θ = nothing)
Perform one time step.
Non-mutating/allocating/out-of-place version.
See also timestep!
.
timestep!(method, stepper, Δt; θ = nothing, cache)
Perform one time step>
Mutating/non-allocating/in-place version.
See also timestep
.
Adams-Bashforth Crank-Nicolson method
struct AdamsBashforthCrankNicolsonMethod{T, M} <: IncompressibleNavierStokes.AbstractODEMethod{T}
IMEX AB-CN: Adams-Bashforth for explicit convection (parameters α₁
and α₂
) and Crank-Nicolson for implicit diffusion (implicitness θ
). The method is second order for θ = 1/2
.
The LU decomposition of the LHS matrix is computed every time the time step changes.
Note that, in contrast to explicit methods, the pressure from previous time steps has an influence on the accuracy of the velocity.
We here require that the time step
where
We can compute
We then compute the pressure difference
after which a divergence free velocity
A first order accurate prediction of the corresponding pressure is
Fields
α₁
α₂
θ
p_add_solve
method_startup
One-leg beta method
struct OneLegMethod{T, M} <: IncompressibleNavierStokes.AbstractODEMethod{T}
Explicit one-leg β-method following symmetry-preserving discretization of turbulent flow. See Verstappen and Veldman [15] [17] for details.
We here require that the time step
A tentative velocity field
A pressure correction
Finally, the divergence free velocity field is given by
while the second order accurate pressure is given by
Fields
β
p_add_solve
method_startup
Runge-Kutta methods
abstract type AbstractRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractODEMethod{T}
Abstract Runge Kutta method.
Fields
struct ExplicitRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractRungeKuttaMethod{T}
Explicit Runge Kutta method. See Sanderse [18].
Consider the velocity field
For
where
Finally, we return
Note that each of the sub-step velocities
Fields
A
b
c
r
p_add_solve
struct ImplicitRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractRungeKuttaMethod{T}
Implicit Runge Kutta method. See Sanderse [19].
The implicit linear system is solved at each time step using Newton's method. The newton_type
may be one of the following:
:no
: Replace iteration matrix with I/Δt (no Jacobian):approximate
: Build Jacobian once before iterations only:full
: Build Jacobian at each iteration
Fields
A
b
c
r
newton_type
maxiter
abstol
reltol
p_add_solve
Set up Butcher arrays A
, b
, and c
, as well as and SSP coefficient r
. For families of methods, optional input s
is the number of stages.
Original (MATLAB) by David Ketcheson, extended by Benjamin Sanderse.
Exports
Explicit Methods
FE11(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
FE11 (Forward Euler).
SSP22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP22.
SSP42(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP42.
SSP33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP33.
SSP43(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP43.
SSP104(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP104.
rSSPs2(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
rSSPs2(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Rational (optimal, low-storage) s
-stage 2nd order SSP.
rSSPs3(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
rSSPs3(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Rational (optimal, low-storage) s^2
-stage 3rd order SSP.
Wray3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Wray's RK3.
RK56(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK56.
DOPRI6(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Dormand-Price pair.
Implicit Methods
BE11(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Backward Euler.
SDIRK34(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
3-stage, 4th order singly diagonally implicit (SSP).
ISSPm2(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
ISSPm2(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Optimal DIRK SSP schemes of order 2.
ISSPs3(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
ISSPs3(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Optimal DIRK SSP schemes of order 3.
Half explicit methods
HEM3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Brasey and Hairer.
HEM3BS(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
HEM3BS.
HEM5(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Brasey and Hairer, 5 stage, 4th order.
Classical Methods
GL1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL1.
GL2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL2.
GL3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL3.
RIA1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
This is implicit Euler.
RIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIA2.
RIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIA3.
RIIA1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA1.
RIIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA2.
RIIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA3.
LIIIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
LIIIA2.
LIIIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
LIIIA3.
Chebyshev methods
CHDIRK3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Chebyshev based DIRK (not algebraically stable).
CHCONS3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CHCONS3.
CHC3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Chebyshev quadrature and C(3) satisfied. Note this equals Lobatto IIIA.
CHC5(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CHC5.
Miscellaneous Methods
Mid22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Midpoint 22 method.
MTE22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Minimal truncation error 22 method (Heun).
CN22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Crank-Nicholson.
Heun33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Heun33.
RK33C2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK3 satisfying C(2) for i=3.
RK33P2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK3 satisfying the second order condition for the pressure.
RK44(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Classical fourth order.
RK44C2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying C(2) for i=3.
RK44C23(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying C(2) for i=3 and c2=c3.
RK44P2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying the second order condition for the pressure (but not third order).
DSRK Methods
DSso2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CBM's DSRKso2.
DSRK2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CBM's DSRK2.
DSRK3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Zennaro's DSRK3.
"Non-SSP" Methods of Wong & Spiteri
NSSP21(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP21.
NSSP32(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP32.
NSSP33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP33.
NSSP53(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP53.