structuralcodes 0.0.1__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 (50) hide show
  1. structuralcodes/__init__.py +17 -0
  2. structuralcodes/codes/__init__.py +79 -0
  3. structuralcodes/codes/ec2_2004/__init__.py +133 -0
  4. structuralcodes/codes/ec2_2004/_concrete_material_properties.py +239 -0
  5. structuralcodes/codes/ec2_2004/_reinforcement_material_properties.py +104 -0
  6. structuralcodes/codes/ec2_2004/_section_7_3_crack_control.py +941 -0
  7. structuralcodes/codes/ec2_2004/annex_b_shrink_and_creep.py +257 -0
  8. structuralcodes/codes/ec2_2004/shear.py +506 -0
  9. structuralcodes/codes/ec2_2023/__init__.py +104 -0
  10. structuralcodes/codes/ec2_2023/_annexB_time_dependent.py +17 -0
  11. structuralcodes/codes/ec2_2023/_section5_materials.py +1160 -0
  12. structuralcodes/codes/ec2_2023/_section9_sls.py +325 -0
  13. structuralcodes/codes/mc2010/__init__.py +169 -0
  14. structuralcodes/codes/mc2010/_concrete_creep_and_shrinkage.py +704 -0
  15. structuralcodes/codes/mc2010/_concrete_interface_different_casting_times.py +104 -0
  16. structuralcodes/codes/mc2010/_concrete_material_properties.py +463 -0
  17. structuralcodes/codes/mc2010/_concrete_punching.py +543 -0
  18. structuralcodes/codes/mc2010/_concrete_shear.py +749 -0
  19. structuralcodes/codes/mc2010/_concrete_torsion.py +164 -0
  20. structuralcodes/codes/mc2010/_reinforcement_material_properties.py +105 -0
  21. structuralcodes/core/__init__.py +1 -0
  22. structuralcodes/core/_section_results.py +211 -0
  23. structuralcodes/core/base.py +260 -0
  24. structuralcodes/geometry/__init__.py +25 -0
  25. structuralcodes/geometry/_geometry.py +875 -0
  26. structuralcodes/geometry/_steel_sections.py +2155 -0
  27. structuralcodes/materials/__init__.py +9 -0
  28. structuralcodes/materials/concrete/__init__.py +82 -0
  29. structuralcodes/materials/concrete/_concrete.py +114 -0
  30. structuralcodes/materials/concrete/_concreteEC2_2004.py +477 -0
  31. structuralcodes/materials/concrete/_concreteEC2_2023.py +435 -0
  32. structuralcodes/materials/concrete/_concreteMC2010.py +494 -0
  33. structuralcodes/materials/constitutive_laws.py +979 -0
  34. structuralcodes/materials/reinforcement/__init__.py +84 -0
  35. structuralcodes/materials/reinforcement/_reinforcement.py +172 -0
  36. structuralcodes/materials/reinforcement/_reinforcementEC2_2004.py +103 -0
  37. structuralcodes/materials/reinforcement/_reinforcementEC2_2023.py +93 -0
  38. structuralcodes/materials/reinforcement/_reinforcementMC2010.py +98 -0
  39. structuralcodes/sections/__init__.py +23 -0
  40. structuralcodes/sections/_generic.py +1249 -0
  41. structuralcodes/sections/_reinforcement.py +115 -0
  42. structuralcodes/sections/section_integrators/__init__.py +14 -0
  43. structuralcodes/sections/section_integrators/_factory.py +41 -0
  44. structuralcodes/sections/section_integrators/_fiber_integrator.py +238 -0
  45. structuralcodes/sections/section_integrators/_marin_integration.py +47 -0
  46. structuralcodes/sections/section_integrators/_marin_integrator.py +222 -0
  47. structuralcodes/sections/section_integrators/_section_integrator.py +49 -0
  48. structuralcodes-0.0.1.dist-info/METADATA +40 -0
  49. structuralcodes-0.0.1.dist-info/RECORD +50 -0
  50. structuralcodes-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,435 @@
1
+ """The concrete class for EC2 2023 Concrete Material."""
2
+
3
+ import typing as t
4
+ import warnings
5
+
6
+ from structuralcodes.codes import ec2_2023
7
+
8
+ from ._concrete import Concrete
9
+
10
+
11
+ class ConcreteEC2_2023(Concrete): # noqa: N801
12
+ """Concrete implementation for EC2 2023 Concrete."""
13
+
14
+ # Inherent concrete properties
15
+ _kE: t.Optional[float] = None # noqa: N815
16
+ _strength_dev_class: t.Optional[str] = None
17
+
18
+ # Computed attributes
19
+ _fcm: t.Optional[float] = None
20
+ _fctm: t.Optional[float] = None
21
+ _Ecm: t.Optional[float] = None
22
+ _fctk_5: t.Optional[float] = None
23
+ _fctk_95: t.Optional[float] = None
24
+ _eps_c1: t.Optional[float] = None
25
+ _eps_cu1: t.Optional[float] = None
26
+ _k_sargin: t.Optional[float] = None
27
+ _eps_c2: t.Optional[float] = None
28
+ _eps_cu2: t.Optional[float] = None
29
+ _n_parabolic_rectangular: t.Optional[float] = None
30
+
31
+ def __init__(
32
+ self,
33
+ fck: float,
34
+ name: t.Optional[str] = None,
35
+ density: float = 2400.0,
36
+ kE: float = 9500,
37
+ strength_dev_class: t.Literal[
38
+ 'CS', 'CN', 'CR', 'slow', 'normal', 'rapid'
39
+ ] = 'CN',
40
+ gamma_c: t.Optional[float] = None,
41
+ existing: bool = False,
42
+ **kwargs,
43
+ ):
44
+ """Initializes a new instance of Concrete for EC2 2023.
45
+
46
+ Arguments:
47
+ fck (float): Characteristic strength in MPa if concrete is not
48
+ existing.
49
+
50
+ Keyword Arguments:
51
+ name (str): A descriptive name for concrete.
52
+ density (float): Density of material in kg/m3 (default: 2400).
53
+ kE (float): Coefficient relating aggregates.
54
+ strength_dev_class (str, optional): Default is CN. Possible values:
55
+ CS, CN, CR, slow, normal or rapid.
56
+ gamma_c (float, optional): Partial factor of concrete (default is
57
+ 1.5).
58
+ existing (bool, optional): The material is of an existing structure
59
+ (default: False).
60
+ """
61
+ del kwargs
62
+ if name is None:
63
+ name = f'C{round(fck):d}'
64
+
65
+ # Check if strength_dev_class is valid
66
+ strength_dev_class = strength_dev_class.strip()
67
+ valid_dev_classes = ('cs', 'cn', 'cr', 'slow', 'normal', 'rapid')
68
+ if strength_dev_class.lower() not in valid_dev_classes:
69
+ raise ValueError(
70
+ 'strength_dev_class not valid. '
71
+ + f'{strength_dev_class} not {valid_dev_classes}'
72
+ )
73
+
74
+ # Check for valid security coeff
75
+ if gamma_c is not None and gamma_c <= 0:
76
+ raise ValueError(
77
+ f'gamma_c cannot be less than zero. Current: {gamma_c}'
78
+ )
79
+
80
+ super().__init__(
81
+ fck=fck,
82
+ name=name,
83
+ density=density,
84
+ existing=existing,
85
+ gamma_c=gamma_c,
86
+ )
87
+ self._kE = kE
88
+ self._strength_dev_class = strength_dev_class
89
+
90
+ def _reset_attributes(self):
91
+ """Reset computed properties."""
92
+ # We only need to reset computed properties
93
+ self._fcm = None
94
+ self._fctm = None
95
+ self._Ecm = None
96
+ self._fctk_5 = None
97
+ self._fctk_95 = None
98
+ self._eps_c1 = None
99
+ self._eps_cu1 = None
100
+ self._k_sargin = None
101
+ self._eps_c2 = None
102
+ self._eps_cu2 = None
103
+ self._n_parabolic_rectangular = None
104
+
105
+ @property
106
+ def fcm(self) -> float:
107
+ """Returns the mean strength of concrete.
108
+
109
+ Returns:
110
+ float: The mean compressive strength in MPa.
111
+ """
112
+ self._fcm = self._fcm or ec2_2023.fcm(self.fck)
113
+ return self._fcm
114
+
115
+ @fcm.setter
116
+ def fcm(self, value: float):
117
+ """Sets a user defined value for the mean strength of concrete.
118
+
119
+ Arguments:
120
+ value (float): the value of the mean strength of concrete in MPa.
121
+
122
+ Raises:
123
+ ValueError: If value is less or equal than the value of fck.
124
+ """
125
+ if abs(value) <= self._fck:
126
+ raise ValueError(
127
+ (
128
+ 'Mean compressive strength cannot be lower than',
129
+ 'characteristic strength.\n',
130
+ 'Current characteristing strength: ',
131
+ f'fck = {self._fck}.',
132
+ f'Current value: value = {value}',
133
+ )
134
+ )
135
+ self._fcm = value
136
+
137
+ @property
138
+ def fctm(self) -> None:
139
+ """Returns the mean concrete tensile strength.
140
+
141
+ Returns:
142
+ float: The mean concrete tensile strength.
143
+ """
144
+ self._fctm = self._fctm or ec2_2023.fctm(self.fck)
145
+ return self._fctm
146
+
147
+ @fctm.setter
148
+ def fctm(self, value: float):
149
+ """Sets a custom user defined value for the concrete tensile strength
150
+ for the concrete.
151
+
152
+ Arguments:
153
+ value (float): The new value for fctm in MPa.
154
+ """
155
+ self._fctm = value
156
+
157
+ @property
158
+ def fctk_5(self) -> float:
159
+ """Returns the 5% mean concrete tensile strength fractile.
160
+
161
+ Returns:
162
+ float: The 5% mean concrete tensile strength fractile in MPa.
163
+ """
164
+ self._fctk_5 = self._fctk_5 or ec2_2023.fctk_5(self.fctm)
165
+ return self._fctk_5
166
+
167
+ @property
168
+ def fctk_95(self) -> float:
169
+ """Returns the 95% mean concrete tensile strength fractile.
170
+
171
+ Returns:
172
+ float: The 5% mean concrete tensile strength fractile in MPa.
173
+ """
174
+ self._fctk_95 = self._fctk_95 or ec2_2023.fctk_95(self.fctm)
175
+ return self._fctk_95
176
+
177
+ @property
178
+ def Ecm(self) -> float:
179
+ """Returns the secant modulus.
180
+
181
+ Returns:
182
+ float: The secant concrete modulus in MPa.
183
+ """
184
+ self._Ecm = self._Ecm or ec2_2023.Ecm(self.fcm, self._kE)
185
+ return self._Ecm
186
+
187
+ @Ecm.setter
188
+ def Ecm(self, value: float) -> None:
189
+ """Sets the secant modulus.
190
+
191
+ Arguments:
192
+ float: The secand modulus value in MPa.
193
+ """
194
+ self._Ecm = value
195
+
196
+ def fcd(
197
+ self, t_ref: float = 28, t0: float = 91, fck_ref: float = 40
198
+ ) -> float:
199
+ """Computes the value of the design compressive strength of concrete.
200
+
201
+ Arguments:
202
+ t_ref (float,optional): The reference time in days (default is 28
203
+ days).
204
+ t0 (float, optional): Age at loading in days (default is 91 days).
205
+ fck_ref (float, optional): The reference compressive strength in
206
+ MPa (default is 40 MPa).
207
+
208
+ Returns:
209
+ float: The design compressive strength of concrete in MPa.
210
+
211
+ Raises:
212
+ ValueError: If fck_ref is less or equal to 0.
213
+ ValueError: If t_ref is less than 0.
214
+ ValueError: If t0 is less than 0.
215
+ """
216
+ eta_cc = ec2_2023.eta_cc(self.fck, fck_ref=fck_ref)
217
+ k_tc = ec2_2023.k_tc(t_ref, t0, self._strength_dev_class)
218
+ return ec2_2023.fcd(self.fck, eta_cc, k_tc, self.gamma_c)
219
+
220
+ def fctd(self, t_ref: float = 28) -> float:
221
+ """Computes the value of the design tensile strength of concrete.
222
+
223
+ Arguments:
224
+ t_ref (float, optional): The reference time in days (default is 28
225
+ days).
226
+
227
+ Returns:
228
+ float: The design tensile strength of concrete in MPa.
229
+
230
+ Raises:
231
+ ValueError: If t_ref is less than 0.
232
+ """
233
+ k_tt = ec2_2023.k_tt(
234
+ t_ref=t_ref, strength_dev_class=self._strength_dev_class
235
+ )
236
+ return ec2_2023.fctd(self.fctk_5, k_tt, self.gamma_c)
237
+
238
+ @property
239
+ def eps_c1(self) -> float:
240
+ """Returns the strain at maximum compressive strength of concrete (fcm)
241
+ for the Sargin constitutive law.
242
+
243
+ Returns:
244
+ float: The strain at maximum compressive strength of concrete.
245
+ """
246
+ self._eps_c1 = self._eps_c1 or ec2_2023.eps_c1(self.fcm)
247
+ return self._eps_c1
248
+
249
+ @eps_c1.setter
250
+ def eps_c1(self, value: float):
251
+ """Sets a user defined value for strain at peak strength for Sargin
252
+ constitutive law.
253
+
254
+ Arguments:
255
+ value (float): The new value for eps_c1, no units.
256
+ """
257
+ if abs(value) >= 0.1:
258
+ warnings.warn(
259
+ 'A suspect value is input for eps_c1 that should be a pure'
260
+ ' number without units. Plase check ({value} given).'
261
+ )
262
+ self._eps_c1 = value
263
+
264
+ @property
265
+ def eps_cu1(self) -> float:
266
+ """Returns the strain at concrete failure of concrete.
267
+
268
+ Returns:
269
+ float: The maximum strength at failure of concrete.
270
+ """
271
+ self._eps_cu1 = self._eps_cu1 or ec2_2023.eps_cu1(self.fcm)
272
+ return self._eps_cu1
273
+
274
+ @eps_cu1.setter
275
+ def eps_cu1(self, value: float):
276
+ """Sets the nominal ultimate strain for Sargin constitutive law.
277
+
278
+ Arguments:
279
+ value (float): The new value for eps_cu1, no units.
280
+ """
281
+ if abs(value) >= 0.1:
282
+ warnings.warn(
283
+ 'A suspect value is input for eps_cu1 that should be a pure'
284
+ ' number without units. Plase check ({value} given).'
285
+ )
286
+ self._eps_cu1 = value
287
+
288
+ @property
289
+ def k_sargin(self) -> float:
290
+ """Returns the k coefficient for Sargin constitutive law.
291
+
292
+ Returns:
293
+ float: k coefficient for Sargin constitutive law.
294
+ """
295
+ self._k_sargin = self._k_sargin or ec2_2023.k_sargin(
296
+ Ecm=self.Ecm,
297
+ fcm=self.fcm,
298
+ eps_c1=self.eps_c1,
299
+ )
300
+ return self._k_sargin
301
+
302
+ @k_sargin.setter
303
+ def k_sargin(self, value: float):
304
+ """Sets the the coefficient for Sargin constitutive law.
305
+
306
+ Arguments:
307
+ value (float): The new value for k, no units.
308
+
309
+ Raises:
310
+ ValueError: If value < 0.
311
+ """
312
+ if value < 0:
313
+ raise ValueError(f'n should be a positive value ({value} given)')
314
+ self._k_sargin = value
315
+
316
+ @property
317
+ def eps_c2(self) -> float:
318
+ """Returns the strain at maximum compressive strength of concrete (fcd)
319
+ for the Parabola-rectangle constitutive law.
320
+
321
+ Returns:
322
+ float: The strain at maximum compressive strength of concrete.
323
+ """
324
+ self._eps_c2 = self._eps_c2 or ec2_2023.eps_c2()
325
+ return self._eps_c2
326
+
327
+ @eps_c2.setter
328
+ def eps_c2(self, value: float):
329
+ """Sets the strain at maximum compressive strength of concrete (fcd)
330
+ for the Parabola-rectangle constitutive law.
331
+
332
+ Arguments:
333
+ value (float): The new value for eps_c2, no units.
334
+ """
335
+ if abs(value) >= 0.1:
336
+ warnings.warn(
337
+ 'A suspect value is input for eps_c2 that should be a pure'
338
+ ' number without units. Plase check ({value} given).'
339
+ )
340
+ self._eps_c2 = value
341
+
342
+ @property
343
+ def eps_cu2(self) -> float:
344
+ """Returns the strain at concrete failure of concrete for the
345
+ Parabola-rectangle constitutive law.
346
+
347
+ Returns:
348
+ float: The maximum strain at failure of concrete.
349
+ """
350
+ self._eps_cu2 = self._eps_cu2 or ec2_2023.eps_cu2()
351
+ return self._eps_cu2
352
+
353
+ @eps_cu2.setter
354
+ def eps_cu2(self, value: float):
355
+ """Sets the strain at concrete failure of concrete for the
356
+ Parabola-rectangle constitutive law.
357
+
358
+ Arguments:
359
+ value (float): The new value for eps_cu2, no units.
360
+ """
361
+ if abs(value) >= 0.1:
362
+ warnings.warn(
363
+ 'A suspect value is input for eps_cu2 that should be a pure'
364
+ ' number without units. Plase check ({value} given).'
365
+ )
366
+ self._eps_cu2 = value
367
+
368
+ @property
369
+ def n_parabolic_rectangular(self) -> float:
370
+ """Returns the coefficient for Parabola-rectangle constitutive law.
371
+
372
+ Returns:
373
+ float: The exponent for Parabola-recangle law.
374
+ """
375
+ self._n_parabolic_rectangular = (
376
+ self._n_parabolic_rectangular or ec2_2023.n_parabolic_rectangular()
377
+ )
378
+ return self._n_parabolic_rectangular
379
+
380
+ @n_parabolic_rectangular.setter
381
+ def n_parabolic_rectangular(self, value: float):
382
+ """Sets the coefficient for Parabola-rectangle constitutive law.
383
+
384
+ Arguments:
385
+ value (float): The new value for n, no units.
386
+
387
+ Raises:
388
+ ValueError: If value < 0.
389
+ """
390
+ if value < 0:
391
+ raise ValueError(f'n should be a positive value ({value} given)')
392
+ if value >= 5:
393
+ warnings.warn(
394
+ 'A suspect value is input for eps_cu2 that should be a pure'
395
+ ' number without units. Plase check ({value} given).'
396
+ )
397
+ self._n_parabolic_rectangular = value
398
+
399
+ @property
400
+ def gamma_c(self) -> float:
401
+ """The partial factor for concrete."""
402
+ # Here we should implement the interaction with the globally set
403
+ # national annex. For now, we simply return the default value.
404
+ return self._gamma_c or 1.5
405
+
406
+ def __elastic__(self) -> dict:
407
+ """Returns kwargs for creating an elastic constitutive law."""
408
+ return {'E': self.Ecm}
409
+
410
+ def __parabolarectangle__(self) -> dict:
411
+ """Returns kwargs for creating a parabola rectangle const law."""
412
+ return {
413
+ 'fc': self.fcd(),
414
+ 'eps_0': self.eps_c2,
415
+ 'eps_u': self.eps_cu2,
416
+ 'n': self.n_parabolic_rectangular,
417
+ }
418
+
419
+ def __sargin__(self) -> dict:
420
+ """Returns kwargs for creating a Sargin const law."""
421
+ return {
422
+ 'fc': self.fcd(),
423
+ 'eps_c1': self.eps_c1,
424
+ 'eps_cu1': self.eps_cu1,
425
+ 'k': self.k_sargin,
426
+ }
427
+
428
+ def __popovics__(self) -> dict:
429
+ """Returns kwargs for creating a Sargin const law."""
430
+ return {
431
+ 'fc': self.fcd(),
432
+ 'eps_c': self.eps_c1,
433
+ 'eps_cu': self.eps_cu1,
434
+ 'Ec': self.Ecm,
435
+ }