inverse module

Python implementation of inverse solution methods with Fedem.

class inverse.FedemRun(wrkdir, config)[source]

Bases: FedemSolver, InverseSolver

This class augments FedemSolver with inverse solution capabilities.

Parameters:
wrkdirstr

Current working directory for the fedem dynamics solver

configdictionary

Content of yaml input file

Methods

add_rhs_vector(r_vec)

Utility updating the content of the system right-hand-side vector.

check_times(xtimes[, use_times])

Utility checking that a given time series starts with the current solver time.

compute_int_forces_from_displ(disp, ids)

This method computes beam section forces in triads for the given displacement field.

compute_rel_dist_from_displ(disp, ids)

This method computes the relative distance at sensors for the given displacement field.

compute_spring_var_from_displ(disp, ids)

This method computes one of the spring variables (length, deflection, force) at sensors for the given displacement field.

compute_strains_from_displ(disp, gauge_ids)

This method computes the strain tensor at gauges for the given displacement field, or from current state if no displacements provided.

convert_rev_joint_force(data)

Modify the data set for spring force input for revolute joints with defined spring forces Conversation from force to lenght x=F/k (const.

finish_step()

This method completes current time (or load) step, by iterating the linearized equation system until convergence is achieved.

get_current_strains(gauge_ids)

This method computes the strain tensor at gauges from current state.

get_current_time()

Utility returning the current physical time of the simulation.

get_damping_matrix()

Utility returning current content of the system damping matrix.

get_element_stiffness_matrix(bid)

Utility returning the initial content of an element stiffness matrix.

get_equations(bid)

Utility returning the equation numbers for the DOFs of the object with the specified base Id (bid).

get_external_force_vector()

Utility returning current content of the external force vector.

get_function([uid, tag, arg])

Utility evaluating a general function in the model, identified by the specified user Id uid or tag, and with the function argument arg.

get_function_ids(tags)

Utility returning a list of user Ids of tagged general functions.

get_functions(uids)

Utility evaluating a list of general functions for current state.

get_gauge_size()

Utility returning the required size of the initial strain gauge array which is used when restarting a simulation from an in-core array.

get_joint_spring_stiffness(bid)

Get joint spring stiffness coefficient(s).

get_mass_matrix()

Utility returning current content of the system mass matrix.

get_newton_matrix()

Utility returning current content of the system Newton matrix.

get_next_time()

Utility returning the physical time of the next step of the simulation.

get_part_deformation_state_size(base_id)

Utility returning the required length of the state vector which stores deformation data for the FE Part with the given base Id.

get_part_stress_state_size(base_id)

Utility returning the required length of the state vector which stores von Mises stresses for the FE Part with the given base Id.

get_rhs_vector()

Utility returning current content of the system right-hand-side vector.

get_state_size()

Utility returning the required length of the state vector which is used when restarting a simulation from an in-core array.

get_stiffness_matrix()

Utility returning current content of the system stiffness matrix.

get_system_dofs()

Utiloty returning the total number of DOFs of the system.

get_system_size()

Utility returning the dimension (number of equations) of the system.

get_transformation_state_size()

Utility returning the required length of the vector which stores the transformation matrices (rotation and translation) for Triads, Parts and Beams.

restart_from_state(state_data[, write_to_rdb])

This method re-initializes the mechanism objects with data from the provided state array, such that the simulation can continue from there.

run_all(options)

This method runs the dynamics solver with given command-line options, without any user intervention.

run_inverse(inp_data, out_def)

Collector for different inverse methods.

run_inverse_dyn(inp_data, out_def)

Inverse solution driver (dynamic case).

run_inverse_fedem(inp_data, out_def)

This method uses fedem's inverse solution in fortran

save_gauges()

This method stores initial gauge strains in the self.gauge_data array.

save_part_state(base_id, def_state, str_state)

This method stores current deformation- and stress states for the specified FE Part in the provided core arrays.

save_state()

This method stores current solver state in the self.state_data array.

save_transformation_state(state_data)

This method stores current transformation state for Triads, Parts and Beams in the provided core array.

set_ext_func(func_id[, value])

This method may be used prior to the solve_next call, to assign a sensor value from a physical twin to the specified actuator or load in the model, identified by the argument func_id (external function Id).

set_rhs_vector(r_vec)

Utility replacing current content of the system right-hand-side vector.

solve_inverse(x_val, x_def, g_def[, out_def])

This method solves the inverse problem at current time/load step, assuming small deformations only (linear response).

solve_iteration()

This method solves the current linearized equation system and updates all state variables.

solve_modes(n_modes[, dof_order, use_lapack])

This method solves the eigenvalue problem at current time step, and returns the computed eigenvalues and associated eigenvectors.

solve_next([inp, inp_def, out_def, time_next])

This method advances the solution one time/load step forward.

solve_window(n_step[, inputs, f_out, xtimes])

This method solves the problem for a time/load step window, with given values for the external functions, and extraction of results from another set of general functions in the model.

solver_close()

This method needs to be used if solver_done() was invoked with its remove_singletons argument set to False.

solver_done([remove_singletons])

This method should be used when the time/load step loop is finished.

solver_init(options[, fsi, state_data, ...])

This method processes the input and sets up necessary data structures prior to the time integration loop.

start_step([time_next])

This method starts a new time (or load) step, by calculating the predicted response, the coefficient matrix and right-hand-side vector of the first nonlinear iteration.

exception inverse.InverseException(method_name, ierr=None)[source]

Bases: FedemException

General exception type for inverse solver exceptions. Used to generalize error messages from the FedemSolver methods.

Parameters:
method_namestr

Name of the method that detected an error

ierrint, default=None

Error flag value that is embedded into the error message

class inverse.InverseSolver(solver, config)[source]

Bases: object

This class handles the inverse solution through proper methods. It accesses the Fedem model through the provided FedemSolver instance.

Parameters:
solverFedemSolver

The Fedem dynamics solver instance

configdictionary

Inverse solver configuration

Methods

run_inverse_dyn:

Performs the inverse solution (dynamic case)

run_inverse_fedem:

Performs the inverse static solution using the internal inverse solver

run_inverse:

Performs the inverse solution (static case)

convert_rev_joint_force(data)[source]

Modify the data set for spring force input for revolute joints with defined spring forces Conversation from force to lenght x=F/k (const. stiffness assumption)

Parameters:
datalist of float

Input function/data values

Returns:
list of int

revolute joint ID’s and their modified input data

run_inverse(inp_data, out_def)[source]

Collector for different inverse methods.

Parameters:
inp_datalist of float

Input function values

out_deflist of int

User Ids of the functions to evaluate the response for

Returns:
list of float

Evaluated response variables

run_inverse_dyn(inp_data, out_def)[source]

Inverse solution driver (dynamic case).

Parameters:
inp_datalist of float

Input function values

out_deflist of int

User Ids of the functions to evaluate the response for

Returns:
list of float

Evaluated response variables

run_inverse_fedem(inp_data, out_def)[source]

This method uses fedem’s inverse solution in fortran

Parameters:
inp_datalist of float

Input function values

out_deflist of int

User Ids of the functions to evaluate the response for

Returns:
list of float

Evaluated response variables