# Example 2 - Effect of varying slenderness ratioΒΆ

In this example, we use the rotor seen in Example 5.8.2 from .

import numpy as np
import plotly.graph_objects as go
import ross as rs

steel = rs.materials.steel

number_of_elements = [2, 3, 4, 5, 6, 7, 8]

def create_rotor(n_el, R, shear_effects=False, rotary_inertia=False):
"""Create example rotor with given number of elements and R ration."""
L_total = 1
D = R * L_total

shaft = [
rs.ShaftElement(
1.0 / (n_el),
idl=0,
odl=D,
material=steel,
shear_effects=shear_effects,
rotary_inertia=rotary_inertia,
)
for i in range(n_el)
]

bearings = [
rs.BearingElement(0, kxx=1e15, cxx=0),
rs.BearingElement(n_el, kxx=1e15, cxx=0),
]

return rs.Rotor(shaft_elements=shaft, bearing_elements=bearings)

# create reference rotor with 80 elements
n_eigen = 8
R = 0.04
rotor_80 = create_rotor(80, R)
modal_80 = rotor_80.run_modal(speed=0, num_modes=2 * n_eigen)

errors = np.zeros([len(number_of_elements), n_eigen])

for i, n_el in enumerate(number_of_elements):
rotor = create_rotor(n_el, R)
modal = rotor.run_modal(speed=0, num_modes=2 * n_eigen)
errors[i, :] = abs(
100 * (modal.wn[:n_eigen] - modal_80.wn[:n_eigen]) / modal_80.wn[:n_eigen]
)

fig = go.Figure()
for i in range(n_eigen):