Source code for viiapackage.analyses.nlpo_helper_functions.viia_effective_pier_shear_stiffness

### ===================================================================================================================
###  FUNCTION: Calculate the effective stiffness of the pier
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, List
from math import sqrt

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_math import fem_unit_vector

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.shape_operations import viia_get_wall_horizontal_direction


### ===================================================================================================================
###   2. Function viia_effective_pier_shear_stiffness
### ===================================================================================================================

[docs]def viia_effective_pier_shear_stiffness(project: ViiaProject, piers: List[dict]) -> List[dict]: """ Computes the effective shear stiffness of individual piers, based on the 4 pushover directions and appends the information to the dictionaries describing each pier. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - piers (list): list of dictionaries as obtained with viia_locate_piers(...) Output: - Returns the piers including extended information. """ def _compute_pier_shear_stiffness(project: ViiaProject, pier, height, length, boundary='cantilever'): """ Generic function to compute shear stiffness of the effective part of a pier Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - pier (dict): Dictionary containing pier information containing at least the reference to its parent wall. - height (float): Considered height of the puer. - length (float): Considered length of the pier. - boundary (str): Considered support type at the top of the pier, either 'cantilever' or 'fixed'. Output: - Returns the k-shear as float, the value of the shear stiffness of the pier. """ if pier['parent wall'].material.material_model.__class__.__name__ == 'LinearElasticIsotropicModel': youngs_modulus = pier['parent wall'].material.material_model.youngs_modulus else: try: element_size = f"-{pier['parent wall'].elementsize}x{pier['parent wall'].elementsize}" mat_name = f"LIN-{pier['parent wall'].material.name.split(element_size)[0]}" youngs_modulus = project.viia_materials(mat_name).material_model.youngs_modulus except AttributeError: try: youngs_modulus = project.viia_materials(mat_name).material_model.youngs_modulus except TypeError: project.write_log( f"WARNING: No linear alternative found for {pier['parent wall'].material.name}. " f"Please check the material model. No stiffness is assigned to the considered pier.") return None if boundary.lower() == 'cantilever': k_shear = (4 * (height / length) ** 3 / youngs_modulus / pier['parent wall'].geometry.geometry_model.thickness + 3 * height / length / youngs_modulus / pier['parent wall'].geometry.geometry_model.thickness) ** -1 elif boundary.lower() == 'fixed': k_shear = ((height / length) ** 3 / youngs_modulus / pier['parent wall'].geometry.geometry_model.thickness + 3 * height / length / youngs_modulus / pier['parent wall'].geometry.geometry_model.thickness) ** -1 else: project.write_log( "ERROR: Boundary conditions for pier not recognized. Its shear stiffness is assumed to be 0.") k_shear = 0 return k_shear for pier in piers: # Compute horizontal axis direction of the parent wall of the pier wall_horizontal_direction_vector = fem_unit_vector( vector=viia_get_wall_horizontal_direction(wall=pier['parent']).vector, precision=project.check_precision) # Prepare dictionary for easy assignment of shear stiffnesses pier.update({'k_shear': {}}) # Determine whether the x- and y- direction are of equal or opposite sign. True for equal, False for opposite if wall_horizontal_direction_vector[0] * wall_horizontal_direction_vector[1] > 0: sign_is_equal = True elif wall_horizontal_direction_vector[0] * wall_horizontal_direction_vector[1] < 0: sign_is_equal = False else: # Make sure at least one x or y component of the vector unequals 0. # If still valid, the signs do not matter anymore if float(wall_horizontal_direction_vector[0]) != 0. or \ float(wall_horizontal_direction_vector[1]) != 0.: sign_is_equal = True # The value is arbitrary in this case else: project.write_log( f"ERROR: {pier['parent_wall'].__name__} " f"has an invalid element_x_axis. Its effective shear stiffness cannot be determined.") pass if True: if pier['side'] == 'left': # X_positive if sign_is_equal: length_top_x = abs(max(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(min(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) - \ max(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (min(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) + max(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) - \ max(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (min(pier['coordinates']['RHS']['ULH'][0], pier['coordinates']['RHS']['LLH'][0]) + max(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['RHS']['ULH'][1], pier['coordinates']['RHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRH'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(min(pier['coordinates']['RHS']['ULH'][2], pier['coordinates']['RHS']['URH'][2]) - \ max(pier['coordinates']['RHS']['LLH'][2], pier['coordinates']['RHS']['LRH'][2])) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) ### # X_negative if sign_is_equal: length_top_x = abs(max(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0])) length_top_y = abs(max(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1])) x_nc = (max(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0]))/2 y_nc = (max(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0])) length_top_y = abs(min(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) - \ max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1])) x_nc = (max(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0]))/2 y_nc = (min(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) + max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) - \ max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0])) length_top_y = abs(max(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1])) x_nc = (min(pier['coordinates']['RHS']['ULL'][0], pier['coordinates']['RHS']['LLL'][0]) + max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRL'][0]))/2 y_nc = (max(pier['coordinates']['RHS']['ULL'][1], pier['coordinates']['RHS']['LLL'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRL'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(max(pier['coordinates']['RHS']['ULL'][2], pier['coordinates']['RHS']['URL'][2]) - \ max(pier['coordinates']['RHS']['LLL'][2], pier['coordinates']['RHS']['LRL'][2])) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['side'] == 'middle': # X_positive if sign_is_equal: length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(pier['coordinates']['LHS']['ULL'][2] - pier['coordinates']['RHS']['LRH'][2]) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) ### # X_negative if sign_is_equal: length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + max(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) - \ max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1])) x_nc = (min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLH'][0]) + max(pier['coordinates']['RHS']['URL'][0], pier['coordinates']['RHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['RHS']['URL'][1], pier['coordinates']['RHS']['LRH'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(pier['coordinates']['LHS']['LLH'][2] - pier['coordinates']['RHS']['URL'][2]) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['side'] == 'right': # X_positive if sign_is_equal: length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) - \ min(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) - \ min(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) + min(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) + min(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) - \ min(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0])) length_top_y = abs(min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) - \ max(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1])) x_nc = (max(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) + min(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0]))/2 y_nc = (min(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) + max(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) - \ max(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) - \ min(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1])) x_nc = (min(pier['coordinates']['LHS']['ULL'][0], pier['coordinates']['LHS']['LLL'][0]) + max(pier['coordinates']['LHS']['URL'][0], pier['coordinates']['LHS']['LRL'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULL'][1], pier['coordinates']['LHS']['LLL'][1]) + min(pier['coordinates']['LHS']['URL'][1], pier['coordinates']['LHS']['LRL'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(min(pier['coordinates']['LHS']['ULL'][2], pier['coordinates']['LHS']['URL'][2]) - \ max(pier['coordinates']['LHS']['LLL'][2], pier['coordinates']['LHS']['LRL'][2])) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) ### # X_negative if sign_is_equal: length_top_x = abs(max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1]))/2 elif pier['workplane'] == 'XZ': length_top_x = abs(max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) - \ min(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0])) length_top_y = abs(min(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) - \ max(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1])) x_nc = (max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) + min(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0]))/2 y_nc = (min(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) + max(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1]))/2 elif pier['workplane'] == 'YZ': length_top_x = abs(min(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) - \ max(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) - \ min(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1])) x_nc = (min(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLH'][0]) + max(pier['coordinates']['LHS']['URH'][0], pier['coordinates']['LHS']['LRH'][0]))/2 y_nc = (max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLH'][1]) + min(pier['coordinates']['LHS']['URH'][1], pier['coordinates']['LHS']['LRH'][1]))/2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(min(pier['coordinates']['LHS']['ULH'][2], pier['coordinates']['LHS']['URH'][2]) - \ max(pier['coordinates']['LHS']['LLH'][2], pier['coordinates']['LHS']['LRH'][2])) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) #Assign stiffness in y-direction according to wall orientation if sign_is_equal: pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['workplane'] == 'XZ': pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) elif pier['workplane'] == 'YZ': pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) elif pier['side'] == None: length_top_x = abs(max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLL'][0]) - \ min(pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRL'][0])) length_top_y = abs(max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLL'][1]) - \ min(pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRL'][1])) x_nc = (max(pier['coordinates']['LHS']['ULH'][0], pier['coordinates']['LHS']['LLL'][0]) + min( pier['coordinates']['RHS']['URH'][0], pier['coordinates']['RHS']['LRL'][0])) / 2 y_nc = (max(pier['coordinates']['LHS']['ULH'][1], pier['coordinates']['LHS']['LLL'][1]) + min( pier['coordinates']['RHS']['URH'][1], pier['coordinates']['RHS']['LRL'][1])) / 2 length_top = sqrt(length_top_x ** 2 + length_top_y ** 2) height_eff = abs(min(pier['coordinates']['LHS']['ULH'][2], pier['coordinates']['RHS']['URH'][2]) - \ max(pier['coordinates']['LHS']['LLL'][2], pier['coordinates']['RHS']['LRL'][2])) k_shear = _compute_pier_shear_stiffness(project, pier, height_eff, length_top, boundary='cantilever') k_shear_x = k_shear * abs(wall_horizontal_direction_vector[0]) k_shear_y = k_shear * abs(wall_horizontal_direction_vector[1]) pier.update({'x_nc': x_nc, 'y_nc': y_nc}) pier['k_shear'].update({'X_pos': k_shear_x}) pier['k_shear'].update({'Y_pos': k_shear_y}) pier['k_shear'].update({'X_neg': k_shear_x}) pier['k_shear'].update({'Y_neg': k_shear_y}) return piers
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================