ross.Shape

class ross.Shape(vector, nodes, nodes_pos, shaft_elements_length, normalize=False)

Class used to construct a mode or a deflected shape from a eigen or response vector.

Parameters
vectornp.array

Complex array with the eigenvector or response vector from a forced response analysis. Array shape should be equal to the number of degrees of freedom of the complete rotor (ndof * number_of_nodes).

nodeslist

List of nodes number.

nodes_poslist

List of nodes positions.

shaft_elements_lengthlist

List with Rotor shaft elements lengths.

normalizebool, optional

If True the vector is normalized. Default is False.

Methods

__init__(vector, nodes, nodes_pos, shaft_elements_length, normalize=False)
classmethod load(file)

Load results from a .toml file.

This function will load the simulation results from a .toml file. The file must have all the argument’s names and values that are needed to reinstantiate the class.

Parameters
filestr, pathlib.Path

The name of the file the results will be loaded from.

Examples

>>> # Example running a stochastic unbalance response
>>> from tempfile import tempdir
>>> from pathlib import Path
>>> import ross as rs
>>> # Running an example
>>> rotor = rs.rotor_example()
>>> freq_range = np.linspace(0, 500, 31)
>>> n = 3
>>> m = 0.01
>>> p = 0.0
>>> results = rotor.run_unbalance_response(n, m, p, freq_range)
>>> # create path for a temporary file
>>> file = Path(tempdir) / 'unb_resp.toml'
>>> results.save(file)
>>> # Loading file
>>> results2 = rs.ForcedResponseResults.load(file)
>>> abs(results2.forced_resp).all() == abs(results.forced_resp).all()
True
plot_2d(orientation='major', length_units='m', phase_units='rad', fig=None)

Rotor shape 2d plot.

Parameters
orientationstr, optional

Orientation can be ‘major’, ‘x’ or ‘y’. Default is ‘major’ to display the major axis.

length_unitsstr, optional

length units. Default is ‘m’.

phase_unitsstr, optional

Phase units. Default is “rad”

figPlotly graph_objects.Figure()

The figure object with the plot.

Returns
figPlotly graph_objects.Figure()

The figure object with the plot.

plot_3d(mode=None, orientation='major', title=None, length_units='m', phase_units='rad', fig=None, **kwargs)
plot_orbit(nodes, fig=None)

Plot orbits.

Parameters
nodeslist

List with nodes for which the orbits will be plotted.

figPlotly graph_objects.Figure()

The figure object with the plot.

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 result object.
save(file)

Save results in a .toml file.

This function will save the simulation results to a .toml file. The file will have all the argument’s names and values that are needed to reinstantiate the class.

Parameters
filestr, pathlib.Path

The name of the file the results will be saved in.

Examples

>>> # Example running a unbalance response
>>> from tempfile import tempdir
>>> from pathlib import Path
>>> import ross as rs
>>> # Running an example
>>> rotor = rs.rotor_example()
>>> speed = np.linspace(0, 1000, 101)
>>> response = rotor.run_unbalance_response(node=3,
...                                         unbalance_magnitude=0.001,
...                                         unbalance_phase=0.0,
...                                         frequency=speed)
>>> # create path for a temporary file
>>> file = Path(tempdir) / 'unb_resp.toml'
>>> response.save(file)