def set_cross_section_by_element(self, elements, cross_section, update_cross_section=False): if update_cross_section: t0 = time() cross_section.update_properties() dt = time() - t0 print("Time to process Cross-section: {} [s]".format(round(dt, 6))) for element in slicer(self.structural_elements, elements): element.cross_section = cross_section for element in slicer(self.acoustic_elements, elements): element.cross_section = cross_section
def set_prescribed_dofs_bc_by_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.prescribed_dofs = values node.loads = [None, None, None, None, None, None] # Checking imported tables check_array = [isinstance(bc, np.ndarray) for bc in values] if True in check_array: node.loaded_table_for_prescribed_dofs = True node.there_are_prescribed_dofs = True if not node in self.nodes_with_constrained_dofs: self.nodes_with_constrained_dofs.append(node) if not node in self.nodes_with_prescribed_dofs: self.nodes_with_prescribed_dofs.append(node) return else: node.loaded_table_for_prescribed_dofs = False # Checking complex single values check_values = [isinstance(bc, complex) for bc in values] if True in check_values: node.there_are_prescribed_dofs = True if complex(0) in values: node.there_are_constrained_dofs = True if not node in self.nodes_with_constrained_dofs: self.nodes_with_constrained_dofs.append(node) if not node in self.nodes_with_prescribed_dofs: self.nodes_with_prescribed_dofs.append(node) else: node.there_are_prescribed_dofs = False node.there_are_constrained_dofs = False if node in self.nodes_with_constrained_dofs: self.nodes_with_constrained_dofs.remove(node) if node in self.nodes_with_prescribed_dofs: self.nodes_with_prescribed_dofs.remove(node)
def set_specific_impedance_bc_by_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.specific_impedance = values if not node in self.nodes_with_specific_impedance: self.nodes_with_specific_impedance.append(node) if values is None: if node in self.nodes_with_specific_impedance: self.nodes_with_specific_impedance.remove(node)
def set_volume_velocity_bc_by_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.volume_velocity = values node.acoustic_pressure = None if not node in self.nodes_with_volume_velocity: self.nodes_with_volume_velocity.append(node) if values is None: if node in self.nodes_with_volume_velocity: self.nodes_with_volume_velocity.remove(node)
def set_acoustic_pressure_bc_by_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.acoustic_pressure = values node.volume_velocity = None self.AcousticBCnodes.append(node) if not node in self.nodes_with_acoustic_pressure: self.nodes_with_acoustic_pressure.append(node) if values is None: if node in self.nodes_with_acoustic_pressure: self.nodes_with_acoustic_pressure.remove(node)
def add_mass_to_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.lumped_masses = values # Checking imported tables check_array = [isinstance(bc, np.ndarray) for bc in values] if True in check_array: node.loaded_table_for_lumped_masses = True node.there_are_lumped_masses = True return else: node.loaded_table_for_lumped_masses = False # Checking complex single values check_values = [False if bc is None else True for bc in values] if True in check_values: node.there_are_lumped_masses = True else: node.there_are_lumped_masses = False
def add_damper_to_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.lumped_dampings = values # Checking imported tables check_array = [isinstance(bc, np.ndarray) for bc in values] if True in check_array: node.loaded_table_for_lumped_dampings = True node.there_are_lumped_dampings = True if not node in self.nodes_connected_to_dampers: self.nodes_connected_to_dampers.append(node) return else: node.loaded_table_for_lumped_dampings = False # Checking complex single values check_values = [False if bc is None else True for bc in values] if True in check_values: node.there_are_lumped_dampings = True if not node in self.nodes_connected_to_dampers: self.nodes_connected_to_dampers.append(node) else: node.there_are_lumped_dampings = False if node in self.nodes_connected_to_dampers: self.nodes_connected_to_dampers.remove(node)
def set_radiation_impedance_bc_by_node(self, nodes, values): for node in slicer(self.nodes, nodes): node.radiation_impedance = values
def set_fluid_by_line(self, lines, fluid): for elements in slicer(self.line_to_elements, lines): self.set_fluid_by_element(elements, fluid)
def set_fluid_by_element(self, elements, fluid): for element in slicer(self.acoustic_elements, elements): element.fluid = fluid for element in slicer(self.structural_elements, elements): element.fluid = fluid
def set_force_by_element(self, elements, loads): for element in slicer(self.structural_elements, elements): element.loaded_forces = loads
def set_material_by_line(self, lines, material): for elements in slicer(self.line_to_elements, lines): self.set_material_by_element(elements, material)
def set_material_by_element(self, elements, material): for element in slicer(self.structural_elements, elements): element.material = material for element in slicer(self.acoustic_elements, elements): element.material = material
def set_element_type_by_line(self, lines, element_type): for elements in slicer(self.line_to_elements, lines): self.set_element_type_by_element(elements, element_type)
def set_cross_section_by_line(self, lines, cross_section): for elements in slicer(self.line_to_elements, lines): self.set_cross_section_by_element(elements, cross_section)
def set_element_type_by_element(self, elements, element_type): self.element_type = element_type for element in slicer(self.structural_elements, elements): element.element_type = element_type