MBsysPy.mbsyspy.mbs_modal module¶
Module to handle modal analysis on Multibody systems.
Summary¶
Define the class MbsModal based on the MbsModal structure of MBsysC. This class has the functions required to manipulate the direct modal analysis module. This includes setting the options, running an(or multiple) analysis and freeing the memory.
-
class
MBsysPy.mbsyspy.mbs_modal.
MbsModal
(mbs, user_path=None, symbolic_path=None)¶ Bases:
object
Class of the modal analysis module.
- Variables
mbs (MbsData) – Instance of MbsData related to the analysis.
results (MbsResult) – Instance of MbsResult containing the results of the direct dynamics analysis.
symbolic_path (str) – Path to the folder containing the symbolic functions(python modules) to be loaded.
user_path (str) – Path to the folder containing the user functions(python modules) to be loaded.
- Attributes
nx
Return the number of mode (the conjugated is considered as a second mode).
Methods
get_options
(self, *args)Get the specified options for Modal module.
run
(self, **kwargs)Run a modal analysis.
set_options
(self, **kwargs)Set the specified options for Modal module.
set_user_fct_from_file
(self, function_name, …)Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
set_user_fct_from_ptr
(self, function_name, …)Load a user function chosen by the user instead of the default one in the userfctR folder.
-
__init__
(self, mbs, user_path=None, symbolic_path=None)¶ Create an instance of the MbsModal class for the provided MbsData instance.
- Parameters
mbs (MbsData) – Instance of MbsData related to the analysis.
user_path (str or None, optional) – The path to the folder containing the user functions. If not provided (‘None’) the path is retrieved from the MbsData instance ‘mbs’.
default is None
symbolic_path (str or None, optional) – The path to the folder containing the symbolic functions. If not provided(‘None’) the path is retrieved from the MbsData instance ‘mbs’. default is None
- Returns
MbsModal – A MbsModal instance.
- Return type
self
-
get_options
(self, *args)¶ Get the specified options for Modal module.
- Parameters
The different options specified in the documentation of set_options.
- Returns
- Return type
The value of the different options specified in the documentation of set_options.
-
property
nx
¶ Return the number of mode (the conjugated is considered as a second mode).
-
run
(self, **kwargs)¶ Run a modal analysis.
Options can be set with the function ‘set_options()’ before calling this function. Options can be retrieved with the function ‘get_options()’.
Results are stored in the field ‘results’ if the options ‘store_results’ is set to True.
- Returns
self.results – The instance containing the results of the analysis.
- Return type
-
set_options
(self, **kwargs)¶ Set the specified options for Modal module.
- Parameters
save2file (int) – Determine whether results are written to files on disk(in MbsModalOptions::respath folder): 1: results are saved 0: results are not saved default = 1
resfilename (str) – The keyword used for determining the name of result files
respath (str) – Path in which result file are saved. Default: the resultsR folder of the project
animpath (str) – Path in which anim file is saved. Default: the animationR folder of the project
save_anim (int) – 1 to save the anim file 0 otherwise(only valid if ‘save2file’ is set to 1) default = 1
save_mat (int) – no = 0, yes = 1 flag to save the linearized matrix A, Mr, Gr, Kr default = 0
save_eval (int) – no = 0, yes = 1 flag to save the eigen values in two separate files: “_a” for Real part and “_b” for Imag part default = 0
save_evec (int) – no = 0, yes = 1 flag to save the eigen vector in two separate files: “_a” for Real part, “_b” for Imag part, “_r” for magnitude and “_phi” for phase default = 0
save_result (int) – no = 0, yes = 1 flag to save the modal results summary default = 1
save_anim (int) – no = 0, yes = 1 flag to save and generate the animation for the modes default = 0
mode_ampl (float) – amplification factor for the animation of the modes application dependent default = 0.2
compute_uxd (int) – no = 0, yes = 1 flag to compute the modes associated with the extra constitutive differential equations default = 1
compute_JS (int) – no = 0, yes = 1 flag to compute the non diagonal terms default = 0 TO IMPLEMENT !
norm_evec (int) – no = 0, yes = 1 flag to normalize the eigenvectors default = 1
zeroEigenPrecision (double) – Define the limit at which the eigen value will be considered as null default = 1e-6
lpk_itermax (int) – options for the lpk gradient default = 10
lpk_relincr (float) – options for the lpk gradient default = 1e-2
lpk_absincr (float) – options for the lpk gradient default = 1e-3
lpk_absincr_max (float) – options for the lpk gradient default = 0
lpk_equitol (float) – options for the lpk gradient default = 1e-6
lpk_lintol (float) – options for the lpk gradient default = 1e-3
anim_speed (int) – flag to decide whether the independent speeds have to be integrated while generating the animation files default = 0
anim_dt (int) – delta t for the animation generation default = 1e-2
anim_t (int) – time for the animation generation default = 2
verbose (int) – Gives informations during the process. default: 1, to disable set it to 0.
-
set_user_fct_from_file
(self, function_name, user_path, user_file)¶ Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
- Parameters
function_name (str) – name of the user function to replace.
user_path (str) – path to the new user function file.
user_file (str) – name of the new user function file.
-
set_user_fct_from_ptr
(self, function_name, user_fct_ptr)¶ Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
- Parameters
function_name (str) – name of the user function to replace.
user_fct_ptr (ptr) – new user function pointer.
-
class
MBsysPy.mbsyspy.mbs_modal.
MbsResultModal
¶ Bases:
object
Class dedicated to the results of a modal analysis.
- Variables
eval_a (numpy.ndarray) – Result of the Eigenvalue problem: real part of the nx eigen values.
eval_b (numpy.ndarray) – Result of the Eigenvalue problem: imaginary part of the nx eigen values.
evec_a (numpy.ndarray) – Result of the Eigenvalue problem: real part of the eigen vectors (each column is a eigenvector).
evec_b (numpy.ndarray) – Result of the Eigenvalue problem: imaginary part of the eigen vectors (each column is a eigenvector).
evec_r (numpy.ndarray) – Result of the Eigenvalue problem: norm of the eigen vectors (each column is a eigenvector).
evec_phi (numpy.ndarray) – Result of the Eigenvalue problem: phase of the eigen vectors (each column is a eigenvector).
Methods
load_results
(self, modal)Load the results of an modal analysis.
plot
(self[, normalize])Plot the poles of the transfert functions.
-
load_results
(self, modal)¶ Load the results of an modal analysis.
-
plot
(self, normalize=False)¶ Plot the poles of the transfert functions.
Clicking on a mode gives informations about it.
- Parameters
normalize (bool) – If true all poles are drawn on a unit circle. Otherwhise the computed pole coordinates are draw. The defaut is False.
- Returns
matplotlib.pyplot.Figure or None – The figure instance
matplolib.pyplot.Axe or None – The axis instance.