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

@@ -3,7 +3,7 @@
3
3
  from . import codes, core, geometry, materials, sections
4
4
  from .codes import get_design_codes, set_design_code, set_national_annex
5
5
 
6
- __version__ = '0.3.1'
6
+ __version__ = '0.4.0'
7
7
 
8
8
  __all__ = [
9
9
  'set_design_code',
@@ -81,6 +81,18 @@ from ._concrete_shear import (
81
81
  v_rds,
82
82
  )
83
83
  from ._concrete_torsion import t_rd, t_rd_max, v_ed_ti
84
+ from ._interface_concrete_steel_rebar import (
85
+ K_tr,
86
+ eta_2,
87
+ f_stm,
88
+ s_1,
89
+ s_2,
90
+ s_3,
91
+ s_tau_bu_split,
92
+ tau_bmax,
93
+ tau_bu_split,
94
+ tau_yield,
95
+ )
84
96
  from ._reinforcement_material_properties import (
85
97
  epsud,
86
98
  fyd,
@@ -162,6 +174,16 @@ __all__ = [
162
174
  'tau_edi',
163
175
  'tau_rdi_with_reinforcement',
164
176
  'tau_rdi_without_reinforcement',
177
+ 'eta_2',
178
+ 'tau_bu_split',
179
+ 'K_tr',
180
+ 'tau_bmax',
181
+ 's_1',
182
+ 's_2',
183
+ 's_3',
184
+ 's_tau_bu_split',
185
+ 'f_stm',
186
+ 'tau_yield',
165
187
  ]
166
188
 
167
189
  __title__: str = 'fib Model Code 2010'
@@ -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,26 +28,6 @@ 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
32
  def constitutive_law(self):
54
33
  """Returns the ConstitutiveLaw of the object."""
@@ -4,7 +4,6 @@ import abc
4
4
  import typing as t
5
5
 
6
6
  from structuralcodes.core.base import ConstitutiveLaw, Material
7
- from structuralcodes.materials.constitutive_laws import create_constitutive_law
8
7
 
9
8
 
10
9
  class Concrete(Material):
@@ -13,7 +12,7 @@ class Concrete(Material):
13
12
  _fck: float
14
13
  _gamma_c: t.Optional[float] = None
15
14
  _existing: bool
16
- _constitutive_law: t.Optional[ConstitutiveLaw] = None
15
+ _constitutive_law: t.Optional[ConstitutiveLaw]
17
16
 
18
17
  def __init__(
19
18
  self,
@@ -34,72 +33,12 @@ class Concrete(Material):
34
33
  )
35
34
  self._existing = existing
36
35
  self._gamma_c = gamma_c
37
- self._constitutive_law = None
38
36
 
39
37
  @property
40
38
  def fck(self) -> float:
41
39
  """Returns fck in MPa."""
42
40
  return self._fck
43
41
 
44
- @fck.setter
45
- def fck(self, fck: float) -> None:
46
- """Setter for fck (in MPa)."""
47
- self._fck = abs(fck)
48
- self._reset_attributes()
49
-
50
- @abc.abstractmethod
51
- def _reset_attributes(self):
52
- """Each concrete should define its own _reset_attributes method. This
53
- is because fck setting, reset the object arguments.
54
- """
55
-
56
- @property
57
- def constitutive_law(self) -> ConstitutiveLaw:
58
- """Returns the constitutive law object."""
59
- if self._constitutive_law is None:
60
- self.constitutive_law = 'parabolarectangle'
61
- return self._constitutive_law
62
-
63
- @constitutive_law.setter
64
- def constitutive_law(
65
- self,
66
- constitutive_law: t.Union[
67
- ConstitutiveLaw,
68
- t.Literal['elastic', 'parabolarectangle', 'sargin', 'popovics'],
69
- ],
70
- ) -> None:
71
- """Setter for constitutive law.
72
-
73
- Arguments:
74
- consitutive_law (ConstitutiveLaw | str): A valid ConstitutiveLaw
75
- object for concrete or a string defining a valid constitutive
76
- law type for concrete. (valid options for string: 'elastic',
77
- 'parabolarectangle', 'bilinearcompression', 'sargin',
78
- 'popovics').
79
- """
80
- if constitutive_law is None:
81
- raise ValueError(
82
- 'At least a constitutive law or a string defining the '
83
- 'constitutive law must be provided.'
84
- )
85
- if isinstance(constitutive_law, str):
86
- constitutive_law = create_constitutive_law(
87
- constitutive_law_name=constitutive_law, material=self
88
- )
89
-
90
- if isinstance(constitutive_law, ConstitutiveLaw):
91
- if 'concrete' in constitutive_law.__materials__:
92
- self._constitutive_law = constitutive_law
93
- else:
94
- raise ValueError(
95
- 'The constitutive law selected is not suitable '
96
- 'for being used with a concrete material.'
97
- )
98
- else:
99
- raise ValueError(
100
- f'The constitutive law {constitutive_law} could not be created'
101
- )
102
-
103
42
  @property
104
43
  @abc.abstractmethod
105
44
  def gamma_c(self) -> float: