Skip to content

Commit f976be8

Browse files
committed
Merge branch 'feature/drop-python3.10-support' of https://github.com/Deltares/GEOLib into feature/drop-python3.10-support
2 parents bff8a34 + 93795b1 commit f976be8

File tree

9 files changed

+68
-16
lines changed

9 files changed

+68
-16
lines changed

geolib/models/base_data_class.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ class BaseDataClass(BaseModel):
1212
validate_assignment=True,
1313
arbitrary_types_allowed=True,
1414
validate_default=True,
15+
ser_json_inf_nan='constants',
1516
extra=settings.extra_fields,
1617
)

geolib/models/dsheetpiling/constructions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from geolib.models import BaseDataClass
44
from geolib.models.dsheetpiling.internal import SheetPileElement
5+
from geolib.models.dsheetpiling.internal import VerticalBalance as InternalVerticalBalance
56
from geolib.models.dsheetpiling.settings import SheetPilingElementMaterialType
67

78

@@ -378,3 +379,22 @@ def to_internal(self) -> SheetPileElement:
378379
diaphragmwallnegeielastoplastic2=self.plastic_properties.eI_branch_3_negative,
379380
diaphragmwallnegmomelastoplastic=self.plastic_properties.moment_point_2_negative,
380381
)
382+
383+
384+
class VerticalBalance(BaseDataClass):
385+
"""
386+
Vertical Balance parameters
387+
388+
Arguments:
389+
max_point_resistance: Maximum point resistance (bearing capacity) at the pile point
390+
xi_factor: Statistic factor related to the number of CPT's used for derivation of the maximum point resistance
391+
"""
392+
393+
max_point_resistance: Optional[float] = None
394+
xi_factor: Optional[float] = None
395+
396+
def to_internal(self) -> InternalVerticalBalance:
397+
return InternalVerticalBalance(
398+
sheetpilingqcrep=self.max_point_resistance,
399+
sheetpilingxi=self.xi_factor,
400+
)

geolib/models/dsheetpiling/dsheetpiling_model.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pydantic import FilePath, PositiveFloat
66

77
from geolib.models import BaseDataClass, BaseModel
8-
from geolib.models.dsheetpiling.constructions import DiaphragmWall, Pile, Sheet
8+
from geolib.models.dsheetpiling.constructions import DiaphragmWall, Pile, Sheet, VerticalBalance
99
from geolib.models.meta import CONSOLE_RUN_BATCH_FLAG
1010
from geolib.soils import Soil
1111

@@ -391,6 +391,18 @@ def set_construction(
391391
top_level=top_level, elements=[element.to_internal() for element in elements]
392392
)
393393

394+
def set_vertical_balance(self, vertical_balance: VerticalBalance) -> None:
395+
"""Sets the vertical balance parameters
396+
397+
The parameters are set in [VERTICAL BALANCE]
398+
399+
Args:
400+
vertical_balance: VerticalBalance, holds the vertical balance parameters
401+
"""
402+
self.datastructure.input_data.set_vertical_balance(
403+
vertical_balance=vertical_balance.to_internal()
404+
)
405+
394406
def add_load(
395407
self,
396408
load: Union[

geolib/models/dsheetpiling/internal.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ class SheetPiling(DSeriesStructureCollection):
438438
lengthsheetpiling: Annotated[float, Field(gt=0)] = 10
439439

440440

441+
class VerticalBalance(DSeriesInlineMappedProperties):
442+
sheetpilingqcrep: Optional[Annotated[float, Field(ge=0)]] = 0.001
443+
sheetpilingxi: Optional[Annotated[float, Field(ge=0.1)]] = 1.39
444+
445+
441446
class Anchor(DSheetpilingTableEntry):
442447
name: Annotated[str, StringConstraints(min_length=1, max_length=50)]
443448
level: float = 0
@@ -712,12 +717,7 @@ class DSheetPilingInputStructure(DSeriesStructure):
712717
)
713718
sheet_piling: Union[str, SheetPiling] = SheetPiling()
714719
combined_wall: str = ""
715-
vertical_balance: str = cleandoc(
716-
"""
717-
SheetPilingQcRep=0.000
718-
SheetPilingXi=1.39
719-
"""
720-
)
720+
vertical_balance: VerticalBalance = VerticalBalance()
721721
settlement_by_vibration_params: str = cleandoc(
722722
"""
723723
SheetPilingNumberOfPilesDrilled=2
@@ -1061,6 +1061,9 @@ def add_element_in_sheet_piling(
10611061
self.sheet_piling.sheetpiling.append(sheet)
10621062
self.sheet_piling.update_length_of_sheet_pile()
10631063

1064+
def set_vertical_balance(self, vertical_balance: VerticalBalance):
1065+
self.vertical_balance = vertical_balance
1066+
10641067
def add_anchor(self, stage_id: int, anchor: Anchor, pre_tension: float) -> None:
10651068
if not isinstance(self.anchors, Anchors):
10661069
self.anchors = Anchors()

geolib/models/dsheetpiling/templates/input.shi.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ WoodenSheetPilingElementKModE={{ element.woodensheetpilingelementkmode }}
164164
[END OF COMBINED WALL]
165165

166166
[VERTICAL BALANCE]
167-
{{ vertical_balance }}
167+
SheetPilingQcRep={{ "%.3f"|format(vertical_balance.sheetpilingqcrep) }}
168+
SheetPilingXi={{ "%.2f"|format(vertical_balance.sheetpilingxi) }}
168169
[END OF VERTICAL BALANCE]
169170

170171
[SETTLEMENT BY VIBRATION PARAMS]

poetry.lock

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ python-dotenv = "^1.0.0"
2424
matplotlib = "^3.9.0"
2525
pydantic-settings = "^2.1.0"
2626
pydantic-extra-types = "^2.5.0"
27-
python-multipart = "^0.0.9"
27+
python-multipart = ">=0.0.9,<0.0.19"
2828

2929
[tool.poetry.group.dev.dependencies]
3030
teamcity-messages = "^1.32"

tests/models/dsheetpiling/test_dsheetpiling_acceptance.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
SheetPileModelPlasticCalculationProperties,
2525
SheetPileProperties,
2626
WoodenSheetPileProperties,
27+
VerticalBalance,
2728
)
2829
from geolib.models.dsheetpiling.dsheetpiling_model import (
2930
DiaphragmModelType,
@@ -172,6 +173,10 @@ def test_run_sheet_model_acceptance_different_calculation_types(
172173
top_level=level_top, elements=[sheet_element_1, sheet_element_2]
173174
)
174175

176+
# Add vertical balance properties
177+
vertical_balance = VerticalBalance(max_point_resistance=0.5, xi_factor=1.24)
178+
model.set_vertical_balance(vertical_balance=vertical_balance)
179+
175180
# Add soil
176181
# Set clay material
177182
soil_clay = Soil(name="Clay", color=Color("green"))

tests/models/dsheetpiling/test_dsheetpiling_model.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
PileProperties,
1616
Sheet,
1717
SheetPileProperties,
18+
VerticalBalance,
1819
)
1920
from geolib.models.dsheetpiling.dsheetpiling_model import (
2021
DiaphragmModelType,
@@ -872,3 +873,15 @@ def test_duplicate_loads(self, model: DSheetPilingModel):
872873
error_message = "New SurchargeLoad load name is duplicated. Please change the name of the load."
873874
with pytest.raises(ValueError, match=error_message):
874875
model.add_surcharge_load(load=testload, side=Side.LEFT, stage_id=0)
876+
877+
@pytest.mark.unittest
878+
def test_set_vertical_balance(self, model: DSheetPilingModel):
879+
# Set up vertical balance
880+
vertical_balance = VerticalBalance(max_point_resistance=1, xi_factor=2)
881+
882+
# Call the test function
883+
model.set_vertical_balance(vertical_balance=vertical_balance)
884+
885+
# Assert
886+
assert model.datastructure.input_data.vertical_balance.sheetpilingqcrep == 1
887+
assert model.datastructure.input_data.vertical_balance.sheetpilingxi == 2

0 commit comments

Comments
 (0)