ross.PointMass
Contents
ross.PointMass#
- class ross.PointMass(n=None, m=None, mx=None, my=None, tag=None, color='DarkSalmon')#
A point mass element.
This class will create a point mass element. This element can be used to link other elements in the analysis. The mass provided to the element can be different on the x and y direction (e.g. different support inertia for x and y directions).
- Parameters:
- n: int
Node which the bearing will be located in.
- m: float, pint.Quantity, optional
Mass for the element.
- mx: float, pint.Quantity, optional
Mass for the element on the x direction.
- my: float, pint.Quantity, optional
Mass for the element on the y direction.
- tag: str
A tag to name the element
- colorstr, optional
A color to be used when the element is represented. Default is “DarkSalmon”.
Examples
>>> p0 = PointMass(n=0, m=2) >>> p0.M() array([[2., 0.], [0., 2.]]) >>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.M() array([[2., 0.], [0., 3.]])
Methods
- C()#
Damping matrix for an instance of a point mass element.
This method will return the damping matrix for an instance of a point mass element.
- Returns:
- Cnp.ndarray
A matrix of floats containing the values of the damping matrix.
Examples
>>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.C() array([[0., 0.], [0., 0.]])
- G()#
Gyroscopic matrix for an instance of a point mass element.
This method will return the gyroscopic matrix for an instance of a point mass element.
- Returns:
- Gnp.ndarray
A matrix of floats containing the values of the gyroscopic matrix.
Examples
>>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.G() array([[0., 0.], [0., 0.]])
- K()#
Stiffness matrix for an instance of a point mass element.
This method will return the stiffness matrix for an instance of a point mass element.
- Returns:
- Knp.ndarray
A matrix of floats containing the values of the stiffness matrix.
Examples
>>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.K() array([[0., 0.], [0., 0.]])
- M()#
Mass matrix for an instance of a point mass element.
This method will return the mass matrix for an instance of a point mass element.
- Returns:
- Mnp.ndarray
A matrix of floats containing the values of the mass matrix.
Examples
>>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.M() array([[2., 0.], [0., 3.]])
- __init__(n=None, m=None, mx=None, my=None, tag=None, color='DarkSalmon')#
- dof_local_index()#
Get the local index for a element specific degree of freedom.
- Returns:
- local_index: namedtupple
A named tuple containing the local index.
Examples
>>> # Example using BearingElement >>> from ross.bearing_seal_element import bearing_example >>> bearing = bearing_example() >>> bearing.dof_local_index() LocalIndex(x_0=0, y_0=1)
- dof_mapping()#
Degrees of freedom mapping.
Returns a dictionary with a mapping between degree of freedom and its index.
- Returns:
- dof_mappingdict
A dictionary containing the degrees of freedom and their indexes.
Examples
The numbering of the degrees of freedom for each node.
Being the following their ordering for a node:
x_0 - horizontal translation y_0 - vertical translation
>>> p1 = PointMass(n=0, mx=2, my=3) >>> p1.dof_mapping() {'x_0': 0, 'y_0': 1}
- classmethod load(file)#
- classmethod read_toml_data(data)#
Read and parse data stored in a .toml file.
The data passed to this method needs to be according to the format saved in the .toml file by the .save() method.
- Parameters:
- datadict
Dictionary obtained from toml.load().
- Returns:
- The element object.
Examples
>>> # Example using BearingElement >>> from tempfile import tempdir >>> from pathlib import Path >>> from ross.bearing_seal_element import bearing_example >>> from ross.bearing_seal_element import BearingElement >>> # create path for a temporary file >>> file = Path(tempdir) / 'bearing1.toml' >>> bearing1 = bearing_example() >>> bearing1.save(file) >>> bearing1_loaded = BearingElement.load(file) >>> bearing1 == bearing1_loaded True
- save(file)#
Save the element in a .toml file.
This function will save the element to a .toml file. The file will have all the argument’s names and values that are needed to reinstantiate the element.
- Parameters:
- filestr, pathlib.Path
The name of the file the element will be saved in.
Examples
>>> # Example using DiskElement >>> from tempfile import tempdir >>> from pathlib import Path >>> from ross.disk_element import disk_example >>> # create path for a temporary file >>> file = Path(tempdir) / 'disk.toml' >>> disk = disk_example() >>> disk.save(file)
- summary()#
Present a summary for the element.
A pandas series with the element properties as variables.
- Returns:
- A pandas series.
Examples
>>> # Example using DiskElement >>> from ross.disk_element import disk_example >>> disk = disk_example() >>> disk.summary() n 0 n_l 0 n_r 0...