divergence module

Convenience module for automatic simulation restart of diverging models.

divergence.jump_state(lib_dir)[source]

Checks whether the current state should be jumped over or not.

divergence.ramp_dataframe(dfr, start_pos=0)[source]

Creating a s-shape ramp, starting with 0 and ending with 1 Second derivative at start/end will be zero Multiplying each column in dataframe with ramp-array

divergence.restart(solver, df, state, lib_dir, out_id, c_opts, x_times=None)[source]

Restarts the simulation over a time window in case of divergence issues. When a divergent solution is detected, one (or more) of the following approaches may be attempted:

  • TOL: Increasing tolerance(s) for convergence checks (tolDispNorm, tolVecNorm, tolEnerSum, maxit).

  • STATE_DYNAMIC: Use dynamic equilibrium at restart. Restart can be performed at a specified number of steps before the divergent step, optionally with ramp-scaling activated (default activated).

  • STATE_STATIC: Use quasi-static equilibrium for a specified number of steps at restart. Restart can be performed at a specified number of steps before the divergent step, optionally with ramp-scaling activated (default activated) done n-steps backwards.

  • NO_STATE_WITH_RAMP: Restart of specified number of steps before the diverged step. The loads are ramped up from zero and the state is not used.

  • JUMP_OVER: Skip the rest if the current window and restart from the next, with the loads ramped up from zero.

  • NO_CONV: No convergence is obtained.

  • FAILURE: Other solver failure during re-initialization.

Parameters:
solverFedemSolver

Fedem dynamics solver instance

dfDataFrame

Input function values

statelist of float

State vector to restart simulation from

lib_dirstr

Path to the input/output files

out_idlist of int

List of user Ids identifying the output sensors in the model

c_optsdictionary

Settings for the Fedem solver

x_timeslist of float, default=None

Time list linked to the input

Returns:
list of float

Output sensor values for each time step

str

How the simulation was actually restarted (or not)