Source code for viiapackage.supports.pile_foundation.create_material

### ===================================================================================================================
###   Create the materials for the piles
### ===================================================================================================================
# Copyright ©VIIA 2024

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

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

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.materials import RayleighDamping, Concrete, ReinforcementSteel, TranslationalSpring, RotationalSpring, \
    UserSuppliedMaterialModel, LinearElasticityTranslationalSpringBehaviourMaterialModel, \
    LinearElasticityRotationalSpringBehaviourMaterialModel, UltimateForcesTranslationalSpringBehaviourMaterialModel, \
    NoPlasticHardeningModel, MultiLinearCSC, RotatingTSCM, UserCBW, HordijkTSC

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


### ===================================================================================================================
###   2. Function to create the concrete material of the Huan-beam of the pile
### ===================================================================================================================

[docs]def viia_create_pile_huanbeam_material( project: ViiaProject, pile_basename: str, pile_properties: Dict[str, Dict[str, Union[float, List[float]]]], is_linear: bool = False) -> Concrete: """ This function creates the (concrete) material for the Huan-beam in the piles. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - pile_basename (str): Basename of the materials. For example "PAAL-TYPE-A". - is_linear (bool): Argument that creates a linear or non-linear concrete material model for the Huan-beam. - pile_properties (dict): Dictionary contains calculated pile properties based on pile data from MYVIIA. Output: - Returns the material for the Huan-beam, created according to the data from MYVIIA. """ # Create variable for easy access huanbeam = pile_properties['huan_beam_properties'] required = {'youngs_modulus', 'poissons_ratio', 'raylei_a', 'raylei_b', 'density'} # Create the linear material if requested if is_linear: # Validate input if list(required.difference(huanbeam.keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create linear concrete material for " "Huan-beam.") # Create linear material object for Huan beam of current pile type return project.create_user_defined_concrete( name=f'LIN-{pile_basename}-HUAN', material_model=project.create_linear_elastic_isotropic_model( # Youngs modulus of concrete uncracked [N/m2] youngs_modulus=huanbeam['youngs_modulus'], # Poisson's ratio of concrete [-] poissons_ratio=huanbeam['poissons_ratio'], aspects=[RayleighDamping( mass_factor=huanbeam['raylei_a'], stiffness_factor=huanbeam['raylei_b'])]), # Density of concrete [kg/m3] mass_density=huanbeam['density']) # Create the non-linear materials if requested else: # Validate input required |= { 'compressive_stress_strain_diagram', 'tensile_strength', 'tensile_fracture_energy', 'residual_tensile_strength', 'crack_bandwidth', 'compressive_strength'} if list(required.difference(huanbeam.keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create concrete material for Huan-beam.") # Stress strain diagram compresion huan beam [N/m2, -] stress_strain = huanbeam['compressive_stress_strain_diagram'] # Create non-linear material object for Huan-beam return project.create_user_defined_concrete( name=f'{pile_basename}-HUAN', material_model=project.create_total_strain_crack_model( # Youngs modulus of concrete uncracked [N/m2] youngs_modulus=huanbeam['youngs_modulus'], total_strain_crack_model=RotatingTSCM(), # Poisson's ratio of concrete [-] poissons_ratio=huanbeam['poissons_ratio'], tensile_curve=HordijkTSC( # Tension strenght Huan-beam [N/m2] tensile_strength=huanbeam['tensile_strength'], # Tensile fraqture energy [N/m] tensile_fracture_energy=huanbeam['tensile_fracture_energy'], # Residual tensile strength [N/m2] tensile_rest_strength=huanbeam['residual_tensile_strength'], poisson_reduction='damage based', crack_bandwidth=UserCBW(crack_bandwidth=huanbeam['crack_bandwidth'])), compressive_curve=MultiLinearCSC( # Compresive strenght huan beam [N/m2] compressive_strength=huanbeam['compressive_strength'], compressive_strain_stress=[ [stress_strain[i] for i in range(0, len(stress_strain), 2)], [stress_strain[i] for i in range(1, len(stress_strain), 2)]], lateral_cracking=None, confinement=None), aspects=[RayleighDamping( mass_factor=huanbeam['raylei_a'], stiffness_factor=huanbeam['raylei_b'])]), # Density of concrete [kg/m3] mass_density=huanbeam['density'])
### =================================================================================================================== ### 3. Function to create the reinforcement steel material for the rebar of the Huan-beam of the pile ### ===================================================================================================================
[docs]def viia_create_pile_rebar_material( project: ViiaProject, pile_basename: str, pile_properties: Dict[str, Dict[str, Union[float, List[float]]]]) -> ReinforcementSteel: """ This function creates the steel reinforcement material for the rebar of the Huan-beam in the piles. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - pile_basename (str): Basename of the materials. For example "PAAL-TYPE-A". - pile_properties (dict): Dictionary contains calculated pile properties based on pile data from MYVIIA. Output: - Returns the steel reinforcement material for the rebar of the Huan-beam, created according to the data from MYVIIA. """ # Validate input if 'pile_reinforcement' not in pile_properties or \ list({'youngs_modulus', 'yield_stress'}.difference(pile_properties['pile_reinforcement'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create reinforcement steel material for " "Huan-beam.") return project.create_user_defined_reinforcement_steel( name=f'{pile_basename}-HUAN-WAPENING', material_model=project.create_von_mises_plasticity_model( # Youngs modulus of reinforcement steel for Huan-beam of pile [N/m2] youngs_modulus=pile_properties['pile_reinforcement']['youngs_modulus'], poissons_ratio=0, plastic_hardening_model=NoPlasticHardeningModel( # Yielding stress reinforcement for beam element [N/m2] yield_stress=pile_properties['pile_reinforcement']['yield_stress'])))
### =================================================================================================================== ### 4. Functions to create the spring materials of the pile ### ===================================================================================================================
[docs]def viia_create_pile_horizontal_translational_spring_material( project: ViiaProject, direction: str, pile_basename: str, pile_properties: Dict[str, Dict[str, Union[float, int, List[float], List[int], List[List[float]]]]], is_linear: bool = False) -> TranslationalSpring: """ Create the material for springs in horizontal translational-direction for pile. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - direction (str): Direction for the translational spring, can be 'x' or 'y'. - pile_basename (str): Basename of the materials, it will be extended with the corresponding spring direction. - pile_properties (dict): Dictionary contains calculated pile properties based on pile data from MYVIIA. - is_linear (bool): Select to create linear or non-linear spring material. Default value False, creating non-linear spring material. For non-linear material, additional properties are used. Output: - Returns the material for translational spring. """ if is_linear: # Validate input if 'spring_values' not in pile_properties or \ list({f'spring_stiffness_{direction}', f'spring_damping_{direction}'}.difference( pile_properties['spring_values'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create linear horizontal translational " "spring material for the pile.") return project.create_user_defined_spring_behaviour( name=f'LIN-{pile_basename}-FCRIT{direction.upper()}', material_model=project.create_translational_spring_model( spring_stiffness=pile_properties['spring_values'][f'spring_stiffness_{direction}'], spring_behaviour=LinearElasticityTranslationalSpringBehaviourMaterialModel(), constant_damping_coefficient=pile_properties['spring_values'][f'spring_damping_{direction}'])) else: # Validate input if 'spring_values' not in pile_properties or \ list({f'spring_stiffness_{direction}', f'spring_damping_{direction}', 'force_elongation_diagram'}.difference(pile_properties['spring_values'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create non-linear horizontal translational " "spring material for the pile.") user_supplied_material = UserSuppliedMaterialModel( name='SPHYST', material_model_type='usrspr', # Parameters in order: initial stiffness, damping coefficient of dashpot, # number of elastic entries in F-D diagram, number of plastic entries in F-D diagram, # F-D diagram where force from unloading stiffness is subtracted (alternation F then D entries) material_parameters=pile_properties['subroutine_data']['material_parameters'], # The value for the initial state is a list of zeros initial_state_values=pile_properties['subroutine_data']['initial_state_values'], # Initial values is zero initial_values=pile_properties['subroutine_data']['initial_values']) return project.create_user_defined_spring_behaviour( name=f'{pile_basename}-FCRIT{direction.upper()}', material_model=project.create_translational_spring_model( spring_stiffness=pile_properties['spring_values'][f'spring_stiffness_{direction}'], spring_behaviour=LinearElasticityTranslationalSpringBehaviourMaterialModel(), aspects=[user_supplied_material]))
[docs]def viia_create_pile_vertical_translational_spring_material( project: ViiaProject, pile_basename: str, pile_properties: Dict[str, Dict[str, Union[float, List[List[float]]]]], is_linear: bool = False) \ -> TranslationalSpring: """ Create the material for springs in vertical translational-direction for pile. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - pile_basename (str): Basename of the materials, it will be extended with the corresponding spring direction. - pile_properties (dict): Dictionary contains calculated pile properties based on pile data from MYVIIA. - is_linear (bool): Select to create linear or non-linear spring material. Default value False, creating non-linear spring material. For non-linear material, additional properties are used. Output: - Returns the material for translational spring. """ if is_linear: # Validate input if 'spring_values' not in pile_properties or \ list({f'spring_stiffness_z', f'spring_damping_z'}.difference(pile_properties['spring_values'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create linear vertical translational spring " "material for the pile.") return project.create_user_defined_spring_behaviour( name=f'LIN-{pile_basename}-FCRITZ', material_model=project.create_translational_spring_model( spring_stiffness=pile_properties['spring_values'][f'spring_stiffness_z'], spring_behaviour=LinearElasticityTranslationalSpringBehaviourMaterialModel(), constant_damping_coefficient=pile_properties['spring_values'][f'spring_damping_z'])) else: # Validate input if 'spring_values' not in pile_properties or \ list({f'spring_stiffness_z', f'spring_damping_z', 'max_tensile_force_z', 'max_compressive_force_z'}.difference(pile_properties['spring_values'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create non-linear vertical translational " "spring material for the pile.") return project.create_user_defined_spring_behaviour( name=f'{pile_basename}-FCRITZ', material_model=project.create_translational_spring_model( spring_stiffness=pile_properties['spring_values'][f'spring_stiffness_z'], spring_behaviour=UltimateForcesTranslationalSpringBehaviourMaterialModel( minimum_ultimate_force=pile_properties['spring_values']['max_compressive_force_z'], maximum_ultimate_force=pile_properties['spring_values']['max_tensile_force_z']), constant_damping_coefficient=pile_properties['spring_values'][f'spring_damping_z']))
[docs]def viia_create_pile_rotational_spring_material( project: ViiaProject, direction: str, pile_basename: str, pile_properties: Dict[str, Dict[str, Union[float, List[List[float]]]]]) -> RotationalSpring: """ Create the material for springs in rotational-direction for pile. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - direction (str): Direction for the rotational spring, can be 'x' or 'y'. - pile_basename (str): Basename of the materials, it will be extended with the corresponding spring direction. - pile_properties (dict): Dictionary contains calculated pile properties based on pile data from MYVIIA. Output: - Returns the material for rotational spring. """ # Validate input if 'spring_values' not in pile_properties or \ list({f'spring_stiffness_r{direction}', f'spring_damping_r{direction}'}.difference( pile_properties['spring_values'].keys())): raise KeyError( "ERROR: The pile-properties are not provided correctly to create rotational spring material for the pile.") return project.create_user_defined_spring_behaviour( name=f'LIN-{pile_basename}-ROT{direction.upper()}', material_model=project.create_rotational_spring_model( spring_stiffness=pile_properties['spring_values'][f'spring_stiffness_r{direction}'], spring_behaviour=LinearElasticityRotationalSpringBehaviourMaterialModel(), constant_damping_coefficient=pile_properties['spring_values'][f'spring_damping_r{direction}']))
### =================================================================================================================== ### 5. End of script ### ===================================================================================================================