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}")
Esempio n. 2
0
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_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}")
Esempio n. 4
0
right_wing_2 = basic_objects.Beam(structure_points, 8, 9, rectangular_section,
                                  mat_aluminium7075, 1)
right_wing_3 = basic_objects.Beam(structure_points, 9, 10, rectangular_section,
                                  mat_aluminium7075, 1)
right_wing_4 = basic_objects.Beam(structure_points, 10, 11,
                                  rectangular_section, mat_aluminium7075, 1)
right_wing_5 = basic_objects.Beam(structure_points, 11, 12,
                                  rectangular_section, mat_aluminium7075, 1)

structure_beams = [
    left_wing_0, left_wing_1, left_wing_2, left_wing_3, left_wing_4,
    left_wing_5, right_wing_0, right_wing_1, right_wing_2, right_wing_3,
    right_wing_4, right_wing_5
]

wing_structure = basic_objects.Structure(structure_points, structure_beams)

# visualization.plot_structure(wing_structure)

# visualization.plot_aircraft(xx, yy, zz, wing_structure)

# Constrains

constrain = basic_objects.Constraint(6, [0, 0, 0, 0, 0, 0])
constraints = [constrain]

orig_xx, orig_yy, orig_zz = xx, yy, zz

for i in range(50):
    # Aerodynamic Loads Calculation
    panel_matrix = mesh.generate_panel_matrix(xx, yy, zz, wing.wing_span)