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.
IncompressibleNavierStokes.AbstractODEMethod Type
abstract type AbstractODEMethod{T}
Abstract ODE method.
Fields
IncompressibleNavierStokes.ode_method_cache Function
ode_method_cache(method, setup, u, temp)
Get time stepper cache for the given ODE method.
IncompressibleNavierStokes.runge_kutta_method Function
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
.
IncompressibleNavierStokes.create_stepper Function
create_stepper(method; setup, psolver, u, temp, t, n)
Create time stepper.
IncompressibleNavierStokes.timestep Function
timestep(method, stepper, Δt; θ = nothing)
Perform one time step.
Non-mutating/allocating/out-of-place version.
See also timestep!
.
IncompressibleNavierStokes.timestep! Function
timestep!(method, stepper, Δt; θ = nothing, cache)
Perform one time step>
Mutating/non-allocating/in-place version.
See also timestep
.
Adams-Bashforth Crank-Nicolson method
IncompressibleNavierStokes.AdamsBashforthCrankNicolsonMethod Type
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
IncompressibleNavierStokes.OneLegMethod Type
struct OneLegMethod{T, M} <: IncompressibleNavierStokes.AbstractODEMethod{T}
Explicit one-leg β-method following symmetry-preserving discretization of turbulent flow. See Verstappen and Veldman [14] [16] 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
IncompressibleNavierStokes.AbstractRungeKuttaMethod Type
abstract type AbstractRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractODEMethod{T}
Abstract Runge Kutta method.
Fields
IncompressibleNavierStokes.ExplicitRungeKuttaMethod Type
struct ExplicitRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractRungeKuttaMethod{T}
Explicit Runge Kutta method. See Sanderse [17].
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
IncompressibleNavierStokes.ImplicitRungeKuttaMethod Type
struct ImplicitRungeKuttaMethod{T} <: IncompressibleNavierStokes.AbstractRungeKuttaMethod{T}
Implicit Runge Kutta method. See Sanderse [18].
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
IncompressibleNavierStokes.RKMethods Module
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
IncompressibleNavierStokes.LMWray3 Type
struct LMWray3{T} <: IncompressibleNavierStokes.AbstractRungeKuttaMethod{T}
Low memory Wray 3rd order scheme. Uses 3 vector fields and one scalar field.
Fields
Explicit Methods
IncompressibleNavierStokes.RKMethods.FE11 Function
FE11(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
FE11 (Forward Euler).
IncompressibleNavierStokes.RKMethods.SSP22 Function
SSP22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP22.
IncompressibleNavierStokes.RKMethods.SSP42 Function
SSP42(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP42.
IncompressibleNavierStokes.RKMethods.SSP33 Function
SSP33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP33.
IncompressibleNavierStokes.RKMethods.SSP43 Function
SSP43(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP43.
IncompressibleNavierStokes.RKMethods.SSP104 Function
SSP104(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
SSP104.
IncompressibleNavierStokes.RKMethods.rSSPs2 Function
rSSPs2(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
rSSPs2(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Rational (optimal, low-storage) s
-stage 2nd order SSP.
IncompressibleNavierStokes.RKMethods.rSSPs3 Function
rSSPs3(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
rSSPs3(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Rational (optimal, low-storage) s^2
-stage 3rd order SSP.
IncompressibleNavierStokes.RKMethods.Wray3 Function
Wray3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Wray's RK3.
IncompressibleNavierStokes.RKMethods.RK56 Function
RK56(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK56.
IncompressibleNavierStokes.RKMethods.DOPRI6 Function
DOPRI6(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Dormand-Price pair.
Implicit Methods
IncompressibleNavierStokes.RKMethods.BE11 Function
BE11(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Backward Euler.
IncompressibleNavierStokes.RKMethods.SDIRK34 Function
SDIRK34(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
3-stage, 4th order singly diagonally implicit (SSP).
IncompressibleNavierStokes.RKMethods.ISSPm2 Function
ISSPm2(
;
...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
ISSPm2(
s;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod, IncompressibleNavierStokes.ImplicitRungeKuttaMethod}
Optimal DIRK SSP schemes of order 2.
IncompressibleNavierStokes.RKMethods.ISSPs3 Function
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
IncompressibleNavierStokes.RKMethods.HEM3 Function
HEM3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Brasey and Hairer.
IncompressibleNavierStokes.RKMethods.HEM3BS Function
HEM3BS(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
HEM3BS.
IncompressibleNavierStokes.RKMethods.HEM5 Function
HEM5(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Brasey and Hairer, 5 stage, 4th order.
Classical Methods
IncompressibleNavierStokes.RKMethods.GL1 Function
GL1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL1.
IncompressibleNavierStokes.RKMethods.GL2 Function
GL2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL2.
IncompressibleNavierStokes.RKMethods.GL3 Function
GL3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
GL3.
IncompressibleNavierStokes.RKMethods.RIA1 Function
RIA1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
This is implicit Euler.
IncompressibleNavierStokes.RKMethods.RIA2 Function
RIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIA2.
IncompressibleNavierStokes.RKMethods.RIA3 Function
RIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIA3.
IncompressibleNavierStokes.RKMethods.RIIA1 Function
RIIA1(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA1.
IncompressibleNavierStokes.RKMethods.RIIA2 Function
RIIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA2.
IncompressibleNavierStokes.RKMethods.RIIA3 Function
RIIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RIIA3.
IncompressibleNavierStokes.RKMethods.LIIIA2 Function
LIIIA2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
LIIIA2.
IncompressibleNavierStokes.RKMethods.LIIIA3 Function
LIIIA3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
LIIIA3.
Chebyshev methods
IncompressibleNavierStokes.RKMethods.CHDIRK3 Function
CHDIRK3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Chebyshev based DIRK (not algebraically stable).
IncompressibleNavierStokes.RKMethods.CHCONS3 Function
CHCONS3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CHCONS3.
IncompressibleNavierStokes.RKMethods.CHC3 Function
CHC3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Chebyshev quadrature and C(3) satisfied. Note this equals Lobatto IIIA.
IncompressibleNavierStokes.RKMethods.CHC5 Function
CHC5(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CHC5.
Miscellaneous Methods
IncompressibleNavierStokes.RKMethods.Mid22 Function
Mid22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Midpoint 22 method.
IncompressibleNavierStokes.RKMethods.MTE22 Function
MTE22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Minimal truncation error 22 method (Heun).
IncompressibleNavierStokes.RKMethods.CN22 Function
CN22(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Crank-Nicholson.
IncompressibleNavierStokes.RKMethods.Heun33 Function
Heun33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Heun33.
IncompressibleNavierStokes.RKMethods.RK33C2 Function
RK33C2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK3 satisfying C(2) for i=3.
IncompressibleNavierStokes.RKMethods.RK33P2 Function
RK33P2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK3 satisfying the second order condition for the pressure.
IncompressibleNavierStokes.RKMethods.RK44 Function
RK44(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Classical fourth order.
IncompressibleNavierStokes.RKMethods.RK44C2 Function
RK44C2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying C(2) for i=3.
IncompressibleNavierStokes.RKMethods.RK44C23 Function
RK44C23(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying C(2) for i=3 and c2=c3.
IncompressibleNavierStokes.RKMethods.RK44P2 Function
RK44P2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
RK4 satisfying the second order condition for the pressure (but not third order).
DSRK Methods
IncompressibleNavierStokes.RKMethods.DSso2 Function
DSso2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CBM's DSRKso2.
IncompressibleNavierStokes.RKMethods.DSRK2 Function
DSRK2(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
CBM's DSRK2.
IncompressibleNavierStokes.RKMethods.DSRK3 Function
DSRK3(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
Zennaro's DSRK3.
"Non-SSP" Methods of Wong & Spiteri
IncompressibleNavierStokes.RKMethods.NSSP21 Function
NSSP21(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP21.
IncompressibleNavierStokes.RKMethods.NSSP32 Function
NSSP32(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP32.
IncompressibleNavierStokes.RKMethods.NSSP33 Function
NSSP33(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP33.
IncompressibleNavierStokes.RKMethods.NSSP53 Function
NSSP53(
;
kwargs...
) -> Union{IncompressibleNavierStokes.ExplicitRungeKuttaMethod{Float64}, IncompressibleNavierStokes.ImplicitRungeKuttaMethod{Float64}}
NSSP53.