geolysis 0.4.4__tar.gz → 0.4.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {geolysis-0.4.4 → geolysis-0.4.5}/PKG-INFO +3 -3
  2. {geolysis-0.4.4 → geolysis-0.4.5}/README.md +0 -1
  3. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/__init__.py +1 -1
  4. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/abc/cohl/__init__.py +30 -90
  5. geolysis-0.4.5/geolysis/bearing_capacity/abc/cohl/_core.py +55 -0
  6. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/abc/cohl/bowles_abc.py +1 -1
  7. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/abc/cohl/meyerhof_abc.py +1 -1
  8. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/abc/cohl/terzaghi_abc.py +1 -1
  9. geolysis-0.4.5/geolysis/bearing_capacity/ubc/__init__.py +160 -0
  10. geolysis-0.4.5/geolysis/bearing_capacity/ubc/_core.py +192 -0
  11. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/ubc/hansen_ubc.py +3 -2
  12. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/ubc/terzaghi_ubc.py +2 -1
  13. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/ubc/vesic_ubc.py +4 -3
  14. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/foundation.py +51 -17
  15. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/soil_classifier.py +24 -22
  16. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/spt.py +195 -73
  17. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis.egg-info/PKG-INFO +3 -3
  18. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis.egg-info/SOURCES.txt +2 -0
  19. {geolysis-0.4.4 → geolysis-0.4.5}/tests/test_spt.py +24 -2
  20. geolysis-0.4.4/geolysis/bearing_capacity/ubc/__init__.py +0 -337
  21. {geolysis-0.4.4 → geolysis-0.4.5}/LICENSE.txt +0 -0
  22. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/__init__.py +0 -0
  23. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/bearing_capacity/abc/__init__.py +0 -0
  24. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/utils/__init__.py +0 -0
  25. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis/utils/validators.py +0 -0
  26. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis.egg-info/dependency_links.txt +0 -0
  27. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis.egg-info/requires.txt +0 -0
  28. {geolysis-0.4.4 → geolysis-0.4.5}/geolysis.egg-info/top_level.txt +0 -0
  29. {geolysis-0.4.4 → geolysis-0.4.5}/pyproject.toml +0 -0
  30. {geolysis-0.4.4 → geolysis-0.4.5}/setup.cfg +0 -0
  31. {geolysis-0.4.4 → geolysis-0.4.5}/setup.py +0 -0
  32. {geolysis-0.4.4 → geolysis-0.4.5}/tests/test_foundation.py +0 -0
  33. {geolysis-0.4.4 → geolysis-0.4.5}/tests/test_soil_classifier.py +0 -0
  34. {geolysis-0.4.4 → geolysis-0.4.5}/tests/test_utils.py +0 -0
  35. {geolysis-0.4.4 → geolysis-0.4.5}/tests/test_validators.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: geolysis
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: geolysis is an opensource software for geotechnical engineering analysis and modeling.
5
5
  Author-email: Patrick Boateng <boatengpato.pb@gmail.com>
6
6
  License: MIT License
@@ -28,6 +28,7 @@ Provides-Extra: dev
28
28
  Requires-Dist: pytest; extra == "dev"
29
29
  Requires-Dist: pytest-cov; extra == "dev"
30
30
  Requires-Dist: coverage; extra == "dev"
31
+ Dynamic: license-file
31
32
 
32
33
  <div align="center">
33
34
  <img src="https://raw.githubusercontent.com/patrickboateng/geolysis/dev/docs/source/_static/branding/geolysislogo.svg"
@@ -147,7 +148,6 @@ SoilClf(symbol='SC', description='Clayey sands')
147
148
  >>> aashto_clf = create_soil_classifier(liquid_limit=34.1,
148
149
  ... plastic_limit=21.1,
149
150
  ... fines=47.88,
150
- ... sand=37.84, # Sand is optional for AASHTO classification
151
151
  ... clf_type="AASHTO")
152
152
  >>> clf = aashto_clf.classify()
153
153
  >>> clf
@@ -116,7 +116,6 @@ SoilClf(symbol='SC', description='Clayey sands')
116
116
  >>> aashto_clf = create_soil_classifier(liquid_limit=34.1,
117
117
  ... plastic_limit=21.1,
118
118
  ... fines=47.88,
119
- ... sand=37.84, # Sand is optional for AASHTO classification
120
119
  ... clf_type="AASHTO")
121
120
  >>> clf = aashto_clf.classify()
122
121
  >>> clf
@@ -1,5 +1,5 @@
1
1
  from . import foundation, soil_classifier, spt
2
2
 
3
- __version__ = "0.4.4"
3
+ __version__ = "0.4.5"
4
4
 
5
5
  __all__ = ["foundation", "soil_classifier", "spt"]
@@ -1,13 +1,5 @@
1
1
  """ Allowable bearing capacity package for cohesionless soils.
2
2
 
3
- Exceptions
4
- ==========
5
-
6
- .. autosummary::
7
- :toctree: _autosummary
8
-
9
- SettlementError
10
-
11
3
  Enums
12
4
  =====
13
5
 
@@ -15,7 +7,7 @@ Enums
15
7
  :toctree: _autosummary
16
8
  :nosignatures:
17
9
 
18
- ABC_TYPE
10
+ ABCType
19
11
 
20
12
  Functions
21
13
  =========
@@ -25,76 +17,21 @@ Functions
25
17
 
26
18
  create_allowable_bearing_capacity
27
19
  """
20
+
28
21
  import enum
29
- from abc import ABC, abstractmethod
30
22
  from typing import Optional
31
23
 
32
- from geolysis.foundation import (FoundationSize,
33
- Shape,
34
- FoundationType,
35
- create_foundation)
36
- from geolysis.utils import inf, enum_repr, validators
37
-
38
-
39
- class SettlementError(ValueError):
40
- """Raised when tolerable settlement is greater than the maximum
41
- allowable settlement.
42
- """
43
-
44
-
45
- class AllowableBearingCapacity(ABC):
46
- #: Maximum tolerable foundation settlement (mm).
47
- MAX_TOL_SETTLEMENT = 25.4
48
-
49
- def __init__(self, corrected_spt_n_value: float,
50
- tol_settlement: float,
51
- foundation_size: FoundationSize) -> None:
52
- self.corrected_spt_n_value = corrected_spt_n_value
53
- self.tol_settlement = tol_settlement
54
- self.foundation_size = foundation_size
55
-
56
- @property
57
- def corrected_spt_n_value(self) -> float:
58
- return self._corrected_spt_n_value
59
-
60
- @corrected_spt_n_value.setter
61
- @validators.ge(0.0)
62
- def corrected_spt_n_value(self, val: float) -> None:
63
- self._corrected_spt_n_value = val
64
-
65
- @property
66
- def tol_settlement(self) -> float:
67
- return self._tol_settlement
68
-
69
- @tol_settlement.setter
70
- @validators.le(25.4, exc_type=SettlementError)
71
- def tol_settlement(self, tol_settlement: float) -> None:
72
- self._tol_settlement = tol_settlement
73
-
74
- def _sr(self) -> float:
75
- """Calculate the settlement ratio."""
76
- return self.tol_settlement / self.MAX_TOL_SETTLEMENT
77
-
78
- def _fd(self) -> float:
79
- """Calculate the depth factor."""
80
- depth = self.foundation_size.depth
81
- width = self.foundation_size.width
82
-
83
- return min(1.0 + 0.33 * depth / width, 1.33)
84
-
85
- @abstractmethod
86
- def bearing_capacity(self): ...
87
-
88
-
89
- from . import bowles_abc, terzaghi_abc, meyerhof_abc
24
+ from geolysis.foundation import FoundationType, Shape, create_foundation
25
+ from geolysis.utils import enum_repr, inf
90
26
 
27
+ from ._core import AllowableBearingCapacity
91
28
  from .bowles_abc import BowlesABC4MatFoundation, BowlesABC4PadFoundation
92
29
  from .meyerhof_abc import MeyerhofABC4MatFoundation, MeyerhofABC4PadFoundation
93
30
  from .terzaghi_abc import TerzaghiABC4MatFoundation, TerzaghiABC4PadFoundation
94
31
 
95
32
 
96
33
  @enum_repr
97
- class ABC_TYPE(enum.StrEnum):
34
+ class ABCType(enum.StrEnum):
98
35
  """Enumeration of available allowable bearing capacity types."""
99
36
  BOWLES = enum.auto()
100
37
  MEYERHOF = enum.auto()
@@ -109,10 +46,10 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
109
46
  eccentricity: float = 0.0,
110
47
  ground_water_level: float = inf,
111
48
  shape: Shape | str = Shape.SQUARE,
112
- foundation_type: FoundationType | str = \
113
- FoundationType.PAD,
49
+ foundation_type: FoundationType | str =
50
+ FoundationType.PAD,
114
51
  abc_type: Optional[
115
- ABC_TYPE | str] = None,
52
+ ABCType | str] = None,
116
53
  ) -> AllowableBearingCapacity:
117
54
  """ A factory function that encapsulate the creation of allowable bearing
118
55
  capacities.
@@ -133,42 +70,44 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
133
70
  :type length: float, optional
134
71
 
135
72
  :param eccentricity: The deviation of the foundation load from the center
136
- of gravity of the foundation footing, defaults to 0.0.
137
- This means that the foundation load aligns with the
138
- center of gravity of the foundation footing (m).
73
+ of gravity of the foundation footing (m), defaults to
74
+ 0.0. This means that the foundation load aligns with
75
+ the center of gravity of the foundation footing.
139
76
  :type eccentricity: float, optional
140
77
 
141
78
  :param ground_water_level: Depth of water below ground level (m).
142
- :type ground_water_level: float
79
+ :type ground_water_level: float, optional
143
80
 
144
- :param shape: Shape of foundation footing, defaults to "SQUARE".
81
+ :param shape: Shape of foundation footing, defaults to
82
+ :attr:`~geolysis.foundation.Shape.SQUARE`.
145
83
  :type shape: str, optional
146
84
 
147
85
  :param foundation_type: Type of foundation, defaults to "pad".
148
86
  :type foundation_type: FoundationType | str, optional
149
87
 
150
88
  :param abc_type: Type of allowable bearing capacity calculation to apply.
151
- Available values can be found in :class:`ABC_TYPE`,
89
+ Available values can be found in :class:`ABCType`,
152
90
  defaults to None.
153
- :type abc_type: ABC_TYPE | str
91
+ :type abc_type: ABCType | str, optional
154
92
 
155
- :raises ValueError: Raised if abc_type or foundation_type is not supported.
156
- :raises ValueError: Raised when length is not provided for a rectangular
93
+ :raises ValueError: Raised if ``abc_type`` or ``foundation_type`` is not
94
+ supported.
95
+ :raises ValueError: Raised when ``length`` is not provided for a rectangular
157
96
  footing.
158
- :raises ValueError: Raised if an invalid footing shape is provided.
97
+ :raises ValueError: Raised if an invalid footing ``shape`` is provided.
159
98
  """
160
- msg = (f"{abc_type = } is not supported, Supported "
161
- f"types are: {list(ABC_TYPE)}")
99
+ msg = (f"{abc_type=} is not supported, Supported "
100
+ f"types are: {list(ABCType)}")
162
101
 
163
102
  if abc_type is None:
164
103
  raise ValueError(msg)
165
104
 
166
105
  try:
167
- abc_type = ABC_TYPE(str(abc_type).casefold())
106
+ abc_type = ABCType(str(abc_type).casefold())
168
107
  except ValueError as e:
169
108
  raise ValueError(msg) from e
170
109
 
171
- msg = (f"{foundation_type = } is not supported, Supported "
110
+ msg = (f"{foundation_type=} is not supported, Supported "
172
111
  f"types are: {list(FoundationType)}")
173
112
 
174
113
  try:
@@ -183,23 +122,24 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
183
122
  length=length,
184
123
  eccentricity=eccentricity,
185
124
  ground_water_level=ground_water_level,
125
+ foundation_type=foundation_type,
186
126
  shape=shape)
187
127
  abc_classes = {
188
- ABC_TYPE.BOWLES: {
128
+ ABCType.BOWLES: {
189
129
  FoundationType.PAD: BowlesABC4PadFoundation,
190
130
  FoundationType.MAT: BowlesABC4MatFoundation,
191
131
  },
192
- ABC_TYPE.MEYERHOF: {
132
+ ABCType.MEYERHOF: {
193
133
  FoundationType.PAD: MeyerhofABC4PadFoundation,
194
134
  FoundationType.MAT: MeyerhofABC4MatFoundation,
195
135
  },
196
- ABC_TYPE.TERZAGHI: {
136
+ ABCType.TERZAGHI: {
197
137
  FoundationType.PAD: TerzaghiABC4PadFoundation,
198
138
  FoundationType.MAT: TerzaghiABC4MatFoundation,
199
139
  }
200
140
  }
201
141
 
202
- abc_class = abc_classes[abc_type][foundation_type]
142
+ abc_class = abc_classes[abc_type][fnd_size.foundation_type]
203
143
  abc = abc_class(corrected_spt_n_value=corrected_spt_n_value,
204
144
  tol_settlement=tol_settlement,
205
145
  foundation_size=fnd_size)
@@ -0,0 +1,55 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ from geolysis.foundation import FoundationSize
4
+ from geolysis.utils import validators
5
+
6
+
7
+ class SettlementError(ValueError):
8
+ """Raised when tolerable settlement is greater than the maximum
9
+ allowable settlement.
10
+ """
11
+
12
+
13
+ class AllowableBearingCapacity(ABC):
14
+ #: Maximum tolerable foundation settlement (mm).
15
+ MAX_TOL_SETTLEMENT = 25.4
16
+
17
+ def __init__(self, corrected_spt_n_value: float,
18
+ tol_settlement: float,
19
+ foundation_size: FoundationSize) -> None:
20
+ self.corrected_spt_n_value = corrected_spt_n_value
21
+ self.tol_settlement = tol_settlement
22
+ self.foundation_size = foundation_size
23
+
24
+ @property
25
+ def corrected_spt_n_value(self) -> float:
26
+ """Statistical average of corrected SPT N-value."""
27
+ return self._corrected_spt_n_value
28
+
29
+ @corrected_spt_n_value.setter
30
+ @validators.ge(0.0)
31
+ def corrected_spt_n_value(self, val: float) -> None:
32
+ self._corrected_spt_n_value = val
33
+
34
+ @property
35
+ def tol_settlement(self) -> float:
36
+ """Tolerable settlement foundation (mm)."""
37
+ return self._tol_settlement
38
+
39
+ @tol_settlement.setter
40
+ @validators.le(25.4, exc_type=SettlementError)
41
+ def tol_settlement(self, tol_settlement: float) -> None:
42
+ self._tol_settlement = tol_settlement
43
+
44
+ def _sr(self) -> float:
45
+ """Calculate the settlement ratio."""
46
+ return self.tol_settlement / self.MAX_TOL_SETTLEMENT
47
+
48
+ def _fd(self) -> float:
49
+ """Calculate the depth factor."""
50
+ depth = self.foundation_size.depth
51
+ width = self.foundation_size.width
52
+ return min(1.0 + 0.33 * depth / width, 1.33)
53
+
54
+ @abstractmethod
55
+ def bearing_capacity(self): ...
@@ -12,7 +12,7 @@ Classes
12
12
  from geolysis.foundation import FoundationSize
13
13
  from geolysis.utils import round_
14
14
 
15
- from . import AllowableBearingCapacity
15
+ from ._core import AllowableBearingCapacity
16
16
 
17
17
 
18
18
  class BowlesABC4PadFoundation(AllowableBearingCapacity):
@@ -12,7 +12,7 @@ Classes
12
12
  from geolysis.foundation import FoundationSize
13
13
  from geolysis.utils import round_
14
14
 
15
- from . import AllowableBearingCapacity
15
+ from ._core import AllowableBearingCapacity
16
16
 
17
17
 
18
18
  class MeyerhofABC4PadFoundation(AllowableBearingCapacity):
@@ -12,7 +12,7 @@ Classes
12
12
  from geolysis.foundation import FoundationSize
13
13
  from geolysis.utils import round_
14
14
 
15
- from . import AllowableBearingCapacity
15
+ from ._core import AllowableBearingCapacity
16
16
 
17
17
 
18
18
  class TerzaghiABC4PadFoundation(AllowableBearingCapacity):
@@ -0,0 +1,160 @@
1
+ """ Ultimate bearing capacity estimation package
2
+
3
+ Enum
4
+ ====
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+ :nosignatures:
9
+
10
+ UBCType
11
+
12
+ Functions
13
+ =========
14
+
15
+ .. autosummary::
16
+ :toctree: _autosummary
17
+
18
+ create_ultimate_bearing_capacity
19
+ """
20
+ import enum
21
+ from typing import Optional
22
+
23
+ from geolysis.foundation import Shape, create_foundation
24
+ from geolysis.utils import enum_repr
25
+
26
+ from ._core import UltimateBearingCapacity
27
+ from .hansen_ubc import HansenUltimateBearingCapacity
28
+ from .terzaghi_ubc import (TerzaghiUBC4CircularFooting,
29
+ TerzaghiUBC4RectangularFooting,
30
+ TerzaghiUBC4SquareFooting, TerzaghiUBC4StripFooting)
31
+ from .vesic_ubc import VesicUltimateBearingCapacity
32
+
33
+ __all__ = ["UBCType",
34
+ "TerzaghiUBC4StripFooting",
35
+ "TerzaghiUBC4CircularFooting",
36
+ "TerzaghiUBC4RectangularFooting",
37
+ "TerzaghiUBC4SquareFooting",
38
+ "HansenUltimateBearingCapacity",
39
+ "VesicUltimateBearingCapacity",
40
+ "create_ultimate_bearing_capacity"]
41
+
42
+
43
+ @enum_repr
44
+ class UBCType(enum.StrEnum):
45
+ """Enumeration of available ultimate bearing capacity types."""
46
+ HANSEN = enum.auto()
47
+ TERZAGHI = enum.auto()
48
+ VESIC = enum.auto()
49
+
50
+
51
+ def create_ultimate_bearing_capacity(friction_angle: float,
52
+ cohesion: float,
53
+ moist_unit_wgt: float,
54
+ depth: float,
55
+ width: float,
56
+ length: Optional[float] = None,
57
+ eccentricity: float = 0.0,
58
+ ground_water_level: Optional[
59
+ float] = None,
60
+ load_angle=0.0,
61
+ apply_local_shear=False,
62
+ shape: Shape | str = Shape.SQUARE,
63
+ ubc_type: Optional[UBCType | str] = None,
64
+ ) -> UltimateBearingCapacity:
65
+ r"""A factory function that encapsulate the creation of ultimate bearing
66
+ capacity.
67
+
68
+ :param friction_angle: Internal angle of friction for general shear
69
+ failure (degree).
70
+ :type friction_angle: float
71
+
72
+ :param cohesion: Cohesion of soil (:math:`kPa`).
73
+ :type cohesion: float
74
+
75
+ :param moist_unit_wgt: Moist unit weight of soil (:math:`kN/m^3`).
76
+ :type moist_unit_wgt: float
77
+
78
+ :param depth: Depth of foundation (m).
79
+ :type depth: float
80
+
81
+ :param width: Width of foundation footing (m).
82
+ :type width: float
83
+
84
+ :param length: Length of foundation footing (m).
85
+ :type length: float, optional
86
+
87
+ :param eccentricity: The deviation of the foundation load from the
88
+ center of gravity of the foundation footing,
89
+ defaults to 0.0 (m). This means that the foundation
90
+ load aligns with the center of gravity of the
91
+ foundation footing.
92
+ :type eccentricity: float, optional
93
+
94
+ :param ground_water_level: Depth of water below ground level (m).
95
+ :type ground_water_level: float, optional
96
+
97
+ :param load_angle: Inclination of the applied load with the vertical
98
+ (:math:`\alpha^{\circ}`), defaults to 0.0.
99
+ :type load_angle: float, optional
100
+
101
+ :param apply_local_shear: Indicate whether bearing capacity failure is
102
+ general or local shear failure, defaults to
103
+ False.
104
+ :type apply_local_shear: bool, optional
105
+
106
+ :param shape: Shape of foundation footing, defaults to
107
+ :attr:`~geolysis.foundation.Shape.SQUARE`.
108
+ :type shape: Shape | str, optional
109
+
110
+ :param ubc_type: Type of allowable bearing capacity calculation to apply.
111
+ Available values are: :attr:`~UBCType.HANSEN`,
112
+ :attr:`~UBCType.TERZAGHI`, and :attr:`~UBCType.VESIC`
113
+ defaults to None.
114
+ :type ubc_type: UBCType | str, optional
115
+
116
+ :raises ValueError: Raised if ubc_type is not supported.
117
+ :raises ValueError: Raised when length is not provided for a rectangular
118
+ footing.
119
+ :raises ValueError: Raised if an invalid footing shape is provided.
120
+ """
121
+ msg = (f"{ubc_type=} is not supported, Supported "
122
+ f"types are: {list(UBCType)}")
123
+
124
+ if ubc_type is None:
125
+ raise ValueError(msg)
126
+
127
+ try:
128
+ ubc_type = UBCType(str(ubc_type).casefold())
129
+ except ValueError as e:
130
+ raise ValueError(msg) from e
131
+
132
+ # exception from create_foundation will automatically propagate
133
+ # no need to catch and handle it.
134
+ fnd_size = create_foundation(depth=depth,
135
+ width=width,
136
+ length=length,
137
+ eccentricity=eccentricity,
138
+ ground_water_level=ground_water_level,
139
+ shape=shape)
140
+ ubc_classes = {
141
+ UBCType.HANSEN: HansenUltimateBearingCapacity,
142
+ UBCType.TERZAGHI: {Shape.STRIP: TerzaghiUBC4StripFooting,
143
+ Shape.CIRCLE: TerzaghiUBC4CircularFooting,
144
+ Shape.SQUARE: TerzaghiUBC4SquareFooting,
145
+ Shape.RECTANGLE: TerzaghiUBC4RectangularFooting},
146
+ UBCType.VESIC: VesicUltimateBearingCapacity,
147
+ }
148
+
149
+ if ubc_type == UBCType.TERZAGHI:
150
+ ubc_class = ubc_classes[ubc_type][fnd_size.footing_shape]
151
+ else:
152
+ ubc_class = ubc_classes[ubc_type]
153
+
154
+ ubc = ubc_class(friction_angle=friction_angle,
155
+ cohesion=cohesion,
156
+ moist_unit_wgt=moist_unit_wgt,
157
+ foundation_size=fnd_size,
158
+ load_angle=load_angle,
159
+ apply_local_shear=apply_local_shear)
160
+ return ubc
@@ -0,0 +1,192 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ from geolysis.foundation import FoundationSize
4
+ from geolysis.utils import arctan, round_, tan, validators
5
+
6
+
7
+ class UltimateBearingCapacity(ABC):
8
+ def __init__(self, friction_angle: float,
9
+ cohesion: float,
10
+ moist_unit_wgt: float,
11
+ foundation_size: FoundationSize,
12
+ load_angle=0.0,
13
+ apply_local_shear=False) -> None:
14
+ r"""
15
+ :param friction_angle: Internal angle of friction for general shear
16
+ failure (degrees).
17
+ :type friction_angle: float
18
+
19
+ :param cohesion: Cohesion of soil (:math:`kPa`).
20
+ :type cohesion: float
21
+
22
+ :param moist_unit_wgt: Moist unit weight of soil (:math:`kN/m^3`).
23
+ :type moist_unit_wgt: float
24
+
25
+ :param foundation_size: Size of the foundation.
26
+ :type foundation_size: FoundationSize
27
+
28
+ :param load_angle: Inclination of the applied load with the vertical
29
+ (:math:`\alpha^{\circ}`), defaults to 0.0.
30
+ :type load_angle: float, optional
31
+
32
+ :param apply_local_shear: Indicate whether bearing capacity failure is
33
+ general shear or local shear failure,
34
+ defaults to False.
35
+ :type apply_local_shear: bool, optional
36
+ """
37
+ self.friction_angle = friction_angle
38
+ self.cohesion = cohesion
39
+ self.moist_unit_wgt = moist_unit_wgt
40
+ self.load_angle = load_angle
41
+ self.foundation_size = foundation_size
42
+ self.apply_local_shear = apply_local_shear
43
+
44
+ @property
45
+ def friction_angle(self) -> float:
46
+ """Return friction angle for local shear in the case of local shear
47
+ failure or general shear in the case of general shear failure.
48
+ """
49
+ if self.apply_local_shear:
50
+ return arctan((2 / 3) * tan(self._friction_angle))
51
+ return self._friction_angle
52
+
53
+ @friction_angle.setter
54
+ @validators.ge(0.0)
55
+ def friction_angle(self, val: float):
56
+ self._friction_angle = val
57
+
58
+ @property
59
+ def cohesion(self) -> float:
60
+ """Return cohesion for local shear in the case of local shear failure
61
+ or general shear in the case of general shear failure.
62
+ """
63
+ if self.apply_local_shear:
64
+ return (2.0 / 3.0) * self._cohesion
65
+ return self._cohesion
66
+
67
+ @cohesion.setter
68
+ @validators.ge(0.0)
69
+ def cohesion(self, val: float):
70
+ self._cohesion = val
71
+
72
+ @property
73
+ def moist_unit_wgt(self) -> float:
74
+ """Moist unit weight of soil (:math:`kN/m^3`)."""
75
+ return self._moist_unit_wgt
76
+
77
+ @moist_unit_wgt.setter
78
+ @validators.gt(0.0)
79
+ def moist_unit_wgt(self, val: float):
80
+ self._moist_unit_wgt = val
81
+
82
+ @property
83
+ def load_angle(self) -> float:
84
+ """Inclination of the applied load with the vertical."""
85
+ return self._load_angle
86
+
87
+ @load_angle.setter
88
+ @validators.le(90.0)
89
+ @validators.ge(0.0)
90
+ def load_angle(self, val: float):
91
+ self._load_angle = val
92
+
93
+ @property
94
+ def s_c(self) -> float:
95
+ """Shape factor :math:`S_c`"""
96
+ return 1.0
97
+
98
+ @property
99
+ def s_q(self) -> float:
100
+ """Shape factor :math:`S_q`"""
101
+ return 1.0
102
+
103
+ @property
104
+ def s_gamma(self) -> float:
105
+ r"""Shape factor :math:`S_{\gamma}`"""
106
+ return 1.0
107
+
108
+ @property
109
+ def d_c(self) -> float:
110
+ """Depth factor :math:`d_c`"""
111
+ return 1.0
112
+
113
+ @property
114
+ def d_q(self) -> float:
115
+ """Depth factor :math:`d_q`"""
116
+ return 1.0
117
+
118
+ @property
119
+ def d_gamma(self) -> float:
120
+ r"""Depth factor :math:`d_{\gamma}`"""
121
+ return 1.0
122
+
123
+ @property
124
+ def i_c(self) -> float:
125
+ """Inclination factor :math:`i_c`"""
126
+ return 1.0
127
+
128
+ @property
129
+ def i_q(self) -> float:
130
+ """Inclination factor :math:`i_q`"""
131
+ return 1.0
132
+
133
+ @property
134
+ def i_gamma(self) -> float:
135
+ r"""Inclination factor :math:`i_{\gamma}`"""
136
+ return 1.0
137
+
138
+ def _cohesion_term(self, coef: float = 1.0) -> float:
139
+ return coef * self.cohesion * self.n_c * self.s_c * self.d_c * self.i_c
140
+
141
+ def _surcharge_term(self) -> float:
142
+ depth = self.foundation_size.depth
143
+ water_level = self.foundation_size.ground_water_level
144
+
145
+ if water_level is None:
146
+ water_corr = 1.0 # water correction
147
+ else:
148
+ # water level above the base of the foundation
149
+ a = max(depth - water_level, 0.0)
150
+ water_corr = min(1 - 0.5 * a / depth, 1)
151
+
152
+ # effective overburden pressure (surcharge)
153
+ eop = self.moist_unit_wgt * depth
154
+ return eop * self.n_q * self.s_q * self.d_q * self.i_q * water_corr
155
+
156
+ def _embedment_term(self, coef: float = 0.5) -> float:
157
+ depth = self.foundation_size.depth
158
+ width = self.foundation_size.effective_width
159
+ water_level = self.foundation_size.ground_water_level
160
+
161
+ if water_level is None:
162
+ # water correction
163
+ water_corr = 1.0
164
+ else:
165
+ #: b -> water level below the base of the foundation
166
+ b = max(water_level - depth, 0)
167
+ water_corr = min(0.5 + 0.5 * b / width, 1)
168
+
169
+ return (coef * self.moist_unit_wgt * width * self.n_gamma
170
+ * self.s_gamma * self.d_gamma * self.i_gamma * water_corr)
171
+
172
+ @round_
173
+ def bearing_capacity(self):
174
+ """Calculates the ultimate bearing capacity."""
175
+ return (self._cohesion_term(1.0)
176
+ + self._surcharge_term()
177
+ + self._embedment_term(0.5))
178
+
179
+ @property
180
+ @abstractmethod
181
+ def n_c(self) -> float:
182
+ ...
183
+
184
+ @property
185
+ @abstractmethod
186
+ def n_q(self) -> float:
187
+ ...
188
+
189
+ @property
190
+ @abstractmethod
191
+ def n_gamma(self) -> float:
192
+ ...