geolysis 0.4.2__py3-none-any.whl → 0.4.4__py3-none-any.whl

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.
geolysis/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
- from . import foundation, soil_classifier, spt, utils
1
+ from . import foundation, soil_classifier, spt
2
2
 
3
- __version__ = "0.4.2"
3
+ __version__ = "0.4.4"
4
+
5
+ __all__ = ["foundation", "soil_classifier", "spt"]
File without changes
File without changes
@@ -0,0 +1,206 @@
1
+ """ Allowable bearing capacity package for cohesionless soils.
2
+
3
+ Exceptions
4
+ ==========
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+
9
+ SettlementError
10
+
11
+ Enums
12
+ =====
13
+
14
+ .. autosummary::
15
+ :toctree: _autosummary
16
+ :nosignatures:
17
+
18
+ ABC_TYPE
19
+
20
+ Functions
21
+ =========
22
+
23
+ .. autosummary::
24
+ :toctree: _autosummary
25
+
26
+ create_allowable_bearing_capacity
27
+ """
28
+ import enum
29
+ from abc import ABC, abstractmethod
30
+ from typing import Optional
31
+
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
90
+
91
+ from .bowles_abc import BowlesABC4MatFoundation, BowlesABC4PadFoundation
92
+ from .meyerhof_abc import MeyerhofABC4MatFoundation, MeyerhofABC4PadFoundation
93
+ from .terzaghi_abc import TerzaghiABC4MatFoundation, TerzaghiABC4PadFoundation
94
+
95
+
96
+ @enum_repr
97
+ class ABC_TYPE(enum.StrEnum):
98
+ """Enumeration of available allowable bearing capacity types."""
99
+ BOWLES = enum.auto()
100
+ MEYERHOF = enum.auto()
101
+ TERZAGHI = enum.auto()
102
+
103
+
104
+ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
105
+ tol_settlement: float,
106
+ depth: float,
107
+ width: float,
108
+ length: Optional[float] = None,
109
+ eccentricity: float = 0.0,
110
+ ground_water_level: float = inf,
111
+ shape: Shape | str = Shape.SQUARE,
112
+ foundation_type: FoundationType | str = \
113
+ FoundationType.PAD,
114
+ abc_type: Optional[
115
+ ABC_TYPE | str] = None,
116
+ ) -> AllowableBearingCapacity:
117
+ """ A factory function that encapsulate the creation of allowable bearing
118
+ capacities.
119
+
120
+ :param corrected_spt_n_value: The corrected SPT N-value.
121
+ :type corrected_spt_n_value: float
122
+
123
+ :param tol_settlement: Tolerable settlement of foundation (mm).
124
+ :type tol_settlement: float
125
+
126
+ :param depth: Depth of foundation (m).
127
+ :type depth: float
128
+
129
+ :param width: Width of foundation footing (m).
130
+ :type width: float
131
+
132
+ :param length: Length of foundation footing (m).
133
+ :type length: float, optional
134
+
135
+ :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).
139
+ :type eccentricity: float, optional
140
+
141
+ :param ground_water_level: Depth of water below ground level (m).
142
+ :type ground_water_level: float
143
+
144
+ :param shape: Shape of foundation footing, defaults to "SQUARE".
145
+ :type shape: str, optional
146
+
147
+ :param foundation_type: Type of foundation, defaults to "pad".
148
+ :type foundation_type: FoundationType | str, optional
149
+
150
+ :param abc_type: Type of allowable bearing capacity calculation to apply.
151
+ Available values can be found in :class:`ABC_TYPE`,
152
+ defaults to None.
153
+ :type abc_type: ABC_TYPE | str
154
+
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
157
+ footing.
158
+ :raises ValueError: Raised if an invalid footing shape is provided.
159
+ """
160
+ msg = (f"{abc_type = } is not supported, Supported "
161
+ f"types are: {list(ABC_TYPE)}")
162
+
163
+ if abc_type is None:
164
+ raise ValueError(msg)
165
+
166
+ try:
167
+ abc_type = ABC_TYPE(str(abc_type).casefold())
168
+ except ValueError as e:
169
+ raise ValueError(msg) from e
170
+
171
+ msg = (f"{foundation_type = } is not supported, Supported "
172
+ f"types are: {list(FoundationType)}")
173
+
174
+ try:
175
+ foundation_type = FoundationType(str(foundation_type).casefold())
176
+ except ValueError as e:
177
+ raise ValueError(msg) from e
178
+
179
+ # exception from create_foundation will automaatically propagate
180
+ # no need to catch and handle it.
181
+ fnd_size = create_foundation(depth=depth,
182
+ width=width,
183
+ length=length,
184
+ eccentricity=eccentricity,
185
+ ground_water_level=ground_water_level,
186
+ shape=shape)
187
+ abc_classes = {
188
+ ABC_TYPE.BOWLES: {
189
+ FoundationType.PAD: BowlesABC4PadFoundation,
190
+ FoundationType.MAT: BowlesABC4MatFoundation,
191
+ },
192
+ ABC_TYPE.MEYERHOF: {
193
+ FoundationType.PAD: MeyerhofABC4PadFoundation,
194
+ FoundationType.MAT: MeyerhofABC4MatFoundation,
195
+ },
196
+ ABC_TYPE.TERZAGHI: {
197
+ FoundationType.PAD: TerzaghiABC4PadFoundation,
198
+ FoundationType.MAT: TerzaghiABC4MatFoundation,
199
+ }
200
+ }
201
+
202
+ abc_class = abc_classes[abc_type][foundation_type]
203
+ abc = abc_class(corrected_spt_n_value=corrected_spt_n_value,
204
+ tol_settlement=tol_settlement,
205
+ foundation_size=fnd_size)
206
+ return abc
@@ -0,0 +1,107 @@
1
+ """ Bowles allowable bearing capacity.
2
+
3
+ Classes
4
+ =======
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+
9
+ BowlesABC4PadFoundation
10
+ BowlesABC4MatFoundation
11
+ """
12
+ from geolysis.foundation import FoundationSize
13
+ from geolysis.utils import round_
14
+
15
+ from . import AllowableBearingCapacity
16
+
17
+
18
+ class BowlesABC4PadFoundation(AllowableBearingCapacity):
19
+ r"""Allowable bearing capacity for pad foundation on cohesionless soils
20
+ according to ``Bowles (1997)``.
21
+
22
+ :Equation:
23
+
24
+ .. math::
25
+
26
+ q_a(kPa) &= 19.16(N_1)_{55} f_d\left(\dfrac{S}{25.4}\right),
27
+ \ B \ \le \ 1.2m
28
+
29
+ q_a(kPa) &= 11.98(N_1)_{55}\left(\dfrac{3.28B + 1}{3.28B} \right)^2
30
+ f_d \left(\dfrac{S}{25.4}\right), \ B \ \gt 1.2m
31
+
32
+ f_d &= 1 + 0.33 \cdot \frac{D_f}{B} \le 1.33
33
+
34
+ =================== ====================================== ===========
35
+ Symbol Description Unit
36
+ =================== ====================================== ===========
37
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
38
+ :math:`(N_1)_{55}` Corrected SPT N-value —
39
+ :math:`f_d` Depth factor —
40
+ :math:`S` Tolerable settlement :math:`mm`
41
+ :math:`B` Width of foundation footing :math:`m`
42
+ :math:`D_f` Depth of foundation footing :math:`m`
43
+ =================== ====================================== ===========
44
+ """
45
+
46
+ def __init__(self, corrected_spt_n_value: float,
47
+ tol_settlement: float,
48
+ foundation_size: FoundationSize) -> None:
49
+ """
50
+ :param corrected_spt_n_value: Statistical average of corrected SPT
51
+ N-value (55% energy with overburden
52
+ pressure correction) within the foundation
53
+ influence zone i.e ``0.5B`` to ``2B``.
54
+ :type corrected_spt_n_value: float
55
+
56
+ :param tol_settlement: Tolerable settlement of foundation (mm).
57
+ :type tol_settlement: float
58
+
59
+ :param foundation_size: Size of the foundation.
60
+ :type foundation_size: FoundationSize
61
+ """
62
+ super().__init__(corrected_spt_n_value=corrected_spt_n_value,
63
+ tol_settlement=tol_settlement,
64
+ foundation_size=foundation_size)
65
+
66
+ @round_
67
+ def bearing_capacity(self) -> float:
68
+ """Calculate the allowable bearing capacity of the pad foundation."""
69
+ n_corr = self.corrected_spt_n_value
70
+ width = self.foundation_size.width
71
+
72
+ if width <= 1.2:
73
+ return 19.16 * n_corr * self._fd() * self._sr()
74
+
75
+ return (11.98 * n_corr * ((3.28 * width + 1) / (3.28 * width)) ** 2
76
+ * self._fd() * self._sr())
77
+
78
+
79
+ class BowlesABC4MatFoundation(BowlesABC4PadFoundation):
80
+ r"""Allowable bearing capacity for mat foundation on cohesionless soils
81
+ according to ``Bowles (1997)``.
82
+
83
+ :Equation:
84
+
85
+ .. math::
86
+
87
+ q_a(kPa) &= 11.98(N_1)_{55}f_d\left(\dfrac{S}{25.4}\right)
88
+
89
+ f_d &= 1 + 0.33 \cdot \frac{D_f}{B} \le 1.33
90
+
91
+ =================== ====================================== ===========
92
+ Symbol Description Unit
93
+ =================== ====================================== ===========
94
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
95
+ :math:`(N_1)_{55}` Corrected SPT N-value —
96
+ :math:`f_d` Depth factor —
97
+ :math:`S` Tolerable settlement :math:`mm`
98
+ :math:`B` Width of foundation footing :math:`m`
99
+ :math:`D_f` Depth of foundation footing :math:`m`
100
+ =================== ====================================== ===========
101
+ """
102
+
103
+ @round_
104
+ def bearing_capacity(self) -> float:
105
+ """Calculate the allowable bearing capacity of the mat foundation."""
106
+ n_corr = self.corrected_spt_n_value
107
+ return 11.98 * n_corr * self._fd() * self._sr()
@@ -0,0 +1,107 @@
1
+ """ Meyerhof allowable bearing capacity.
2
+
3
+ Classes
4
+ =======
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+
9
+ MeyerhofABC4PadFoundation
10
+ MeyerhofABC4MatFoundation
11
+ """
12
+ from geolysis.foundation import FoundationSize
13
+ from geolysis.utils import round_
14
+
15
+ from . import AllowableBearingCapacity
16
+
17
+
18
+ class MeyerhofABC4PadFoundation(AllowableBearingCapacity):
19
+ r"""Allowable bearing capacity for pad foundation on cohesionless soils
20
+ according to ``Meyerhof (1956)``.
21
+
22
+ :Equation:
23
+
24
+ .. math::
25
+
26
+ q_a(kPa) &= 12N f_d\left(\dfrac{S}{25.4}\right), \ B \ \le 1.2m
27
+
28
+ q_a(kPa) &= 8N\left(\dfrac{3.28B + 1}{3.28B} \right)^2 f_d\left(
29
+ \dfrac{S}{25.4}\right), \ B \ \gt 1.2m
30
+
31
+ f_d &= 1 + 0.33 \cdot \frac{D_f}{B} \le 1.33
32
+
33
+ =================== ====================================== ===========
34
+ Symbol Description Unit
35
+ =================== ====================================== ===========
36
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
37
+ :math:`N` Corrected SPT N-value —
38
+ :math:`f_d` Depth factor —
39
+ :math:`S` Tolerable settlement :math:`mm`
40
+ :math:`B` Width of foundation footing :math:`m`
41
+ :math:`D_f` Depth of foundation footing :math:`m`
42
+ =================== ====================================== ===========
43
+ """
44
+
45
+ def __init__(self, corrected_spt_n_value: float,
46
+ tol_settlement: float,
47
+ foundation_size: FoundationSize):
48
+ """
49
+ :param corrected_spt_n_value: Average uncorrected SPT N-value (60%
50
+ energy with dilatancy (water) correction
51
+ if applicable) within the foundation
52
+ influence zone i.e :math:`D_f` to
53
+ :math:`D_f + 2B`.
54
+ :type corrected_spt_n_value: float
55
+
56
+ :param tol_settlement: Tolerable settlement of foundation (mm).
57
+ :type tol_settlement: float
58
+
59
+ :param foundation_size: Size of the foundation.
60
+ :type foundation_size: FoundationSize
61
+ """
62
+ super().__init__(corrected_spt_n_value=corrected_spt_n_value,
63
+ tol_settlement=tol_settlement,
64
+ foundation_size=foundation_size)
65
+
66
+ @round_
67
+ def bearing_capacity(self):
68
+ """Calculates the allowable bearing capacity of the pad foundation."""
69
+ n_corr = self.corrected_spt_n_value
70
+ width = self.foundation_size.width
71
+
72
+ if width <= 1.2:
73
+ return 12 * n_corr * self._fd() * self._sr()
74
+
75
+ return (8 * n_corr * ((3.28 * width + 1) / (3.28 * width)) ** 2
76
+ * self._fd() * self._sr())
77
+
78
+
79
+ class MeyerhofABC4MatFoundation(MeyerhofABC4PadFoundation):
80
+ r"""Allowable bearing capacity for mat foundation on cohesionless soils
81
+ according to ``Meyerhof (1956)``.
82
+
83
+ :Equation:
84
+
85
+ .. math::
86
+
87
+ q_a(kPa) &= 8 N f_d\left(\dfrac{S}{25.4}\right)
88
+
89
+ f_d &= 1 + 0.33 \cdot \frac{D_f}{B} \le 1.33
90
+
91
+ =================== ====================================== ===========
92
+ Symbol Description Unit
93
+ =================== ====================================== ===========
94
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
95
+ :math:`N` Corrected SPT N-value —
96
+ :math:`f_d` Depth factor —
97
+ :math:`S` Tolerable settlement :math:`mm`
98
+ :math:`B` Width of foundation footing :math:`m`
99
+ :math:`D_f` Depth of foundation footing :math:`m`
100
+ =================== ====================================== ===========
101
+ """
102
+
103
+ @round_
104
+ def bearing_capacity(self):
105
+ """Calculate the allowable bearing capacity of the mat foundation."""
106
+ n_corr = self.corrected_spt_n_value
107
+ return 8 * n_corr * self._fd() * self._sr()
@@ -0,0 +1,142 @@
1
+ """Terzaghi allowable bearing capacity.
2
+
3
+ Classes
4
+ =======
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+
9
+ TerzaghiABC4PadFoundation
10
+ TerzaghiABC4MatFoundation
11
+ """
12
+ from geolysis.foundation import FoundationSize
13
+ from geolysis.utils import round_
14
+
15
+ from . import AllowableBearingCapacity
16
+
17
+
18
+ class TerzaghiABC4PadFoundation(AllowableBearingCapacity):
19
+ r"""Allowable bearing capacity for pad foundation on cohesionless
20
+ soils according to ``Terzaghi & Peck (1948)``.
21
+
22
+ :Equation:
23
+
24
+ .. math::
25
+
26
+ q_a(kPa) &= 12N \dfrac{1}{c_w f_d}\left(\dfrac{S}{25.4}\right),
27
+ \ B \ \le 1.2m
28
+
29
+ q_a(kPa) &= 8N\left(\dfrac{3.28B + 1}{3.28B} \right)^2\dfrac{1}
30
+ {c_w f_d}\left(\dfrac{S}{25.4}\right), \ B \ \gt 1.2m
31
+
32
+ f_d &= 1 + 0.25 \cdot \frac{D_f}{B} \le 1.25
33
+
34
+ c_w &= 2 - \frac{D_w}{2B} \le 2, D_w \gt D_f
35
+
36
+ c_w &= 2 - \frac{D_f}{2B} \le 2, D_w \le D_f
37
+
38
+ =================== ====================================== ===========
39
+ Symbol Description Unit
40
+ =================== ====================================== ===========
41
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
42
+ :math:`N` Corrected SPT N-value —
43
+ :math:`f_d` Depth factor —
44
+ :math:`c_w` Water correction factor —
45
+ :math:`S` Tolerable settlement :math:`mm`
46
+ :math:`B` Width of foundation footing :math:`m`
47
+ :math:`D_f` Depth of foundation footing :math:`m`
48
+ :math:`D_w` Depth of water below ground level :math:`m`
49
+ =================== ====================================== ===========
50
+ """
51
+
52
+ def __init__(self, corrected_spt_n_value: float,
53
+ tol_settlement: float,
54
+ foundation_size: FoundationSize) -> None:
55
+ """
56
+ :param corrected_spt_n_value: Lowest (or average) uncorrected SPT
57
+ N-value (60% energy) within the foundation
58
+ influence zone i.e :math:`D_f` to
59
+ :math:`D_f + 2B`
60
+ :type corrected_spt_n_value: float
61
+
62
+ :param tol_settlement: Tolerable settlement of foundation (mm).
63
+ :type tol_settlement: float
64
+
65
+ :param foundation_size: Size of the foundation.
66
+ :type foundation_size: FoundationSize
67
+ """
68
+ super().__init__(corrected_spt_n_value=corrected_spt_n_value,
69
+ tol_settlement=tol_settlement,
70
+ foundation_size=foundation_size)
71
+
72
+ def _fd(self) -> float:
73
+ """Calculate the depth factor."""
74
+ depth = self.foundation_size.depth
75
+ width = self.foundation_size.width
76
+
77
+ return min(1.0 + 0.25 * depth / width, 1.25)
78
+
79
+ def _cw(self):
80
+ """Calculate the water correction factor."""
81
+ depth = self.foundation_size.depth
82
+ width = self.foundation_size.width
83
+ water_level = self.foundation_size.ground_water_level
84
+
85
+ if water_level is None:
86
+ return 2.0
87
+
88
+ if water_level <= depth:
89
+ cw = 2.0 - depth / (2.0 * width)
90
+ else:
91
+ cw = 2.0 - water_level / (2.0 * width)
92
+
93
+ return min(cw, 2.0)
94
+
95
+ @round_
96
+ def bearing_capacity(self):
97
+ """Calculates the allowable bearing capacity of the pad foundation."""
98
+ n_corr = self.corrected_spt_n_value
99
+ width = self.foundation_size.width
100
+
101
+ if width <= 1.2:
102
+ return 12 * n_corr * (1 / (self._cw() * self._fd())) * self._sr()
103
+
104
+ return (8 * n_corr * ((3.28 * width + 1) / (3.28 * width)) ** 2
105
+ * (1 / (self._cw() * self._fd())) * self._sr())
106
+
107
+
108
+ class TerzaghiABC4MatFoundation(TerzaghiABC4PadFoundation):
109
+ r"""Allowable bearing capacity for mat foundation on cohesionless soils
110
+ according to ``Terzaghi & Peck (1948)``.
111
+
112
+ :Equation:
113
+
114
+ .. math::
115
+
116
+ q_a(kPa) &= 8N\dfrac{1}{c_w f_d}\left(\dfrac{S}{25.4}\right)
117
+
118
+ f_d &= 1 + 0.25 \cdot \frac{D_f}{B} \le 1.25
119
+
120
+ c_w &= 2 - \frac{D_w}{2B} \le 2, D_w \gt D_f
121
+
122
+ c_w &= 2 - \frac{D_f}{2B} \le 2, D_w \le D_f
123
+
124
+ =================== ====================================== ===========
125
+ Symbol Description Unit
126
+ =================== ====================================== ===========
127
+ :math:`q_a` Allowable bearing capacity :math:`kPa`
128
+ :math:`N` Corrected SPT N-value —
129
+ :math:`f_d` Depth factor —
130
+ :math:`c_w` Water correction factor —
131
+ :math:`S` Tolerable settlement :math:`mm`
132
+ :math:`B` Width of foundation footing :math:`m`
133
+ :math:`D_f` Depth of foundation footing :math:`m`
134
+ :math:`D_w` Depth of water below ground level :math:`m`
135
+ =================== ====================================== ===========
136
+ """
137
+
138
+ @round_
139
+ def bearing_capacity(self):
140
+ """Calculates the allowable bearing capacity of the mat foundation."""
141
+ n_corr = self.corrected_spt_n_value
142
+ return 8 * n_corr * (1 / (self._cw() * self._fd())) * self._sr()