def test_plot_structure(): name = "Steel" density = 8000 young_modulus = 200e9 shear_modulus = 80e9 poisson_ratio = 0.25 yield_strength = 350e6 ultimate_strength = 420e6 mat_steel = basic_objects.Material(name, young_modulus, shear_modulus, poisson_ratio, density, yield_strength, ultimate_strength) area = 2e-2 m_inertia_y = 10e-5 m_inertia_z = 20e-5 polar_moment = 5e-5 rotation = pi / 6 section = basic_objects.Section(area, rotation, m_inertia_y, m_inertia_z, polar_moment) structure_points = np.array([[0, 0, 0], [2, 0, 0], [5, 0, 0], [5, 0, 1], [2, -5, 0.4], [2, 5, 0.4], [5, -2, 1], [5, 2, 1]]) fuselage_frontal = basic_objects.Beam(structure_points, 0, 1, section, mat_steel, 5) fuselage_posterior = basic_objects.Beam(structure_points, 1, 2, section, mat_steel, 5) wing_left = basic_objects.Beam(structure_points, 1, 4, section, mat_steel, 5) wing_right = basic_objects.Beam(structure_points, 1, 5, section, mat_steel, 5) tail_vertical = basic_objects.Beam(structure_points, 2, 3, section, mat_steel, 5) tail_horizontal_left = basic_objects.Beam(structure_points, 3, 6, section, mat_steel, 5) tail_horizontal_right = basic_objects.Beam(structure_points, 3, 7, section, mat_steel, 5) beams = [fuselage_frontal, fuselage_posterior, wing_left, wing_right, tail_vertical, tail_horizontal_left, tail_horizontal_right] constraint = basic_objects.Constraint(1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) constraints = [[constraint]] lift_left_wing = basic_objects.Load(4, np.array([0, 10000, 0, 0, 100, 0])) lift_right_wing = basic_objects.Load(5, np.array([0, 10000, 0, 0, 100, 0])) loads = [lift_left_wing, lift_right_wing] aircraft_structure = basic_objects.Structure(structure_points, beams) visualization.plot_structure(aircraft_structure)
def test_structural_solver(): # Material definition name = "Aluminiun" density = 0.0975 young_modulus = 1e7 shear_modulus = 3770000 poisson_ratio = 0.33 yield_strength = 350e6 ultimate_strength = 420e6 mat_aluminiun = basic_objects.Material(name, young_modulus, shear_modulus, poisson_ratio, density, yield_strength, ultimate_strength) # Section definition area = 1 m_inertia_y = 0.08333333 m_inertia_z = 0.08333333 polar_moment = 0.1408333 rotation = 0 section = basic_objects.Section(area, rotation, m_inertia_y, m_inertia_z, polar_moment) # Structure points definition structure_points = np.array([[0, 0, 0], [10, 0, 0], [20, 0, 0]]) # Structure beams definition beam_0 = basic_objects.Beam(structure_points, 0, 1, section, mat_aluminiun, 5) beam_1 = basic_objects.Beam(structure_points, 1, 2, section, mat_aluminiun, 5) beams = [beam_0, beam_1] # Structure definition structure = basic_objects.Structure(structure_points, beams) # Element Length element_length = 2 # Loads definition force = basic_objects.Load(0, np.array([0, 100, 0, 0, 0, 0])) loads = [force] # Constraints definition constraint_1 = basic_objects.Constraint(1, [0, 0, 0, 0, 0, 0]) constraint_2 = basic_objects.Constraint(2, [0, 0, 0, None, None, None]) constraints = [constraint_1] print("# Testing structural_solver") start = time.time() deformed_grid, deformations, force_vector = finite_element_method.structural_solver( structure, loads, constraints, element_length) end = time.time() print(f"- Test completed in {end - start}")
def test_create_global_FEM_matrices(): # Material definition name = "Aluminiun" density = 0.0975 young_modulus = 1e7 shear_modulus = 3770000 poisson_ratio = 0.33 yield_strength = 350e6 ultimate_strength = 420e6 mat_aluminiun = basic_objects.Material(name, young_modulus, shear_modulus, poisson_ratio, density, yield_strength, ultimate_strength) # Section definition area = 1 m_inertia_y = 0.08333333 m_inertia_z = 0.08333333 polar_moment = 0.1408333 rotation = 0 section = basic_objects.Section(area, rotation, m_inertia_y, m_inertia_z, polar_moment) # Structure points definition structure_points = np.array([[0, 0, 0], [10, 0, 0], [20, 0, 0]]) # Structure beams definition beam_0 = basic_objects.Beam(structure_points, 0, 1, section, mat_aluminiun, 5) beam_1 = basic_objects.Beam(structure_points, 1, 2, section, mat_aluminiun, 5) beams = [beam_0, beam_1] # Structure definition structure = basic_objects.Structure(structure_points, beams) # Element Length element_length = 2 nodes, fem_elements = finite_element_method.generate_FEM_mesh( structure, element_length) # Loads definition force = basic_objects.Load(1, np.array([0, 100, 0, 0, 0, 0])) loads = [force] print("# Testing create_global_FEM_matrices") start = time.time() K_global, F_global = finite_element_method.create_global_FEM_matrices( nodes, fem_elements, loads) end = time.time() print(f"- Test completed in {end - start}")