def test_boom_areas(self): # problem 20.1 taken from Megson. Solution is given on the book neutral_axis = (0, 1, 0) # set up boom architecture boom0 = boom.Boom(0, [0, 150], 1000, neutral_axis) boom1 = boom.Boom(1, [500, 150], 50 * 8 + 30 * 8, neutral_axis) boom2 = boom.Boom(2, [500, -150], 50 * 8 + 30 * 8, neutral_axis) boom3 = boom.Boom(3, [0, -150], 1000, neutral_axis) edge01 = edges.Edge([0, 1], 10, 500) edge03 = edges.Edge([0, 3], 10, 300) edge12 = edges.Edge([1, 2], 8, 300) edge23 = edges.Edge([2, 3], 10, 500) booms = [boom0, boom1, boom2, boom3] edge_list = [edge01, edge03, edge12, edge23] problem_20_1 = geometry.Geometry(4, booms, edge_list, [0.], 0.) problem_20_1.construct_geometry() # calculate boom area for each boom for element in booms: element.calculate_area(problem_20_1) self.assertTrue(abs(boom0.area - 4000) < 1) self.assertTrue(abs(boom0.area - boom3.area) < 0.01) self.assertTrue(abs(boom1.area - 3540) < 1) self.assertTrue(abs(boom1.area - boom2.area) < 0.01)
def test_areas_centroid_inertia(self): # following the example on slide 43 of https://www.slideshare.net/scemd3/lec6aircraft-structural-idealisation-1 # set up boom architecture neutral_axis = (0, 1, 0) boom0 = boom.Boom(0, [-250, 150], 1000, neutral_axis) boom1 = boom.Boom(1, [250, 150], 640, neutral_axis) boom2 = boom.Boom(2, [250, -150], 640, neutral_axis) boom3 = boom.Boom(3, [-250, -150], 1000, neutral_axis) edge01 = edges.Edge([0, 1], 10, 500) edge03 = edges.Edge([0, 3], 10, 300) edge12 = edges.Edge([1, 2], 8, 300) edge23 = edges.Edge([2, 3], 10, 500) # calculate area for each boom example_43 = geometry.Geometry(4, [boom0, boom1, boom2, boom3], [edge01, edge03, edge12, edge23], [0.0], 0.) example_43.construct_geometry() for element in [boom0, boom1, boom2, boom3]: element.calculate_area(example_43) # test the boom areas example_43.get_areas() self.assertTrue( abs(example_43.boom_areas[0] - example_43.boom_areas[3]) < 0.01 and abs(example_43.boom_areas[0] - 4000) < 0.01) self.assertTrue( abs(example_43.boom_areas[1] - example_43.boom_areas[1]) < 0.01 and abs(example_43.boom_areas[1] - 3540) < 0.01) # test centroid example_43.calc_centroid() self.assertTrue(abs(abs(example_43.centroid[0]) - 15.25) < 0.1) self.assertTrue(abs(abs(example_43.centroid[1]) - 0.0) < 0.1) # test moments of inertia example_43.moment_inertia_Izz() example_43.moment_inertia_Iyy() self.assertTrue(abs(example_43.Izz - 339300000) < 1) self.assertTrue(abs(example_43.Iyy - 938992042.5) < 1) self.assertTrue(abs(example_43.Izy) < 1)
def test_shear_flow_pure_torsion(self): # this problem is a generic pure torsion problem # initialise booms neutral_axis = (0, 1, 0) boom_list = [] boom0 = boom.Boom(0, [900, 250], 0.0, neutral_axis) boom_list.append(boom0) boom1 = boom.Boom(1, [900, -250], 0.0, neutral_axis) boom_list.append(boom1) boom2 = boom.Boom(2, [400, -250], 0.0, neutral_axis) boom_list.append(boom2) boom3 = boom.Boom(3, [0, -250], 0.0, neutral_axis) boom_list.append(boom3) boom4 = boom.Boom(4, [0, 250], 0.0, neutral_axis) boom_list.append(boom4) boom5 = boom.Boom(5, [400, 250], 0.0, neutral_axis) boom_list.append(boom5) # initialise edges edge_list = [] edge01 = edges.Edge([0, 1], 4, 500) edge_list.append(edge01) edge12 = edges.Edge([1, 2], 4, 500) edge_list.append(edge12) edge23 = edges.Edge([2, 3], 2, 400) edge_list.append(edge23) edge34 = edges.Edge([3, 4], 2, 500) edge_list.append(edge34) edge45 = edges.Edge([4, 5], 2, 400) edge_list.append(edge45) edge50 = edges.Edge([5, 0], 4, 500) edge_list.append(edge50) edge52 = edges.Edge([5, 2], 3, 500) edge_list.append(edge52) # initialise geometry problem_torsion = geometry.Geometry(6, boom_list, edge_list, [400 * 500, 500**2], 27 * 10**3) problem_torsion.cells = [[edge50, edge01, edge12, edge52], [edge45, edge52, edge34, edge23]] problem_torsion.construct_geometry() # calculate torsion shear flows problem_torsion_section = DiscreteSection.DiscreteSection( neutral_axis, problem_torsion) problem_torsion_section.calc_torsion_shear_flow(2.0329 * 10**9, edge52) # verify twist rate self.assertTrue( abs(problem_torsion_section.twist_rate * 10**5 - 8.73) < 1)
def add_successor(self, succID, edgeID=None): assert succID not in self.successors, "Vertex %d already has successor %d" % ( self.vertexID, succID) e = edges.Edge(succID, edgeID) self.successors[succID] = e
def add_predecessor(self, predID, edgeID=None): assert predID not in self.predecessors, "Vertex %d already has predecessor %d" % ( self.vertexID, predID) e = edges.Edge(predID, edgeID) self.predecessors[predID] = e
def test_shear_flow_pure_shear0(self): # following the problem 23.6 in Megson # set up booms and edges neutral_axis = (0, 1, 0) boom0 = boom.Boom(0, [1092, 153], 0.0, neutral_axis) boom1 = boom.Boom(1, [736, 153], 0.0, neutral_axis) boom2 = boom.Boom(2, [380, 153], 0.0, neutral_axis) boom3 = boom.Boom(3, [0, 153], 0.0, neutral_axis) boom4 = boom.Boom(4, [0, -153], 0.0, neutral_axis) boom5 = boom.Boom(5, [380, -153], 0.0, neutral_axis) boom6 = boom.Boom(6, [736, -153], 0.0, neutral_axis) boom7 = boom.Boom(7, [1092, -153], 0.0, neutral_axis) boom_list = [boom0, boom1, boom2, boom3, boom4, boom5, boom6, boom7] edge10 = edges.Edge([1, 0], 0.915, 356) edge07 = edges.Edge([0, 7], 1.250, 306) edge21 = edges.Edge([2, 1], 0.915, 356) edge32 = edges.Edge([3, 2], 0.783, 380) edge52 = edges.Edge([5, 2], 1.250, 306) edge34 = edges.Edge([3, 4], 1.250, 610) edge54 = edges.Edge([5, 4], 0.783, 380) edge65 = edges.Edge([6, 5], 0.915, 356) edge76 = edges.Edge([7, 6], 0.915, 356) edge_list = [ edge52, edge21, edge10, edge07, edge76, edge65, edge32, edge34, edge54 ] problem_23_6 = geometry.Geometry(8, boom_list, edge_list, [217872, 167780], 24.2 * 10**9) problem_23_6.cells = [[edge10, edge07, edge76, edge65, edge52, edge21], [edge34, edge32, edge52, edge54]] boom0.area = 1290 boom1.area = 645 boom2.area = 1290 boom3.area = 645 boom4.area = 645 boom5.area = 1290 boom6.area = 645 boom7.area = 1290 # calculate geometrical properties problem_23_6.get_areas() problem_23_6.construct_geometry() problem_23_6.calc_centroid() problem_23_6.moment_inertia_Iyy() problem_23_6.moment_inertia_Izz() for boom_element in boom_list: boom_element.calc_y_dist(problem_23_6) boom_element.calc_z_dist(problem_23_6) # test moment of inertia self.assertTrue(abs(problem_23_6.Izz * 10**(-6) - 181.2) < 1) # calculate shear flow due to shear forces problem_23_6_section = DiscreteSection.DiscreteSection( neutral_axis, problem_23_6) problem_23_6_section.calc_shear_flow_q_B(0, 66750, edge52) problem_23_6_section.calc_closed_section_pure_shear_flow_q_0(edge52) # test open section shear flow self.assertTrue(abs(edge10.q_B - 0.0) < 1) self.assertTrue(abs(edge07.q_B - (-72.6)) < 1) self.assertTrue(abs(edge32.q_B - (-36.2)) < 1) self.assertTrue(abs(edge21.q_B - 36.2) < 1) self.assertTrue(abs(edge34.q_B) < 0.1) self.assertTrue(abs(edge54.q_B - (-36.3)) < 1) self.assertTrue(abs(edge52.q_B - 145.3) < 1) self.assertTrue(abs(edge65.q_B - 36.3) < 1) self.assertTrue(abs(edge76.q_B) < 1) # test closed section shear flow self.assertTrue( abs(edge21.q_0 - (-39.2)) < 1 and abs(edge10.q_0 - (-39.2)) < 1 and abs(edge07.q_0 - (-39.2)) < 1 and abs(edge76.q_0 - (-39.2)) < 1 and abs(edge65.q_0 - (-39.2)) < 1) self.assertTrue( abs(edge32.q_0 - 17.8) < 1 and abs(edge34.q_0 - 17.8) < 1 and abs(edge54.q_0 - 17.8) < 1) self.assertTrue(abs(edge52.q_0 - (-57)) < 1)
def test_shear_flow_pure_shear1(self): # using problem 23.5 in Megson. Some sign conventions are switched for consistency. # initialise booms neutral_axis = (0, 1, 0) boom0 = boom.Boom(0, [-635, -127], 0.0, neutral_axis) boom1 = boom.Boom(1, [0, -203], 0.0, neutral_axis) boom2 = boom.Boom(2, [763, -101], 0.0, neutral_axis) boom3 = boom.Boom(3, [763, 101], 0.0, neutral_axis) boom4 = boom.Boom(4, [0, 203], 0.0, neutral_axis) boom5 = boom.Boom(5, [-635, 127], 0.0, neutral_axis) boom_list = [boom0, boom1, boom2, boom3, boom4, boom5] # initialise edges edge45 = edges.Edge([4, 5], 0.915, 647) edge14 = edges.Edge([1, 4], 2.032, 406) edge10 = edges.Edge([1, 0], 0.915, 647) edge05 = edges.Edge([0, 5], 1.625, 254) edge43 = edges.Edge([4, 3], 0.559, 775) edge32 = edges.Edge([3, 2], 1.220, 202) edge21 = edges.Edge([2, 1], 0.559, 775) edge_list = [edge45, edge14, edge10, edge05, edge43, edge32, edge21] # initialise Geometry problem_23_5 = geometry.Geometry(6, boom_list, edge_list, [232000, 258000], 1.0) problem_23_5.cells = [[edge43, edge32, edge21, edge14], [edge45, edge14, edge10, edge05]] # set boom areas to given values boom0.area = 1290 boom1.area = 1936 boom2.area = 645 boom3.area = 645 boom4.area = 1936 boom5.area = 1290 problem_23_5.get_areas() # calculate and verify geometrical properties problem_23_5.construct_geometry() problem_23_5.calc_centroid() problem_23_5.moment_inertia_Iyy() problem_23_5.moment_inertia_Izz() self.assertTrue(abs(problem_23_5.Izy < 1)) self.assertTrue(abs(problem_23_5.Izz * 10**(-6) - 214.3) < 1) for boom_element in boom_list: boom_element.calc_y_dist(problem_23_5) boom_element.calc_z_dist(problem_23_5) # calculate shear flows problem_23_5_section = DiscreteSection.DiscreteSection( neutral_axis, problem_23_5) problem_23_5_section.calc_shear_flow_q_B(0, 44500, edge14) # test open section shear flows self.assertTrue(abs(edge45.q_B) < 0.1 and abs(edge21.q_B) < 0.1) self.assertTrue(abs(edge43.q_B) < 0.1 and abs(edge10.q_B) < 0.1) self.assertTrue(abs(edge32.q_B - (-13.6)) < 1) self.assertTrue(abs(edge14.q_B) - 81.7 < 1) self.assertTrue(abs(edge05.q_B) - 34.07 < 1) # calculate closed section shear flows problem_23_5_section.calc_closed_section_pure_shear_flow_q_0(edge14) # test open section shear flows self.assertTrue( abs(edge45.q_0 - 4.12) < 1 and abs(edge05.q_0 - 4.12) < 1 and abs(edge10.q_0 - 4.12) < 1) self.assertTrue( abs(edge43.q_0 - (-5.74)) < 1 and abs(edge21.q_0 - (-5.74)) < 1 and abs(edge32.q_0 - (-5.74)) < 1) self.assertTrue(abs(edge14.q_0 - (-9.85)) < 1)
def initialise_problem(): stringer_area = 42 * 10**(-6) neutral_axis = (0, 1, 0) # CREATE LIST OF COORDINATES FOR BOOMS # give the coordinates of the booms with respect to the hinge point # for the first eight, they are on a straight line coordinates = [] for n in range(16): coordinates.append([((43.45 - 5.43125 / 2 * (n + 1)) * 10) * 10**(-3), ((1.40625 / 2 * (n + 1)) * 10) * 10**(-3)]) # booms 8, 9 and 10 are along a semi-circle coordinates.append([ -112.5 * math.sin(math.pi / 8) * 10**(-3), 112.5 * math.cos(math.pi / 8) * 10**(-3) ]) coordinates.append([ -112.5 * math.sin(math.pi / 4) * 10**(-3), 112.5 * math.cos(math.pi / 4) * 10**(-3) ]) coordinates.append([ -112.5 * math.sin(3 * math.pi / 8) * 10**(-3), 112.5 * math.cos(3 * math.pi / 8) * 10**(-3) ]) coordinates.append([-112.5 * 10**(-3), 0.0]) # the last 8 are symmetric to the first eight wrt the z-axis for i in range(18, -1, -1): coords = coordinates[i] coordinates.append([coords[0], -coords[1]]) # the ones on the spar are always at z=0 and distributed equally along the height of the spar coordinates.append([0.0, (22.5 + 45) * 10**(-3)]) coordinates.append([0.0, 22.5 * 10**(-3)]) coordinates.append([0.0, -22.5 * 10**(-3)]) coordinates.append([0.0, (-22.5 - 45) * 10**(-3)]) # CREATE BOOM INSTANCES AND INSERT THEM IN GEOMETRY booms = [] boom0 = boom.Boom(0, coordinates[0], 0.0, neutral_axis) booms.append(boom0) boom1 = boom.Boom(1, coordinates[1], stringer_area, neutral_axis) booms.append(boom1) boom2 = boom.Boom(2, coordinates[2], 0.0, neutral_axis) booms.append(boom2) boom3 = boom.Boom(3, coordinates[3], stringer_area, neutral_axis) booms.append(boom3) boom4 = boom.Boom(4, coordinates[4], 0.0, neutral_axis) booms.append(boom4) boom5 = boom.Boom(5, coordinates[5], stringer_area, neutral_axis) booms.append(boom5) boom6 = boom.Boom(6, coordinates[6], 0.0, neutral_axis) booms.append(boom6) boom7 = boom.Boom(7, coordinates[7], stringer_area, neutral_axis) booms.append(boom7) boom8 = boom.Boom(8, coordinates[8], 0.0, neutral_axis) booms.append(boom8) boom9 = boom.Boom(9, coordinates[9], stringer_area, neutral_axis) booms.append(boom9) boom10 = boom.Boom(10, coordinates[10], 0.0, neutral_axis) booms.append(boom10) boom11 = boom.Boom(11, coordinates[11], stringer_area, neutral_axis) booms.append(boom11) boom12 = boom.Boom(12, coordinates[12], 0.0, neutral_axis) booms.append(boom12) boom13 = boom.Boom(13, coordinates[13], stringer_area, neutral_axis) booms.append(boom13) boom14 = boom.Boom(14, coordinates[14], 0.0, neutral_axis) booms.append(boom14) boom15 = boom.Boom(15, coordinates[15], 0.0, neutral_axis) booms.append(boom15) # semi circle booms boom16 = boom.Boom(16, coordinates[16], 0.0, neutral_axis) booms.append(boom16) boom17 = boom.Boom(17, coordinates[17], stringer_area, neutral_axis) booms.append(boom17) boom18 = boom.Boom(18, coordinates[18], 0.0, neutral_axis) booms.append(boom18) boom19 = boom.Boom(19, coordinates[19], stringer_area, neutral_axis) booms.append(boom19) boom20 = boom.Boom(20, coordinates[20], 0.0, neutral_axis) booms.append(boom20) boom21 = boom.Boom(21, coordinates[21], stringer_area, neutral_axis) booms.append(boom21) boom22 = boom.Boom(22, coordinates[22], 0.0, neutral_axis) booms.append(boom22) # lower straight line booms boom23 = boom.Boom(23, coordinates[23], 0.0, neutral_axis) booms.append(boom23) boom24 = boom.Boom(24, coordinates[24], 0.0, neutral_axis) booms.append(boom24) boom25 = boom.Boom(25, coordinates[25], stringer_area, neutral_axis) booms.append(boom25) boom26 = boom.Boom(26, coordinates[26], 0.0, neutral_axis) booms.append(boom26) boom27 = boom.Boom(27, coordinates[27], stringer_area, neutral_axis) booms.append(boom27) boom28 = boom.Boom(28, coordinates[28], 0.0, neutral_axis) booms.append(boom28) boom29 = boom.Boom(29, coordinates[29], stringer_area, neutral_axis) booms.append(boom29) boom30 = boom.Boom(30, coordinates[30], 0.0, neutral_axis) booms.append(boom30) boom31 = boom.Boom(31, coordinates[31], stringer_area, neutral_axis) booms.append(boom31) boom32 = boom.Boom(32, coordinates[32], 0.0, neutral_axis) booms.append(boom32) boom33 = boom.Boom(33, coordinates[33], stringer_area, neutral_axis) booms.append(boom33) boom34 = boom.Boom(34, coordinates[34], 0.0, neutral_axis) booms.append(boom34) boom35 = boom.Boom(35, coordinates[35], stringer_area, neutral_axis) booms.append(boom35) boom36 = boom.Boom(36, coordinates[36], 0.0, neutral_axis) booms.append(boom36) boom37 = boom.Boom(37, coordinates[37], stringer_area, neutral_axis) booms.append(boom37) boom38 = boom.Boom(38, coordinates[38], 0.0, neutral_axis) booms.append(boom38) # booms on the spar boom39 = boom.Boom(39, coordinates[39], 0.0, neutral_axis) booms.append(boom39) boom40 = boom.Boom(40, coordinates[40], 0.0, neutral_axis) booms.append(boom40) boom41 = boom.Boom(41, coordinates[41], 0.0, neutral_axis) booms.append(boom41) boom42 = boom.Boom(42, coordinates[42], 0.0, neutral_axis) booms.append(boom42) # CREATE EDGES INSTANCES AND PUT THEM IN A LIST edge_list = [] edge10 = edges.Edge([1, 0], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge10) edge21 = edges.Edge([2, 1], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge21) edge32 = edges.Edge([3, 2], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge32) edge43 = edges.Edge([4, 3], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge43) edge54 = edges.Edge([5, 4], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge54) edge65 = edges.Edge([6, 5], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge65) edge76 = edges.Edge([7, 6], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge76) edge87 = edges.Edge([8, 7], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge87) edge98 = edges.Edge([9, 8], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge98) edge109 = edges.Edge([10, 9], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge109) edge1110 = edges.Edge([11, 10], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge1110) edge1211 = edges.Edge([12, 11], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge1211) edge1312 = edges.Edge([13, 12], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge1312) edge1413 = edges.Edge([14, 13], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge1413) edge1514 = edges.Edge([15, 14], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge1514) # booms on semicircle edge1615 = edges.Edge([16, 15], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge1615) edge1716 = edges.Edge([17, 16], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge1716) edge1817 = edges.Edge([18, 17], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge1817) edge1918 = edges.Edge([19, 18], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge1918) edge2019 = edges.Edge([20, 19], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge2019) edge2120 = edges.Edge([21, 20], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge2120) edge2221 = edges.Edge([22, 21], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge2221) edge2322 = edges.Edge([23, 22], 1.1 * 10**(-3), 44.179 * 10**(-3)) edge_list.append(edge2322) # booms on lower spar edge2423 = edges.Edge([24, 23], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2423) edge2524 = edges.Edge([25, 24], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2524) edge2625 = edges.Edge([26, 25], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2625) edge2726 = edges.Edge([27, 26], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2726) edge2827 = edges.Edge([28, 27], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2827) edge2928 = edges.Edge([29, 28], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge2928) edge3029 = edges.Edge([30, 29], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3029) edge3130 = edges.Edge([31, 30], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3130) edge3231 = edges.Edge([32, 31], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3231) edge3332 = edges.Edge([33, 32], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3332) edge3433 = edges.Edge([34, 33], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3433) edge3534 = edges.Edge([35, 34], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3534) edge3635 = edges.Edge([36, 35], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3635) edge3736 = edges.Edge([37, 36], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3736) edge3837 = edges.Edge([38, 37], 1.1 * 10**(-3), 56.103 * 0.5 * 10**(-3)) edge_list.append(edge3837) edge038 = edges.Edge([0, 38], 1.1 * 10**(-3), 56.103 * 10**(-3)) edge_list.append(edge038) # booms on the vertical spar edge3915 = edges.Edge([39, 15], 2.9 * 10**(-3), 45 * 10**(-3)) edge_list.append(edge3915) edge4039 = edges.Edge([40, 39], 2.9 * 10**(-3), 45 * 10**(-3)) edge_list.append(edge4039) edge4140 = edges.Edge([41, 40], 2.9 * 10**(-3), 45 * 10**(-3)) edge_list.append(edge4140) edge4241 = edges.Edge([42, 41], 2.9 * 10**(-3), 45 * 10**(-3)) edge_list.append(edge4241) edge2342 = edges.Edge([23, 42], 2.9 * 10**(-3), 45 * 10**(-3)) edge_list.append(edge2342) # CREATE INSTANCE OF AILERON GEOMETRY WITH ALL THE BOOMS aileron_geometry = geometry.Geometry( 43, booms, edge_list, [19880.391 * 10**(-6), 36225 * 10**(-6)], 28 * 10**9) aileron_geometry.construct_geometry() aileron_geometry.cells = [[ edge038, edge3837, edge3736, edge3635, edge3534, edge3433, edge3332, edge3231, edge3130, edge3029, edge2928, edge2827, edge2726, edge2625, edge2524, edge2423, edge2342, edge4241, edge4140, edge4039, edge3915, edge1514, edge1413, edge1312, edge1211, edge1110, edge109, edge98, edge87, edge76, edge65, edge54, edge43, edge32, edge21, edge10 ], [ edge2019, edge1918, edge1817, edge1716, edge1615, edge3915, edge4039, edge4140, edge4241, edge2342, edge2322, edge2221, edge2120 ]] # calculate areas of all booms for element in booms: element.calculate_area(aileron_geometry) # insert them in aileron_geometry object aileron_geometry.get_areas() # calculate centroid position aileron_geometry.calc_centroid() for boom_element in booms: boom_element.calc_y_dist(aileron_geometry) boom_element.calc_z_dist(aileron_geometry) # calculate moments of inertia aileron_geometry.moment_inertia_Izz() aileron_geometry.moment_inertia_Iyy() # PLOT AND PRINT GEOMETRICAL PROPERTIES FOR VERIFICATION aileron_geometry.plot_edges() for it, el in enumerate(booms): print('area of boom ', it, ' : ', aileron_geometry.boom_areas[it], '[mm^2]') print('centroid position : ', aileron_geometry.centroid) print('z moment of inertia : ', aileron_geometry.Izz, ' [mm^4]') print('y moment of inertia : ', aileron_geometry.Iyy, ' [mm^4]') print('zy moment of inertia : ', aileron_geometry.Izy, '[mm^4]') # GET THE LIST OF FORCES AND MOMENTS file_name = "Loads.txt" x_i_array = helpers.get_array_x_i(file_name) Mx_array = helpers.get_array_Mx_i(file_name) My_array = helpers.get_array_My_i(file_name) Mz_array = helpers.get_array_Mz_i(file_name) Sz_array = helpers.get_array_Sz_i(file_name) Sy_array = helpers.get_array_Sy_i(file_name) # create a matrix of stresses stress_matrix = np.zeros((43, 101)) for j, location in enumerate(x_i_array): for i, boom_member in enumerate(aileron_geometry.booms): boom_member.calc_bending_stress(Mz_array[j], My_array[j], aileron_geometry) stress_matrix[i][j] = boom_member.bending_stress # find maximum stress max_stress_matrix = np.amax(stress_matrix, axis=1) # set up matrix of shear stresses stress_matrix_shear = np.zeros((len(aileron_geometry.edges), 101)) # set up lists twist_rate_list = [] thetas_list = [] section_numbers = 100 step = 2.771 / section_numbers thetas_list.append(0.453786) file = open("thetas_list.txt", "w") for i, x_i in enumerate(x_i_array): # create new instance of section with new location aileron_section = DiscreteSection.DiscreteSection( neutral_axis, aileron_geometry) # calculate shear flows due to pure shear and torque aileron_section.calc_total_shear_flow(Sz_array[i], Sy_array[i], Mx_array[i], edge2342) # calculate shear stress due to total shear flows and insert in the shear stress matrix aileron_section.calc_shear_stress() for n1, edge_ex in enumerate(aileron_geometry.edges): stress_matrix_shear[n1][i] = edge_ex.shear_stress # append the twist rate (computed at the same time as torque shear flow) in the twist rate list twist_rate_list.append(aileron_section.twist_rate) # calculate theta with finite differences, append to the list and copy to the txt file theta = twist_rate_list[i - 1] * step + thetas_list[i - 1] thetas_list.append(theta) file.write(str(float(theta)) + '\n') # find the maximum shear stress on each rib print('the maximum shear stress in rib A : ', np.max(stress_matrix_shear[:, 97])) print('the maximum shear stress in rib B : ', np.max(stress_matrix_shear[:, 51])) print('the maximum shear stress in rib C : ', np.max(stress_matrix_shear[:, 41])) print('the maximum shear stress in rib D : ', np.max(stress_matrix_shear[:, 18])) # find the maximum normal stress on each rib print('the maximum normal stress in rib A : ', np.max(stress_matrix[:, 97])) print('the maximum normal stress in rib A : ', np.max(stress_matrix[:, 51])) print('the maximum normal stress in rib A : ', np.max(stress_matrix[:, 41])) print('the maximum normal stress in rib A : ', np.max(stress_matrix[:, 18]))