# sfepy.solvers.ts_controllers module

Time step controllers.

class sfepy.solvers.ts_controllers.ElastodynamicsBasicTSC(conf, **kwargs)

  Adaptive time step I-controller for elastodynamics.

  The implementation is based on [1]. The default parameters correspond to the PID-Controller as implemented in `tsc.ed_pid` with P=D=0, I=1.

  [1] Grafenhorst, Matthias, Joachim Rang, and Stefan Hartmann. “Time-Adaptive Finite Element Simulations of Dynamical Problems for Temperature-Dependent Materials.” Journal of Mechanics of Materials and Structures 12, no. 1 (November 26, 2016): 57–91. https://doi.org/10.2140/jomms.2017.12.57.

  > Kind: ‘tsc.ed_basic’

  > For common configuration parameters, see `Solver`.

  > Specific configuration parameters:

  Parameters:
    eps_r list of floats or float

      Relative tolerance(s).

    eps_a list of floats or float

      Absolute tolerance(s).

    fmin float (default: 0.3)

      Minimum step size change factor on step rejection.

    fmax float (default: 2.5)

      Maximum step size change factor on step acceptance.

    fsafety float (default: 0.8)

      Step size change safety factor.

    error_order float (default: 2)

      The order of the solver error estimate.

    guess_dt0 bool (default: False)

      Guess a good initial step size from initial conditions.

  get_initial_dt(ts, vec, unpack, **kwargs)

    Adapted from [1] for second order ODEs.

    [1] Hairer, Ernst, Gerhard Wanner, and Syvert P. Nørsett. Solving Ordinary Differential Equations I: Nonstiff Problems. Vol. 8. Springer Series in Computational Mathematics. Berlin, Heidelberg: Springer, 1993. https://doi.org/10.1007/978-3-540-78862-1.

  static get_scaled_errors(dt, vec0, vec1, eps_as, eps_rs, unpack)
  name = 'tsc.ed_basic'

class sfepy.solvers.ts_controllers.ElastodynamicsLinearTSC(conf, **kwargs)

  Adaptive time step controller for elastodynamics and linear problems.

  Simple heuristics around `ElastodynamicsBasicTSC` that increases the step size only after a sufficient number of accepted iterations passed and the increase is large enough. In particular:

  - Let new_dt be the step size proposed by tsc.ed_basic and dt the current step size.

  - If the current step is rejected, the count attribute is reset to zero and fred * new_dt is returned.

  - If the current step is accepted:

    - If the count is lower than inc_wait, it is incremented and dt is returned.

    - Otherwise, if (new_dt / dt) >= min_finc (>= 1), the count is reset to zero and new_dt is returned.

    - Else, if (new_dt / dt) < min_finc, dt is returned.

      Kind: ‘tsc.ed_linear’

      For common configuration parameters, see `Solver`.

      Specific configuration parameters:

  Parameters:
    eps_r list of floats or float

      Relative tolerance(s).

    eps_a list of floats or float

      Absolute tolerance(s).

    fmin float (default: 0.3)

      Minimum step size change factor on step rejection.

    fmax float (default: 2.5)

      Maximum step size change factor on step acceptance.

    fsafety float (default: 0.8)

      Step size change safety factor.

    error_order float (default: 2)

      The order of the solver error estimate.

    guess_dt0 bool (default: False)

      Guess a good initial step size from initial conditions.

    fred float (default: 1.0)

      Additional step size reduction factor w.r.t. tsc.ed_basic.

    inc_wait int (default: 10)

      The number of consecutive accepted steps to wait before increasing the step size.

    min_finc float >= 1 (default: 1.5)

      Minimum step size increase factor.

  name = 'tsc.ed_linear'

class sfepy.solvers.ts_controllers.ElastodynamicsPIDTSC(conf, **kwargs)

  Adaptive time step PID controller for elastodynamics.

  The implementation is based on [1], [2] (PI Controller) and [3] (PID). The default parameters correspond to the I-Controller as implemented in `tsc.ed_basic`.

  [1] Grafenhorst, Matthias, Joachim Rang, and Stefan Hartmann. “Time-Adaptive Finite Element Simulations of Dynamical Problems for Temperature-Dependent Materials.” Journal of Mechanics of Materials and Structures 12, no. 1 (November 26, 2016): 57–91. https://doi.org/10.2140/jomms.2017.12.57. [2] Hairer, Ernst, Syvert Paul Nørsett, and Gerhard Wanner. Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems. Springer Science & Business Media, 1993. [3] Söderlind, Gustaf. “Digital Filters in Adaptive Time-Stepping.” ACM Transactions on Mathematical Software 29, no. 1 (March 1, 2003): 1–26. https://doi.org/10.1145/641876.641877.

  > Kind: ‘tsc.ed_pid’

  > For common configuration parameters, see `Solver`.

  > Specific configuration parameters:

  Parameters:
    eps_r list of floats or float

      Relative tolerance(s).

    eps_a list of floats or float

      Absolute tolerance(s).

    fmin float (default: 0.3)

      Minimum step size change factor on step rejection.

    fmax float (default: 2.5)

      Maximum step size change factor on step acceptance.

    fsafety float (default: 0.8)

      Step size change safety factor.

    error_order float (default: 2)

      The order of the solver error estimate.

    guess_dt0 bool (default: False)

      Guess a good initial step size from initial conditions.

    pcoef float (default: 0.0)

      Proportional (P) coefficient of the step size control.

    icoef float (default: 1.0)

      Intregral (I) coefficient of the step size control.

    dcoef float (default: 0.0)

      Derivative (D) coefficient of the step size control.

  name = 'tsc.ed_pid'

class sfepy.solvers.ts_controllers.FixedTSC(conf, **kwargs)

  Fixed (do-nothing) time step controller.

  > Kind: ‘tsc.fixed’

  > For common configuration parameters, see `Solver`.

  > Specific configuration parameters:

  Parameters:

  name = 'tsc.fixed'

class sfepy.solvers.ts_controllers.TimesSequenceTSC(conf, **kwargs)

  Given times sequence time step controller.

  > Kind: ‘tsc.time_sequence’

  > For common configuration parameters, see `Solver`.

  > Specific configuration parameters:

  Parameters:
    times iterable (default: range(1, 6))

      A sequence of times to generate.

  get_initial_dt(ts, vec, **kwargs)
  name = 'tsc.time_sequence'

sfepy.solvers.ts_controllers.eval_scaled_norm(terr, eps_a, eps_r)