Source code for viiapackage.viiaDatas

### =============================================================================================================== ###
###                                                                                                                 ###
###                                                   viiaData.py                                                   ###
###                                                                                                                 ###
### =============================================================================================================== ###
# This module ``viiaData`` contains the functions that handle the data properties of the shapes and connections.
# It contains available functionality to create the data instances, based on VIIA conventions.

# Module is based on:
# VIIA_QE_R376 Basis of Design Retrofit Advice NLTH, v11.0, d.d. 29 August 2024
# VIIA_QE_R376 Basis of Design Step-by-Step MRS, v1.0, d.d. 21 January 2022
# VIIA_QE_R1674 Uitgangspuntenrapport engineering NLPO, v1.0, d.d. 1 August 2019

# This script was based upon the Constitution For Python At VIIA
# For use by VIIA
# Copyright RHDHV

### ===================================================================================================================
###   Contents script
### ===================================================================================================================

#   1. Import modules

#   2. Function to create instance of Data class for VIIA

#   3. Function to create all Data classes for the shapes and connections in the model

#   4. End of script

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

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

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.connections import Interface, BoundaryInterface, Spring, BoundarySpring
from rhdhv_fem.shapes import Points
from rhdhv_fem.data import Data

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


### ===================================================================================================================
###   2. Function to create instance of Data class for VIIA
### ===================================================================================================================

[docs]def viia_create_datas(project: ViiaProject, data_names: Union[str, List[str]]) -> Data: """ This function will create an instance of the Data class, based on VIIA naming convention. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - data_names (str): Name of the element data to be created. Alternative (list of str): List of multiple strings, the names of the data-models for the element data to be created. All data-models are part of a single instance of the Data class. The name of which is a combination of the names of the data-models. Output: - Returns the object reference to the 'Data' object that is created based on the input arguments. - If name is not corresponding to the VIIA naming convention an error is raised. """ # Argument handling if isinstance(data_names, str): data_names = [data_names] # Create the joined name data_name_joined = '+'.join(data_names) # Check if the data is already present (check on name) for data in project.collections.datas: if data.name == data_name_joined: return data # Create the data-models data_models = [] for data_name in data_names: data_name = data_name.upper() # Check if data requested is for the number of integration points if 'THINTE' in data_name: data_models.append(project.create_integration_points_thickness( integration_points=int(data_name.split('THINTE')[-1]))) # Set data properties for piles elif 'PALEN' in data_name: data_models.append(project.create_bondslip_interface_reinforcement(behaviour='beam')) data_models.append(project.create_integration_points_tangential( integration_points=project.viia_settings.INTEGRATION_POINTS_LINEAR)) # Check if data requested is for interfaces (combination of integration points and no-geometrical non-linearity) elif 'INTERFACE' in data_name or 'PUNT-IF' in data_name or 'LIJN-IF' in data_name or 'VLAK-IF' in data_name: if 'LIN' in data_name: data_models.append(project.create_integration_points_thickness( integration_points=project.viia_settings.INTEGRATION_POINTS_LINEAR)) else: data_models.append(project.create_integration_points_thickness( integration_points=project.viia_settings.INTEGRATION_POINTS_NONLINEAR)) if project.analysis_type != 'SBS': data_models.append(project.create_no_geometrical_nonlinearity_interface()) # Set data for CFRP strips in L4O measure elif 'L4O' in data_name: data_models.append(project.create_bondslip_interface_reinforcement(behaviour='truss')) # Set data properties for soil elif 'GROND' in data_name: data_models.append(project.create_no_EAS_modes()) elif 'TORSTI' in data_name: data_models.append(project.create_torsional_stiffness_3DBeams()) # Otherwise the name is not recognised, None is returned else: raise NotImplementedError( f"ERROR: Data-model requested '{data_name}' is not recognised (does not comply to VIIA naming " f"convention.") # Make sure no duplicates of data's are included data_models = list(set(data_models)) return project.create_data(name=data_name_joined, data_models=data_models)
### =================================================================================================================== ### 3. Function to create all Data classes for the shapes and connections in the model ### ===================================================================================================================
[docs]def viia_create_all_datas(project: ViiaProject): """ This function will set the data properties for all the shapes and connections, based on the VIIA convention. For all soil shapes the data is set for 'GROND' and interfaces 'INTERFACE'. For the rest of the shapes and connections the number of integration points over the thickness is set to the number in viiaSettings (depending on linear or non-linear material behaviour). Point-shapes, no-connections and tyings are excluded in this function. Also, shapes or connections that already have a data assigned are not updated. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. Output: - All data attributes of shapes and connections are set. Except if the shape or connection has sub-shapes or already has a data set. """ # Set the default datas for shapes, following VIIA protocol for shape in project.collections.shapes: # Create the data if there is no data assigned yet and exclude for point-shapes if hasattr(shape, 'data') and shape.data is None and not isinstance(shape, Points): # Beam elements of the piles with reinforcement have specified data if 'HUAN' in shape.material.name and 'WAPENING' not in shape.material.name: shape.data = project.viia_create_datas('PALEN') # Other shapes get integration points based on the linearity of the material applied elif shape.material.is_linear: shape.data = project.viia_create_datas(f'THINTE{project.viia_settings.INTEGRATION_POINTS_LINEAR}') else: shape.data = project.viia_create_datas(f'THINTE{project.viia_settings.INTEGRATION_POINTS_NONLINEAR}') # Set the default datas for connections, following VIIA protocol for connection in project.collections.connections: # These don't have integration points but can have material if isinstance(connection, (Spring, BoundarySpring)): continue # Create the data if there is no data assigned yet and exclude for point-shapes if hasattr(connection, 'data') and connection.data is None: # Interface connections have a specified data if isinstance(connection, (Interface, BoundaryInterface)): if connection.material.is_linear: connection.data = project.viia_create_datas('INTERFACE-LIN') else: connection.data = project.viia_create_datas('INTERFACE') # Other connections get integration points based on the linearity of the material applied elif hasattr(connection, 'material'): if connection.material.is_linear: connection.data = \ project.viia_create_datas(f'THINTE{project.viia_settings.INTEGRATION_POINTS_LINEAR}') else: connection.data = \ project.viia_create_datas(f'THINTE{project.viia_settings.INTEGRATION_POINTS_NONLINEAR}')
### =================================================================================================================== ### 4. End of script ### ===================================================================================================================