Time steppers
The following time steppers are implemented in FESolvers.
FESolvers.FixedTimeStepper — TypeFixedTimeStepper(;num_steps::Int, Δt=1, t_start=0)
FixedTimeStepper(t::Vector)A time stepper which gives fixed time steps. If the convenience interface is used, constant increments are used. Note that length(t)=num_steps+1 since the first value is just the initial value and is not an actual step.
FESolvers.AdaptiveTimeStepper — TypeAdaptiveTimeStepper(
Δt_init::T, t_end::T;
t_start=zero(T), Δt_min=Δt_init, Δt_max=typemax(T),
change_factor=T(0.5), optiter_ratio=T(0.5), k=one(T)) where TAn adaptive time stepper with an initial step Δt_init and total time t_end. Two ways of adaption:
- If the previous attempt did not converge, the time
step is reduced as Δt*=change_factor and the step is retried.
- If convergence, the next time step depends on how many iterations was
required to converge; numiter. The time step is changed as Δt*=change_factor^(k*m), where m=(numiter-optiter)/(maxiter-optiter). In this expression, maxiter and optiter are the maximum and optimum number of iterations for the nonlinear solver. optiter=floor(maxiter*optiter_ratio) and maxiter is obtained from the nonlinear solver (via get_max_iter(s))
If numiter=maxiter, then m=1 and the time step update is the same as for a non-converged solution if k=1. Note that k>0, change_factor∈[0,1], and optiter_ratio∈[0,1] are expected, otherwise warnings are thrown.
Custom time stepper
A time stepper should support the following functions
FESolvers.get_time — Functionget_time(timestepper)Return the current time for timestepper
FESolvers.get_step — Functionget_step(timestepper)Return the current step number
FESolvers.is_last_step — Functionis_last_step(timestepper)->BoolReturn true if the current step/time is the last step, return false otherwise
FESolvers.step_time! — Functionstep_time!(solver)
step_time!(timestepper, nlsolver)Increment the timestepper depending on the convergence status of nlsolver. If not converged and a smaller time step is not possible, throw ConvergenceError.
Note that a call to the first definition is forwarded to the second function definition by decomposing the solver, unless another specialization is defined.
FESolvers.reset_timestepper! — Functionreset_timestepper!(timestepper)Reset the time and step in timestepper