Iteration

In kinetic methods, time marching is commonly coupled with collision process. The time marching scheme as well as the realization of collision process is abstracted as

The best supported time marching type is

In this type, time derivative is dicretized with backward Euler method, exhibiting first order accuracy. Collision process is carried out with conserved correction, which is crucial for AMR in velocity space.


Here are the related functions. The per-step driver advances the solution one time step (collision + time marching), reduces the residual across ranks, exchanges ghost data and increments the step counters:

KitAMR.iterate!Method
iterate!(
    p4est::Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}},
    ka::KA
)

Outer function of collision and time marching.

source

The time step itself is set from the CFL/grid step and, when needed, shrunk to land exactly on the next output/termination time by

KitAMR.limit_Δt!Function
limit_Δt!(ka::KA)

Shrink the time step status.Δt (starting from the grid/CFL step Δt_ξ) so the simulation lands exactly on the next output target: the next animation frame time (integer multiples of output.anim_dt, when animation is enabled) and the termination time solver.max_sim_time. Call once per step before flux!. With the default max_sim_time=Inf and animation off, this is a no-op (Δt = Δt_ξ). Note: only the time-accurate marching schemes (CIP_Marching, CAIDVM_Marching) consume status.Δt directly; UGKS/Euler reset it to Δt_ξ mid-step and are meant for steady runs.

source

and the run terminates when

KitAMR.reached_max_timeFunction
reached_max_time(ka::KA) -> Bool

Return true once sim_time has reached solver.max_sim_time (within a small relative tolerance). Use as the main-loop termination condition. Always false for the default max_sim_time=Inf (i.e. terminate only by convergence).

source

Developer may hope to define their own collision process. As an example, the method for CAIDVM_Marching is defined as

KitAMR.iterate!Method
iterate!(_::Type{CAIDVM_Marching}, ka::KA)

Iteration for Conserved Adaptive Implicit DVM (CAIDVM).

source