Skip to content

Solver and real time

solver: {type: HHT, alpha: -0.1, end_time: 10.0, step: 0.001, output_step: 0.01}

freedyn2 integrates with the HHT-α method (Hilber–Hughes–Taylor) on the Lie group of the bodies, at a fixed step, solving the nonlinear equations of each step with Newton's method and a sparse LU (KLU). The equations and their Jacobians are exact (generated).

key value
type (required) HHT
alpha number Default -0.1.
end_time (required) number
step (required) number
output_step number Must be an integer multiple of step. Default: step.
newton_tol number Default 1e-10.
max_newton integer Default 25.
newton velocity | fixed | legacy velocity: Newton until the velocity change is below newton_tol; fixed: exactly newton_iterations corrections per step (the same work in every step, for real-time use); legacy: the rule of legacy FreeDyn (Negrut Eq. 40; models converted with --profile legacy). Default velocity.
newton_iterations integer Default 2.
form arnold_bruls | negrut HHT form: arnold_bruls (equations at t_n+1, second order) or negrut (force-weighted, as legacy FreeDyn). Default arnold_bruls.
adaptive boolean Step size control of legacy FreeDyn (models converted from .fds): step is then the largest step (SolverMaxTimeStep), eps the error tolerance; output_step need not be a multiple of step. Default False.
eps number adaptive: tolerance of the local error (GlobalErrorTolerance). Default 1e-06.
h_min number adaptive: smallest step; the run stops below it (SolverMinTimeStep). Default 1e-14.
error_norm mixed | legacy adaptive: weights of the error norm, mixed (absolute and relative tolerance) or legacy (as legacy FreeDyn). Default mixed.
exact_output boolean adaptive: steps end exactly at the output times (isExactOutputTimeEnforced). Default True.
output_begin number adaptive: the first output after t = 0 is at this time or later (OutputTimeBegin). Default 0.
vproj_tol number The initial velocities are projected onto the constraints when they violate them by more than this (legacy FreeDyn: 1e-5). Default 1e-12.

Choosing the values

  • step: small enough for the fastest motion you care about – about a tenth of its period or less (1 ms for a vehicle with wheel hop at 12 Hz is plenty; stiff bushings may want less). The run reports the Newton iterations per step; more than 3 or 4 on average means the step is large for the model.
  • alpha between −1/3 and 0 damps high-frequency numerical noise; −0.1 (the default) damps what the step cannot resolve and leaves the physics alone. Models with joints need α < 0.
  • output_step: how often a row is written; a multiple of step. It does not change the accuracy, only the size of the result file.

Any of them can be overridden on the command line without editing the model: freedyn2 run model.yaml -- --end-time 2 --step 1e-4.

Real-time mode

solver: {type: HHT, end_time: 10, step: 0.001, newton: fixed, newton_iterations: 2}

With newton: fixed every step does exactly newton_iterations corrections, with a fixed pivot order: every step costs the same, for hardware-in-the-loop and driving simulators. At 1 ms the Newton error is far below the discretization error (10⁷ times at 2 iterations). Median cost per step at two iterations: a car with simple tires 164 µs (one core).

Models converted from FreeDyn

A model converted from a legacy .fds (freedyn2 convert) keeps the step size control of legacy FreeDyn: adaptive: true, the error tolerance eps (GlobalErrorTolerance), step as the largest step (SolverMaxTimeStep; output_step need not be a multiple of it), h_min. Converted with --profile legacy it also has form: negrut, newton: legacy, error_norm: legacy, vproj_tol and Euler-parameter bodies (element: rigid_body_euler), and runs as legacy FreeDyn does. For a fixed step, remove adaptive and eps and choose step; --fixed-step on the command line does the same for one run.

Linear solvers and the command line

freedyn2_run takes --linear-solver klu|sparselu|dense, --step-log FILE and --timing-log FILE for diagnosis; see Command line.