structuralcodes 0.3.1__py3-none-any.whl → 0.5.0__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.

Potentially problematic release.


This version of structuralcodes might be problematic. Click here for more details.

Files changed (33) hide show
  1. structuralcodes/__init__.py +1 -1
  2. structuralcodes/codes/ec2_2004/__init__.py +2 -0
  3. structuralcodes/codes/ec2_2004/shear.py +44 -4
  4. structuralcodes/codes/mc2010/__init__.py +40 -0
  5. structuralcodes/codes/mc2010/_concrete_punching.py +300 -388
  6. structuralcodes/codes/mc2010/_interface_concrete_steel_rebar.py +348 -0
  7. structuralcodes/core/base.py +1 -22
  8. structuralcodes/geometry/_circular.py +3 -10
  9. structuralcodes/geometry/_geometry.py +47 -92
  10. structuralcodes/geometry/_rectangular.py +3 -10
  11. structuralcodes/geometry/_reinforcement.py +8 -11
  12. structuralcodes/materials/__init__.py +2 -1
  13. structuralcodes/materials/basic/__init__.py +11 -0
  14. structuralcodes/materials/basic/_elastic.py +52 -0
  15. structuralcodes/materials/basic/_elasticplastic.py +75 -0
  16. structuralcodes/materials/basic/_generic.py +26 -0
  17. structuralcodes/materials/concrete/_concrete.py +1 -62
  18. structuralcodes/materials/concrete/_concreteEC2_2004.py +270 -224
  19. structuralcodes/materials/concrete/_concreteEC2_2023.py +246 -188
  20. structuralcodes/materials/concrete/_concreteMC2010.py +280 -235
  21. structuralcodes/materials/constitutive_laws/__init__.py +16 -15
  22. structuralcodes/materials/reinforcement/_reinforcement.py +0 -71
  23. structuralcodes/materials/reinforcement/_reinforcementEC2_2004.py +37 -2
  24. structuralcodes/materials/reinforcement/_reinforcementEC2_2023.py +34 -1
  25. structuralcodes/materials/reinforcement/_reinforcementMC2010.py +38 -2
  26. structuralcodes/sections/_generic.py +76 -21
  27. structuralcodes/sections/_rc_utils.py +15 -5
  28. structuralcodes/sections/section_integrators/_fiber_integrator.py +19 -11
  29. structuralcodes/sections/section_integrators/_marin_integrator.py +24 -19
  30. {structuralcodes-0.3.1.dist-info → structuralcodes-0.5.0.dist-info}/METADATA +3 -2
  31. {structuralcodes-0.3.1.dist-info → structuralcodes-0.5.0.dist-info}/RECORD +33 -27
  32. {structuralcodes-0.3.1.dist-info → structuralcodes-0.5.0.dist-info}/WHEEL +1 -1
  33. structuralcodes-0.5.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,348 @@
1
+ """Provides functions to determine parameters of the bond stress-slip
2
+ relations as shown in Figure 6.1-1 of the fib
3
+ ModelCode 2010.
4
+
5
+ - Eq. 6.1-5.
6
+ - Eq. 6.1-6.
7
+ - Table 6.1-1 s_1, s_2 and s_3
8
+ - Solve s for Eq. 6.1-1 with substitution of tau_bu_split for tau_b.
9
+ - Eq. 6.1-19.
10
+ """
11
+
12
+ import typing as t
13
+ import warnings
14
+
15
+
16
+ def _validate_bond_value(bond: t.Optional[str] = None) -> str:
17
+ """Validate the value provided for 'bond'."""
18
+ valid_bond_values = ('good', 'other')
19
+ if (
20
+ bond is not None
21
+ and isinstance(bond, str)
22
+ and bond.lower() in valid_bond_values
23
+ ):
24
+ return bond.lower()
25
+ raise ValueError("Invalid bond condition. Must be 'good' or 'other'.")
26
+
27
+
28
+ def _validate_confinement_value(confinement: t.Optional[str] = None) -> str:
29
+ """Validate the value provided for 'confinement'."""
30
+ valid_confinement_values = ('unconfined', 'stirrups')
31
+ if (
32
+ confinement is not None
33
+ and isinstance(confinement, str)
34
+ and confinement.lower() in valid_confinement_values
35
+ ):
36
+ return confinement.lower()
37
+ raise ValueError(
38
+ "Invalid confinement value. Must be 'unconfined' or 'stirrups'."
39
+ )
40
+
41
+
42
+ def _validate_failmod_value(failmod: t.Optional[str] = None) -> str:
43
+ """Validate the value provided for 'failmod'."""
44
+ valid_failmod_values = ['po', 'sp']
45
+ if (
46
+ failmod is not None
47
+ and isinstance(failmod, str)
48
+ and failmod.lower() in valid_failmod_values
49
+ ):
50
+ return failmod.lower()
51
+ raise ValueError("Invalid failmod value. Must be 'PO' or 'SP'.")
52
+
53
+
54
+ def eta_2(bond: t.Literal['good', 'other']) -> float:
55
+ """Bond coefficient eta_2.
56
+
57
+ fib Model Code 2010, Eq. (6.1-5).
58
+
59
+ Args:
60
+ bond (str): Bond condition according to Subsection 6.1.3.2. Input must
61
+ be 'good' or 'other'.
62
+
63
+ Returns:
64
+ float: eta_2 value.
65
+
66
+ Raises:
67
+ ValueError: If a proper value for 'bond' is not input.
68
+ """
69
+ eta_2 = {'good': 1.0, 'other': 0.7}
70
+
71
+ return eta_2[_validate_bond_value(bond=bond)]
72
+
73
+
74
+ def tau_bu_split(
75
+ eta_2: float,
76
+ f_cm: float,
77
+ phi: float,
78
+ c_min: float,
79
+ c_max: float,
80
+ k_m: float,
81
+ K_tr: float,
82
+ ) -> float:
83
+ """Maximum bond stress in case of splitting failure.
84
+
85
+ fib Model Code 2010, Eq. (6.1-5).
86
+
87
+ Args:
88
+ eta_2 (float): Parameter based on bond condition. 1.0 for 'good' bond
89
+ condition and 0.7 for 'other' conditions.
90
+ f_cm (float): Mean cylinder concrete compressive strength in MPa.
91
+ phi (float): Nominal bar diameter in mm.
92
+ c_min (float): Parameter according to MC2010 Figure 6.1-2.
93
+ c_max (float): Parameter according to MC2010 Figure 6.1-2.
94
+ k_m (float): Parameter according to MC2010 Figure 6.1-3.
95
+ K_tr (float): To be calculated with MC2010 Eq.(6.1-6).
96
+
97
+ Returns:
98
+ float: tau_bu_split in MPa.
99
+ """
100
+ return (
101
+ eta_2
102
+ * 6.5
103
+ * (f_cm / 25) ** 0.25
104
+ * (25 / phi) ** 0.2
105
+ * ((c_min / phi) ** 0.33 * (c_max / c_min) ** 0.1 + k_m * K_tr)
106
+ )
107
+
108
+
109
+ def K_tr(
110
+ n_t: float,
111
+ A_st: float,
112
+ n_b: float,
113
+ phi: float,
114
+ s_t: float,
115
+ ) -> float:
116
+ """Coefficient accounting for transverse stresses, K_tr.
117
+
118
+ fib Model Code 2010, Eq. (6.1-6).
119
+
120
+ Args:
121
+ n_t (float): Number of legs of confining reinforcement crossing a
122
+ potential splitting failure surface at a section.
123
+ A_st (float): Cross-sectional area of one leg of a confining bar in
124
+ mm^2.
125
+ n_b (float): Number of anchored bars or pairs of lapped bars in
126
+ potential splitting surface.
127
+ phi (float): Nominal bar diameter in mm.
128
+ s_t (float): Longitudnal spacing of confining reinforcement in mm.
129
+
130
+ Returns:
131
+ float: K_tr as value.
132
+ """
133
+ return min((n_t * A_st / (n_b * phi * s_t)), 0.05)
134
+
135
+
136
+ def tau_bmax(bond: t.Literal['good', 'other'], f_cm: float) -> float:
137
+ """Maximum bond stress tau_bmax.
138
+
139
+ fib Model Code 2010, Table 6.1-1.
140
+
141
+ Args:
142
+ bond (str): Bond condition according to Subsection 6.1.3.2. Must be
143
+ 'good' or 'other'.
144
+ f_cm (float): Mean cylinder concrete compressive strength in MPa.
145
+
146
+ Returns:
147
+ float: tau_bmax in MPa.
148
+
149
+ Raises:
150
+ ValueError: If a proper value for 'bond' is not input.
151
+ """
152
+ tau_bmax = {'good': 2.5 * f_cm**0.5, 'other': 1.25 * f_cm**0.5}
153
+
154
+ return tau_bmax[_validate_bond_value(bond)]
155
+
156
+
157
+ def s_1(bond: t.Literal['good', 'other']) -> float:
158
+ """Slip at maximum bond stress, s_1.
159
+
160
+ fib Model Code 2010, Table 6.1-1.
161
+
162
+ Args:
163
+ bond (str): Bond condition according to Subsection 6.1.3.2. Must be
164
+ 'good' or 'other'.
165
+
166
+ Returns:
167
+ float: s_1 in mm.
168
+
169
+ Raises:
170
+ ValueError: If a proper value for 'bond' is not input.
171
+ """
172
+ s_1_values = {'good': 1.0, 'other': 1.8}
173
+
174
+ return s_1_values[_validate_bond_value(bond)]
175
+
176
+
177
+ def s_2(bond: t.Literal['good', 'other']) -> float:
178
+ """s_2 according to Table 6.1-1.
179
+
180
+ Args:
181
+ bond (str): Bond condition according to Subsection 6.1.3.2. Must be
182
+ 'good' or 'other'.
183
+
184
+ Returns:
185
+ float: s_2 in mm.
186
+
187
+ Raises:
188
+ ValueError: If a proper value for 'bond' is not input.
189
+ """
190
+ s_2_values = {'good': 2.0, 'other': 3.6}
191
+
192
+ return s_2_values[_validate_bond_value(bond)]
193
+
194
+
195
+ def s_3(
196
+ failmod: t.Literal['PO', 'SP'],
197
+ bond: t.Literal['good', 'other'],
198
+ confinement: t.Literal['unconfined', 'stirrups'],
199
+ c_clear: float,
200
+ s_1: float,
201
+ ) -> float:
202
+ """s_3 according to Table 6.1-1.
203
+
204
+ Args:
205
+ failmod (str): Failure mode. Must be "PO" for Pull-out of "SP" for
206
+ Splitting.
207
+ bond (str): Bond condition according to Subsection 6.1.3.2. Must be
208
+ 'Good' or 'Other'.
209
+ confinement (str): Confinement conditions. Must be "Unconfined" or
210
+ "Stirrups"
211
+ c_clear (float): Clear distance between ribs in mm.
212
+ s_1 (float): s_1 according to Table 6.1-1 columns 1 and 2 for Pull-out
213
+ failure.
214
+
215
+ Returns:
216
+ float: s_3 in mm.
217
+
218
+ Raises:
219
+ ValueError: If a proper value for 'failmod' is not input.
220
+ ValueError: If a proper value for 'bond' is not input.
221
+ ValueError: If a proper value for 'confinement' is not input.
222
+ """
223
+ s_3_values = {
224
+ 'po': {
225
+ 'good': c_clear,
226
+ 'other': c_clear,
227
+ },
228
+ 'sp': {
229
+ 'good': {'unconfined': 1.2 * s_1, 'stirrups': 0.5 * c_clear},
230
+ 'other': {'unconfined': 1.2 * s_1, 'stirrups': 0.5 * c_clear},
231
+ },
232
+ }
233
+
234
+ if _validate_failmod_value(failmod) == 'po':
235
+ return s_3_values[_validate_failmod_value(failmod)][
236
+ _validate_bond_value(bond)
237
+ ]
238
+ if _validate_failmod_value(failmod) == 'sp':
239
+ return s_3_values[_validate_failmod_value(failmod)][
240
+ _validate_bond_value(bond)
241
+ ][_validate_confinement_value(confinement)]
242
+ return 0.0
243
+
244
+
245
+ def s_tau_bu_split(
246
+ tau_bmax: float,
247
+ tau_bu_split: float,
248
+ alpha: float,
249
+ s_1: float,
250
+ ) -> float:
251
+ """Calculates the slip at tau_bu_split by rewriting Eq. 6.1-1 to solve for
252
+ s and substituting tau_bu_split for tau_b.
253
+
254
+ Args:
255
+ tau_bmax (float): Maximum bond stress according to Table 6.1-1.
256
+ tau_bu_split (float): Concrete bond stress at splitting failure.
257
+ alpha (float): Parameter in Eq. 6.1-1. Alpha is 0.4 in Table 6.1-1.
258
+ s_1 (float): s_1 according to Table 6.1-1.
259
+
260
+ Returns:
261
+ float: Slip at tau_bu_split in mm.
262
+ """
263
+ return (tau_bu_split / tau_bmax) ** (1 / alpha) * s_1
264
+
265
+
266
+ def f_stm(
267
+ f_cm: float,
268
+ phi: float,
269
+ l_b: float,
270
+ c_min: float,
271
+ c_max: float,
272
+ k_m: float,
273
+ K_tr: float,
274
+ ) -> float:
275
+ """Reinforcement stress, f_stm.
276
+
277
+ fib Model Code 2010, Eq. (6.1-19).
278
+
279
+ Args:
280
+ f_cm (float): Mean cylinder concrete compressive strength in MPa.
281
+ phi (float): Nominal bar diameter in mm.
282
+ l_b (float): Bond length in mm.
283
+ c_min (float): Parameter shown in Figure 6.1-2.
284
+ c_max (float): Parameter shown in Figure 6.1-2.
285
+ k_m (float): Parameter shown in Figure 6.1-3.
286
+ K_tr (float): Parameter calculated with Eq.(6.1-6).
287
+
288
+ Returns:
289
+ float: f_stm in MPa.
290
+
291
+ Raises:
292
+ UserWarning: If not 15 MPa < f_cm < 110 MPa.
293
+ UserWarning: If not 0.5 < c_min / phi < 3.5.
294
+ UserWarning: If not 1.0 < c_max / c_min < 5.0.
295
+ UserWarning: If not K_tr <= 0.05.
296
+ """
297
+ if not 15 < f_cm < 110:
298
+ warnings.warn(
299
+ 'Warning: Eq.(6.1-19) is valid for 15 MPa < f_cm < 110 MPa.',
300
+ UserWarning,
301
+ )
302
+ if not 0.5 < c_min / phi < 3.5:
303
+ warnings.warn(
304
+ 'Warning: Eq.(6.1-19) is valid for 0.5 < c_min / phi < 3.5.',
305
+ UserWarning,
306
+ )
307
+ if not 1.0 < c_max / c_min < 5.0:
308
+ warnings.warn(
309
+ 'Warning: Eq.(6.1-19) is valid for 1.0 < c_max / c_min < 5.0',
310
+ UserWarning,
311
+ )
312
+ if not K_tr <= 0.05:
313
+ warnings.warn(
314
+ 'Warning: Eq.(6.1-19) is valid for K_tr <= 0.05.',
315
+ UserWarning,
316
+ )
317
+
318
+ return (
319
+ 54
320
+ * (f_cm / 25) ** 0.25
321
+ * (25 / phi) ** 0.2
322
+ * (l_b / phi) ** 0.55
323
+ * ((c_min / phi) ** 0.25 * (c_max / c_min) ** 0.1 + k_m * K_tr)
324
+ )
325
+
326
+
327
+ def tau_yield(
328
+ f_y: float,
329
+ l_b: float,
330
+ phi: float,
331
+ ) -> float:
332
+ """Calculates the bond stress at yield of the reinforcement bar based
333
+ on a uniform bond stress over l_b.
334
+
335
+ The bond stress at yield is a limit for:
336
+ - tau_bmax, given with eps_s < eps_s,y in Table 6.1-1.
337
+ - tau_bu_split, explicitly stated for Eq. 6.1-19.
338
+
339
+ Args:
340
+ f_y (float): Reinforcement bar yield stress in MPa.
341
+ l_b (float): Bond length with uniform bond stress assumed in mm.
342
+ phi (float): Nominal bar diameter in mm.
343
+
344
+ Returns:
345
+ float: Bond stress at yield of rebar in MPa.
346
+
347
+ """
348
+ return f_y / (4 * l_b / phi)
@@ -4,7 +4,6 @@ from __future__ import annotations # To have clean hints of ArrayLike in docs
4
4
 
5
5
  import abc
6
6
  import typing as t
7
- import warnings
8
7
 
9
8
  import numpy as np
10
9
  from numpy.typing import ArrayLike
@@ -29,28 +28,8 @@ class Material(abc.ABC):
29
28
  self._density = abs(density)
30
29
  self._name = name if name is not None else 'Material'
31
30
 
32
- def update_attributes(self, updated_attributes: t.Dict) -> None:
33
- """Function for updating the attributes specified in the input
34
- dictionary.
35
-
36
- Args:
37
- updated_attributes (dict): the dictionary of parameters to be
38
- updated (not found parameters are skipped with a warning)
39
- """
40
- for key, value in updated_attributes.items():
41
- if not hasattr(self, '_' + key):
42
- str_list_keys = ', '.join(updated_attributes.keys())
43
- str_warn = (
44
- f"WARNING: attribute '{key}' not found."
45
- " Ignoring the entry.\n"
46
- f"Used keys in the call: {str_list_keys}"
47
- )
48
- warnings.warn(str_warn)
49
- continue
50
- setattr(self, '_' + key, value)
51
-
52
31
  @property
53
- def constitutive_law(self):
32
+ def constitutive_law(self) -> ConstitutiveLaw:
54
33
  """Returns the ConstitutiveLaw of the object."""
55
34
  return self._constitutive_law
56
35
 
@@ -12,7 +12,7 @@ import numpy as np
12
12
  from numpy.typing import ArrayLike
13
13
  from shapely import Polygon
14
14
 
15
- from structuralcodes.core.base import ConstitutiveLaw, Material
15
+ from structuralcodes.core.base import Material
16
16
 
17
17
  from ._geometry import SurfaceGeometry
18
18
 
@@ -37,9 +37,8 @@ class CircularGeometry(SurfaceGeometry):
37
37
  def __init__(
38
38
  self,
39
39
  diameter: float,
40
- material: t.Union[Material, ConstitutiveLaw],
40
+ material: Material,
41
41
  n_points: int = 20,
42
- density: t.Optional[float] = None,
43
42
  concrete: bool = False,
44
43
  origin: t.Optional[ArrayLike] = None,
45
44
  name: t.Optional[str] = None,
@@ -49,14 +48,9 @@ class CircularGeometry(SurfaceGeometry):
49
48
 
50
49
  Arguments:
51
50
  diameter (float): The diameter of the geometry.
52
- material (Union(Material, ConstitutiveLaw)): A Material or
53
- ConsitutiveLaw class applied to the geometry.
51
+ material (Material): A Material class applied to the geometry.
54
52
  n_points (int): The number of points used to discretize the
55
53
  circle as a shapely `Polygon` (default = 20).
56
- density (Optional(float)): When a ConstitutiveLaw is passed as
57
- material, the density can be provided by this argument. When
58
- material is a Material object the density is taken from the
59
- material.
60
54
  concrete (bool): Flag to indicate if the geometry is concrete.
61
55
  origin (Optional(ArrayLike)): The center point of the circle.
62
56
  (0.0, 0.0) is used as default.
@@ -84,7 +78,6 @@ class CircularGeometry(SurfaceGeometry):
84
78
  super().__init__(
85
79
  poly=polygon,
86
80
  material=material,
87
- density=density,
88
81
  concrete=concrete,
89
82
  name=name,
90
83
  group_label=group_label,