ross.GearElement#

class ross.GearElement(n, m, Id, Ip, pitch_diameter=None, base_diameter=None, pressure_angle=None, tag=None, scale_factor=1.0, color='Goldenrod')#

A gear element.

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

Parameters:
n: int

Node in which the gear will be inserted.

mfloat, pint.Quantity

Mass of the gear element (kg).

Idfloat, pint.Quantity

Diametral moment of inertia.

Ipfloat, pint.Quantity

Polar moment of inertia.

base_diameterfloat, pint.Quantity

Base diameter of the gear (m). If given pitch_diameter is not necessary.

pitch_diameterfloat, pint.Quantity

Pitch diameter of the gear (m). If given base_diameter is not necessary.

pressure_anglefloat, pint.Quantity, optional

The pressure angle of the gear (rad). Default is 20 deg (converted to rad).

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 gear drawing. For gears it is also possible to provide ‘mass’ as the scale factor. In this case the code will calculate scale factors for each gear based on the gear with the higher mass. Notice that in this case you have to create all gears with the scale_factor=’mass’. Default is 1.

colorstr, optional

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

Examples

>>> gear = GearElement(
...        n=0, m=4.67, Id=0.015, Ip=0.030,
...        pitch_diameter=0.187,
...        pressure_angle=Q_(22.5, "deg")
... )
>>> gear.pressure_angle 
0.392699...

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., 0., 0.],
       [0., 0., 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().round(2)
array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.33,  0.  ],
       [ 0.  ,  0.  ,  0.  , -0.33,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  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().round(2)
array([[0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0.]])
Kdt()#

Dynamic stiffness matrix for an instance of a disk element.

Stiffness matrix for the disk element associated with the transient motion. It needs to be multiplied by the angular acceleration when considered in time dependent analyses.

Returns:
Kdtnp.ndarray

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

Examples

>>> disk = disk_example()
>>> disk.Kdt().round(2)
array([[0.  , 0.  , 0.  , 0.  , 0.  , 0.  ],
       [0.  , 0.  , 0.  , 0.  , 0.  , 0.  ],
       [0.  , 0.  , 0.  , 0.  , 0.  , 0.  ],
       [0.  , 0.  , 0.  , 0.  , 0.  , 0.  ],
       [0.  , 0.  , 0.  , 0.33, 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().round(2)
array([[32.59,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  , 32.59,  0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  , 32.59,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.18,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.18,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.33]])
__init__(n, m, Id, Ip, pitch_diameter=None, base_diameter=None, pressure_angle=None, tag=None, scale_factor=1.0, color='Goldenrod')#
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, z_0=2)
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 z_0 - axial translation alpha_0 - rotation around horizontal beta_0 - rotation around vertical theta_0 - torsion around axial

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

Create a gear element from geometry properties.

This class method will create a gear element from geometry data. Properties are calculated as per [Friswell, 2010], appendix 1 for a hollow cylinder:

Mass:

\(m = \rho \pi w (d_o^2 - d_i^2) / 4\)

Polar moment of inertia:

\(I_p = m (d_o^2 + d_i^2) / 8\)

Diametral moment of inertia:

\(I_d = \frac{1}{2} I_p + \frac{1}{12} m w^2\)

Where \(\rho\) is the material density, \(w\) is the gear width, \(d_o\) is the outer diameter and \(d_i\) is the inner diameter.

Parameters:
nint

Node in which the gear will be inserted.

material: ross.Material

Gear material.

widthfloat, pint.Quantity

The face width of the gear considering that the gear body has the same thickness (m).

i_dfloat, pint.Quantity

Inner diameter (the diameter of the shaft on which the gear is mounted).

o_dfloat, pint.Quantity

Outer pitch diameter (m).

pressure_anglefloat, pint.Quantity, optional

The pressure angle of the gear (rad). Default is 20 deg (converted to rad).

tagstr, optional

A tag to name the element Default is None

scale_factor: float, optional

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

colorstr, optional

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

Examples

>>> from ross.materials import steel
>>> gear = GearElement.from_geometry(0, steel, 0.07, 0.05, 0.28)
>>> gear.base_radius 
0.131556...
>>>
Attributes:
mfloat

Mass of the gear 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)
get_class_name_prefix(index=None)#

Extract prefix of the class name preceding ‘Element’, insert spaces before uppercase letters, and append an index number at the end.

Parameters:
indexint, optional

The index number to append at the end of the resulting string. Default is None.

Returns:
prefixstr

The processed class name prefix.

Examples

>>> # Example using BearingElement
>>> from ross.bearing_seal_element import bearing_example
>>> bearing = bearing_example()
>>> bearing.get_class_name_prefix()
'Bearing'
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...