def mesh_(): steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) cross_section = CrossSection(0.05, 0.008) preprocessor = Preprocessor() preprocessor.generate('iges_files\\tube_1.iges', 0.01) preprocessor.set_prescribed_dofs_bc_by_node([40, 1424, 1324], np.zeros(6)) preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', cross_section) return mesh
def model(): steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) cross_section = CrossSection(0.05, 0.008) preprocessor = Preprocessor() preprocessor.generate('iges_files\\tube_1.iges', 0.01) preprocessor.set_prescribed_dofs_bc_by_node([40, 1424, 1324], np.zeros(6)) preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', cross_section) assembly = AssemblyStructural(preprocessor) # We need to separate it in multiple atribute or functions as soon as possible. names = ['Kadd_lump', 'Madd_lump', 'K', 'M', 'Kr', 'Mr', 'K_lump', 'M_lump', 'C_lump', 'Kr_lump', 'Mr_lump', 'Cr_lump'] answer = assembly.get_all_matrices() return dict(zip(names, answer))
# Fluid setup speed_of_sound = 343.21 density = 1.2041 air = Fluid('air', density, speed_of_sound) steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) # Tube setup cross_section = CrossSection(0.05, 0.008, offset_y=0, offset_z=0) cross_section.update_properties() cross_section_expansion = CrossSection(0.288, 0.008, offset_y=0, offset_z=0) cross_section_expansion.update_properties() cross_section_branch = CrossSection(0.025, 0.004, offset_y=0, offset_z=0) cross_section_branch.update_properties() # Preprocessor init preprocessor = Preprocessor() preprocessor.generate('examples/iges_files/tube_2.iges', 0.01) preprocessor.set_material_by_element('all', steel) preprocessor.set_acoustic_pressure_bc_by_node(50, 1 + 0j) unflanged = True flanged = False if unflanged: preprocessor.set_radiation_impedance_bc_by_node(1086 , 1) elif flanged: preprocessor.set_radiation_impedance_bc_by_node(1086 , 2) preprocessor.set_fluid_by_element('all', air) preprocessor.set_cross_section_by_element('all', cross_section) # Analisys Frequencies f_max = 2500
air.isentropic_exponent = 1.400 air.thermal_conductivity = 0.0263 air.specific_heat_Cp = 1007 air.dynamic_viscosity = 184.6e-7 steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) # Tube setup cross_section = CrossSection(0.05, 0.008, offset_y=0, offset_z=0) cross_section.update_properties() cross_section_expansion = CrossSection(0.288, 0.008, offset_y=0, offset_z=0) cross_section_expansion.update_properties() cross_section_branch = CrossSection(0.025, 0.004, offset_y=0, offset_z=0) cross_section_branch.update_properties() # Preprocessor init preprocessor = Preprocessor() preprocessor.generate( 'examples/validation_length_correction/tube_2_expasion.iges', 0.01) preprocessor.set_material_by_element('all', steel) preprocessor.set_acoustic_pressure_bc_by_node(10, 1 + 0j) preprocessor.set_radiation_impedance_bc_by_node(1047, 0) element_type = 'LRF full' preprocessor.set_acoustic_element_type_by_element('all', element_type, proportional_damping=None) preprocessor.set_fluid_by_element('all', air) preprocessor.set_cross_section_by_element('all', cross_section) preprocessor.set_cross_section_by_line(40, cross_section_expansion) preprocessor.set_cross_section_by_line([37, 38, 39], cross_section_branch)
t0 = time() # PREPARING MESH speed_of_sound = 331.2 # speed of sound at 0ºC density = 1.204 air = Fluid('air', density, speed_of_sound) steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) offset = [0.005, 0.005] element_type = 'pipe_1' cross_section = CrossSection(0.05, 0.008, offset_y=offset[0], offset_z=offset[1], poisson_ratio=steel.poisson_ratio) cross_section.update_properties() preprocessor = Preprocessor() preprocessor.generate('examples/iges_files/tube_2.iges', 0.01) # preprocessor.set_acoustic_pressure_bc_by_node([50], 1e5 + 0j) # preprocessor.set_specific_impedance_bc_by_node(1086, speed_of_sound * density+ 0j) preprocessor.set_prescribed_dofs_bc_by_node([1136, 1236], np.zeros(6) + 0j) preprocessor.set_element_type_by_element('all', element_type) preprocessor.set_fluid_by_element('all', air) preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', cross_section) preprocessor.set_structural_load_bc_by_node([50], np.array([1, 1, 1, 0, 0, 0]) + 0j) f_max = 200 df = 2
# Fluid setup speed_of_sound = 343.21 density = 1.2041 air = Fluid('air', density, speed_of_sound) steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) # Tube setup cross_section = CrossSection(0.05, 0.008, offset_y=0, offset_z=0) cross_section.update_properties() cross_section_expansion = CrossSection(0.288, 0.008, offset_y=0, offset_z=0) cross_section_expansion.update_properties() cross_section_branch = CrossSection(0.025, 0.004, offset_y=0, offset_z=0) cross_section_branch.update_properties() # Preprocessor init preprocessor = Preprocessor() preprocessor.generate('examples/validation_length_correction/tube_2_expasion.iges', 0.01) preprocessor.set_material_by_element('all', steel) preprocessor.set_acoustic_pressure_bc_by_node(10, 1 + 0j) preprocessor.set_radiation_impedance_bc_by_node(1047 , 0) preprocessor.set_fluid_by_element('all', air) preprocessor.set_cross_section_by_element('all', cross_section) preprocessor.set_cross_section_by_line(40, cross_section_expansion) preprocessor.set_cross_section_by_line([37, 38, 39], cross_section_branch) preprocessor.set_cross_section_by_line([21, 22, 23, 24, 25, 27, 28], cross_section_branch) preprocessor.set_length_correction_by_line([1, 40, 41, 21, 27], 1) # Expansion correction preprocessor.set_length_correction_by_line([37, 38, 39], 2) # Side branch correction # Analisys Frequencies f_max = 250
from pulse.preprocessing.cross_section import CrossSection from pulse.preprocessing.material import Material from pulse.preprocessing.preprocessor import Preprocessor from pulse.processing.assembly_structural import get_global_matrices # create materials steel = Material('Steel', density=7860, young_modulus=210e9, poisson_ratio=0.3) alloy_steel = Material('AISI4140', density=7850, young_modulus=203200000000, poisson_ratio=0.27) # create cross sections large_tube = CrossSection(0.05, 0.034) thin_tube = CrossSection(0.01, 0.005) # create preprocessor preprocessor = Preprocessor() # define mesh file and element size preprocessor.generate('tube_2.iges', 0.01) # set properties to all elements preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', large_tube) # set properties for specific lines preprocessor.set_cross_section_by_line([37, 38, 39], thin_tube) preprocessor.set_material_by_lines([37, 38, 39], alloy_steel)
from pulse.processing.assembly_structural import AssemblyStructural from pulse.processing.solution_structural import SolutionStructural from pulse.postprocessing.plot_structural_data import get_structural_frf, get_structural_response from pulse.animation.plot_function import plot_results ''' |=============================================================================| | Please, it's necessary to copy and paste main.py script at OpenPulse file | | then type "python main.py" in the terminal to run the code ! | |=============================================================================| ''' t0 = time() # PREPARING MESH element_type = 'beam_1' steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) preprocessor = Preprocessor() load_file = 1 if load_file == 1: preprocessor.generate('examples/iges_files/tube_1.iges', 0.01) preprocessor.set_prescribed_dofs_bc_by_node([40, 1424, 1324], np.zeros(6, dtype=complex)) preprocessor.set_structural_load_bc_by_node([359], np.array([1, 0, 0, 0, 0, 0], dtype=complex)) if load_file == 2: preprocessor.load_mesh('examples/mesh_files/Geometry_01/coord.dat', 'examples/mesh_files/Geometry_01/connect.dat') preprocessor.set_prescribed_dofs_bc_by_node([1, 1200, 1325], np.zeros(6, dtype=complex)) preprocessor.set_structural_load_bc_by_node([361],
"offset_y": 0, "offset_z": 0, "insulation_thickness": 0, "insulation_density": 0 } pipe_section_info = { "section_type_label": "Pipe section", "section_parameters": section_parameters } cross_section2 = CrossSection(pipe_section_info=pipe_section_info) cross_section2.update_properties() # preprocessor init preprocessor = Preprocessor() preprocessor.generate('examples/validation_mean_flow/side_branch.iges', 0.01) preprocessor.set_material_by_element('all', steel) # preprocessor.set_volume_velocity_bc_by_node(51, 1.8543e-5 + 0j) preprocessor.set_acoustic_pressure_bc_by_node(51, [1 + 0j, '']) preprocessor.set_radiation_impedance_bc_by_node(103, 0) # element_type = 'undamped mean flow' element_type = 'peters' # element_type = 'howe' preprocessor.set_acoustic_element_type_by_element('all', element_type, proportional_damping=None) preprocessor.set_fluid_by_element('all', air) preprocessor.set_cross_section_by_line([1, 2], cross_section1)
from pulse.preprocessing.cross_section import CrossSection from pulse.preprocessing.material import Material from pulse.preprocessing.preprocessor import Preprocessor from pulse.processing.assembly_structural import get_global_matrices # PREPARING MESH steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) cross_section = CrossSection(0.05, 0.034) preprocessor = Preprocessor() preprocessor.generate('tube_1.iges', 0.01) preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', cross_section) # GETTING ALL MATRICES TOGETHER K, M, Kr, Mr = get_global_matrices(preprocessor)
density = 1.1614 air = Fluid('air', density, speed_of_sound) air.isentropic_exponent = 1.400 air.thermal_conductivity = 0.0263 air.specific_heat_Cp = 1007 air.dynamic_viscosity = 1.846e-05 steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) # Tube setup cross_section = CrossSection(0.273, 0.00927, offset_y=0, offset_z=0) cross_section.update_properties() cross_section_expansion = CrossSection(0.56, 0.00475, offset_y=0, offset_z=0) cross_section_expansion.update_properties() # preprocessor init preprocessor = Preprocessor() preprocessor.generate('examples/validation_perforated_plate/silencer_wpp.iges', 0.01) preprocessor.set_material_by_element('all', steel) preprocessor.set_acoustic_pressure_bc_by_node(188, 2 + 0j) preprocessor.set_radiation_impedance_bc_by_node(234, 0) element_type = 'undamped' preprocessor.set_acoustic_element_type_by_element('all', element_type, proportional_damping=None) preprocessor.set_fluid_by_element('all', air) preprocessor.set_cross_section_by_element('all', cross_section) preprocessor.set_cross_section_by_line([1, 2, 3, 4], cross_section_expansion)
from time import time import numpy as np import matplotlib.pyplot as plt from pulse.preprocessing.cross_section import CrossSection from pulse.preprocessing.material import Material from pulse.preprocessing.preprocessor import Preprocessor from pulse.processing.solution_structural import SolutionStructural from pulse.postprocessing.plot_structural_data import get_structural_frf # PREPARING MESH steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) cross_section = CrossSection(0.05, 0.034) preprocessor = Preprocessor() preprocessor.load_mesh('coord.dat', 'connect.dat') preprocessor.set_material_by_element('all', steel) preprocessor.set_cross_section_by_element('all', cross_section) preprocessor.set_prescribed_dofs_bc_by_node([1, 1200, 1325], np.zeros(6)) preprocessor.set_structural_load_bc_by_node([361], np.array([1, 0, 0, 0, 0, 0])) # SOLVING THE PROBLEM BY TWO AVALIABLE METHODS frequencies = np.arange(0, 202, 2) modes = 200 solution = SolutionStructural(preprocessor) direct = solution.direct_method(frequencies) modal = solution.mode_superposition(frequencies, modes) # GETTING FRF node = 711
from pulse.postprocessing.plot_acoustic_data import get_acoustic_frf, get_acoustic_response from pulse.animation.plot_function import plot_results ''' |=============================================================================| | Please, it's necessary to copy and paste main.py script at OpenPulse file | | then type "python main.py" in the terminal to run the code ! | |=============================================================================| ''' speed_of_sound = 350.337 density = 24.85 hydrogen = Fluid('hydrogen', density, speed_of_sound) steel = Material('Steel', 7860, young_modulus=210e9, poisson_ratio=0.3) # Tube setup cross_section = CrossSection(0.05, 0.008, offset_y=0.005, offset_z=0.005) # Mesh init preprocessor = Preprocessor() run = 2 anechoic_termination = True if run == 1: preprocessor.generate('examples/iges_files/tube_2.iges', 0.01) preprocessor.set_acoustic_pressure_BC_by_node([50], 1) # Anechoic termination if anechoic_termination: preprocessor.set_specific_impedance_BC_by_node( 1086, speed_of_sound * density) if run == 2: preprocessor.load_mesh('examples/validation_acoustic/coord.dat', 'examples/validation_acoustic/connect.dat') # Acoustic boundary conditions - Prescribe pressure preprocessor.set_acoustic_pressure_BC_by_node([1], 1) # Anechoic termination