### ===================================================================================================================
### Function to collect the material-group constants
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
import yaml
from typing import TYPE_CHECKING, Optional, Dict
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Get material-group constants based on material-group
### ===================================================================================================================
[docs]def viia_get_material_group_constants(project: ViiaProject, material_group: str) -> Optional[Dict]:
"""
This function will return a dictionary with the material group constants from the viia_constants database.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- material_group (str): Name of the material group that is looked up in the viia constants database.
Output:
- Return dictionary with the constants of the material group from the database.
"""
# Read yaml with VIIA constants
with open(project.viia_settings.project_specific_package_location / 'viia_constants.yaml') as f:
material_group_constants_dict = yaml.load(f, Loader=yaml.FullLoader)['Materials'][material_group]
# Delete Rayleigh damping in case of SBS approach
if project.analysis_type == 'SBS' and 'rayleigh damping' in material_group_constants_dict['aspects']:
material_group_constants_dict['aspects'].remove('rayleigh damping')
# Return the material group properties
return material_group_constants_dict
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================