ross.BearingFluidFlow

class ross.BearingFluidFlow(n, nz, ntheta, length, omega, p_in, p_out, radius_rotor, radius_stator, visc, rho, eccentricity=None, load=None, tag=None, n_link=None, scale_factor=1.0, color='#355d7a')

Instantiate a bearing using inputs from its fluid flow.

This method always creates elements with frequency-dependent coefficients. It calculates a set of coefficients for each frequency value appendend to “omega”.

Parameters
nint

The node in which the bearing will be located in the rotor.

Grid related
^^^^^^^^^^^^
Describes the discretization of the problem
nz: int

Number of points along the Z direction (direction of flow).

ntheta: int

Number of points along the direction theta. NOTE: ntheta must be odd.

nradius: int

Number of points along the direction r.

length: float

Length in the Z direction (m).

Operation conditions
^^^^^^^^^^^^^^^^^^^^
Describes the operation conditions.
omega: list

List of frequencies (rad/s) used to calculate the coefficients. If the length is greater than 1, an array of coefficients is returned.

p_in: float

Input Pressure (Pa).

p_out: float

Output Pressure (Pa).

load: float

Load applied to the rotor (N).

Geometric data of the problem
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Describes the geometric data of the problem.
radius_rotor: float

Rotor radius (m).

radius_stator: float

Stator Radius (m).

eccentricity: float

Eccentricity (m) is the euclidean distance between rotor and stator centers. The center of the stator is in position (0,0).

Fluid characteristics
^^^^^^^^^^^^^^^^^^^^^
Describes the fluid characteristics.
visc: float

Viscosity (Pa.s).

rho: float

Fluid density(Kg/m^3).

Others
^^^^^^
tagstr, optional

A tag to name the element Default is None.

n_linkint, optional

Node to which the bearing will connect. If None the bearing is connected to ground. Default is None.

scale_factorfloat, optional

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

Returns
bearing: rs.BearingElement

A bearing object.

Examples

>>> nz = 30
>>> ntheta = 20
>>> length = 0.03
>>> omega = [157.1]
>>> p_in = 0.
>>> p_out = 0.
>>> radius_rotor = 0.0499
>>> radius_stator = 0.05
>>> load = 525
>>> visc = 0.1
>>> rho = 860.
>>> BearingFluidFlow(0, nz, ntheta, length, omega, p_in,
...                  p_out, radius_rotor, radius_stator,
...                  visc, rho, load=load) 
BearingFluidFlow(n=0, n_link=None,
 kxx=[145...

Methods

C(frequency)

Damping matrix for an instance of a bearing element.

This method returns the damping matrix for an instance of a bearing element.

Parameters
frequencyfloat

The excitation frequency (rad/s).

Returns
Cnp.ndarray

A 2x2 matrix of floats containing the cxx, cxy, cyx, and cyy values (N*s/m).

Examples

>>> bearing = bearing_example()
>>> bearing.C(0)
array([[200.,   0.],
       [  0., 150.]])
G()

Gyroscopic matrix for an instance of a bearing element.

This method returns the mass matrix for an instance of a bearing element.

Returns
Gnp.ndarray

A 2x2 matrix of floats.

Examples

>>> bearing = bearing_example()
>>> bearing.G()
array([[0., 0.],
       [0., 0.]])
K(frequency)

Stiffness matrix for an instance of a bearing element.

This method returns the stiffness matrix for an instance of a bearing element.

Parameters
frequencyfloat

The excitation frequency (rad/s).

Returns
Knp.ndarray

A 2x2 matrix of floats containing the kxx, kxy, kyx, and kyy values.

Examples

>>> bearing = bearing_example()
>>> bearing.K(0)
array([[1000000.,       0.],
       [      0.,  800000.]])
M()

Mass matrix for an instance of a bearing element.

This method returns the mass matrix for an instance of a bearing element.

Returns
Mnp.ndarray

Mass matrix (kg).

Examples

>>> bearing = bearing_example()
>>> bearing.M()
array([[0., 0.],
       [0., 0.]])
__init__(n, nz, ntheta, length, omega, p_in, p_out, radius_rotor, radius_stator, visc, rho, eccentricity=None, load=None, tag=None, n_link=None, scale_factor=1.0, color='#355d7a')
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

>>> bearing = bearing_example()
>>> bearing.dof_mapping()
{'x_0': 0, 'y_0': 1}
classmethod from_table(n, file, sheet_name=0, tag=None, n_link=None, scale_factor=1, color='#355d7a')

Instantiate a bearing 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
nint

The node in which the bearing will be located in the rotor.

filestr

Path to the file containing the bearing 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.

tagstr, optional

A tag to name the element. Default is None.

n_linkint, optional

Node to which the bearing will connect. If None the bearing is connected to ground. Default is None.

scale_factorfloat, optional

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

colorstr, optional

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

Returns
bearingrs.BearingElement

A bearing object.

Examples

>>> import os
>>> file_path = os.path.dirname(os.path.realpath(__file__)) + '/tests/data/bearing_seal_si.xls'
>>> BearingElement.from_table(0, file_path, n_link=1) 
BearingElement(n=0, n_link=1,
 kxx=[1.379...
classmethod load(file)
plot(coefficients=None, frequency_units='rad/s', stiffness_units='N/m', damping_units='N*s/m', fig=None, **kwargs)

Plot coefficient vs frequency.

Parameters
coefficientslist, str

List or str with the coefficients to plot.

frequency_unitsstr

Frequency units. Default is rad/s.

y_unitsstr
**kwargsoptional

Additional key word arguments can be passed to change the plot layout only (e.g. width=1000, height=800, …). *See Plotly Python Figure Reference for more information.

Returns
figPlotly graph_objects.Figure()

The figure object with the plot.

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...
classmethod table_to_toml(n, file)

Convert bearing parameters to toml.

Convert a table with parameters of a bearing element to a dictionary ready to save to a toml file that can be later loaded by ross.

Parameters
nint

The node in which the bearing will be located in the rotor.

filestr

Path to the file containing the bearing parameters.

Returns
datadict

A dict that is ready to save to toml and readable by ross.

Examples

>>> import os
>>> file_path = os.path.dirname(os.path.realpath(__file__)) + '/tests/data/bearing_seal_si.xls'
>>> BearingElement.table_to_toml(0, file_path) 
{'n': 0, 'kxx': array([...