pyHarm

The pyHarm package is the core of pyHarm. It contains every modules and subpackages for pyHarm to be runnning an analysis.

Submodules

Attributes

__version__

NonLinearStudy_kind

Dictionary containing ABCAnalysis subclasses as values and their factory_keyword attribute as key.

Corrector_dico

Dictionary containing the ABCCorrector subclasses as values and their factory_keyword as key.

ElementDictionary

Dictionary of available ABCElement as values and their factory_keyword as key.

Predictor_dico

Dictionary that contains ABCPredictor objects as values and their factory_keyword attribute as their key.

Reductor_dico

Dictionary containing availabe ABCReductors as values and their factoryu keyword as key.

StepSizer_dico

Dictionary containing the factory keywords and their associated class of ABCStepSizeRule objects.

Stopper_dico

Dictionary containing all the StopCriterions available.

System_dico

Dictionary containing the available ABCSystem in pyHarm for creation as values and their factory_keyword as keys.

Kinematic_dico

Dictionary containing ABCKinematic as values and their factory_keyword attribute as key.

Solver_dico

Dictionary containing all the available ABCNLSolvers as values, and their factory_keyword attribute as key.

SubstructureDico

List of available ABCSubstructure subclasses available for creation.

SubstructureReaderDictionary

Dictionary of available Substructure readers subclasses as values and their factory_keyword as key.

Dico_ABCClass_factory_keyword

Dictionary linking the abstract classes defined in every available subpackages and their factory dictionary.

Classes

ABCAnalysis

This is the abstract class ruling the solver class. The system is responsible of solving the system starting at a given starting point.

ABCCorrector

This is the abstract class ruling the corrector class. The system is responsible for adding the correction residual equation to the augmented system.

ABCElement

This is the abstract class ruling the element class.

ABCPredictor

Abstract class for the predictor: Any added predictor shall be constructed from this class.

ABCReductor

This is the abstract class ruling the reducers class. The reducer is responsible for reducing the size of the system to be solved based on different hypotheses.

ABCStepSizeRule

This is the abstract class ruling the stepsize rules class. The step size rules are responsible for adjusting the step size of the analysis depending on the given inputs.

ABCStopCriterion

Abstract class for the stopping criterion. Any stopping criterion code

ABCSystem

This is the abstract class ruling the system class. The system is responsible for assembling the Residual and Jacobian of a list of elements.

ABCKinematic

This is the abstract class ruling the kinematic conditions class. The kinematic conditions are responsible to impose kinematic on dofs of the system and transfer the residuals.

ABCNLSolver

This is the abstract class ruling the solver class. The system is responsible of solving the system starting at a given starting point.

ABCSubstructure

This class defines a substructure. Its main responsability is to create dofs and put them in an explicit pandas DataFrame.

ABCReader

This is the abstract class ruling the reader class for substructure. The reader is responsible for reading, parsing and completing an input dictionary from a external file to comply with pyHarm.

Maestro

Class that reads and launches the pyHarm analysis contained in the provided input file.

Functions

getCustomOptionDictionary(custom_options, default_options)

Given a custom option dictionary and a default option dictionary,

getIndexfromExpldofs(expl_dofs, list_of_caracteristics)

Uses an explicit dof vector and returns an array of indices corresponding to the required dofs.

pyHarm_plugin(cls)

Plugin function for the pyHarm module. Allows registering a class in the pyHarm factories.

Package Contents

pyHarm.__version__ = 'Uninferable.Uninferable.Uninferable'
pyHarm.getCustomOptionDictionary(custom_options: dict, default_options: dict)

Given a custom option dictionary and a default option dictionary, returns a new dictionary containing all the custom information along with the missing mandatory ones from the default dictionary.

Parameters:
  • custom_options (dict) – A dictionary containing custom options.

  • default_options (dict) – A dictionary containing default options.

Returns:

A new dictionary combining the custom options with the default options.

Return type:

dict

pyHarm.getIndexfromExpldofs(expl_dofs: pandas.DataFrame, list_of_caracteristics: list[tuple[str, int, list[int]]])

Uses an explicit dof vector and returns an array of indices corresponding to the required dofs. Takes a list of tuples [(substructure_name[str], node_number[int], dir_num[list[int]]), …]. If None is given as input for the directions, then all the dofs from the node are returned.

Parameters:
  • expl_dofs (pd.DataFrame) – A DataFrame representing the explicit representation of the degree of freedom vector.

  • list_of_caracteristics (list[tuple[str,int,list[int]]]) – A list of tuples specifying the substructure name, node number, and direction numbers.

Returns:

An array of indices corresponding to the required dofs, sorted in ascending order.

Return type:

np.ndarray

class pyHarm.ABCAnalysis(inputData: dict, System: pyHarm.Systems.ABCSystem.ABCSystem, ndofs: int, **kwargs)

Bases: abc.ABC

This is the abstract class ruling the solver class. The system is responsible of solving the system starting at a given starting point.

abstract property factory_keyword

Class name for factory call during instantiation

abstractmethod initialise(**kwargs)

Initialise step of the analysis.

abstractmethod Solve(**kwargs)

Solving step of the analysis.

abstractmethod makeStep(**kwargs)

Make a whole step of the analysis.

pyHarm.NonLinearStudy_kind

Dictionary containing ABCAnalysis subclasses as values and their factory_keyword attribute as key.

Type:

dict[str, ABCAnalysis]

class pyHarm.ABCCorrector(**kwargs)

Bases: abc.ABC

This is the abstract class ruling the corrector class. The system is responsible for adding the correction residual equation to the augmented system.

property factory_keyword: str
Abstractmethod:

name of the class to call in the factory in order to create an instance of the class.

Type:

str

abstractmethod ClosureEquation(solx: numpy.ndarray, sol: pyHarm.Solver.SystemSolution, sollist: list[pyHarm.Solver.SystemSolution]) numpy.ndarray

Computes the residual contribution of the correction equation.

Parameters:
  • solx (np.ndarray) – actual displacement vector.

  • sol (SystemSolution) – actual SystemSolution that contains the starting point.

  • sollist (list[SystemSolution]) – list of SystemSolutions from previous analysis steps.

abstractmethod ClosureJacobian(solx: numpy.ndarray, sol: pyHarm.Solver.SystemSolution, sollist: list[pyHarm.Solver.SystemSolution]) tuple[numpy.ndarray, numpy.ndarray]

Computes the jacobian contribution of the correction equation.

Parameters:
  • solx (np.ndarray) – actual displacement vector.

  • sol (SystemSolution) – actual SystemSolution that contains the starting point.

  • sollist (list[SystemSolution]) – list of SystemSolutions from previous analysis steps.

pyHarm.Corrector_dico

Dictionary containing the ABCCorrector subclasses as values and their factory_keyword as key.

Type:

dict[str, ABCCorrector]

class pyHarm.ABCElement(nh: int, nti: int, name: str, data: dict, CS: pyHarm.CoordinateSystem.CoordinateSystem)

Bases: abc.ABC

This is the abstract class ruling the element class.

An element consists in an elementary contribution to the residual equations.

Parameters:
  • nh (int) – number of harmonics.

  • nti (int) – number of time steps.

  • name (str) – name given to the kinematic condition.

  • data (dict) – dictionary containing all the definition information of the kinematic condition.

  • CS (CoordinateSystem) – local or global coordinate system the kinematic condition is defined on.

flag_nonlinear

if True, the element is nonlinear.

Type:

bool

flag_AFT

if True, the element requires an alternating frequency/time domain procedure for computing residuals.

Type:

bool

flag_extforcing

if True, the element is an external forcing.

Type:

bool

flag_DLFT

if True, the element uses the dynamic Lagrangian method for computing the residuals.

Type:

bool

flag_adim

if True, the element is adimentioned.

Type:

bool

nh

number of harmonics.

Type:

int

nti

number of time steps.

Type:

int

D

Dynamic operators containing inverse discrete Fourier transform and discrete Fourier transform.

Type:

dict[np.ndarray,np.ndarray]

nabla

Derivation operator.

Type:

np.ndarray

abstract property factory_keyword
__init_flags__()
__init_harmonic_operators__(nh, nti)
__repr__()
__post_init__(*args)
__flag_update__(*args)
abstractmethod __init_data__(name, data, CS)
abstractmethod __str__()
abstractmethod generateIndices(expl_dofs: pandas.DataFrame)
abstractmethod adim(lc, wc)

Modifies the element properties according to the characteristic length and angular frequency.

Parameters:
  • lc (float) – characteristic length value.

  • wc (float) – characteristic angular frequency value.

abstractmethod evalResidual(x, om)

Computes the residual.

Parameters:
  • x (np.ndarray) – full displacement vector.

  • om (float) – angular frequency value.

abstractmethod evalJacobian(x, om)

Computes the jacobians.

Parameters:
  • x (np.ndarray) – full displacement vector.

  • om (float) – angular frequency value.

pyHarm.ElementDictionary

Dictionary of available ABCElement as values and their factory_keyword as key.

Type:

dict[str, ABCElement]

class pyHarm.ABCPredictor(sign_ds, **kwargs)

Bases: abc.ABC

Abstract class for the predictor: Any added predictor shall be constructed from this class.

Parameters:

sign_ds (float) – if -1 predict in the direction of decreasing angular frequency, if 1 the opposite direction

flag_print

information are printed during the analysis if True.

Type:

bool

predictor_options

dictionary containing the kwargs and competed using the default options if the keywords are missing.

Type:

dict

property factory_keyword: str
Abstractmethod:

Returns: str: keyword that is used to call the creation of this class in the system factory.

default_options

set of default parameters for the system class if not given in the input argument.

It contains a normalisation parameter using the keyword ‘norm’ that can be set to either ‘norm1’ (default) if the direction is normed to 1 or ‘om’ if the direction is normed to 1 only for the angular frequency. It contains a bifurcation detection using the ‘bifurcation_detect’ keyword that can be set to True (default) if detection is needed. It contains a ‘verbose’ keyword that can be set to True (default) if information about detection of bifurcations is to be displayed during solving.

Type:

dict

sign_ds_init
sign_ds
predictor_options
flag_print
abstractmethod predict(sollist: list[pyHarm.Solver.SystemSolution], ds: float) tuple[numpy.ndarray, pyHarm.Solver.SystemSolution, float]

Predicts the next strating point.

Parameters:
  • sollist (list[SystemSolution]) – list of SystemSolution already solved during the analysis.

  • ds (float) – step size for the prediction.

bifurcation_detect(lstpt: pyHarm.Solver.SystemSolution)

Makes a bifurcation detection analysis computing determinant of jacobian matrix and analysing change of sign.

Parameters:

lstpt (SystemSolution) – previously accepted point in direct link with the actual solved point.

sign_ds

Attribute is modified if a turning point is detected.

Type:

float

getPointerToSolution(sollist: list[pyHarm.Solver.SystemSolution], k_imposed=None) pyHarm.Solver.SystemSolution

Gets the last accepted solution in direct link with the studied point.

Parameters:
  • sollist (list[SystemSolution]) – list of SystemSolution already solved during the analysis.

  • k_imposed (None|int) – if not None then the provided index is used as the last accepted point.

Returns:

last accepted point.

Return type:

SystemSolution

norm_dir(dir: float) float

Normalises the direction according to the choice of norm given in the class attributes.

Parameters:

dir (np.ndarray) – prediction direction.

Returns:

normalized prediction direction.

Return type:

np.ndarray

pyHarm.Predictor_dico

Dictionary that contains ABCPredictor objects as values and their factory_keyword attribute as their key.

Type:

dict

class pyHarm.ABCReductor(data: dict, expl_dofs: pandas.DataFrame, *args)

Bases: abc.ABC

This is the abstract class ruling the reducers class. The reducer is responsible for reducing the size of the system to be solved based on different hypotheses.

Parameters:
  • data (dict) – A dictionary containing the reducers parameters.

  • expl_dofs (pd.DataFrame) – DataFrame describing the positioning of dofs. It is generated by ABCSystem objects.

expl_dofs

DataFrame describing the positioning of dofs. It is generated by ABCSystem objects.

Type:

pd.DataFrame

property factory_keyword: str
Abstractmethod:

Returns: str: keyword that is used to call the creation of this class in the system factory.

data
expl_dofs
__post_init__(*args)

A post init method to be customized if needed when building new class.

output_expl_dofs() pandas.DataFrame

Returns the explicit dof list after transformation by the reducer.

Returns:

reduced explicit dof DataFrame after passing through the reducer.

Return type:

pd.DataFrame

reduce_vectorx(q: numpy.ndarray) numpy.ndarray

Applies the reduce_vector method to the input vector of displacement.

Parameters:

q (np.ndarray) – vector of displacement of full size.

Returns:

reduced vector of displacement.

Return type:

np.ndarray

abstractmethod update_reductor(*args) None

Using the given parameters, performs an update of the reductor and generates its new transformation matrix

abstractmethod expand(q: numpy.ndarray) numpy.ndarray

From reduced vector, performs the inverse transformation to retrieve the original vector.

Parameters:

q (np.ndarray) – reduced vector of displacement

Returns:

full size vector of displacement.

Return type:

np.ndarray

abstractmethod reduce_vector(x: numpy.ndarray) numpy.ndarray

From original vector, performs the transformation to get the reduced vector.

Parameters:

x (np.ndarray) – full size vector.

Returns:

reduced vector.

Return type:

np.ndarray

abstractmethod reduce_matrix(dJdx: numpy.ndarray) numpy.ndarray

From original matrix, perform the transformation to get the reduced matrix.

Parameters:

dJdx (np.ndarray) – full size jacobian matrix with respect to displacement.

Returns:

reduced size jacobian matrix with respect to displacement.

Return type:

np.ndarray

pyHarm.Reductor_dico

Dictionary containing availabe ABCReductors as values and their factoryu keyword as key.

Type:

dict

class pyHarm.ABCStepSizeRule(bounds: list[float, float], **kwargs)

Bases: abc.ABC

This is the abstract class ruling the stepsize rules class. The step size rules are responsible for adjusting the step size of the analysis depending on the given inputs.

Parameters:

bounds (list[float,float]) – List containing the step size bounds [min_step, max_step].

ds_min

min step size.

Type:

float

ds_max

max step size.

Type:

float

property factory_keyword: str
Abstractmethod:

Returns: str: keyword that is used to call the creation of this class in the system factory.

ds_min
ds_max
abstractmethod getStepSize(ds: float, sollist: list[pyHarm.Solver.SystemSolution], **kwargs) float

Returns the step size to be used for the prediction step of the analysis.

ProjectInBounds(ds: float) float

Projects the step-size onto the bounds if the step-size is out of the required bounds.

Parameters:

ds (float) – step-size.

Returns:

step-size projected onto the bounds if it is out of the bounds.

Return type:

float

pyHarm.StepSizer_dico

Dictionary containing the factory keywords and their associated class of ABCStepSizeRule objects.

Type:

dict

class pyHarm.ABCStopCriterion(bounds: list[float, float], ds_min: float, **kwargs)

Bases: abc.ABC

Abstract class for the stopping criterion. Any stopping criterion code shall inherit from this class.

Parameters:
  • bounds (list[float, float]) – A list of upper and lower bounds.

  • ds_min – The minimum step size.

  • **kwargs – Additional keyword arguments.

Raises:
  • NotImplementedError – If the subclass lacks the factory_keyword class attribute.

  • TypeError – If the factory_keyword is not a string value.

property factory_keyword: str
Abstractmethod:

Returns: str: keyword that is used to call the creation of this class in the system factory.

puls_inf
puls_sup
epsilon_bounds
bound_inf
bound_sup
ds_min
abstractmethod getStopCriterionStatus(sol: pyHarm.Solver.SystemSolution, sollist: list, **kwargs) bool

Abstract method to get the stop criterion status.

Parameters:
  • sol (SystemSolution) – A SystemSolution object.

  • sollist (list) – A list of solutions.

  • **kwargs – Additional keyword arguments.

Raises:

None.

pyHarm.Stopper_dico

Dictionary containing all the StopCriterions available.

Type:

dict[str,ABCStopCriterion]

class pyHarm.ABCSystem(idata: dict)

Bases: abc.ABC

This is the abstract class ruling the system class. The system is responsible for assembling the Residual and Jacobian of a list of elements.

Parameters:

idata (dict) – A dictionary containing the system parameters, the local coordinate systems, the substructures the kinematic conditions and the connectors.

system_options

dictionary containing other options for creation of the system class.

Type:

dict

nh

number of harmonics.

Type:

int

nti

number of time steps.

Type:

int

adim

adimension the equations using the characteristic length and angular frequency.

Type:

bool

adim_options

contains the characteristic length and angular frequency.

Type:

dict

lc

characteristic length.

Type:

float

wc

characteristic angular frequency.

Type:

float

ndofs

total number of degrees of freedom.

Type:

int

LE

list of elements.

Type:

list[ABCElement]

LC

list of kinematic conditions.

Type:

lit[ABCKinematic]

LE_extforcing

list of elements of type external forcing.

Type:

list[ABCElement]

LE_linear

list of elements that are linear towards the displacement.

Type:

list[ABCElement]

LE_nonlinear_dlft

list of elements that are nonlinear while using DLFT formulation.

Type:

list[ABCElement]

LE_nonlinear_nodlft

list of elements that are nonlinear while not using DLFT formulation.

Type:

list[ABCElement]

expl_dofs

Dataframe that explicit the nature of the degrees of freedom vector.

Type:

pd.DataFrame

ndofs_solve

number of degree of freedom that are to be solved.

Type:

int

default

set of default parameters for the system class if not given in the input argument.

Type:

dict

abstract property factory_keyword
ndofs
LE_extforcing
LE_linear
LE_nonlinear_dlft
LE_nonlinear_nodlft
_maincarateristics(idata: dict) None

Set attributes of the system class based on the input dictionary.

Parameters:

idata (dict) – A dictionary containing the system parameters.

system_options

dictionary containing other options for creation of the system class.

Type:

dict

nh

number of harmonics.

Type:

int

nti

number of time steps.

Type:

int

adim

adimension the equations using the characteristic length and angular frequency.

Type:

bool

adim_options

contains the characteristic length and angular frequency.

Type:

dict

lc

characteristic length.

Type:

float

wc

characteristic angular frequency.

Type:

float

_complete_expl_dofs() None

Modify the explicit dof vector according to the presence of kinematic conditions or non-linear connexions on certain dofs.

expl_dofs

Dataframe that explicit the nature of the degrees of freedom vector.

Type:

pd.DataFrame

ndofs_solve

number of degree of freedom that are to be solved.

Type:

int

_buildElements(idata: dict) None

Build the elements of the system and the kinematic conditions using the factory functions.

Parameters:

idata (dict) – A dictionary containing the system parameters, the local coordinate systems, the substructures the kinematic conditions and the connectors.

LE

list of elements.

Type:

list[ABCElement]

LC

list of kinematic conditions.

Type:

lit[ABCKinematic]

_generate_system_dof_DataFrame()
_get_expl_dofs_into_solver() pandas.DataFrame

Returns the explicit dof DataFrame that has to be solved after applying the kinematic condtions.

Returns:

Cut explicit dof DataFrame to be solved.

Return type:

pd.DataFrame

_expand_q(q: numpy.ndarray) numpy.ndarray

From the reduced size displacement vector, extend it to its full size.

Parameters:

q (np.ndarray) – Reduced size displacement vector (without the kinematic conditions).

Returns:

full size displacement vector without kinematic conditions applied.

Return type:

np.ndarray

_complete_x(list_of_kine: list[pyHarm.KinematicConditions.ABCKinematic.ABCKinematic], x: numpy.ndarray, **kwargs) numpy.ndarray

Apply the list of kinematic conditions and returns a vector of displacement to add to the full size displacement vector.

Parameters:
  • list_of_kine (list[ABCKinematic]) – List of kinematic conditions to be applied.

  • x (np.ndarray) – Full size displacement vector without kinematic conditions applied.

Returns:

vector of displacement to add in order to obtain the full size displacement vector with kinematic conditions.

Return type:

np.ndarray

get_full_disp(q: numpy.ndarray) numpy.ndarray

Apply the full list of kinematic conditions and returns the displacement vector.

Parameters:

q (list[ABCKinematic]) – Reduced size displacement vector without kinematic conditions applied.

Returns:

Full size displacement vector with kinematic conditions applied.

Return type:

np.ndarray

_complete_R(list_of_kine: list[pyHarm.KinematicConditions.ABCKinematic.ABCKinematic], R, x, **kwargs) numpy.ndarray

Apply the list of kinematic conditions and returns a vector of residual to add to the full size residual vector.

Parameters:
  • list_of_kine (list[ABCKinematic]) – List of kinematic conditions to be applied.

  • R (np.ndarray) – Full size residual vector without kinematic conditions applied.

  • x (np.ndarray) – Full size displacement vector without kinematic conditions applied.

Returns:

vector of residuals to add in order to obtain the full size residual vector with kinematic conditions.

Return type:

np.ndarray

_complete_J(list_of_kine: list[pyHarm.KinematicConditions.ABCKinematic.ABCKinematic], Jx, Jom, x, **kwargs) tuple[numpy.ndarray]

Apply the list of kinematic conditions and returns a jacobian matrices to add to the full size jacobian matrices.

Parameters:
  • list_of_kine (list[ABCKinematic]) – List of kinematic conditions to be applied.

  • Jx (np.ndarray) – Full size jacobian matrix with respect to displacement without kinematic conditions applied.

  • Jom (np.ndarray) – Full size jacobian matrix with respect to angular frequency without kinematic conditions applied.

  • x (np.ndarray) – Full size displacement vector without kinematic conditions applied.

Returns:

jacobian matrices to add in order to obtain the full size jacobian matrix with kinematic condtions.

Return type:

tuple(np.ndarray)

__post_init__() None

Method that can be complete in subclasses in order to facilitate a add during the instanciation of a class.

_residual(list_of_elems: list[pyHarm.Elements.ABCElement.ABCElement], x, **kwargs) numpy.ndarray

Compute the residual of a list of elements and add them in a full size residual vector.

Parameters:
  • list_of_elems (list[ABCElement]) – List of elements with a residual contribution.

  • x (np.ndarray) – Full size displacement vector.

Returns:

residual vector computed at point x for the list of elements.

Return type:

np.ndarray

_jacobian(list_of_elems: list[pyHarm.Elements.ABCElement.ABCElement], x, **kwargs) tuple[numpy.ndarray]

Compute the jacobian matrices of a list of elements and add them in a full size residual vector.

Parameters:
  • list_of_elems (list[ABCElement]) – List of elements with a residual contribution.

  • x (np.ndarray) – Full size displacement vector.

Returns:

jacobian matrices computed at point x for the list of elements.

Return type:

tuple(np.ndarray)

_get_assembled_mass_matrix(x, **kwargs)

Compute the mass matrix of the assembled system

Parameters:

x (np.ndarray) – Full size displacement vector.

Returns:

full mass matrix of the system

Return type:

M_assembled (np.ndarray)

_get_assembled_stiffness_matrix(x, **kwargs)

Compute the stiffness matrix of the assembled system

Parameters:

x (np.ndarray) – Full size displacement vector.

Returns:

full stiffness matrix of the system

Return type:

K_assembled (np.ndarray)

abstractmethod Residual() numpy.ndarray

Abstract method that is completed in each subclass and responsible to compute the residual vector of the whole system.

abstractmethod Jacobian() tuple[numpy.ndarray]

Abstract method that is completed in each subclass and responsible to compute the jacobian matrices of the whole system.

pyHarm.System_dico

Dictionary containing the available ABCSystem in pyHarm for creation as values and their factory_keyword as keys.

Type:

dict[str,ABCSystem]

class pyHarm.ABCKinematic(nh: int, nti: int, name: str, data: dict, CS: pyHarm.CoordinateSystem.CoordinateSystem)

Bases: abc.ABC

This is the abstract class ruling the kinematic conditions class. The kinematic conditions are responsible to impose kinematic on dofs of the system and transfer the residuals.

Parameters:
  • nh (int) – number of harmonics.

  • nti (int) – number of time steps.

  • name (str) – name given to the kinematic condition.

  • data (dict) – dictionary containing all the definition information of the kinematic condition.

  • CS (CoordinateSystem) – local or global coordinate system the kinematic condition is defined on.

nh

number of harmonics.

Type:

int

nti

number of time steps.

Type:

int

D

Dynamic operators containing inverse discrete Fourier transform and discrete Fourier transform.

Type:

dict[np.ndarray,np.ndarray]

nabla

Derivation operator.

Type:

np.ndarray

indices

index of the dofs that the kinematic conditions needs.

Type:

np.ndarray

Pdir

a slice of first dimension is a transformation matrix to a direction in local coordinate system.

Type:

np.ndarray

Pslave

selection array that selects the slave dofs of the kinematic condition.

Type:

np.ndarray

Pmaster

selection array that selects the master dofs of the kinematic condition.

Type:

np.ndarray

subs

list containing the name of the substructures that are involved.

Type:

list[str]

nbSub

number of substructure involved.

Type:

int

nodes

list of list of nodes the kinematic conditions act on.

Type:

list[list]

nbdofi

number of nodes involved per substructure.

Type:

int

abstract property factory_keyword
__init_flags__()
__init_harmonic_operators__(nh, nti)
__init_data__(name, data, CS)
__str__()
__repr__()
__post_init__(*args)
__flag_update__(*args)
generateIndices(expl_dofs: pandas.DataFrame)

From the explicit dof DataFrame, generates the index of dofs concerned by the kinematic condition.

Parameters:

expl_dofs (pd.DataFrame) – explicit dof DataFrame from the studied system.

indices

index of the dofs that the kinematic conditions needs.

Type:

np.ndarray

Pdir

a slice of first dimension is a transformation matrix to a direction in local coordinate system.

Type:

np.ndarray

Pslave

selection array that selects the slave dofs of the kinematic condition.

Type:

np.ndarray

Pmaster

selection array that selects the master dofs of the kinematic condition.

Type:

np.ndarray

_generateMatrices(sub_expl_dofs)
abstractmethod adim(lc, wc)

Using adim parameters, modifies the kinematic conditions accordingly.

Parameters:
  • lc (float) – characteristic length.

  • wc (float) – characteristic angular frequency.

abstractmethod complete_x(x, om)

Returns a vector x_add of same size of x that completes the vector of displacement x = x + x_add.

Parameters:
  • x (np.ndarray) – displacement vector.

  • om (float) – angular frequency.

abstractmethod complete_R(R, x)

Returns a vector R_add of same size of R that completes the vector of residual R = R + R_add

Parameters:
  • R (np.ndarray) – residual vector.

  • x (np.ndarray) – displacement vector.

abstractmethod complete_J(Jx, Jom, x)

Returns a vector Jx_add and Jom_add of same size of Jx and Jom that completes the Jacobian

Parameters:
  • Jx (np.ndarray) – jacobian matrix with respect to displacement.

  • Jom (np.ndarray) – jacobian matrix with respect to angular frequency.

  • x (np.ndarray) – displacement vector.

pyHarm.Kinematic_dico

Dictionary containing ABCKinematic as values and their factory_keyword attribute as key.

Type:

dict

class pyHarm.ABCNLSolver(residual, jacobian, solver_options)

Bases: abc.ABC

This is the abstract class ruling the solver class. The system is responsible of solving the system starting at a given starting point.

Parameters:
  • solver_options (dict) – dictionary containing other options for creation of the solver class.

  • residual (Callable) – function that returns the residual vector of the system to be solved.

  • jacobian (Callable) – function that returns the jacobian matrix of the system to be solved.

property factory_keyword: str
Abstractmethod:

keyword that is used to call the creation of this class in the system factory.

solver_options
residual
jacobian
__post_init__()
abstractmethod Solve(system_solution: pyHarm.Solver.SystemSolution) pyHarm.Solver.SystemSolution

Runs the solver.

Parameters:

system_solution (SystemSolution) – SystemSolution that contains the starting point.

pyHarm.Solver_dico

Dictionary containing all the available ABCNLSolvers as values, and their factory_keyword attribute as key.

Type:

dict

pyHarm.SubstructureDico

List of available ABCSubstructure subclasses available for creation.

Type:

dict[str,ABCSubstructure]

class pyHarm.ABCSubstructure(nh: int, name: str, data: dict)

Bases: abc.ABC

This class defines a substructure. Its main responsability is to create dofs and put them in an explicit pandas DataFrame.

Parameters:
  • nh (int) – number of harmonics.

  • nti (int) – number of time steps.

  • name (str) – name given to the kinematic condition.

  • data (dict) – dictionary containing all the definition information of the substructure.

nh

number of harmonics.

Type:

int

name

name of the substructure.

Type:

int

nnodes

number of nodes.

Type:

int

nmodes

number of modes.

Type:

int

ndofs

number of dofs per node.

Type:

int

edf

DataFrame describing the created dofs.

Type:

pd.DataFrame

connectors

dictionary containing the added Elements to the system.

Type:

dict

kinematics

dictionary containing the added Kinematic Conditions to the system.

Type:

dict

flag_substructure = True
default_data
nh
name
substructure_reader
nnodes
nmodes
ndofs
dofs_matching
total_dofs
edf
connectors
kinematics
__repr__() str
property factory_keyword: str
Abstractmethod:

” Property defining the factory_keyword to be used for instantiation of daughter class.

Returns:

factory_keyword

Return type:

str

abstractmethod _add_connectors() dict

” Method that adds connectors depending on the type of substructure.

abstractmethod _add_kinematics() dict

” Method that adds kinematic conditions depending on the type of substructure.

_gen_sub_col()
_gen_harm_col()
_gen_cs_col()
_gen_nodes_col()
_gen_dofs_col()
_gen_PoM_col()
_get_explicit_df()
pyHarm.SubstructureReaderDictionary

Dictionary of available Substructure readers subclasses as values and their factory_keyword as key.

Type:

dict[str, ABCReader]

class pyHarm.ABCReader

Bases: abc.ABC

This is the abstract class ruling the reader class for substructure. The reader is responsible for reading, parsing and completing an input dictionary from a external file to comply with pyHarm.

abstract property factory_keyword

Factory keyword to be used when instantiating a reader

abstractmethod data_complete(data: dict) dict

Reads and completes the input dictionary from the file.

pyHarm.Dico_ABCClass_factory_keyword

Dictionary linking the abstract classes defined in every available subpackages and their factory dictionary.

Type:

dict

pyHarm.pyHarm_plugin(cls)

Plugin function for the pyHarm module. Allows registering a class in the pyHarm factories.

Parameters:

cls – A class to be registered in one of the pyHarm factories.

class pyHarm.Maestro(idata: dict)

Class that reads and launches the pyHarm analysis contained in the provided input file.

The class is in charge of reading the input file and build the system and the analysis that are requested by the input file. The class is in charge of loading the plugins beforehand if some plugins are requested by the input file. When operated, the class runs a loop over the analysis required and solve them.

Parameters:

idata (dict) – input dictionary describing all the necessary component (analysis, system composition).

default
inputData
system
nls
operate(x0=None, **kwargs)

Loops over the analysis and runs the Solve method associated with the analysis.

Parameters:
  • x0 (None | np.ndarray | str) – initial point from which running the analysis.

  • kwargs – additional keyword arguments.

getIndex(sub: str, node: int, dir_num: int) numpy.ndarray

From a substructure name, a node number, and a direction; returns the index of the required dof into the explicit dof vector of the system.

Parameters:
  • sub (str) – name of the substructure.

  • node (int) – node number.

  • dir_num (int) – direction number.

Returns :

np.ndarray : sorted array of the dof index associated with the input in the explicit dof DataFrame of the system.