@@ -156,7 +156,6 @@ def __init__(
156156 modal_damping = None ,
157157 default_modes = None ,
158158 tag = None ,
159-
160159 ):
161160 self .parameters = {"min_w" : min_w , "max_w" : max_w , "rated_w" : rated_w }
162161
@@ -560,7 +559,7 @@ def flatten(l):
560559
561560 M0 [np .ix_ (dofs , dofs )] += elm .M ()
562561 C0 [np .ix_ (dofs , dofs )] += elm .C ()
563- K0 [np .ix_ (dofs , dofs )] += elm .K ()
562+ K0 [np .ix_ (dofs , dofs )] += elm .K ()
564563 G0 [np .ix_ (dofs , dofs )] += elm .G ()
565564
566565 if elm in self .shaft_elements :
@@ -573,7 +572,11 @@ def flatten(l):
573572 # Damping configuration
574573 self .modal_damping = modal_damping
575574 self .default_modals = default_modes
576- self .C0 = C0 if self .modal_damping == None else self ._modal_damping (self .modal_damping )
575+ self .C0 = (
576+ C0
577+ if self .modal_damping == None
578+ else self ._modal_damping (self .modal_damping )
579+ )
577580 self .G0 = G0
578581 self .Ksdt0 = Ksdt0
579582
@@ -666,7 +669,7 @@ def _find_linked_bearing_node(self, node):
666669 return brg .n
667670 return None
668671
669- def _modal_damping (self , modal_damping ):
672+ def _modal_damping (self , modal_damping ):
670673 """Compute the physical damping matrix from modal damping ratios.
671674
672675 Parameters
@@ -687,9 +690,7 @@ def _modal_damping(self, modal_damping ):
687690
688691 w = np .sqrt (evals .real )
689692 below_1rpm = Q_ (np .sort (w ), "rad/s" ).to ("RPM" ).m < 1
690- modal_damping = np .block (
691- [np .zeros (below_1rpm .sum ()), np .array (modal_damping )]
692- )
693+ modal_damping = np .block ([np .zeros (below_1rpm .sum ()), np .array (modal_damping )])
693694 idx = np .argsort (w )
694695 w = w [idx ]
695696 phi = evecs [:, idx ]
@@ -996,11 +997,11 @@ def run_critical_speed(self, speed_range=None, num_modes=12, rtol=0.005):
996997 wd = np .zeros_like (_wd )
997998
998999 for i in range (len (wn )):
999- wn_func = lambda s : ( s - self .run_modal (s , num_modes ).wn [i ])
1000+ wn_func = lambda s : s - self .run_modal (s , num_modes ).wn [i ]
10001001 wn [i ] = newton (func = wn_func , x0 = _wn [i ], rtol = rtol )
10011002
10021003 for i in range (len (wd )):
1003- wd_func = lambda s : ( s - self .run_modal (s , num_modes ).wd [i ])
1004+ wd_func = lambda s : s - self .run_modal (s , num_modes ).wd [i ]
10041005 wd [i ] = newton (func = wd_func , x0 = _wd [i ], rtol = rtol )
10051006
10061007 log_dec = np .zeros_like (wn )
@@ -2627,26 +2628,32 @@ def integrate_system(self, speed, F, t, **kwargs):
26272628 add_to_RHS = kwargs .get ("add_to_RHS" )
26282629
26292630 if add_to_RHS is None :
2630- forces = lambda step , ** curr_state : F [step , :] + reduction [1 ](
2631- magnetic_force (
2632- step ,
2633- curr_state .get ("dt" ),
2634- reduction [2 ](curr_state .get ("y" )),
2631+ forces = lambda step , ** curr_state : (
2632+ F [step , :]
2633+ + reduction [1 ](
2634+ magnetic_force (
2635+ step ,
2636+ curr_state .get ("dt" ),
2637+ reduction [2 ](curr_state .get ("y" )),
2638+ )
26352639 )
26362640 )
26372641 else :
2638- forces = lambda step , ** curr_state : F [step , :] + reduction [1 ](
2639- add_to_RHS (
2640- step ,
2641- time_step = curr_state .get ("dt" ),
2642- disp_resp = reduction [2 ](curr_state .get ("y" )),
2643- velc_resp = reduction [2 ](curr_state .get ("ydot" )),
2644- accl_resp = reduction [2 ](curr_state .get ("y2dot" )),
2645- )
2646- + magnetic_force (
2647- step ,
2648- curr_state .get ("dt" ),
2649- reduction [2 ](curr_state .get ("y" )),
2642+ forces = lambda step , ** curr_state : (
2643+ F [step , :]
2644+ + reduction [1 ](
2645+ add_to_RHS (
2646+ step ,
2647+ time_step = curr_state .get ("dt" ),
2648+ disp_resp = reduction [2 ](curr_state .get ("y" )),
2649+ velc_resp = reduction [2 ](curr_state .get ("ydot" )),
2650+ accl_resp = reduction [2 ](curr_state .get ("y2dot" )),
2651+ )
2652+ + magnetic_force (
2653+ step ,
2654+ curr_state .get ("dt" ),
2655+ reduction [2 ](curr_state .get ("y" )),
2656+ )
26502657 )
26512658 )
26522659
@@ -2773,8 +2780,8 @@ def _init_ambs_for_integrate(self, dt, **kwargs):
27732780 rotor = deepcopy (self )
27742781
27752782 if len (magnetic_bearings ):
2776- magnetic_force = (
2777- lambda step , time_step , disp_resp : self .magnetic_bearing_controller (
2783+ magnetic_force = lambda step , time_step , disp_resp : (
2784+ self .magnetic_bearing_controller (
27782785 step , magnetic_bearings , time_step , disp_resp , ** kwargs
27792786 )
27802787 )
0 commit comments