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,164 @@
1
+ """Covers torsion in Model code 2010, 7.3.4."""
2
+
3
+ from math import cos, pi, sin, tan
4
+
5
+ from ._concrete_shear import epsilon_x, eta_fc, v_rd_max
6
+
7
+
8
+ def v_ed_ti(t_ed: float, a_k: float, z_i: float):
9
+ """Shear force due to torsion.
10
+
11
+ fib Model Code 2010, eq. (7.3-53).
12
+
13
+ Args:
14
+ t_ed: The acting torsion force in the cross section in Nmm.
15
+ z_i: Can be found in figure 7.3-18.
16
+ a_k: Can be found in figure 7.3-18.
17
+
18
+ Returns:
19
+ float: The shear force that will occur due to torsion moment.
20
+ """
21
+ return t_ed * z_i / (2 * a_k)
22
+
23
+
24
+ def t_rd_max(
25
+ f_ck: float,
26
+ d_k: float,
27
+ a_k: float,
28
+ theta: float,
29
+ approx_lvl: int,
30
+ z: float,
31
+ E_s: float,
32
+ As: float,
33
+ loads: dict,
34
+ gamma_c: float = 1.5,
35
+ ) -> float:
36
+ """The maximum allowed torsion.
37
+
38
+ fib Model Code 2010, eq. (7.3-56).
39
+
40
+ Args:
41
+ f_ck (float): Characteristic strength in MPa.
42
+ gamma_c (float): Concrete safety factor.
43
+ d_k (float): Is the diameter in the smallest circel in the cross
44
+ section.
45
+ a_k: Can be found in figure 7.3-18.
46
+ theta (float): inclination of the compression stressfield in degrees.
47
+ approx_lvl (int): Approximation method for concrete with reinforcement.
48
+ z (float): distances between the centerline of the compressive chord
49
+ and the reinforcement in mm.
50
+ E_s (float): The E_modulus to the material in MPa.
51
+ As (float): The cross-section reinforcement in mm^2.
52
+ loads (dict): The given loads in a dictionary. See create_load_dict.
53
+ gamma_c (float): Concrete safety factor.
54
+
55
+ Returns:
56
+ float: The maximum allowed torsion.
57
+ """
58
+ t_ef = d_k / 8
59
+
60
+ if approx_lvl == 1:
61
+ k_epsilon = 0.55
62
+
63
+ elif approx_lvl == 2:
64
+ epsilonx = epsilon_x(E_s, As, z, loads)
65
+ epsilon_1 = epsilonx + (epsilonx + 0.002) * (
66
+ (1 / tan(theta * pi / 180)) ** 2
67
+ )
68
+ k_epsilon = min(1 / (1.2 + 55 * epsilon_1), 0.65)
69
+
70
+ elif approx_lvl == 3:
71
+ epsilonx = epsilon_x(E_s, As, z, loads)
72
+ theta_min = 20 + 10000 * epsilonx
73
+ epsilon_1 = epsilonx + (epsilonx + 0.002) * (
74
+ (1 / tan(theta_min * pi / 180)) ** 2
75
+ )
76
+ k_epsilon = min(1 / (1.2 + 55 * epsilon_1), 0.65)
77
+
78
+ k_c = eta_fc(f_ck) * k_epsilon
79
+ return (
80
+ k_c
81
+ * f_ck
82
+ * t_ef
83
+ * 2
84
+ * a_k
85
+ * sin(theta * pi / 180)
86
+ * cos(theta * pi / 180)
87
+ / gamma_c
88
+ )
89
+
90
+
91
+ def t_rd( # pylint: disable=r0801
92
+ t_ed: float,
93
+ approx_lvl: int,
94
+ fck: float,
95
+ bw: float,
96
+ theta: float,
97
+ z: float,
98
+ E_s: float,
99
+ As: float,
100
+ loads: dict,
101
+ d_k: float,
102
+ a_k: float,
103
+ alpha: float = 90.0,
104
+ gamma_c: float = 1.5,
105
+ ) -> bool:
106
+ """Checks if the combination of torsion and shear is ok.
107
+
108
+ fib Model Code 2010, eq. (7.3-56).
109
+
110
+ Args:
111
+ t_ed (float): The torsion working on the material in Nmm.
112
+ approx_lvl (int): Approximation level chosen for shear resistance.
113
+ fck (float): Characteristic strength in MPa.
114
+ bw: (float): Thickness of web in cross section.
115
+ theta (float): inclination of the compression stressfield in degrees.
116
+ z: (float): The length to the areasenter of cross-section in mm.
117
+ E_s: (float): The E_modulus to the material in MPa.
118
+ As: (float): The cross-section area in mm^2.
119
+ loads (dict): The given loads in a dictionary. See create_load_dict.
120
+ d_k (float): Is the diameter in the smallest circel in the cross
121
+ section.
122
+ a_k (float): Can be found in figure 7.3-18.
123
+ alpha (float): Inclination of the stirrups in degrees.
124
+ gamma_c (float): Concrete safety factor.
125
+
126
+ Returns:
127
+ bool: Returns a bool that is true if the criterion for torsion and
128
+ shear is fulfilled.
129
+ """
130
+ return bool(
131
+ (
132
+ t_ed
133
+ / t_rd_max(
134
+ fck,
135
+ d_k,
136
+ a_k,
137
+ theta,
138
+ approx_lvl,
139
+ z,
140
+ E_s,
141
+ As,
142
+ loads,
143
+ gamma_c,
144
+ )
145
+ )
146
+ ** 2
147
+ + (
148
+ loads.get('Ved')
149
+ / v_rd_max(
150
+ approx_lvl,
151
+ fck,
152
+ bw,
153
+ theta,
154
+ z,
155
+ E_s,
156
+ As,
157
+ loads,
158
+ alpha,
159
+ gamma_c,
160
+ )
161
+ )
162
+ ** 2
163
+ <= 1
164
+ )
@@ -0,0 +1,105 @@
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
+ 'D': {
19
+ 'epsuk': 8.0e-2,
20
+ 'k': 1.25,
21
+ },
22
+ }
23
+
24
+
25
+ def fyd(fyk: float, gamma_s: float = 1.15) -> float:
26
+ """Calculate the design value of the reinforcement yield strength.
27
+
28
+ fib Model Code 2010, Sec. 4.5.2.2.3.
29
+
30
+ Args:
31
+ fyk (float): The characteristic yield strength in MPa.
32
+ gamma_s (float): The partial factor. Default value 1.15.
33
+
34
+ Returns:
35
+ float: The design yield strength in MPa.
36
+
37
+ Raises:
38
+ ValueError: If fyk is less than 0.
39
+ ValueError: If gamma_s is less than 1.
40
+ """
41
+ if fyk < 0:
42
+ raise ValueError(f'fyk={fyk} cannot be less than 0')
43
+ if gamma_s < 1:
44
+ raise ValueError(f'gamma_s={gamma_s} must be larger or equal to 1')
45
+ return fyk / gamma_s
46
+
47
+
48
+ def epsud(epsuk: float, gamma_eps: float = 0.9) -> float:
49
+ """Calculate the design value of the reinforcement ultimate strain.
50
+
51
+ fib Model Code 2010, Sec. 7.2.3.2.
52
+
53
+ Args:
54
+ epsuk (float): The characteristic ultimate strain.
55
+ gamma_eps (float): The partial factor. Default value 0.9.
56
+
57
+ Returns:
58
+ float: The design ultimate strain.
59
+
60
+ Raises:
61
+ ValueError: If epsuk is less than 0.
62
+ ValueError: If gamma_eps is greater than 1.
63
+ """
64
+ if epsuk < 0:
65
+ raise ValueError(f'epsuk={epsuk} cannot be less than 0')
66
+ if gamma_eps > 1:
67
+ raise ValueError(
68
+ f'gamma_eps={gamma_eps} must be smaller or equal to 1'
69
+ )
70
+ return epsuk * gamma_eps
71
+
72
+
73
+ def reinforcement_duct_props(
74
+ fyk: float,
75
+ ductility_class: t.Literal['A', 'B', 'C', 'D'],
76
+ ) -> t.Dict[str, float]:
77
+ """Return a dict with the minimum characteristic ductility properties for
78
+ reinforcement ductility class.
79
+
80
+ fib Model Code 2010, Sec. 5.2.5.4.
81
+
82
+ Args:
83
+ fyk (float): The characteristic yield strength.
84
+ ductility_class (Literal['A', 'B', 'C', 'D']): The reinforcement
85
+ ductility class designation.
86
+
87
+ Returns:
88
+ Dict[str, float]: A dict with the characteristik strain value at the
89
+ ultimate stress level (epsuk), and the characteristic ultimate stress
90
+ (ftk).
91
+
92
+ Raises:
93
+ ValueError: When the ductility_class does not define a valid ductility
94
+ class.
95
+ """
96
+ duct_props = DUCTILITY_CLASSES.get(ductility_class.upper(), None)
97
+ if duct_props is None:
98
+ raise ValueError(
99
+ 'No properties were found for the provided ductility class '
100
+ f'({ductility_class}).'
101
+ )
102
+ return {
103
+ 'epsuk': duct_props['epsuk'],
104
+ 'ftk': duct_props['k'] * fyk,
105
+ }
@@ -0,0 +1 @@
1
+ """Core functionality shared between other modules."""
@@ -0,0 +1,211 @@
1
+ """Results."""
2
+
3
+ from __future__ import annotations # To have clean hints of ArrayLike in docs
4
+
5
+ from dataclasses import dataclass, field, fields
6
+
7
+ from numpy.typing import ArrayLike
8
+
9
+
10
+ @dataclass
11
+ class GrossProperties:
12
+ """Simple dataclass for storing gross section properties."""
13
+
14
+ # section areas
15
+ area: float = field(default=0, metadata={'description': 'Total area'})
16
+ area_reinforcement: float = field(
17
+ default=0, metadata={'description': 'Reinforcement area'}
18
+ )
19
+
20
+ # axial rigidity
21
+ ea: float = field(
22
+ default=0, metadata={'description': 'Axial rigidity (E * A)'}
23
+ )
24
+ # ea = {'value': 0, 'description': 'Axial rigidity (E_A)'}
25
+
26
+ # section mass
27
+ mass: float = field(
28
+ default=0, metadata={'description': 'Mass per unit length'}
29
+ )
30
+
31
+ # section perimeter
32
+ perimeter: float = field(default=0, metadata={'description': 'Perimeter'})
33
+
34
+ # first moments of area
35
+ # global axes of section
36
+ sy: float = field(
37
+ default=0, metadata={'description': 'First moment of area (Sy)'}
38
+ )
39
+ sz: float = field(
40
+ default=0, metadata={'description': 'Second moment of area (Sz)'}
41
+ )
42
+
43
+ # first moments of area * E
44
+ # global axes of section
45
+ e_sy: float = field(default=0, metadata={'description': 'E * Sy'})
46
+ e_sz: float = field(default=0, metadata={'description': 'E * Sz'})
47
+
48
+ # centroids
49
+ cy: float = field(
50
+ default=0, metadata={'description': 'Centroid y Coordinate'}
51
+ )
52
+ cz: float = field(
53
+ default=0, metadata={'description': 'Centroid z Coordinate'}
54
+ )
55
+
56
+ # second moments of area
57
+ # global axes of section
58
+ iyy: float = field(
59
+ default=0, metadata={'description': 'Second moment (Iyy)'}
60
+ )
61
+ izz: float = field(
62
+ default=0, metadata={'description': 'Second moment (Izz)'}
63
+ )
64
+ iyz: float = field(
65
+ default=0, metadata={'description': 'Product moment (Iyz)'}
66
+ )
67
+ # centroidal axes of section
68
+ iyy_c: float = field(
69
+ default=0, metadata={'description': 'Centroidal Second moment (Iyy_c)'}
70
+ )
71
+ izz_c: float = field(
72
+ default=0, metadata={'description': 'Centroidal Second moment (Izz_c)'}
73
+ )
74
+ iyz_c: float = field(
75
+ default=0,
76
+ metadata={'description': 'Centroidal Product moment (Iyz_c)'},
77
+ )
78
+ # principal axes of section
79
+ i11: float = field(
80
+ default=0, metadata={'description': 'Principal Second Moment (I11)'}
81
+ )
82
+ i22: float = field(
83
+ default=0, metadata={'description': 'Principal Second Moment (I22)'}
84
+ )
85
+ theta: float = field(
86
+ default=0, metadata={'description': 'Principal axis angle (theta)'}
87
+ )
88
+
89
+ # section flexural rigidity
90
+ # global axes of section
91
+ e_iyy: float = field(default=0, metadata={'description': 'E * Iyy'})
92
+ e_izz: float = field(default=0, metadata={'description': 'E * Izz'})
93
+ e_iyz: float = field(default=0, metadata={'description': 'E * Iyz'})
94
+ # centroidal axes of section
95
+ e_iyy_c: float = field(default=0, metadata={'description': 'E * Iyy_c'})
96
+ e_izz_c: float = field(default=0, metadata={'description': 'E * Izz_c'})
97
+ e_iyz_c: float = field(default=0, metadata={'description': 'E * Iyz_c'})
98
+ # principal axes of section
99
+ e_i11: float = field(default=0, metadata={'description': 'E * I11'})
100
+ e_i22: float = field(default=0, metadata={'description': 'E * I22'})
101
+ e_theta: float = field(
102
+ default=0, metadata={'description': 'Principal axis angle (theta)'}
103
+ )
104
+
105
+ def __format__(self, spec: str) -> str:
106
+ """Defines the format for returning the string representation.
107
+
108
+ Arguments:
109
+ spec (str): The string specifying the format.
110
+ """
111
+ output_string = 'Gross Concrete Section Properties:\n'
112
+ for f in fields(self):
113
+ value = getattr(self, f.name)
114
+ description = f.metadata.get(
115
+ 'description', 'No description available'
116
+ )
117
+ output_string += f'{description}: {value:{spec}}\n'
118
+
119
+ # etc. all other characteristics
120
+ return output_string
121
+
122
+ def __str__(self) -> str:
123
+ """Returns the informal string representation of the gross concrete
124
+ section properties.
125
+ """
126
+ return f'{self}'
127
+
128
+
129
+ @dataclass
130
+ class CrackedProperties:
131
+ """Simple dataclass for storing cracked section properties."""
132
+
133
+ # second moments of area
134
+ i_yy: float = 0
135
+ i_zz: float = 0
136
+ i_yz: float = 0
137
+
138
+ # section cracked flexural rigidity
139
+ ei_yy: float = 0
140
+ ei_zz: float = 0
141
+
142
+
143
+ @dataclass
144
+ class MomentCurvatureResults:
145
+ """Class for storing moment curvature results.
146
+
147
+ The analysis will be done in general for a given inclination of n.a.
148
+ """
149
+
150
+ theta: float = 0 # the inclination of n.a.
151
+ n: float = 0 # axial load - mantained constant during analysis
152
+ chi_y: ArrayLike = None # the curvatures
153
+ chi_z: ArrayLike = None # the curvatures
154
+ eps_axial: ArrayLike = 0 # the axial strain (at section 0,0)
155
+ m_y: ArrayLike = None # the moment
156
+ m_z: ArrayLike = None # the moment
157
+
158
+ # The strains can be reconstructed at each step from chi and eps_axial
159
+ # The stresses can be recomputed if needed on the fly? Or storing them?
160
+
161
+
162
+ @dataclass
163
+ class UltimateBendingMomentResults:
164
+ """Class for storing the ultimate bending moment computation for a given
165
+ inclination of n.a. and axial load.
166
+ """
167
+
168
+ theta: float = 0 # the inclination of n.a.
169
+ n: float = 0 # axial load - mantained constant during analysis
170
+ m_y: float = 0 # the ultimate moment for given theta and n
171
+ m_z: float = 0 # the ultimate moment for given theta and n
172
+ chi_y: float = 0 # the curvature corresponding to the ultimate moment
173
+ chi_z: float = 0 # the curvature corresponding to the ultimate moment
174
+ eps_a: float = 0 # the axial strain at 0,0 corresponding to Mult
175
+
176
+
177
+ @dataclass
178
+ class NMMInteractionDomain:
179
+ """Class for storing the NMM interaction domain results."""
180
+
181
+ num_theta: int = 0 # number of discretizations along the angle
182
+ num_axial: int = 0 # number of discretizations along axial load axis
183
+
184
+ strains: ArrayLike = None # array with shape (n,3) containing strains
185
+ forces: ArrayLike = None # array with shape(n,3) containing N, My, Mz
186
+
187
+
188
+ @dataclass
189
+ class NMInteractionDomain:
190
+ """Class for storing the NM interaction domain results."""
191
+
192
+ theta: float = 0 # the inclination of n.a.
193
+ num_axial: float = 0 # number of discretizations along axial load axis
194
+
195
+ n: ArrayLike = None # Axial loads
196
+ m_y: ArrayLike = None # Moments My
197
+ m_z: ArrayLike = None # Moments Mz
198
+
199
+ strains: ArrayLike = None
200
+
201
+
202
+ @dataclass
203
+ class MMInteractionDomain:
204
+ """Class for storing the MM interaction domain results."""
205
+
206
+ num_theta: float = 0 # number of discretizations along the angle
207
+ n: float = 0 # axial load
208
+
209
+ theta: ArrayLike = None # Angle theta respect axis Y
210
+ m_y: ArrayLike = None # Moments My
211
+ m_z: ArrayLike = None # Moments Mz