geolysis 0.4.3__py3-none-any.whl → 0.4.5__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 +1,5 @@
1
- __version__ = "0.4.3"
1
+ from . import foundation, soil_classifier, spt
2
+
3
+ __version__ = "0.4.5"
4
+
5
+ __all__ = ["foundation", "soil_classifier", "spt"]
File without changes
File without changes
@@ -0,0 +1,146 @@
1
+ """ Allowable bearing capacity package for cohesionless soils.
2
+
3
+ Enums
4
+ =====
5
+
6
+ .. autosummary::
7
+ :toctree: _autosummary
8
+ :nosignatures:
9
+
10
+ ABCType
11
+
12
+ Functions
13
+ =========
14
+
15
+ .. autosummary::
16
+ :toctree: _autosummary
17
+
18
+ create_allowable_bearing_capacity
19
+ """
20
+
21
+ import enum
22
+ from typing import Optional
23
+
24
+ from geolysis.foundation import FoundationType, Shape, create_foundation
25
+ from geolysis.utils import enum_repr, inf
26
+
27
+ from ._core import AllowableBearingCapacity
28
+ from .bowles_abc import BowlesABC4MatFoundation, BowlesABC4PadFoundation
29
+ from .meyerhof_abc import MeyerhofABC4MatFoundation, MeyerhofABC4PadFoundation
30
+ from .terzaghi_abc import TerzaghiABC4MatFoundation, TerzaghiABC4PadFoundation
31
+
32
+
33
+ @enum_repr
34
+ class ABCType(enum.StrEnum):
35
+ """Enumeration of available allowable bearing capacity types."""
36
+ BOWLES = enum.auto()
37
+ MEYERHOF = enum.auto()
38
+ TERZAGHI = enum.auto()
39
+
40
+
41
+ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
42
+ tol_settlement: float,
43
+ depth: float,
44
+ width: float,
45
+ length: Optional[float] = None,
46
+ eccentricity: float = 0.0,
47
+ ground_water_level: float = inf,
48
+ shape: Shape | str = Shape.SQUARE,
49
+ foundation_type: FoundationType | str =
50
+ FoundationType.PAD,
51
+ abc_type: Optional[
52
+ ABCType | str] = None,
53
+ ) -> AllowableBearingCapacity:
54
+ """ A factory function that encapsulate the creation of allowable bearing
55
+ capacities.
56
+
57
+ :param corrected_spt_n_value: The corrected SPT N-value.
58
+ :type corrected_spt_n_value: float
59
+
60
+ :param tol_settlement: Tolerable settlement of foundation (mm).
61
+ :type tol_settlement: float
62
+
63
+ :param depth: Depth of foundation (m).
64
+ :type depth: float
65
+
66
+ :param width: Width of foundation footing (m).
67
+ :type width: float
68
+
69
+ :param length: Length of foundation footing (m).
70
+ :type length: float, optional
71
+
72
+ :param eccentricity: The deviation of the foundation load from the center
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.
76
+ :type eccentricity: float, optional
77
+
78
+ :param ground_water_level: Depth of water below ground level (m).
79
+ :type ground_water_level: float, optional
80
+
81
+ :param shape: Shape of foundation footing, defaults to
82
+ :attr:`~geolysis.foundation.Shape.SQUARE`.
83
+ :type shape: str, optional
84
+
85
+ :param foundation_type: Type of foundation, defaults to "pad".
86
+ :type foundation_type: FoundationType | str, optional
87
+
88
+ :param abc_type: Type of allowable bearing capacity calculation to apply.
89
+ Available values can be found in :class:`ABCType`,
90
+ defaults to None.
91
+ :type abc_type: ABCType | str, optional
92
+
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
96
+ footing.
97
+ :raises ValueError: Raised if an invalid footing ``shape`` is provided.
98
+ """
99
+ msg = (f"{abc_type=} is not supported, Supported "
100
+ f"types are: {list(ABCType)}")
101
+
102
+ if abc_type is None:
103
+ raise ValueError(msg)
104
+
105
+ try:
106
+ abc_type = ABCType(str(abc_type).casefold())
107
+ except ValueError as e:
108
+ raise ValueError(msg) from e
109
+
110
+ msg = (f"{foundation_type=} is not supported, Supported "
111
+ f"types are: {list(FoundationType)}")
112
+
113
+ try:
114
+ foundation_type = FoundationType(str(foundation_type).casefold())
115
+ except ValueError as e:
116
+ raise ValueError(msg) from e
117
+
118
+ # exception from create_foundation will automaatically propagate
119
+ # no need to catch and handle it.
120
+ fnd_size = create_foundation(depth=depth,
121
+ width=width,
122
+ length=length,
123
+ eccentricity=eccentricity,
124
+ ground_water_level=ground_water_level,
125
+ foundation_type=foundation_type,
126
+ shape=shape)
127
+ abc_classes = {
128
+ ABCType.BOWLES: {
129
+ FoundationType.PAD: BowlesABC4PadFoundation,
130
+ FoundationType.MAT: BowlesABC4MatFoundation,
131
+ },
132
+ ABCType.MEYERHOF: {
133
+ FoundationType.PAD: MeyerhofABC4PadFoundation,
134
+ FoundationType.MAT: MeyerhofABC4MatFoundation,
135
+ },
136
+ ABCType.TERZAGHI: {
137
+ FoundationType.PAD: TerzaghiABC4PadFoundation,
138
+ FoundationType.MAT: TerzaghiABC4MatFoundation,
139
+ }
140
+ }
141
+
142
+ abc_class = abc_classes[abc_type][fnd_size.foundation_type]
143
+ abc = abc_class(corrected_spt_n_value=corrected_spt_n_value,
144
+ tol_settlement=tol_settlement,
145
+ foundation_size=fnd_size)
146
+ return abc
@@ -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): ...
@@ -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 ._core 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 ._core 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 ._core 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()