Source code for viiapackage.materials.viia_get_material_group

### ===================================================================================================================
###  Function to collect the material-group based on VIIA naming conventions
### ===================================================================================================================
# Copyright ©2026 Haskoning Nederland B.V.
# For use by VIIA

### ===================================================================================================================
###  Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING

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


### ===================================================================================================================
###  Get material-group based on material-name
### ===================================================================================================================

[docs]def viia_get_material_group(project: ViiaProject, material_name: str) -> str: """ Function to find the material group of the element material based on the name of the material. The groups are related to the material type. Materials are split in category's 'linear' and 'non-linear'. All information needed is in the name of the material (VIIA naming convention). Currently available material-groups are: Linear: - 'Linear' - 'LinearInterface' - 'LinearOrthotropic' - 'LinearSpring' - 'EmbeddedPile' - 'TimberFrame' - 'PointMass' - 'LineMass' - 'LineMass-Truss' - 'SurfaceMass' - 'Dummy' Non-linear: - 'NonLinMasonry' - 'NonLinConcrete' - 'NonLinRebar' - 'NonLinBondSlipRebar' - 'NonLinSteel' - 'Soil' - 'NonLinInterfaceFriction' - 'NonLinElasticInterface' - 'USRDEF' - 'NonLinSpring' Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - material_name (str): Name of the material to be created (VIIA naming convention). Output: - The name of the material group is returned as string. """ # Masonry material model is meshsize dependent and should be removed for this check # Also any adjusted density name_parts = ['-0.25x0.25', '-0.5x0.5', '-0.1x0.1'] for name_part in name_parts: if name_part in material_name: material_name = material_name.replace(name_part, '') if '-DENSIT' in material_name: material_name = material_name.split('-DENSIT')[0] # Check if material is in VIIA material database, if present the material-group will be returned material_in_dict = project.viia_check_materialname_present(material_name=material_name) if material_in_dict: return material_in_dict # If the material is not in the VIIA material database, the name contains the information to create the material if 'LIN' in material_name or 'DUMMY' in material_name: # Linear materialmodels by name # Material name with 4 parts expected for KPV with structural top layer (e.g. "LIN-KPV-floor_thick-layer_thick") if 'BETON' in material_name or 'SANDWICH' in material_name or \ ('KPV' in material_name and len(material_name.split('-')) == 4 and project.analysis_type == 'SBS'): # Material model: Concrete and masonry | Linear elastic isotropic return 'Linear' if 'EmbeddedPile' in material_name: # Material model: Reinforcements and pile foundations | Foundation pile return 'EmbeddedPile' if 'KPV' in material_name: # Material model: Concrete and masonry | Linear elastic orthotropic return 'LinearOrthotropic' if 'PLANKEN' in material_name or 'PLATEN' in material_name or 'HSB' in material_name: # Material model: Concrete and masonry | Direct stiffness matrix for flat shells return 'TimberFrame' if 'WAPENING' in material_name: # Material model: Reinforcements and pile foundation | Linear return 'LinRebar' if 'PUNTMASSA' in material_name: # Material model: Mass elements | Point mass return 'PointMass' if 'LIJNMASSA' in material_name: if len(material_name.split('-')) == 4: # Material model: Mass elements | Line mass 3D return 'LineMass' else: # Material model: Steel | Linear elastic isotropic return 'LineMass-Truss' if 'VLAKMASSA' in material_name: # Material model: Mass elements | Surface mass return 'SurfaceMass' if 'DUMMY' in material_name: # Material model: Mass elements | Point mass return 'Dummy' if 'SPOUWANKER' in material_name or 'SPRING' in material_name or 'FCRIT' in material_name: # Material model: Springs and dashpots | Translational spring-dashpot return 'LinearTranslationalSpring' if 'ROT' in material_name: # Material model: Springs and dashpots | Rotational spring-dashpot return 'LinearRotationalSpring' else: # Non-linear materialmodels by name if 'USRDEF' in material_name: # Material model: User supplied subroutine return 'USRDEF' if 'BETON' in material_name: # Material model: Concrete and masonry | Total strain based crack model return 'NonLinConcrete' if 'SPOUWANKER' in material_name: # Material model: Springs and dashpots | Translational spring-dashpot return 'NonLinSpring' # Else the material is not recognised raise NotImplementedError(f"ERROR: Unknown material name: '{material_name}'.")
### =================================================================================================================== ### End of script ### ===================================================================================================================