Source code for viiapackage.strengthening.l4.l4d

### ===================================================================================================================
###   L4-D strengthening measure
### ===================================================================================================================
# Copyright ©VIIA 2025

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Union, List, Optional

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Wall
from rhdhv_fem.shape_geometries import Line

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.strengthening.helper_functions import viia_check_shape_argument, viia_check_measure_in_gmc


### ===================================================================================================================
###   2. Function to create L4-D strengthening measures
### ===================================================================================================================

[docs]def viia_l4d( project: ViiaProject, variant: int, wall: Union[List[Union[str, Wall]], str, Wall], cavity: float = 0.0, outer_wall_thickness: Optional[float] = None, outer_wall_material: Optional[str] = None, flip: bool = False, edge_distance: float = 0.25, wall_tie_distance: float = 0.5, lines: Optional[List[Line]] = None): """ This function creates an L4-D-measure for a selected wall. The purpose of this measure is to fix the outer leaf at the cavity wall to the structural inner leaf with cavity wall ties. The measure is modeled with the same properties as the modelling of existing wall ties. .. warning:: Wall ties close to the corners or edges of the wall's geometry will be moved to the nearby corner or edge. This is done to prevent mesh inconsistencies. Check the final mesh! .. note:: Strengthening measure is only applicable on vertical walls. .. note:: When a L4-D measure on a line has to be applied the lines should be given. In other cases the lines input is neglected. When the lines are given the input for 'wall' should be given as a list, in addition the input for 'cavity', 'outer_wall_thickness', 'outer_wall_material', 'flip' will be neglected. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - variant (int): The variant number of the measure that is in the GMC. - wall (as object/str or list of two objects/str): When provided with only one wall object or string, the outer leaf of that wall will be created along with cavity wall ties. When provided with list of 2 wall objects or strings in case the walls are existing in the model, the cavity wall ties will be created between two walls. When the measure should be on a line it should be provided as a list with two walls. - cavity (as float): Cavity distance only when one wall has been given as input. This is the dimension between the inner- and outer leaf of cavity wall, in [m]. - outer_wall_thickness (as float) in [m], only when one wall has been given as input and may be omitted if wall thickness is same as inner leaf. - outer_wall_material (as string): Material for the outer wall, only when one wall has been given as input and may be omitted if wall material is same as inner leaf. Alternative (str): Name of the material. If the material does not yet exist it will be created. - flip (as bool): Not obligatory, default value is 'False'. If flip is true, the new leaf will be placed on the inner side of the existing wall. - edge_distance (as float): Distance between cavity wall ties and the edges of the wall. - wall_tie_distance (as float): Mutual distance between cavity wall ties. - lines (list of lines): List of Line objects. The lines should be continous. It can be lines of the inner leaf or outer leaf. Along the lines the wall ties will be applied. Should only be provided when the measure should be on a line instead of the full area of the wall. Default is None. Output: - The strengthening measure is added to class of springs and modelled in DIANA or SCIA. For example: - To make a L4-D-1 on a line at the top of the wall, the following input can be used: >>> project.viia_l4d(variant=1, wall=['name_inner', 'name_outer'], lines=[line_1, line_2]) - To make a L4-D-1 on an area, the following input can be used: >>> project.viia_l4d(variant=1, wall=['name_of_inner_wall'], outer_wall_thickness=0.1) """ # Check if measure is in GMC measure_type = 'L4-D' measure_sub_type = f"{measure_type}-{int(variant)}" viia_check_measure_in_gmc(project=project, measure_sub_type=measure_sub_type) on_a_line = False if lines and isinstance(wall, list): if not all(isinstance(line, Line) for line in lines): raise TypeError( f"ERROR: The lines for the L4D should be provided as a list of lines. Provided was " f"{lines=}.") on_a_line = True # Argument handling if isinstance(wall, list): if len(wall) != 2: raise ValueError( f"ERROR: The provided argument type for wall is a list with a length other than two, which is " f"not correct, please check.") wall = [viia_check_shape_argument(project, one_wall, 'viia_l4d') for one_wall in wall] if on_a_line: wall_ties = project.viia_create_wall_ties_on_line( inner_leaf=wall[0], outer_leaf=wall[1], lines=lines, wall_tie_distance=wall_tie_distance, snap_to_points=True, minimum_distance=edge_distance) else: wall_ties = project.viia_create_cavity_wall_ties( inner_leaf=wall[0], outer_leaf=wall[1], edge_distance=edge_distance, wall_tie_distance=wall_tie_distance) elif isinstance(wall, Wall) or isinstance(wall, str): wall = [viia_check_shape_argument(project, wall, 'viia_l4d')] outer_leafs, wall_ties, dummy_plates = project.viia_create_cavity_wall_ties_from_list( cavity_wall_list=wall, cavity=cavity, outer_wall_thickness=outer_wall_thickness, outer_wall_material=outer_wall_material, flip=flip, edge_distance=edge_distance, wall_tie_distance=wall_tie_distance, complete_output=True) else: raise TypeError( f"ERROR: The provided argument type for wall is {type(wall)}, which is not correct, please check.") if wall_ties is not None: if isinstance(wall, list): for single_wall in wall: # Update wall attribute with strengthening measure single_wall.add_meta_data({'strengthening': measure_sub_type}) # Notifications for user project.write_log( f"L4-D measure applied on wall ({single_wall.name}) with {len(wall_ties)} wall ties.") elif isinstance(wall, Wall): # Update wall attribute with strengthening measure wall.add_meta_data({'strengthening': measure_sub_type}) # Notifications for user project.write_log( f"L4-D measure applied on wall ({wall.name}) with {len(wall_ties)} wall ties.") else: project.write_log( "Something went wrong in the viia_create_cavity_wall_ties function, no wall ties is created, please check.") return wall
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================