ross.DiskElement

class ross.DiskElement(n, m, Id, Ip, tag=None, scale_factor=1.0, color='Firebrick')

A disk element.

This class creates a disk element from input data of inertia and mass.

Parameters
n: int

Node in which the disk will be inserted.

mfloat, pint.Quantity

Mass of the disk element.

Idfloat, pint.Quantity

Diametral moment of inertia.

Ipfloat, pint.Quantity

Polar moment of inertia

tagstr, optional

A tag to name the element Default is None

scale_factor: float or str, optional

The scale factor is used to scale the disk drawing. For disks it is also possible to provide ‘mass’ as the scale factor. In this case the code will calculate scale factors for each disk based on the disk with the higher mass. Notice that in this case you have to create all disks with the scale_factor=’mass’. Default is 1.

colorstr, optional

A color to be used when the element is represented. Default is ‘Firebrick’.

Examples

>>> disk = DiskElement(n=0, m=32, Id=0.2, Ip=0.3)
>>> disk.Ip
0.3

Methods

C()

Damping matrix for an instance of a disk element.

This method will return the damping matrix for an instance of a disk element.

Returns
Cnp.ndarray

A matrix of floats containing the values of the damping matrix.

Examples

>>> disk = disk_example()
>>> disk.C()
array([[0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])
G()

Gyroscopic matrix for an instance of a disk element.

This method will return the gyroscopic matrix for an instance of a disk element.

Returns
G: np.ndarray

Gyroscopic matrix for the disk element.

Examples

>>> disk = DiskElement(0, 32.58972765, 0.17808928, 0.32956362)
>>> disk.G()
array([[ 0.        ,  0.        ,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.        ,  0.32956362],
       [ 0.        ,  0.        , -0.32956362,  0.        ]])
K()

Stiffness matrix for an instance of a disk element.

This method will return the stiffness matrix for an instance of a disk element.

Returns
Knp.ndarray

A matrix of floats containing the values of the stiffness matrix.

Examples

>>> disk = disk_example()
>>> disk.K()
array([[0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])
M()

Mass matrix for an instance of a disk element.

This method will return the mass matrix for an instance of a disk element.

Returns
Mnp.ndarray

A matrix of floats containing the values of the mass matrix.

Examples

>>> disk = DiskElement(0, 32.58972765, 0.17808928, 0.32956362)
>>> disk.M()
array([[32.58972765,  0.        ,  0.        ,  0.        ],
       [ 0.        , 32.58972765,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.17808928,  0.        ],
       [ 0.        ,  0.        ,  0.        ,  0.17808928]])
__init__(n, m, Id, Ip, tag=None, scale_factor=1.0, color='Firebrick')
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 alpha_0 - rotation around horizontal beta_0 - rotation around vertical

>>> disk = disk_example()
>>> disk.dof_mapping()
{'x_0': 0, 'y_0': 1, 'alpha_0': 2, 'beta_0': 3}
classmethod from_geometry(n, material, width, i_d, o_d, tag=None, scale_factor=1.0, color='Firebrick')

Create a disk element from geometry properties.

This class method will create a disk element from geometry data.

Parameters
nint

Node in which the disk will be inserted.

material: ross.Material

Disk material.

widthfloat, pint.Quantity

The disk width.

i_dfloat, pint.Quantity

Inner diameter.

o_dfloat, pint.Quantity

Outer diameter.

tagstr, optional

A tag to name the element Default is None

scale_factor: float, optional

The scale factor is used to scale the disk drawing. Default is 1.

colorstr, optional

A color to be used when the element is represented. Default is ‘Firebrick’ (Cardinal).

Examples

>>> from ross.materials import steel
>>> disk = DiskElement.from_geometry(0, steel, 0.07, 0.05, 0.28)
>>> disk.Ip
0.32956362089137037
Attributes
mfloat

Mass of the disk element.

Idfloat

Diametral moment of inertia.

Ipfloat

Polar moment of inertia

classmethod from_table(file, sheet_name=0, tag=None, scale_factor=None, color=None)

Instantiate one or more disks using inputs from an Excel table.

A header with the names of the columns is required. These names should match the names expected by the routine (usually the names of the parameters, but also similar ones). The program will read every row bellow the header until they end or it reaches a NaN.

Parameters
filestr

Path to the file containing the disk parameters.

sheet_nameint or str, optional

Position of the sheet in the file (starting from 0) or its name. If none is passed, it is assumed to be the first sheet in the file.

tag_listlist, optional

list of tags for the disk elements. Default is None

scale_factor: list, optional

List of scale factors for the disk elements patches. The scale factor is used to scale the disk drawing. Default is 1.

colorlist, optional

A color to be used when the element is represented. Default is ‘Firebrick’.

Returns
disklist

A list of disk objects.

Examples

>>> import os
>>> file_path = os.path.dirname(os.path.realpath(__file__)) + '/tests/data/shaft_si.xls'
>>> list_of_disks = DiskElement.from_table(file_path, sheet_name="More")
>>> list_of_disks[0]
DiskElement(Id=0.0, Ip=0.0, m=15.12, color='Firebrick', n=3, scale_factor=1, tag=None)
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...