### ===================================================================================================================
### Create flexbase pile foundations
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, List, Union
import math
# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Fstrip, Floor, Wall
from rhdhv_fem.groups import Part
from rhdhv_fem.shape_geometries import Node
from rhdhv_fem.supports import PointSupport
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
from viiapackage.supports.pile_foundation.collect_pile_foundation_myviia import viia_get_pile_properties_from_myviia
from viiapackage.supports.pile_foundation.create_material import viia_create_pile_huanbeam_material, \
viia_create_pile_rebar_material, viia_create_pile_horizontal_translational_spring_material, \
viia_create_pile_vertical_translational_spring_material, viia_create_pile_rotational_spring_material
from viiapackage.supports.pile_foundation.create_geometry import viia_create_pile_huanbeam_geometry, \
viia_create_pile_rebar_geometry, viia_create_pile_translational_spring_geometry, \
viia_create_pile_rotational_spring_geometry
from viiapackage.supports.pile_foundation.relative_coordinates_rebar import viia_relative_coordinates_pile_rebar
### ===================================================================================================================
### 2. Helper functions
### ===================================================================================================================
def _get_fstrip_shape(node: Node):
""" Function to collect the fstrip the node connects to, in case of more, the first one is selected."""
shapes = node.get_shapes()
for shape in shapes:
if isinstance(shape, Fstrip):
return shape
for shape in shapes:
if isinstance(shape, Floor):
return shape
min_shape_val = None
min_shape = None
for shape in shapes:
if isinstance(shape, Wall):
min = shape.contour.get_min_z()
if min_shape_val is None or min_shape_val < min:
min_shape_val = min
min_shape = shape
if min_shape:
return min_shape
return shapes[0]
### ===================================================================================================================
### 3. Function to create flexbase piles per pile-group
### ===================================================================================================================
[docs]def viia_create_piles_flexbase(
project: ViiaProject, connecting_nodes: List[Node], pile_group: str, counter: int = 1, is_linear: bool = False,
pile_numbers: Optional[List[Union[int, str]]] = None, plot_diagram: bool = False,
horizontal_stiffness_factor: float = 1.0) -> List[Union[Part, PointSupport]]:
"""
This function creates piles in a pile-group for the flexbase pile foundation.
.. note:: If piles are located at the positions where there are several strips overlapping the same area at
different height, the piles will be created under the lowest strip.
.. warning:: This function uses the pile properties on MYVIIA. Make sure to complete the workflow for piles to
calculate the pile-properties. This requires involvement of the geotechnical advisor. In case is_linear is
selected, less information from MYVIIA is required.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- connecting_nodes (list of nodes): List with the nodes, which are the connecting points on the foundation
strips. These nodes should be part of the Fstrip (on contour or as internal point).
- pile_group (str): Name of the pile group (e.g. A, B, C...), to retrieve pile data from MYVIIA. Use the name
that is shown in MYVIIA.
- counter (int): Counter for the numbering of the piles. Default starting at 1, but in case of multiple
pile-groups in the model, the numbering should start at higher numbers.
- is_linear (bool): Select to create flexbase with linear material properties and without rebar. Default value
is False, creating nonlinear materials and rebar for the piles.
- pile_numbers (list): List of pile numbers that is used to number the piles. The user can overrule the
auto-numbering by providing this list. The list should be of equal length as the list of coordinates. Default
value is None, in which case the piles are numbered regularly (based on order of creation). It is also
possible to provide a list of strings.
- plot_diagram (bool): Option to create plot of the force-elongation diagram for the pile group. It will create
an image in a folder 'Pile properties' in the working folder. Default value is False.
- horizontal_stiffness_factor (float): Specifies the factor to adjust the horizontal stiffness of the piles.
Default value is 1.0.
Output:
- Returns list of created piles and point supports.
"""
# Convert pile properties from myviia data:
pile_properties = viia_get_pile_properties_from_myviia(project=project, pile_group=pile_group, plot=plot_diagram)
# Optional factor to adjust the horizontal stiffness of the piles (applied on the elongation part of the diagram)
factor = 1.0 / horizontal_stiffness_factor
pile_properties['spring_values']['force_elongation_diagram'][0] = \
[d * factor for d in pile_properties['spring_values']['force_elongation_diagram'][0]]
# Default properties for flexbase piles
pile_basename = f"PAAL-TYPE-{pile_group}"
layer = project.viia_create_layer(name='F')
# Create the materials for the flexbase pile
huan_beam_rebar_material = None
if project.software == 'abaqus':
huan_beam_material = viia_create_pile_huanbeam_material(
project=project, pile_basename=pile_basename, pile_properties=pile_properties, is_linear=True)
else:
huan_beam_material = viia_create_pile_huanbeam_material(
project=project, pile_basename=pile_basename, pile_properties=pile_properties, is_linear=is_linear)
if not is_linear:
huan_beam_rebar_material = viia_create_pile_rebar_material(
project=project, pile_basename=pile_basename, pile_properties=pile_properties)
fcritx_material = viia_create_pile_horizontal_translational_spring_material(
project=project, direction='x', pile_basename=pile_basename, pile_properties=pile_properties,
is_linear=is_linear)
fcrity_material = viia_create_pile_horizontal_translational_spring_material(
project=project, direction='y', pile_basename=pile_basename, pile_properties=pile_properties,
is_linear=is_linear)
fcritz_material = viia_create_pile_vertical_translational_spring_material(
project=project, pile_basename=pile_basename, pile_properties=pile_properties, is_linear=is_linear)
rotx_material = viia_create_pile_rotational_spring_material(
project=project, direction='x', pile_basename=pile_basename, pile_properties=pile_properties)
roty_material = viia_create_pile_rotational_spring_material(
project=project, direction='y', pile_basename=pile_basename, pile_properties=pile_properties)
# Create the geometries for the flexbase pile
huan_beam_geometry = viia_create_pile_huanbeam_geometry(
project=project, pile_basename=pile_basename, pile_dimension=pile_properties['pile_dim'],
pile_shape=pile_properties['pile_shape'].lower())
huan_beam_rebar_geometry = None
if project.software != 'abaqus' and not is_linear:
if 'pile_reinforcement' in pile_properties and 'rebar_area' in pile_properties['pile_reinforcement']:
dim_rebar = 2 * math.sqrt(pile_properties['pile_reinforcement']['rebar_area'] / math.pi)
huan_beam_rebar_geometry = viia_create_pile_rebar_geometry(
project=project, pile_basename=pile_basename, rebar_dimension=dim_rebar)
fcrit_geometry = viia_create_pile_translational_spring_geometry(project=project)
rot_geometry = viia_create_pile_rotational_spring_geometry(project=project)
x_axes = [
project.create_direction(name='x'), project.create_direction(name='y'), project.create_direction(name='z')]
y_axes = [
project.create_direction(name='y'), project.create_direction(name='z'), project.create_direction(name='x')]
z_axes = [
project.create_direction(name='z'), project.create_direction(name='x'), project.create_direction(name='y')]
# Create the data for the flexbase pile
pile_data = project.viia_create_datas(f'THINTE7')
huan_beam_data = project.viia_create_datas(f'THINTE{pile_properties["huan_beam_intergration"]}')
# Create the support-set and the axes
support_set = project.create_support_set('PileSupport')
axes = [project.create_direction(name='X'), project.create_direction(name='Y'), project.create_direction(name='Z')]
# List with relative locations of rebar
rebar_relative_coordinates = None
if project.software != 'abaqus' and not is_linear:
rebar_relative_coordinates = viia_relative_coordinates_pile_rebar(
rebar_configuration=pile_properties['pile_reinforcement']['rebar_config'],
pile_dimension=pile_properties['pile_dim'],
edge_distance=pile_properties['pile_reinforcement']['edge_distance'],
pile_shape=pile_properties['pile_shape'].lower())
# Start creating piles in PY-memory
project.assign_list(True)
# Create the individual piles
created_piles = []
for i, node in enumerate(connecting_nodes):
# Get the connecting foundation strip shape
shape = _get_fstrip_shape(node)
if isinstance(shape, Wall):
strip_height = 0
else:
strip_height = shape.geometry.geometry_model.thickness
# Dimension of the Huan beam is half of the foundation strip minus the default dimension of the springs
# Minimum height is the default dimension of the springs
dim_huan_beam = max(
strip_height / 2 - project.pile_foundation_settings['dimension_pile_spring'],
project.pile_foundation_settings['dimension_pile_spring'])
# Coordinate of the bottom of the springs and the top of the Huan-beam
point_1 = [
node.coordinates[0], node.coordinates[1],
node.coordinates[2] - project.pile_foundation_settings['dimension_pile_spring']]
# Coordinate of the bottom of the Huan-beam
point_2 = [
node.coordinates[0], node.coordinates[1],
node.coordinates[2] - project.pile_foundation_settings['dimension_pile_spring'] - dim_huan_beam]
# Set the name for the pile
if pile_numbers:
nr = pile_numbers[i]
else:
nr = counter
pile_name = f'{pile_basename}-{nr}'
# Collect the created shapes and connections
collect_shapes = []
collect_connections = []
# Create the Huan-beam shape of the pile
huan_beam = project.create_pile(
name=f'{pile_basename}-HUAN-{nr}', contour=project.create_line([point_2, point_1]),
material=huan_beam_material, geometry=huan_beam_geometry, data=huan_beam_data)
collect_shapes.append(huan_beam)
layer.add_shape(huan_beam)
# Create the springs for the pile 5 degrees of freedom
connecting_shapes = {
'source_connecting_shape': huan_beam, 'target_connecting_shape': shape,
'source_shape_geometry': huan_beam.contour.node_end, 'target_shape_geometry': node}
collect_connections.append(project.create_spring(
name=f'{pile_name}-FCRITX', connecting_shapes=connecting_shapes, material=fcritx_material,
geometry=fcrit_geometry, data=pile_data, axes=x_axes))
collect_connections.append(project.create_spring(
name=f'{pile_name}-FCRITY', connecting_shapes=connecting_shapes, material=fcrity_material,
geometry=fcrit_geometry, data=pile_data, axes=y_axes))
collect_connections.append(project.create_spring(
name=f'{pile_name}-FCRITZ', connecting_shapes=connecting_shapes, material=fcritz_material,
geometry=fcrit_geometry, data=pile_data, axes=z_axes))
collect_connections.append(project.create_spring(
name=f'{pile_name}-ROTX', connecting_shapes=connecting_shapes, material=rotx_material,
geometry=rot_geometry, data=pile_data, axes=x_axes))
collect_connections.append(project.create_spring(
name=f'{pile_name}-ROTY', connecting_shapes=connecting_shapes, material=roty_material,
geometry=rot_geometry, data=pile_data, axes=y_axes))
# Create the rebar for the Huan-beam shape of the pile (only for nonlinear analysis)
if project.software != 'abaqus' and not is_linear:
for i, rel_coordinate in enumerate(rebar_relative_coordinates):
x = node.coordinates[0] + rel_coordinate[0]
y = node.coordinates[1] + rel_coordinate[1]
rebar = project.create_main_line_reinforcement(
name=f'{pile_name}-HUAN-WAPENING-{i + 1}', contour=project.create_line(
point_list=[[x, y, point_2[2]], [x, y, point_1[2]]]),
material=huan_beam_rebar_material, geometry=huan_beam_rebar_geometry, data=pile_data,
host_members=[huan_beam], discretisation='element')
collect_shapes.append(rebar)
layer.add_shape(rebar)
# Create part for pile
created_piles.append(project.create_part(
name=pile_name, shapes=collect_shapes, connections=collect_connections))
# Create support at bottom of pile
created_piles.append(project.create_point_support(
name=pile_name, support_set=support_set, axes=axes, degrees_of_freedom=[[1, 1, 1], [0, 0, 1]],
connecting_shapes=[{'connecting_shape': huan_beam, 'shape_geometry': huan_beam.contour.node_start}]))
project.write_log(f"{pile_name} is created.")
counter += 1
# Assign pile properties as list - end
project.assign_list(False)
return created_piles
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================