From 059e8e05c25b74e991fbbe072ef66e9624247e1e Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Fri, 25 Nov 2022 17:34:37 -0300 Subject: [PATCH 01/15] Including gyroscopic effects in the UCS analysis --- ross/rotor_assembly.py | 90 +++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index 5ade5a79f..ff7cc319c 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -581,7 +581,7 @@ def __eq__(self, other): return False @check_units - def run_modal(self, speed, num_modes=12, sparse=True): + def run_modal(self, speed, num_modes=12, sparse=True, synchronous=False): """Run modal analysis. Method to calculate eigenvalues and eigvectors for a given rotor system. @@ -613,6 +613,9 @@ def run_modal(self, speed, num_modes=12, sparse=True): If False, scipy.linalg.eig() is used to calculate all the eigenvalues and eigenvectors. Default is True. + synchronous : bool, optional + If True a synchronous analysis is carried out. + Default is False. Returns ------- @@ -636,7 +639,7 @@ def run_modal(self, speed, num_modes=12, sparse=True): >>> mode2 = 1 # Second mode >>> fig = modal.plot_mode_2d(mode2) """ - evalues, evectors = self._eigen(speed, num_modes=num_modes, sparse=sparse) + evalues, evectors = self._eigen(speed, num_modes=num_modes, sparse=sparse, synchronous=synchronous) wn_len = num_modes // 2 wn = (np.absolute(evalues))[:wn_len] wd = (np.imag(evalues))[:wn_len] @@ -884,9 +887,15 @@ def convergence(self, n_eigval=0, err_max=1e-02): return results - def M(self): + def M(self, synchronous=False): """Mass matrix for an instance of a rotor. + Parameters + ---------- + synchronous : bool, optional + If True a synchronous analysis is carried out. + Default is False. + Returns ------- M0 : np.ndarray @@ -905,7 +914,32 @@ def M(self): for elm in self.elements: dofs = list(elm.dof_global_index.values()) - M0[np.ix_(dofs, dofs)] += elm.M() + if synchronous: + if elm in self.shaft_elements: + M = elm.M() + G = elm.G() + for i in range(8): + if i == 0 or i == 3 or i == 4 or i == 7: + M[i, 0] = M[i, 0] - G[i, 1] + M[i, 3] = M[i, 3] + G[i, 2] + M[i, 4] = M[i, 4] - G[i, 5] + M[i, 7] = M[i, 7] + G[i, 6] + else: + M[i, 1] = M[i, 1] + G[i, 0] + M[i, 2] = M[i, 2] - G[i, 3] + M[i, 5] = M[i, 5] + G[i, 4] + M[i, 6] = M[i, 6] - G[i, 7] + M0[np.ix_(dofs, dofs)] += M + elif elm in self.disk_elements: + M = elm.M() + G = elm.G() + M[2, 2] = M[2, 2] - G[2, 3] + M[3, 3] = M[3, 3] + G[3, 2] + M0[np.ix_(dofs, dofs)] += M + else: + M0[np.ix_(dofs, dofs)] += elm.M() + else: + M0[np.ix_(dofs, dofs)] += elm.M() return M0 @@ -1035,7 +1069,7 @@ def G(self): return G0 - def A(self, speed=0, frequency=None): + def A(self, speed=0, frequency=None, synchronous=False): """State space matrix for an instance of a rotor. Parameters @@ -1045,6 +1079,9 @@ def A(self, speed=0, frequency=None): Default is 0. frequency : float, optional Excitation frequency. Default is rotor speed. + synchronous : bool, optional + If True a synchronous analysis is carried out. + Default is False. Returns ------- @@ -1071,7 +1108,7 @@ def A(self, speed=0, frequency=None): # fmt: off A = np.vstack( [np.hstack([Z, I]), - np.hstack([la.solve(-self.M(), self.K(frequency) + self.Kst()*speed), la.solve(-self.M(), (self.C(frequency) + self.G() * speed))])]) + np.hstack([la.solve(-self.M(synchronous=synchronous), self.K(frequency) + self.Kst()*speed), la.solve(-self.M(synchronous=synchronous), (self.C(frequency) + self.G() * speed))])]) # fmt: on return A @@ -1222,7 +1259,7 @@ def _index(eigenvalues): @check_units def _eigen( - self, speed, num_modes=12, frequency=None, sorted_=True, A=None, sparse=True + self, speed, num_modes=12, frequency=None, sorted_=True, A=None, sparse=True, synchronous=False ): """Calculate eigenvalues and eigenvectors. @@ -1246,6 +1283,9 @@ def _eigen( sparse : bool, optional If sparse, eigenvalues will be calculated with arpack. Default is True. + synchronous : bool, optional + If True a synchronous analysis is carried out. + Default is False. Returns ------- @@ -1262,7 +1302,7 @@ def _eigen( 91.796... """ if A is None: - A = self.A(speed=speed, frequency=frequency) + A = self.A(speed=speed, frequency=frequency, synchronous=synchronous) if sparse is True: try: @@ -2154,9 +2194,8 @@ def run_ucs( Default is 16. In this case 4 modes are plotted, since for each pair of eigenvalues calculated we have one wn, and we show only the forward mode in the plots. - synchronous : bool - If True a synchronous analysis is carried out and the frequency of - the first forward model will be equal to the speed. + synchronous : bool, optional + If True a synchronous analysis is carried out. Default is False. Returns @@ -2193,31 +2232,8 @@ def run_ucs( bearings = [BearingElement(b.n, kxx=k, cxx=0) for b in bearings_elements] rotor = self.__class__(self.shaft_elements, self.disk_elements, bearings) speed = 0 - if synchronous: - - def wn_diff(x): - """Function to evaluate difference between speed and - natural frequency for the first mode.""" - modal = rotor.run_modal(speed=x, num_modes=num_modes) - # get first forward mode - if modal.whirl_direction()[0] == "Forward": - wn0 = modal.wn[0] - else: - wn0 = modal.wn[1] - - return wn0 - x - - speed = newton(wn_diff, 0) - modal = rotor.run_modal(speed=speed, num_modes=num_modes) - - # if sync, select only forward modes - if synchronous: - rotor_wn[:, i] = modal.wn[modal.whirl_direction() == "Forward"] - # if not sync, with speed=0 whirl direction can be confusing, with - # two close modes being forward or backward, so we select one mode in - # each 2 modes. - else: - rotor_wn[:, i] = modal.wn[::2] + modal = rotor.run_modal(speed=speed, num_modes=num_modes, synchronous=synchronous) + rotor_wn[:, i] = modal.wn[::2] bearing0 = bearings_elements[0] @@ -2262,7 +2278,7 @@ def wn_diff(x): bearing_elements=bearings, ) - modal_critical = rotor_critical.run_modal(speed=speed) + modal_critical = rotor_critical.run_modal(speed=speed, synchronous=synchronous) critical_points_modal.append(modal_critical) From bab2764c2d4c926a9398ae87946a5ffb9aab1477 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Fri, 25 Nov 2022 18:01:45 -0300 Subject: [PATCH 02/15] Fixing error in comparison between two elements --- ross/disk_element.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ross/disk_element.py b/ross/disk_element.py index 696c67738..9505dcc62 100644 --- a/ross/disk_element.py +++ b/ross/disk_element.py @@ -91,16 +91,10 @@ def __eq__(self, other): false_number = 0 for i in self.__dict__: try: - if np.allclose(self.__dict__[i], other.__dict__[i]): - pass - else: - false_number += 1 - - except TypeError: - if self.__dict__[i] == other.__dict__[i]: - pass - else: - false_number += 1 + self.__dict__[i] == other.__dict__[i] + + except: + false_number += 1 if false_number == 0: return True From afb8bea4dc0ce1537b6a203e34b3d57726fe5aaa Mon Sep 17 00:00:00 2001 From: Fernanda Rossi Date: Mon, 28 Nov 2022 17:03:38 -0300 Subject: [PATCH 03/15] Code formatted with black --- ross/disk_element.py | 1 - ross/rotor_assembly.py | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ross/disk_element.py b/ross/disk_element.py index 9505dcc62..1a8c99658 100644 --- a/ross/disk_element.py +++ b/ross/disk_element.py @@ -92,7 +92,6 @@ def __eq__(self, other): for i in self.__dict__: try: self.__dict__[i] == other.__dict__[i] - except: false_number += 1 diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index ff7cc319c..f20a0fd82 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -639,7 +639,9 @@ def run_modal(self, speed, num_modes=12, sparse=True, synchronous=False): >>> mode2 = 1 # Second mode >>> fig = modal.plot_mode_2d(mode2) """ - evalues, evectors = self._eigen(speed, num_modes=num_modes, sparse=sparse, synchronous=synchronous) + evalues, evectors = self._eigen( + speed, num_modes=num_modes, sparse=sparse, synchronous=synchronous + ) wn_len = num_modes // 2 wn = (np.absolute(evalues))[:wn_len] wd = (np.imag(evalues))[:wn_len] @@ -1259,7 +1261,14 @@ def _index(eigenvalues): @check_units def _eigen( - self, speed, num_modes=12, frequency=None, sorted_=True, A=None, sparse=True, synchronous=False + self, + speed, + num_modes=12, + frequency=None, + sorted_=True, + A=None, + sparse=True, + synchronous=False, ): """Calculate eigenvalues and eigenvectors. @@ -2232,7 +2241,9 @@ def run_ucs( bearings = [BearingElement(b.n, kxx=k, cxx=0) for b in bearings_elements] rotor = self.__class__(self.shaft_elements, self.disk_elements, bearings) speed = 0 - modal = rotor.run_modal(speed=speed, num_modes=num_modes, synchronous=synchronous) + modal = rotor.run_modal( + speed=speed, num_modes=num_modes, synchronous=synchronous + ) rotor_wn[:, i] = modal.wn[::2] bearing0 = bearings_elements[0] @@ -2278,7 +2289,9 @@ def run_ucs( bearing_elements=bearings, ) - modal_critical = rotor_critical.run_modal(speed=speed, synchronous=synchronous) + modal_critical = rotor_critical.run_modal( + speed=speed, synchronous=synchronous + ) critical_points_modal.append(modal_critical) From a1e75cac2aa6599d6fb6567cc9222273158cd755 Mon Sep 17 00:00:00 2001 From: raphaeltimbo Date: Mon, 28 Nov 2022 22:57:16 -0300 Subject: [PATCH 04/15] Add test to run_ucs synchronous --- ross/tests/test_rotor_assembly.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ross/tests/test_rotor_assembly.py b/ross/tests/test_rotor_assembly.py index d7b70d890..b23357b0c 100644 --- a/ross/tests/test_rotor_assembly.py +++ b/ross/tests/test_rotor_assembly.py @@ -1759,6 +1759,21 @@ def test_ucs_calc(rotor8): ucs_results.intersection_points["y"][:3], exp_intersection_points_y, rtol=1e-3 ) + ucs_results = rotor8.run_ucs(synchronous=True) + exp_rotor_wn = np.array([86.90425, 96.074398, 102.443684]) + exp_intersection_points_x = np.array( + [10058123.652648, 10058123.652648, 10363082.398797] + ) + exp_intersection_points_y = np.array([108.307651, 108.307651, 413.276569]) + assert_allclose(ucs_results.stiffness_log[:3], exp_stiffness_range) + assert_allclose(ucs_results.wn[0, :3], exp_rotor_wn) + assert_allclose( + ucs_results.intersection_points["x"][:3], exp_intersection_points_x, rtol=1e-3 + ) + assert_allclose( + ucs_results.intersection_points["y"][:3], exp_intersection_points_y, rtol=1e-3 + ) + def test_ucs_rotor9(rotor9): ucs_results = rotor9.run_ucs(num_modes=32) From c6eb9436c6489ee0a4b3706b9318cb9ad5fc3db2 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Tue, 10 Jan 2023 20:26:24 -0300 Subject: [PATCH 05/15] Correction of the UCS map --- ross/rotor_assembly.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index f20a0fd82..bec45f203 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -1313,18 +1313,32 @@ def _eigen( if A is None: A = self.A(speed=speed, frequency=frequency, synchronous=synchronous) - if sparse is True: - try: - evalues, evectors = las.eigs( - A, k=num_modes, sigma=0, ncv=2 * num_modes, which="LM", v0=self._v0 - ) - # store v0 as a linear combination of the previously - # calculated eigenvectors to use in the next call to eigs - self._v0 = np.real(sum(evectors.T)) - except las.ArpackError: - evalues, evectors = la.eig(A) - else: + if synchronous: evalues, evectors = la.eig(A) + idx = np.where(np.imag(evalues) != 0)[0] + evalues = evalues[idx] + evectors = evectors[:, idx] + idx = np.where(np.abs(np.real(evalues) / np.imag(evalues)) < 1000)[0] + evalues = evalues[idx] + evectors = evectors[:, idx] + else: + if sparse is True: + try: + evalues, evectors = las.eigs( + A, + k=num_modes, + sigma=0, + ncv=2 * num_modes, + which="LM", + v0=self._v0, + ) + # store v0 as a linear combination of the previously + # calculated eigenvectors to use in the next call to eigs + self._v0 = np.real(sum(evectors.T)) + except las.ArpackError: + evalues, evectors = la.eig(A) + else: + evalues, evectors = la.eig(A) if sorted_ is False: return evalues, evectors From a242072a9f11d444708bdc790e29bce243e09c11 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Wed, 11 Jan 2023 19:19:42 -0300 Subject: [PATCH 06/15] Updated code --- ross/rotor_assembly.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index bec45f203..134c443c4 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -2303,9 +2303,7 @@ def run_ucs( bearing_elements=bearings, ) - modal_critical = rotor_critical.run_modal( - speed=speed, synchronous=synchronous - ) + modal_critical = rotor_critical.run_modal(speed=speed) critical_points_modal.append(modal_critical) From a074b7ea77a497ac46a5b66d93425255e5a40cea Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Mon, 6 Feb 2023 17:32:49 -0300 Subject: [PATCH 07/15] UCS tests modified --- ross/tests/test_rotor_assembly.py | 703 +++++++++++++++++++++++++++--- 1 file changed, 639 insertions(+), 64 deletions(-) diff --git a/ross/tests/test_rotor_assembly.py b/ross/tests/test_rotor_assembly.py index b23357b0c..ec0b26994 100644 --- a/ross/tests/test_rotor_assembly.py +++ b/ross/tests/test_rotor_assembly.py @@ -1724,85 +1724,660 @@ def rotor8(): def test_ucs_calc_rotor2(rotor2): - ucs_results = rotor2.run_ucs() - expected_intersection_points_y = [ - 215.37072557303264, - 215.37072557303264, - 598.024741157381, - 598.024741157381, - 3956.224979518562, - 3956.224979518562, - 4965.289823255782, - 4965.289823255782, - ] - assert_allclose( - ucs_results.intersection_points["y"], expected_intersection_points_y + exp_rotor_wn = np.array( + [ + [ + 215.37072557, + 283.80994851, + 366.86912206, + 460.53914551, + 555.6339197, + 640.32650515, + 706.0780713, + 751.34310872, + 779.83176945, + 796.72990074, + 806.39721162, + 811.81289519, + 814.81102149, + 816.45987555, + 817.36339085, + 817.85749941, + 818.1274194, + 818.27478247, + 818.35520922, + 818.39909624, + ], + [ + 598.02474114, + 799.46636352, + 1057.70436175, + 1373.74248509, + 1729.64320906, + 2079.77186424, + 2367.99373458, + 2567.69744007, + 2690.52418862, + 2761.4174174, + 2801.13738888, + 2823.0913233, + 2835.14811303, + 2841.74862093, + 2845.35623074, + 2847.32634838, + 2848.40174108, + 2848.98860223, + 2849.30882097, + 2849.4835338, + ], + [ + 3956.224973, + 4062.07552707, + 4249.58400228, + 4573.6000451, + 5112.58991935, + 5963.9057796, + 7227.66815371, + 8977.98586645, + 11209.15347504, + 13742.89203466, + 16175.83274873, + 18056.34394912, + 19282.21914334, + 20006.24626009, + 20414.15343628, + 20639.66981718, + 20763.42435719, + 20831.12561174, + 20868.11080392, + 20888.30264105, + ], + [ + 4965.28982295, + 5025.38045612, + 5136.67510967, + 5343.17672239, + 5723.17881707, + 6398.10091437, + 7508.44360294, + 9150.62680727, + 11311.73143116, + 13795.63516793, + 16186.47408516, + 18081.26060018, + 19332.61770536, + 20072.40777584, + 20489.35934417, + 20719.90875241, + 20846.4293277, + 20915.646125, + 20953.45866009, + 20974.10006581, + ], + ] ) - fig = ucs_results.plot() - assert_allclose(fig.data[4]["y"], expected_intersection_points_y) + ucs_results = rotor2.run_ucs() + assert_allclose(ucs_results.wn, exp_rotor_wn) def test_ucs_calc(rotor8): - exp_stiffness_range = np.array([1000000.0, 1832980.710832, 3359818.286284]) - exp_rotor_wn = np.array([86.658114, 95.660573, 101.868254]) - exp_intersection_points_x = np.array( - [10058123.652648, 10058123.652648, 10363082.398797] + exp_rotor_wn = np.array( + [ + [ + 86.65811435, + 95.66057326, + 101.86825429, + 105.77854216, + 108.09888143, + 109.42658356, + 110.17043717, + 110.58225348, + 110.80874181, + 110.93285112, + 111.00072364, + 111.03780095, + 111.05804338, + 111.06909117, + 111.07511968, + 111.07840898, + 111.0802036, + 111.08118271, + 111.08171688, + 111.0820083, + ], + [ + 274.31285391, + 325.11814102, + 366.19875009, + 394.79384259, + 412.67726755, + 423.17290554, + 429.12464766, + 432.439225, + 434.26762238, + 435.27109643, + 435.82032762, + 436.12049426, + 436.28441024, + 436.37388292, + 436.42270952, + 436.44935147, + 436.46388748, + 436.47181809, + 436.47614484, + 436.47850536, + ], + [ + 716.78631221, + 838.8349461, + 975.91941882, + 1094.44878855, + 1172.5681763, + 1216.43412434, + 1239.90023448, + 1252.41864548, + 1259.14192099, + 1262.77498349, + 1264.74615415, + 1265.81822821, + 1266.4021086, + 1266.72035103, + 1266.89388148, + 1266.98852606, + 1267.04015246, + 1267.06831513, + 1267.08367898, + 1267.09206063, + ], + [ + 1066.1562004, + 1194.71380733, + 1383.21963246, + 1611.2607587, + 1811.78963328, + 1932.88449588, + 1992.93768733, + 2022.35515478, + 2037.28135654, + 2045.0830944, + 2049.23769603, + 2051.47407412, + 2052.68517943, + 2053.34324267, + 2053.70146233, + 2053.89665559, + 2054.00307642, + 2054.06111426, + 2054.09277044, + 2054.11003892, + ], + ] ) - exp_intersection_points_y = np.array([107.542416, 107.542416, 409.451575]) ucs_results = rotor8.run_ucs() - assert_allclose(ucs_results.stiffness_log[:3], exp_stiffness_range) - assert_allclose(ucs_results.wn[0, :3], exp_rotor_wn) - assert_allclose( - ucs_results.intersection_points["x"][:3], exp_intersection_points_x, rtol=1e-3 - ) - assert_allclose( - ucs_results.intersection_points["y"][:3], exp_intersection_points_y, rtol=1e-3 - ) + assert_allclose(ucs_results.wn, exp_rotor_wn) - ucs_results = rotor8.run_ucs(synchronous=True) - exp_rotor_wn = np.array([86.90425, 96.074398, 102.443684]) - exp_intersection_points_x = np.array( - [10058123.652648, 10058123.652648, 10363082.398797] - ) - exp_intersection_points_y = np.array([108.307651, 108.307651, 413.276569]) - assert_allclose(ucs_results.stiffness_log[:3], exp_stiffness_range) - assert_allclose(ucs_results.wn[0, :3], exp_rotor_wn) - assert_allclose( - ucs_results.intersection_points["x"][:3], exp_intersection_points_x, rtol=1e-3 - ) - assert_allclose( - ucs_results.intersection_points["y"][:3], exp_intersection_points_y, rtol=1e-3 + exp_rotor_wn = np.array( + [ + [ + 86.90424993, + 96.07439757, + 102.44368355, + 106.4793955, + 108.88395104, + 110.26337332, + 111.03737524, + 111.46625295, + 111.70223863, + 111.83158678, + 111.9023347, + 111.94098589, + 111.96208851, + 111.97360604, + 111.97989096, + 111.98332019, + 111.98519116, + 111.98621193, + 111.98676882, + 111.98707265, + ], + [ + 288.61681387, + 340.2268304, + 381.1079096, + 409.06350367, + 426.3367896, + 436.40207642, + 442.08713715, + 445.24635051, + 446.98699943, + 447.94170533, + 448.46406291, + 448.7494886, + 448.90533871, + 448.99040391, + 449.03682385, + 449.0621522, + 449.07597137, + 449.08351086, + 449.0876242, + 449.08986829, + ], + [ + 925.78185127, + 1119.90966576, + 1392.50590974, + 1750.68004093, + 2182.08834741, + 2636.00694936, + 3028.14253213, + 3302.1410502, + 3467.15137752, + 3559.91633393, + 3610.85969755, + 3638.66057974, + 3653.81442223, + 3662.07522778, + 3666.57962529, + 3669.03626937, + 3670.37627387, + 3671.10725248, + 3671.50602247, + 3671.7235685, + ], + [ + 1115.3680757, + 1270.72738636, + 1513.13125359, + 1856.25476513, + 2290.15538281, + 2763.19618667, + 3184.21829185, + 3484.87824235, + 3668.02539976, + 3771.4613247, + 3828.36052651, + 3859.4312424, + 3876.3717534, + 3885.60756849, + 3890.6438837, + 3893.39070372, + 3894.889009, + 3895.70634721, + 3896.15223096, + 3896.3954801, + ], + ] ) + ucs_results = rotor8.run_ucs(synchronous=True) + assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-3) def test_ucs_rotor9(rotor9): + exp_rotor_wn = np.array( + [ + [ + 89.61923785, + 120.89655744, + 162.59246556, + 217.425531, + 287.64594654, + 372.93534774, + 466.25814268, + 551.40762697, + 613.12372592, + 650.46897865, + 671.24798007, + 682.53537749, + 688.64859296, + 691.96547755, + 693.76881819, + 694.7506708, + 695.285721, + 695.57743822, + 695.73653186, + 695.82331031, + ], + [ + 124.81086082, + 168.92618198, + 228.57530222, + 309.1399173, + 417.73370517, + 563.55369388, + 757.94393269, + 1013.34629559, + 1338.33336355, + 1716.48711759, + 2004.84715555, + 2078.87616065, + 2097.72539858, + 2104.92507293, + 2108.22480935, + 2109.87062855, + 2110.72694071, + 2111.18237167, + 2111.42744318, + 2111.56014974, + ], + [ + 976.61001493, + 979.80715967, + 985.74354414, + 996.8720841, + 1018.04353872, + 1059.04002181, + 1138.83365402, + 1287.13960311, + 1530.72813068, + 1866.60041718, + 2224.74095549, + 2566.15214639, + 2812.55685454, + 2954.95682486, + 3030.88283515, + 3070.97419313, + 3092.32848217, + 3103.80664324, + 3110.01486765, + 3113.38540522, + ], + [ + 2159.6407481, + 2159.75647029, + 2159.9699711, + 2160.36603438, + 2161.10827679, + 2162.5260229, + 2165.33441045, + 2171.31311788, + 2186.13480083, + 2238.18713736, + 2490.96139533, + 2978.35425554, + 3456.78057965, + 3814.95999654, + 4040.90821429, + 4171.39629362, + 4244.09187063, + 4284.06293966, + 4305.93731562, + 4317.88700523, + ], + [ + 3853.46210184, + 3854.08548114, + 3855.22925572, + 3857.32967442, + 3861.19258844, + 3868.31615447, + 3881.5147837, + 3906.16285386, + 3952.73774363, + 4041.84088253, + 4211.14623982, + 4507.4924533, + 4926.04159776, + 5364.12923278, + 5712.67262402, + 5942.70497938, + 6079.91287023, + 6157.94796105, + 6201.38332616, + 6225.31959058, + ], + [ + 6455.7326613, + 6456.70723425, + 6458.49360217, + 6461.7679455, + 6467.76943373, + 6478.76847016, + 6498.92151342, + 6535.81499076, + 6603.16996609, + 6725.07300306, + 6939.94970666, + 7292.32740927, + 7784.69039169, + 8316.94975504, + 8752.6829863, + 9042.91526691, + 9215.62482285, + 9313.34492171, + 9367.50236286, + 9397.26223449, + ], + [ + 9356.6100194, + 9357.54008845, + 9359.24476542, + 9362.37006398, + 9368.09992065, + 9378.60761066, + 9397.88126005, + 9433.25152721, + 9498.18943165, + 9617.35925395, + 9835.00323507, + 10224.31117917, + 10874.66218842, + 11785.95798911, + 12676.05543746, + 13183.21883091, + 13402.61033914, + 13504.26586912, + 13555.18339302, + 13581.75044573, + ], + [ + 12110.407594, + 12110.95289427, + 12111.95232896, + 12113.78349773, + 12117.13906658, + 12123.28295266, + 12134.52660186, + 12155.06600786, + 12192.46531244, + 12260.08124223, + 12380.33340144, + 12585.92784295, + 12907.4048289, + 13341.47035551, + 13891.26716032, + 14550.26698271, + 15084.82353094, + 15411.31856539, + 15592.26640948, + 15690.26281893, + ], + ] + ) ucs_results = rotor9.run_ucs(num_modes=32) - fig = ucs_results.plot() - expected_x = np.array( + assert_allclose(ucs_results.wn, exp_rotor_wn) + + exp_rotor_wn = np.array( [ - 1.00000000e06, - 1.83298071e06, - 3.35981829e06, - 6.15848211e06, - 1.12883789e07, - 2.06913808e07, - 3.79269019e07, - 6.95192796e07, - 1.27427499e08, - 2.33572147e08, - 4.28133240e08, - 7.84759970e08, - 1.43844989e09, - 2.63665090e09, - 4.83293024e09, - 8.85866790e09, - 1.62377674e10, - 2.97635144e10, - 5.45559478e10, - 1.00000000e11, + [ + 89.61947067, + 120.8974189, + 162.5960395, + 217.44095697, + 287.71229813, + 373.20676064, + 467.2243615, + 554.0117419, + 618.0228653, + 657.38198265, + 679.5050572, + 691.58822265, + 698.15087843, + 701.7168497, + 703.6571225, + 704.71396966, + 705.29001687, + 705.60412457, + 705.77544066, + 705.86888929, + ], + [ + 126.0890214, + 170.65739194, + 230.92107316, + 312.32101393, + 422.05546023, + 569.4514242, + 766.09122049, + 1025.02536232, + 1357.18701995, + 1759.29639867, + 2139.22396753, + 2225.7223414, + 2241.24852987, + 2246.71661806, + 2249.14967665, + 2250.34715923, + 2250.96610867, + 2251.29417728, + 2251.47039346, + 2251.56572169, + ], + [ + 1006.73169609, + 1010.040964, + 1016.17901979, + 1027.66388689, + 1049.44232449, + 1091.39953213, + 1172.55460038, + 1322.87033842, + 1570.73575289, + 1916.3041552, + 2265.7169214, + 2655.54276612, + 2969.42618148, + 3163.00092966, + 3269.2557514, + 3325.84538209, + 3356.03761951, + 3372.26520963, + 3381.03936788, + 3385.80171303, + ], + [ + 2282.84557623, + 2282.91523733, + 2283.04371522, + 2283.28189567, + 2283.72771553, + 2284.57736125, + 2286.25338979, + 2289.79373787, + 2298.45136457, + 2328.81587058, + 2527.0040818, + 3011.54457199, + 3511.90570423, + 3911.96812761, + 4184.16765929, + 4351.24520861, + 4448.09334558, + 4502.60333614, + 4532.82984385, + 4549.46314869, + ], + [ + 4245.7271474, + 4246.2947522, + 4247.33592245, + 4249.24676828, + 4252.75746497, + 4259.21954321, + 4271.15319412, + 4293.3127077, + 4334.80387526, + 4413.21239715, + 4561.02893185, + 4824.7964076, + 5222.03154964, + 5676.38734556, + 6071.02781164, + 6351.49195348, + 6527.98091417, + 6631.85212842, + 6690.85488773, + 6723.74898557, + ], + [ + 7611.13371369, + 7612.04494313, + 7613.71440723, + 7616.77206839, + 7622.36827171, + 7632.5976041, + 7651.25153039, + 7685.11581167, + 7746.06162869, + 7853.87717877, + 8038.11142569, + 8332.01598354, + 8745.78266417, + 9227.31947169, + 9674.31098678, + 10012.64104008, + 10234.44326808, + 10367.99569896, + 10444.78272378, + 10487.86639818, + ], + [ + 12409.29311809, + 12410.39659237, + 12412.41831682, + 12416.12049691, + 12422.89462665, + 12435.2714055, + 12457.82332152, + 12498.70896845, + 12572.13830401, + 12701.69123884, + 12922.65167887, + 13276.09488926, + 13779.57457996, + 14375.46492934, + 14931.55744534, + 15346.00574748, + 15610.74473501, + 15766.45731869, + 15854.53209819, + 15903.45161118, + ], + [ + 16965.61287956, + 16966.89728329, + 16969.25012726, + 16973.56084112, + 16981.45544042, + 16995.90314455, + 17022.30755287, + 17070.44173261, + 17157.76611784, + 17314.7054629, + 17591.49482152, + 18061.24561207, + 18798.88181738, + 19797.261162, + 20845.68079645, + 21634.15925076, + 22090.48820466, + 22330.35150212, + 22455.69687753, + 22522.08463551, + ], ] ) - assert_allclose(fig.data[0]["x"], expected_x) + ucs_results = rotor9.run_ucs(num_modes=32, synchronous=True) + assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-3) def test_pickle(rotor8): From 70c50dd7fb9291fc1861ccd381fe4b4cd1675a73 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Wed, 15 Mar 2023 19:25:05 -0300 Subject: [PATCH 08/15] UCS tests update --- ross/tests/test_rotor_assembly.py | 443 ++++++++++++++++++------------ 1 file changed, 269 insertions(+), 174 deletions(-) diff --git a/ross/tests/test_rotor_assembly.py b/ross/tests/test_rotor_assembly.py index ec0b26994..76280877a 100644 --- a/ross/tests/test_rotor_assembly.py +++ b/ross/tests/test_rotor_assembly.py @@ -1817,6 +1817,101 @@ def test_ucs_calc_rotor2(rotor2): ] ) ucs_results = rotor2.run_ucs() + assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-6) + + exp_rotor_wn = np.array( + [ + [ + 2.15371329e02, + 2.83812357e02, + 3.66877867e02, + 4.60566615e02, + 5.55704705e02, + 6.40471324e02, + 7.06315117e02, + 7.51667171e02, + 7.80222437e02, + 7.97164913e02, + 8.06859321e02, + 8.12290756e02, + 8.15297782e02, + 8.16951585e02, + 8.17857830e02, + 8.18353436e02, + 8.18624175e02, + 8.18771986e02, + 8.18852657e02, + 8.18896678e02, + ], + [ + 1.88802037e03, + 2.28476088e03, + 2.78000154e03, + 3.41117879e03, + 4.23129187e03, + 5.31089177e03, + 6.73193403e03, + 8.56265868e03, + 1.08004453e04, + 1.32860389e04, + 1.56703469e04, + 1.75831951e04, + 1.88890430e04, + 1.96891387e04, + 2.01514788e04, + 2.04110573e04, + 2.05547675e04, + 2.06337750e04, + 2.06770552e04, + 2.07007192e04, + ], + [ + 4.00701928e03, + 4.11399080e03, + 4.30342165e03, + 4.63058499e03, + 5.17436636e03, + 6.03219769e03, + 7.30332537e03, + 9.05967180e03, + 1.12948065e04, + 1.38430517e04, + 1.63370844e04, + 1.83684523e04, + 1.97674949e04, + 2.06278515e04, + 2.11255558e04, + 2.14050391e04, + 2.15597608e04, + 2.16448157e04, + 2.16914058e04, + 2.17168786e04, + ], + [ + 3.75678825e04, + 3.75949522e04, + 3.76446065e04, + 3.77357411e04, + 3.79031768e04, + 3.82113096e04, + 3.87797759e04, + 3.98314192e04, + 4.17770276e04, + 4.53362190e04, + 5.16143414e04, + 6.19874527e04, + 7.79184129e04, + 1.01059654e05, + 1.33577562e05, + 1.78470328e05, + 2.39880642e05, + 3.23483351e05, + 4.37008883e05, + 5.90956828e05, + ], + ] + ) + ucs_results = rotor2.run_ucs(synchronous=True) assert_allclose(ucs_results.wn, exp_rotor_wn) @@ -1967,22 +2062,22 @@ def test_ucs_calc(rotor8): 1119.90966576, 1392.50590974, 1750.68004093, - 2182.08834741, + 2182.0883474, 2636.00694936, - 3028.14253213, + 3028.14253219, 3302.1410502, 3467.15137752, - 3559.91633393, - 3610.85969755, - 3638.66057974, - 3653.81442223, - 3662.07522778, - 3666.57962529, - 3669.03626937, + 3559.91633395, + 3610.85969749, + 3638.66057981, + 3653.81442225, + 3662.07522781, + 3666.57962521, + 3669.03626945, 3670.37627387, - 3671.10725248, - 3671.50602247, - 3671.7235685, + 3671.10725239, + 3671.50602245, + 3671.72356858, ], [ 1115.3680757, @@ -1991,25 +2086,25 @@ def test_ucs_calc(rotor8): 1856.25476513, 2290.15538281, 2763.19618667, - 3184.21829185, - 3484.87824235, - 3668.02539976, - 3771.4613247, - 3828.36052651, - 3859.4312424, - 3876.3717534, - 3885.60756849, - 3890.6438837, + 3184.21829187, + 3484.87824241, + 3668.02539974, + 3771.46132472, + 3828.3605264, + 3859.43124229, + 3876.37175328, + 3885.60756844, + 3890.64388364, 3893.39070372, - 3894.889009, - 3895.70634721, - 3896.15223096, - 3896.3954801, + 3894.8890089, + 3895.7063473, + 3896.15223098, + 3896.39548013, ], ] ) ucs_results = rotor8.run_ucs(synchronous=True) - assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-3) + assert_allclose(ucs_results.wn, exp_rotor_wn) def test_ucs_rotor9(rotor9): @@ -2199,185 +2294,185 @@ def test_ucs_rotor9(rotor9): exp_rotor_wn = np.array( [ [ - 89.61947067, - 120.8974189, + 89.61947064, + 120.89741889, 162.5960395, - 217.44095697, - 287.71229813, - 373.20676064, - 467.2243615, - 554.0117419, + 217.44095694, + 287.71229812, + 373.20676063, + 467.22436151, + 554.01174191, 618.0228653, - 657.38198265, + 657.38198264, 679.5050572, - 691.58822265, + 691.58822264, 698.15087843, - 701.7168497, - 703.6571225, + 701.71684971, + 703.65712249, 704.71396966, 705.29001687, - 705.60412457, - 705.77544066, + 705.60412456, + 705.77544067, 705.86888929, ], [ - 126.0890214, - 170.65739194, - 230.92107316, - 312.32101393, - 422.05546023, - 569.4514242, - 766.09122049, - 1025.02536232, - 1357.18701995, - 1759.29639867, - 2139.22396753, - 2225.7223414, + 126.08902147, + 170.65739193, + 230.92107312, + 312.32101392, + 422.05546021, + 569.45142419, + 766.09122048, + 1025.02536231, + 1357.18701994, + 1759.29639866, + 2139.22396755, + 2225.72234144, 2241.24852987, - 2246.71661806, - 2249.14967665, - 2250.34715923, - 2250.96610867, - 2251.29417728, + 2246.71661805, + 2249.14967666, + 2250.34715925, + 2250.96610863, + 2251.29417729, 2251.47039346, 2251.56572169, ], [ - 1006.73169609, - 1010.040964, - 1016.17901979, + 1006.73169597, + 1010.04096437, + 1016.17902002, 1027.66388689, - 1049.44232449, - 1091.39953213, + 1049.44232444, + 1091.39953214, 1172.55460038, - 1322.87033842, - 1570.73575289, + 1322.87033841, + 1570.73575288, 1916.3041552, - 2265.7169214, - 2655.54276612, - 2969.42618148, - 3163.00092966, - 3269.2557514, - 3325.84538209, - 3356.03761951, - 3372.26520963, - 3381.03936788, - 3385.80171303, + 2265.71692139, + 2655.54276614, + 2969.42618151, + 3163.00092959, + 3269.25575144, + 3325.84538219, + 3356.03761948, + 3372.26520948, + 3381.03936768, + 3385.80171304, ], [ - 2282.84557623, - 2282.91523733, - 2283.04371522, - 2283.28189567, - 2283.72771553, - 2284.57736125, - 2286.25338979, - 2289.79373787, - 2298.45136457, - 2328.81587058, - 2527.0040818, - 3011.54457199, - 3511.90570423, - 3911.96812761, - 4184.16765929, - 4351.24520861, - 4448.09334558, - 4502.60333614, - 4532.82984385, - 4549.46314869, + 2282.84557629, + 2282.91523796, + 2283.04371506, + 2283.28189556, + 2283.72771552, + 2284.57736115, + 2286.25338975, + 2289.79373785, + 2298.45136454, + 2328.81587039, + 2527.00408181, + 3011.54457196, + 3511.90570401, + 3911.96812784, + 4184.16765863, + 4351.24520897, + 4448.09334563, + 4502.60333569, + 4532.82984364, + 4549.46314886, ], [ - 4245.7271474, - 4246.2947522, - 4247.33592245, - 4249.24676828, - 4252.75746497, - 4259.21954321, - 4271.15319412, - 4293.3127077, - 4334.80387526, - 4413.21239715, - 4561.02893185, - 4824.7964076, - 5222.03154964, - 5676.38734556, - 6071.02781164, - 6351.49195348, - 6527.98091417, - 6631.85212842, - 6690.85488773, - 6723.74898557, + 4245.7271403, + 4246.29475546, + 4247.33591109, + 4249.24676697, + 4252.75746816, + 4259.21954318, + 4271.15319432, + 4293.31270755, + 4334.80387528, + 4413.21239704, + 4561.02893175, + 4824.79640746, + 5222.03154965, + 5676.38734561, + 6071.02781163, + 6351.49195301, + 6527.98091463, + 6631.85212825, + 6690.85488765, + 6723.74898588, ], [ - 7611.13371369, - 7612.04494313, - 7613.71440723, - 7616.77206839, - 7622.36827171, - 7632.5976041, - 7651.25153039, - 7685.11581167, - 7746.06162869, - 7853.87717877, - 8038.11142569, - 8332.01598354, - 8745.78266417, - 9227.31947169, - 9674.31098678, - 10012.64104008, - 10234.44326808, - 10367.99569896, - 10444.78272378, - 10487.86639818, + 7611.13371045, + 7612.04492313, + 7613.71441629, + 7616.77206799, + 7622.36827204, + 7632.5976039, + 7651.25153066, + 7685.11581146, + 7746.06162547, + 7853.87718066, + 8038.11142543, + 8332.01598342, + 8745.7826638, + 9227.31947118, + 9674.31098643, + 10012.64104038, + 10234.44326861, + 10367.99569964, + 10444.78272419, + 10487.86639878, ], [ - 12409.29311809, - 12410.39659237, - 12412.41831682, - 12416.12049691, - 12422.89462665, - 12435.2714055, - 12457.82332152, - 12498.70896845, - 12572.13830401, - 12701.69123884, - 12922.65167887, - 13276.09488926, - 13779.57457996, - 14375.46492934, - 14931.55744534, - 15346.00574748, - 15610.74473501, - 15766.45731869, - 15854.53209819, - 15903.45161118, + 12409.29308927, + 12410.39662173, + 12412.41831965, + 12416.12050568, + 12422.89462321, + 12435.27140932, + 12457.82331724, + 12498.7089647, + 12572.13830817, + 12701.69123779, + 12922.65167833, + 13276.09488854, + 13779.57458094, + 14375.46493089, + 14931.55744653, + 15346.0057475, + 15610.74473549, + 15766.45731664, + 15854.5320987, + 15903.45161092, ], [ - 16965.61287956, - 16966.89728329, - 16969.25012726, - 16973.56084112, - 16981.45544042, - 16995.90314455, - 17022.30755287, - 17070.44173261, - 17157.76611784, - 17314.7054629, - 17591.49482152, - 18061.24561207, - 18798.88181738, - 19797.261162, - 20845.68079645, - 21634.15925076, - 22090.48820466, - 22330.35150212, - 22455.69687753, - 22522.08463551, + 16965.61328304, + 16966.89723962, + 16969.25010351, + 16973.56082693, + 16981.45546415, + 16995.9031366, + 17022.30753946, + 17070.44176132, + 17157.76608636, + 17314.70545972, + 17591.49482558, + 18061.245618, + 18798.88181722, + 19797.261159, + 20845.680798, + 21634.15925113, + 22090.48820368, + 22330.35150525, + 22455.69687602, + 22522.08463485, ], ] ) ucs_results = rotor9.run_ucs(num_modes=32, synchronous=True) - assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-3) + assert_allclose(ucs_results.wn, exp_rotor_wn) def test_pickle(rotor8): From 2bac55dcd187068ea569016e5b0e4a01595c2050 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Wed, 15 Mar 2023 20:19:28 -0300 Subject: [PATCH 09/15] UCS tests update --- ross/tests/test_rotor_assembly.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ross/tests/test_rotor_assembly.py b/ross/tests/test_rotor_assembly.py index 305e5dac1..f83aff40a 100644 --- a/ross/tests/test_rotor_assembly.py +++ b/ross/tests/test_rotor_assembly.py @@ -2289,7 +2289,7 @@ def test_ucs_rotor9(rotor9): ] ) ucs_results = rotor9.run_ucs(num_modes=32) - assert_allclose(ucs_results.wn, exp_rotor_wn) + assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-6) exp_rotor_wn = np.array( [ @@ -2472,7 +2472,7 @@ def test_ucs_rotor9(rotor9): ] ) ucs_results = rotor9.run_ucs(num_modes=32, synchronous=True) - assert_allclose(ucs_results.wn, exp_rotor_wn) + assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-6) def test_pickle(rotor8): From 5b22e74542e7ab5ef51650c41027d3dffdda193f Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Sat, 25 Mar 2023 20:53:31 -0300 Subject: [PATCH 10/15] Code structure change --- ross/rotor_assembly.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index 3e0ed413f..d94a2b1e1 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -2255,9 +2255,8 @@ def run_ucs( for i, k in enumerate(stiffness_log): bearings = [BearingElement(b.n, kxx=k, cxx=0) for b in bearings_elements] rotor = self.__class__(self.shaft_elements, self.disk_elements, bearings) - speed = 0 modal = rotor.run_modal( - speed=speed, num_modes=num_modes, synchronous=synchronous + speed=0, num_modes=num_modes, synchronous=synchronous ) rotor_wn[:, i] = modal.wn[::2] From 8933562e16248639ef11f33a2e9a69ab01d28dbe Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Mon, 27 Mar 2023 16:23:31 -0300 Subject: [PATCH 11/15] Disk element update --- ross/disk_element.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ross/disk_element.py b/ross/disk_element.py index 1a8c99658..4d3a3f090 100644 --- a/ross/disk_element.py +++ b/ross/disk_element.py @@ -89,11 +89,21 @@ def __eq__(self, other): True """ false_number = 0 - for i in self.__dict__: - try: - self.__dict__[i] == other.__dict__[i] - except: - false_number += 1 + if other.__class__.__name__ == "DiskElement": + for i in self.__dict__: + try: + if np.allclose(self.__dict__[i], other.__dict__[i]): + pass + else: + false_number += 1 + + except TypeError: + if self.__dict__[i] == other.__dict__[i]: + pass + else: + false_number += 1 + else: + false_number += 1 if false_number == 0: return True From 0a11c0cbe793e39ad7f83851df1f70ceb0f35433 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Tue, 28 Mar 2023 17:09:48 -0300 Subject: [PATCH 12/15] Disk element update --- ross/disk_element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ross/disk_element.py b/ross/disk_element.py index 4d3a3f090..63a7e4e4a 100644 --- a/ross/disk_element.py +++ b/ross/disk_element.py @@ -89,7 +89,7 @@ def __eq__(self, other): True """ false_number = 0 - if other.__class__.__name__ == "DiskElement": + if "DiskElement" in other.__class__.__name__: for i in self.__dict__: try: if np.allclose(self.__dict__[i], other.__dict__[i]): From 0fbdf397ddc185b9a1c63273db47341385954596 Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Mon, 15 May 2023 18:19:54 -0300 Subject: [PATCH 13/15] Branch restored --- docs/references.bib | 11 +++++++++++ ross/rotor_assembly.py | 12 ++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/references.bib b/docs/references.bib index 4281c45e5..a31e5ba8b 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -720,3 +720,14 @@ @article{genta1988conical journal = {Journal of Sound and Vibration}, doi = {10.1016/0022-460X(88)90342-2} } + +@article{rouch1980dynamic, +author = {Rouch, K. E. and Kao, J. S.}, +title = {Dynamic Reduction in Rotor Dynamics by the Finite Element Method}, +journal = {Journal of Mechanical Design}, +volume = {102}, +number = {2}, +pages = {360-368}, +year = {1980}, +doi = {10.1115/1.3254752} +} diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index 2c91ae12f..728b5e8fe 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -616,7 +616,7 @@ def run_modal(self, speed, num_modes=12, sparse=True, synchronous=False): eigenvectors. Default is True. synchronous : bool, optional - If True a synchronous analysis is carried out. + If True a synchronous analysis is carried out based on :cite:`rouch1980dynamic`. Default is False. Returns @@ -925,7 +925,7 @@ def M(self, frequency=None, synchronous=False): dofs = list(elm.dof_global_index.values()) if synchronous: if elm in self.shaft_elements: - M = elm.M() + M = elm.M(frequency) G = elm.G() for i in range(8): if i == 0 or i == 3 or i == 4 or i == 7: @@ -940,15 +940,15 @@ def M(self, frequency=None, synchronous=False): M[i, 6] = M[i, 6] - G[i, 7] M0[np.ix_(dofs, dofs)] += M elif elm in self.disk_elements: - M = elm.M() + M = elm.M(frequency) G = elm.G() M[2, 2] = M[2, 2] - G[2, 3] M[3, 3] = M[3, 3] + G[3, 2] M0[np.ix_(dofs, dofs)] += M else: - M0[np.ix_(dofs, dofs)] += elm.M() + M0[np.ix_(dofs, dofs)] += elm.M(frequency) else: - M0[np.ix_(dofs, dofs)] += elm.M() + M0[np.ix_(dofs, dofs)] += elm.M(frequency) return M0 @@ -1116,7 +1116,7 @@ def A(self, speed=0, frequency=None, synchronous=False): # fmt: off A = np.vstack( [np.hstack([Z, I]), - np.hstack([la.solve(-self.M(frequencysynchronous=synchronous), self.K(frequency) + self.Kst()*speed), la.solve(-self.M(frequencysynchronous=synchronous), (self.C(frequency) + self.G() * speed))])]) + np.hstack([la.solve(-self.M(frequency,synchronous=synchronous), self.K(frequency) + self.Kst()*speed), la.solve(-self.M(frequency,synchronous=synchronous), (self.C(frequency) + self.G() * speed))])]) # fmt: on return A From e4f04387f9107fe6927a8513308629b967d3d6fb Mon Sep 17 00:00:00 2001 From: fernandarossi Date: Mon, 15 May 2023 20:02:35 -0300 Subject: [PATCH 14/15] Corrections --- ross/rotor_assembly.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ross/rotor_assembly.py b/ross/rotor_assembly.py index 728b5e8fe..8addd71a7 100644 --- a/ross/rotor_assembly.py +++ b/ross/rotor_assembly.py @@ -616,7 +616,7 @@ def run_modal(self, speed, num_modes=12, sparse=True, synchronous=False): eigenvectors. Default is True. synchronous : bool, optional - If True a synchronous analysis is carried out based on :cite:`rouch1980dynamic`. + If True a synchronous analysis is carried out according to :cite:`rouch1980dynamic`. Default is False. Returns @@ -925,7 +925,10 @@ def M(self, frequency=None, synchronous=False): dofs = list(elm.dof_global_index.values()) if synchronous: if elm in self.shaft_elements: - M = elm.M(frequency) + try: + M = elm.M(frequency) + except TypeError: + M = elm.M() G = elm.G() for i in range(8): if i == 0 or i == 3 or i == 4 or i == 7: @@ -940,15 +943,24 @@ def M(self, frequency=None, synchronous=False): M[i, 6] = M[i, 6] - G[i, 7] M0[np.ix_(dofs, dofs)] += M elif elm in self.disk_elements: - M = elm.M(frequency) + try: + M = elm.M(frequency) + except TypeError: + M = elm.M() G = elm.G() M[2, 2] = M[2, 2] - G[2, 3] M[3, 3] = M[3, 3] + G[3, 2] M0[np.ix_(dofs, dofs)] += M else: - M0[np.ix_(dofs, dofs)] += elm.M(frequency) + try: + M0[np.ix_(dofs, dofs)] += elm.M(frequency) + except TypeError: + M0[np.ix_(dofs, dofs)] += elm.M() else: - M0[np.ix_(dofs, dofs)] += elm.M(frequency) + try: + M0[np.ix_(dofs, dofs)] += elm.M(frequency) + except TypeError: + M0[np.ix_(dofs, dofs)] += elm.M() return M0 From 8b76b9b3de1039b345a3e951be03030e73da280f Mon Sep 17 00:00:00 2001 From: frossi Date: Thu, 21 Mar 2024 14:30:34 -0300 Subject: [PATCH 15/15] Test ucs rotor 9 fixed --- ross/tests/test_rotor_assembly.py | 189 +++++++++++++++--------------- 1 file changed, 97 insertions(+), 92 deletions(-) diff --git a/ross/tests/test_rotor_assembly.py b/ross/tests/test_rotor_assembly.py index 657cf89b1..c9f8380e2 100644 --- a/ross/tests/test_rotor_assembly.py +++ b/ross/tests/test_rotor_assembly.py @@ -2217,9 +2217,102 @@ def test_ucs_calc(rotor8): def test_ucs_rotor9(rotor9): - ucs_results = rotor9.run_ucs(num_modes=8) - fig = ucs_results.plot() - expected_x = np.array( + exp_rotor_wn = np.array( + [ + [ + 89.61923784473375, + 120.89655743664413, + 162.59246554800114, + 217.42553100241312, + 287.6459465590863, + 372.935347725518, + 466.2581426686537, + 551.4076269641628, + 613.1237259191993, + 650.4689786203988, + 671.2479800816767, + 682.5353774789179, + 688.6485929814294, + 691.965477524608, + 693.7688181845082, + 694.7506707995042, + 695.2857209934174, + 695.577438207025, + 695.7365318523782, + 695.8233102639163, + ], + [ + 124.8108608009496, + 168.92618197956605, + 228.5753022242499, + 309.1399173060739, + 417.7337051968829, + 563.5536938601297, + 757.9439326311913, + 1013.3462956039914, + 1338.3333635278868, + 1716.48711727428, + 2004.8471556137, + 2078.8761601177744, + 2097.725398329982, + 2104.9250739620065, + 2108.224809182831, + 2109.8706285775806, + 2110.7269388638374, + 2111.182371668304, + 2111.427443127732, + 2111.5601496202053, + ], + [ + 976.610014941276, + 979.8071596437271, + 985.7435440438873, + 996.8720841293019, + 1018.0435385669914, + 1059.040021915284, + 1138.8336540231767, + 1287.1396017447778, + 1530.728131538211, + 1866.6004173519655, + 2224.740955271474, + 2566.1521460703593, + 2812.5568536324695, + 2954.956819348177, + 3030.8828351975917, + 3070.974195701119, + 3092.3284826481, + 3103.806643182663, + 3110.0148616594533, + 3113.3854057718704, + ], + [ + 2159.640747974065, + 2159.756470270719, + 2159.969971035258, + 2160.366035282546, + 2161.1082776995636, + 2162.5260227884364, + 2165.334410630516, + 2171.3131180341056, + 2186.1348008252444, + 2238.1871377763114, + 2490.9613952181917, + 2978.354255657329, + 3456.7805801535656, + 3814.959990456543, + 4040.908191796628, + 4171.396315088025, + 4244.09186723666, + 4284.062958149884, + 4305.937322108033, + 4317.887004191494, + ], + ] + ) + ucs_results = rotor9.run_ucs() + assert_allclose(ucs_results.wn, exp_rotor_wn) + + exp_rotor_wn = np.array( [ [ 89.61947064, @@ -2309,97 +2402,9 @@ def test_ucs_rotor9(rotor9): 4532.82984364, 4549.46314886, ], - [ - 4245.7271403, - 4246.29475546, - 4247.33591109, - 4249.24676697, - 4252.75746816, - 4259.21954318, - 4271.15319432, - 4293.31270755, - 4334.80387528, - 4413.21239704, - 4561.02893175, - 4824.79640746, - 5222.03154965, - 5676.38734561, - 6071.02781163, - 6351.49195301, - 6527.98091463, - 6631.85212825, - 6690.85488765, - 6723.74898588, - ], - [ - 7611.13371045, - 7612.04492313, - 7613.71441629, - 7616.77206799, - 7622.36827204, - 7632.5976039, - 7651.25153066, - 7685.11581146, - 7746.06162547, - 7853.87718066, - 8038.11142543, - 8332.01598342, - 8745.7826638, - 9227.31947118, - 9674.31098643, - 10012.64104038, - 10234.44326861, - 10367.99569964, - 10444.78272419, - 10487.86639878, - ], - [ - 12409.29308927, - 12410.39662173, - 12412.41831965, - 12416.12050568, - 12422.89462321, - 12435.27140932, - 12457.82331724, - 12498.7089647, - 12572.13830817, - 12701.69123779, - 12922.65167833, - 13276.09488854, - 13779.57458094, - 14375.46493089, - 14931.55744653, - 15346.0057475, - 15610.74473549, - 15766.45731664, - 15854.5320987, - 15903.45161092, - ], - [ - 16965.61328304, - 16966.89723962, - 16969.25010351, - 16973.56082693, - 16981.45546415, - 16995.9031366, - 17022.30753946, - 17070.44176132, - 17157.76608636, - 17314.70545972, - 17591.49482558, - 18061.245618, - 18798.88181722, - 19797.261159, - 20845.680798, - 21634.15925113, - 22090.48820368, - 22330.35150525, - 22455.69687602, - 22522.08463485, - ], ] ) - ucs_results = rotor9.run_ucs(num_modes=32, synchronous=True) + ucs_results = rotor9.run_ucs(synchronous=True) assert_allclose(ucs_results.wn, exp_rotor_wn, rtol=1e-6)