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,17 @@
1
+ """A Python package that contains models from structural design codes."""
2
+
3
+ from . import codes, core, geometry, materials, sections
4
+ from .codes import get_design_codes, set_design_code, set_national_annex
5
+
6
+ __version__ = '0.0.1'
7
+
8
+ __all__ = [
9
+ 'set_design_code',
10
+ 'get_design_codes',
11
+ 'set_national_annex',
12
+ 'codes',
13
+ 'core',
14
+ 'materials',
15
+ 'geometry',
16
+ 'sections',
17
+ ]
@@ -0,0 +1,79 @@
1
+ """Collection of functions related to design codes."""
2
+
3
+ import types
4
+ import typing as t
5
+
6
+ from . import ec2_2004, ec2_2023, mc2010
7
+
8
+ __all__ = [
9
+ 'mc2010',
10
+ 'ec2_2023',
11
+ 'ec2_2004',
12
+ 'set_design_code',
13
+ 'get_design_codes',
14
+ 'set_national_annex',
15
+ ]
16
+
17
+ # Global code object used by material classes
18
+ _CODE: t.Optional[types.ModuleType] = None
19
+
20
+ # Global national annex object
21
+ _NATIONAL_ANNEX: t.Optional[str] = None
22
+
23
+ # Design code registry
24
+ _DESIGN_CODES = {
25
+ 'mc2010': mc2010,
26
+ 'ec2_2004': ec2_2004,
27
+ 'ec2_2023': ec2_2023,
28
+ }
29
+
30
+
31
+ def set_design_code(design_code: t.Optional[str] = None) -> None:
32
+ """Set the current design code globally.
33
+
34
+ Args:
35
+ design_code (str): The abbreviation of the code.
36
+
37
+ Note:
38
+ Call get_design_codes() to get a list of the available codes.
39
+ """
40
+ global _CODE # pylint: disable=W0603
41
+ if design_code is not None:
42
+ _CODE = _DESIGN_CODES.get(design_code.lower())
43
+ else:
44
+ _CODE = None
45
+
46
+
47
+ def get_design_codes() -> t.List[str]:
48
+ """Get a list of the available design codes."""
49
+ return list(_DESIGN_CODES.keys())
50
+
51
+
52
+ def set_national_annex(national_annex: str) -> None:
53
+ """Set the current national annex globally.
54
+
55
+ Args:
56
+ national_annex (str): The abbreviation of the national annex.
57
+
58
+ Note:
59
+ Call get_national_annexes() on the relevant design code to see a list
60
+ of available national annexes.
61
+ """
62
+ global _NATIONAL_ANNEX # pylint: disable=W0603
63
+ _NATIONAL_ANNEX = national_annex.lower()
64
+
65
+
66
+ def _use_design_code(
67
+ design_code: t.Optional[str] = None,
68
+ ) -> t.Optional[types.ModuleType]:
69
+ """Use a design code in a class.
70
+
71
+ Kwargs:
72
+ design_code (str): The abbreviation of the code.
73
+
74
+ Note:
75
+ Call get_design_codes() to get a list of the available codes.
76
+ """
77
+ if design_code is None:
78
+ return _CODE
79
+ return _DESIGN_CODES.get(design_code.lower())
@@ -0,0 +1,133 @@
1
+ """EUROCODE 2 1992-1-1:2004."""
2
+
3
+ import typing as t
4
+
5
+ from ._concrete_material_properties import (
6
+ Ecm,
7
+ eps_c1,
8
+ eps_c2,
9
+ eps_c3,
10
+ eps_cu1,
11
+ eps_cu2,
12
+ eps_cu3,
13
+ fcd,
14
+ fcm,
15
+ fctk_5,
16
+ fctk_95,
17
+ fctm,
18
+ k_sargin,
19
+ n_parabolic_rectangular,
20
+ )
21
+ from ._reinforcement_material_properties import (
22
+ epsud,
23
+ fyd,
24
+ reinforcement_duct_props,
25
+ )
26
+ from ._section_7_3_crack_control import (
27
+ As_min,
28
+ As_min_2,
29
+ As_min_p,
30
+ alpha_e,
31
+ eps_sm_eps_cm,
32
+ hc_eff,
33
+ k,
34
+ k1,
35
+ k2,
36
+ k3,
37
+ k4,
38
+ kc_flanges_area,
39
+ kc_rect_area,
40
+ kc_tension,
41
+ kt,
42
+ phi_eq,
43
+ rho_p_eff,
44
+ sr_max_close,
45
+ sr_max_far,
46
+ sr_max_theta,
47
+ w_max,
48
+ w_spacing,
49
+ wk,
50
+ xi1,
51
+ )
52
+ from .annex_b_shrink_and_creep import (
53
+ beta_c,
54
+ beta_fcm,
55
+ beta_H,
56
+ beta_RH,
57
+ eps_cd_0,
58
+ eps_cs,
59
+ phi,
60
+ phi_RH,
61
+ t0_adj,
62
+ )
63
+ from .shear import (
64
+ Asw_max,
65
+ VEdmax_unreinf,
66
+ VRdc,
67
+ VRdc_prin_stress,
68
+ VRdmax,
69
+ VRds,
70
+ )
71
+
72
+ __all__ = [
73
+ 'As_min',
74
+ 'As_min_2',
75
+ 'As_min_p',
76
+ 'Asw_max',
77
+ 'alpha_e',
78
+ 'eps_sm_eps_cm',
79
+ 'hc_eff',
80
+ 'k',
81
+ 'k1',
82
+ 'k2',
83
+ 'k3',
84
+ 'k4',
85
+ 'kc_flanges_area',
86
+ 'kc_rect_area',
87
+ 'kc_tension',
88
+ 'kt',
89
+ 'phi_eq',
90
+ 'reinforcement_duct_props',
91
+ 'rho_p_eff',
92
+ 'sr_max_close',
93
+ 'sr_max_far',
94
+ 'sr_max_theta',
95
+ 'w_max',
96
+ 'w_spacing',
97
+ 'wk',
98
+ 'xi1',
99
+ 'fcd',
100
+ 'fcm',
101
+ 'fctm',
102
+ 'fctk_5',
103
+ 'fctk_95',
104
+ 'Ecm',
105
+ 'eps_c1',
106
+ 'eps_cu1',
107
+ 'k_sargin',
108
+ 'eps_c2',
109
+ 'eps_cu2',
110
+ 'n_parabolic_rectangular',
111
+ 'eps_c3',
112
+ 'eps_cu3',
113
+ 'fyd',
114
+ 'epsud',
115
+ 'VEdmax_unreinf',
116
+ 'VRdc',
117
+ 'VRdc_prin_stress',
118
+ 'VRdmax',
119
+ 'VRds',
120
+ 'beta_c',
121
+ 'beta_fcm',
122
+ 'beta_H',
123
+ 'beta_RH',
124
+ 'eps_cd_0',
125
+ 'eps_cs',
126
+ 'phi',
127
+ 'phi_RH',
128
+ 't0_adj',
129
+ ]
130
+
131
+ __title__: str = 'EUROCODE 2 1992-1-1:2004'
132
+ __year__: str = '2004'
133
+ __materials__: t.Tuple[str] = ('concrete', 'reinforcement')
@@ -0,0 +1,239 @@
1
+ """Concrete material properties according to Tab. 3.1."""
2
+
3
+ import math
4
+
5
+ from structuralcodes.codes import mc2010
6
+
7
+
8
+ def fcm(fck: float, delta_f: float = 8) -> float:
9
+ """The mean compressive strength of concrete.
10
+
11
+ EN 1992-1-1:2004, Table 3.1.
12
+
13
+ Args:
14
+ fck (float): The characteristic compressive strength of concrete in
15
+ MPa.
16
+
17
+ Keyword Args:
18
+ delta_f (float): The difference between the mean and the
19
+ characteristic strength.
20
+
21
+ Returns:
22
+ float: The mean compressive strength in MPa.
23
+ """
24
+ return mc2010.fcm(fck=abs(fck), delta_f=abs(delta_f))
25
+
26
+
27
+ def fctm(fck: float) -> float:
28
+ """The mean tensile strength of concrete.
29
+
30
+ EN 1992-1-1: 2004, Table 3.1.
31
+
32
+ Args:
33
+ fck (float): The characteristic compressive strength of concrete in
34
+ MPa.
35
+
36
+ Returns:
37
+ float: The mean tensile strength in MPa.
38
+ """
39
+ return mc2010.fctm(fck=abs(fck))
40
+
41
+
42
+ def fctk_5(fctm: float) -> float:
43
+ """The 5% fractile of the tensile strength of concrete.
44
+
45
+ EN 1992-1-1: 2004, Table 3.1.
46
+
47
+ Args:
48
+ fctm (float): The mean tensile strength of concrete in MPa.
49
+
50
+ Returns:
51
+ float: The 5% fractile of the tensile strength in MPa.
52
+ """
53
+ return mc2010.fctkmin(fctm=abs(fctm))
54
+
55
+
56
+ def fctk_95(fctm: float) -> float:
57
+ """The 95% fractile of the tensile strength of concrete.
58
+
59
+ EN 1992-1-1: 2004, Table 3.1.
60
+
61
+ Args:
62
+ fctm (float): The mean tensile strength of concrete in MPa.
63
+
64
+ Returns:
65
+ float: The 95% fractile of the tensile strength in MPa.
66
+ """
67
+ return mc2010.fctkmax(fctm=abs(fctm))
68
+
69
+
70
+ def Ecm(fcm: float) -> float:
71
+ """The secant modulus of concrete.
72
+
73
+ EN 1992-1-1:2004, Table 3.1.
74
+
75
+ Args:
76
+ fcm (float): The mean compressive strength of concrete in MPa.
77
+
78
+ Returns:
79
+ float: The secant modulus of concrete in MPa.
80
+ """
81
+ return 22000.0 * math.pow(abs(fcm) / 10, 0.3)
82
+
83
+
84
+ def eps_c1(fcm: float) -> float:
85
+ """The strain at maximum compressive stress of concrete (fcm) for the
86
+ Sargin constitutive law.
87
+
88
+ EN 1992-1-1:2004, Table 3.1.
89
+
90
+ Args:
91
+ fcm (float): The mean compressive strength of concrete in MPa.
92
+
93
+ Returns:
94
+ float: The strain at maximum compressive stress, absolute value, no
95
+ unit.
96
+ """
97
+ return min(0.7 * math.pow(abs(fcm), 0.31), 2.8) / 1000
98
+
99
+
100
+ def eps_cu1(fck: float) -> float:
101
+ """The ultimate strain for the Sargin constitutive law.
102
+
103
+ EN 1992-1-1:2004, Table 3.1.
104
+
105
+ Args:
106
+ fck (float): The characteristic compressive strength of concrete in
107
+ MPa.
108
+
109
+ Returns:
110
+ float: The ultimate strain, absolute value, no unit.
111
+ """
112
+ fck = abs(fck)
113
+ return (
114
+ 3.5 / 1000
115
+ if fck < 50
116
+ else (2.8 + 27 * ((98 - fcm(fck)) / 100) ** 4) / 1000
117
+ )
118
+
119
+
120
+ def k_sargin(
121
+ Ecm: float,
122
+ fcm: float,
123
+ eps_c1: float,
124
+ ) -> float:
125
+ """Computation of k parameter for Sargin constitutive Law.
126
+
127
+ EN 1992-1-1:2004, Eq. (3.14)
128
+
129
+ Args:
130
+ Ecm (float): the mean elastic modulus of concrete in MPa.
131
+ fcm (float): the mean compressive strength in MPa.
132
+ eps_c1 (float): the strain corresponding to peak stress.
133
+ """
134
+ return 1.05 * Ecm * abs(eps_c1) / fcm
135
+
136
+
137
+ def eps_c2(fck: float) -> float:
138
+ """The strain at maximum compressive stress of concrete for the
139
+ parabolic-rectangular law.
140
+
141
+ EN 1992-1-1:2004, Table 3.1.
142
+
143
+ Args:
144
+ fck (float): The characteristic compressive strength of concrete in
145
+ MPa.
146
+
147
+ Returns:
148
+ float: The strain at maximum compressive stress, absolute value, no
149
+ unit.
150
+ """
151
+ fck = abs(fck)
152
+ return (
153
+ 2.0 / 1000 if fck <= 50 else (2.0 + 0.085 * (fck - 50) ** 0.53) / 1000
154
+ )
155
+
156
+
157
+ def eps_cu2(fck: float) -> float:
158
+ """The ultimate strain of the parabolic-rectangular law.
159
+
160
+ EN 1992-1-1:2004, Table 3.1.
161
+
162
+ Args:
163
+ fck (float): The characteristic compressive strength of concrete in
164
+ MPa.
165
+
166
+ Returns:
167
+ float: The ultimate strain, absolute value, no unit.
168
+ """
169
+ fck = abs(fck)
170
+ return (
171
+ 3.5 / 1000
172
+ if fck <= 50
173
+ else (2.6 + 35 * ((90 - fck) / 100) ** 4) / 1000
174
+ )
175
+
176
+
177
+ def n_parabolic_rectangular(fck: float) -> float:
178
+ """The exponent in the parabolic-rectangular law.
179
+
180
+ EN 1992-1-1:2004, Table 3.1.
181
+
182
+ Args:
183
+ fck (float): The characteristic compressive strength of concrete in
184
+ MPa.
185
+
186
+ Returns:
187
+ float: The exponent n, absolute value, no unit.
188
+ """
189
+ fck = abs(fck)
190
+ return 2.0 if fck <= 50 else (1.4 + 23.4 * ((90 - fck) / 100) ** 4)
191
+
192
+
193
+ def eps_c3(fck: float) -> float:
194
+ """The strain at maximum compressive stress of the bi-linear law.
195
+
196
+ EN 1992-1-1:2004, Table 3.1.
197
+
198
+ Args:
199
+ fck (float): The characteristic compressive strength of concrete in
200
+ MPa.
201
+
202
+ Returns:
203
+ float: The strain at maximum compressive stress, absolute value, no
204
+ unit.
205
+ """
206
+ fck = abs(fck)
207
+ return 1.75 / 1000 if fck <= 50 else (1.75 + 0.55 * (fck - 50) / 40) / 1000
208
+
209
+
210
+ def eps_cu3(fck: float) -> float:
211
+ """The ultimate strain of the bi-linear law.
212
+
213
+ EN 1992-1-1:2004, Table 3.1.
214
+
215
+ Args:
216
+ fck (float): The characteristic compressive strength of concrete in
217
+ MPa.
218
+
219
+ Returns:
220
+ float: The ultimate strain, absolute value, no unit.
221
+ """
222
+ return eps_cu2(fck)
223
+
224
+
225
+ def fcd(fck: float, alpha_cc: float, gamma_c: float) -> float:
226
+ """The design compressive strength of concrete.
227
+
228
+ EN 1992-1-1:2004, Eq. (3.15)
229
+
230
+ Args:
231
+ fck (float): The characteristic compressive strength in MPa.
232
+ alpha_cc (float): A factor for considering long-term effects on the
233
+ strength, and effects that arise from the way the load is applied.
234
+ gamma_c (float): The partial factor of concrete.
235
+
236
+ Returns:
237
+ float: The design compressive strength of concrete in MPa
238
+ """
239
+ return abs(alpha_cc) * abs(fck) / abs(gamma_c)
@@ -0,0 +1,104 @@
1
+ """Material properties for reinforcement steel."""
2
+
3
+ import typing as t
4
+
5
+ DUCTILITY_CLASSES = {
6
+ 'A': {
7
+ 'epsuk': 2.5e-2,
8
+ 'k': 1.05,
9
+ },
10
+ 'B': {
11
+ 'epsuk': 5.0e-2,
12
+ 'k': 1.08,
13
+ },
14
+ 'C': {
15
+ 'epsuk': 7.5e-2,
16
+ 'k': 1.15,
17
+ },
18
+ }
19
+
20
+
21
+ def fyd(fyk: float, gamma_s: float) -> float:
22
+ """Calculate the design value of the reinforcement yield strength.
23
+
24
+ EUROCODE 2 1992-1-1:2004, Fig. 3.8
25
+
26
+ Args:
27
+ fyk (float): The characteristic yield strength in MPa.
28
+ gamma_s (float): The partial factor.
29
+
30
+ Returns:
31
+ float: The design yield strength in MPa.
32
+
33
+ Raises:
34
+ ValueError: if fyk is less than 0
35
+ ValueError: if gamma_s is less than 1
36
+ """
37
+ if fyk < 0:
38
+ raise ValueError(f'fyk={fyk} cannot be less than 0')
39
+ if gamma_s < 1:
40
+ raise ValueError(f'gamma_s={gamma_s} must be larger or equal to 1')
41
+ return fyk / gamma_s
42
+
43
+
44
+ def epsud(epsuk: float, gamma_eps: float = 0.9) -> float:
45
+ """Calculate the design value of the reinforcement ultimate strain.
46
+
47
+ EUROCDE 2 1992-1-1:2004, Fig 3.8
48
+
49
+ Args:
50
+ epsuk (float): The characteristic ultimate strain
51
+
52
+ Keyword Args:
53
+ gamma_eps (float): The partial factor specified in NA.
54
+ Default value 0.9.
55
+
56
+ Returns:
57
+ float: The design ultimate strain
58
+
59
+ Raises:
60
+ ValueError: if epsuk is less than 0
61
+ ValueError: if gamma_eps is greater than 1
62
+ """
63
+ if epsuk < 0:
64
+ raise ValueError(f'epsuk={epsuk} cannot be less than 0')
65
+ if gamma_eps > 1:
66
+ raise ValueError(
67
+ f'gamma_eps={gamma_eps} must be smaller or equal to 1'
68
+ )
69
+ return epsuk * gamma_eps
70
+
71
+
72
+ def reinforcement_duct_props(
73
+ fyk: float,
74
+ ductility_class: t.Literal['A', 'B', 'C'],
75
+ ) -> t.Dict[str, float]:
76
+ """Return a dict with the minimum characteristic ductility properties for
77
+ reinforcement ductility class.
78
+
79
+ EUROCODE 2 1992-1-1:2004, Tab. C.1
80
+
81
+ Args:
82
+ fyk (float): The characteristic yield strength.
83
+ ductility_class (Literal['A', 'B', 'C']): The reinforcement ductility
84
+ class designation.
85
+
86
+ Returns:
87
+ Dict[str, float]: A dict with the characteristik strain value at the
88
+ ultimate stress level (epsuk), and the characteristic ultimate stress
89
+ (ftk).
90
+
91
+ Raises:
92
+ ValueError: when the ductility_class does not define a valid ductility
93
+ class
94
+ """
95
+ duct_props = DUCTILITY_CLASSES.get(ductility_class.upper(), None)
96
+ if duct_props is None:
97
+ raise ValueError(
98
+ 'No properties were found for the provided ductility class '
99
+ f'({ductility_class}).'
100
+ )
101
+ return {
102
+ 'epsuk': duct_props['epsuk'],
103
+ 'ftk': duct_props['k'] * fyk,
104
+ }