Skip to content

Commit 3270e6b

Browse files
Merge pull request #202 from robbievanleeuwen/new_conc_sections
Update concrete section definitions
2 parents ce0b45d + 3800536 commit 3270e6b

File tree

2 files changed

+293
-71
lines changed

2 files changed

+293
-71
lines changed

sectionproperties/pre/library/concrete_sections.py

Lines changed: 156 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,46 @@
88
def concrete_rectangular_section(
99
b: float,
1010
d: float,
11-
dia: float,
12-
n_bar: int,
11+
dia_top: float,
12+
n_top: int,
13+
dia_bot: float,
14+
n_bot: int,
1315
n_circle: int,
1416
cover: float,
15-
area: float = None,
17+
area_top: float = None,
18+
area_bot: float = None,
1619
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
1720
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
1821
) -> geometry.CompoundGeometry:
19-
"""Constructs a concrete rectangular section of width *b* and depth *d*, with *n_bar* steel bars
20-
of diameter *dia*, discretised with *n_circle* points with equal side and bottom *cover* to the
21-
steel.
22+
"""Constructs a concrete rectangular section of width *b* and depth *d*, with
23+
*n_top* top steel bars of diameter *dia_top*, *n_bot* bottom steel bars of diameter
24+
*dia_bot*, discretised with *n_circle* points with equal side and top/bottom
25+
*cover* to the steel.
2226
2327
:param float b: Concrete section width
2428
:param float d: Concrete section depth
25-
:param float dia: Diameter of the steel reinforcing bars
26-
:param int n_bar: Number of steel reinforcing bars
29+
:param float dia_top: Diameter of the top steel reinforcing bars
30+
:param int n_top: Number of top steel reinforcing bars
31+
:param float dia_bot: Diameter of the bottom steel reinforcing bars
32+
:param int n_bot: Number of bottom steel reinforcing bars
2733
:param int n_circle: Number of points discretising the steel reinforcing bars
2834
:param float cover: Side and bottom cover to the steel reinforcing bars
29-
:param float area: If provided, constructs reinforcing bars based on their area
30-
rather than a diameter (prevents the underestimation of steel area due to
35+
:param float area_top: If provided, constructs top reinforcing bars based on their
36+
area rather than diameter (prevents the underestimation of steel area due to
3137
circle discretisation)
32-
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
33-
the concrete
34-
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
35-
the steel
38+
:param float area_bot: If provided, constructs bottom reinforcing bars based on
39+
their area rather than diameter (prevents the underestimation of steel area due
40+
to circle discretisation)
41+
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to
42+
associate with the concrete
43+
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to
44+
associate with the steel
3645
37-
:raises ValueErorr: If the number of bars is not greater than or equal to 2
46+
:raises ValueErorr: If the number of bars is not greater than or equal to 2 in an
47+
active layer
3848
39-
The following example creates a 600D x 300W concrete beam with 3N20 steel reinforcing bars and
40-
30 mm cover::
49+
The following example creates a 600D x 300W concrete beam with 3N20 bottom steel
50+
reinforcing bars and 30 mm cover::
4151
4252
from sectionproperties.pre.library.concrete_sections import concrete_rectangular_section
4353
from sectionproperties.pre.pre import Material
@@ -52,7 +62,8 @@ def concrete_rectangular_section(
5262
)
5363
5464
geometry = concrete_rectangular_section(
55-
b=300, d=600, dia=20, n_bar=3, n_circle=24, cover=30, conc_mat=concrete, steel_mat=steel
65+
b=300, d=600, dia_top=20, n_top=0, dia_bot=20, n_bot=3, n_circle=24, cover=30,
66+
conc_mat=concrete, steel_mat=steel
5667
)
5768
geometry.create_mesh(mesh_sizes=[500])
5869
@@ -69,25 +80,51 @@ def concrete_rectangular_section(
6980
Mesh generated from the above geometry.
7081
"""
7182

72-
if n_bar < 2:
73-
raise ValueError("Please provide 2 or more steel reinforcing bars.")
83+
if n_top == 1 or n_bot == 1:
84+
raise ValueError("If adding a reinforcing layer, provide 2 or more bars.")
7485

86+
# create rectangular concrete geometry
7587
geom = primitive_sections.rectangular_section(b=b, d=d, material=conc_mat)
7688

77-
x_i = cover + dia / 2
78-
spacing = (b - 2 * cover - dia) / (n_bar - 1)
89+
# calculate reinforcing bar dimensions
90+
x_i_top = cover + dia_top / 2
91+
x_i_bot = cover + dia_bot / 2
92+
spacing_top = (b - 2 * cover - dia_top) / (n_top - 1)
93+
spacing_bot = (b - 2 * cover - dia_bot) / (n_bot - 1)
7994

80-
for i in range(n_bar):
81-
if area:
95+
# add top bars
96+
for i in range(n_top):
97+
if area_top:
8298
bar = primitive_sections.circular_section_by_area(
83-
area=area, n=n_circle, material=steel_mat
99+
area=area_top, n=n_circle, material=steel_mat
84100
)
85101
else:
86102
bar = primitive_sections.circular_section(
87-
d=dia, n=n_circle, material=steel_mat
103+
d=dia_top, n=n_circle, material=steel_mat
104+
)
105+
106+
bar = bar.shift_section(
107+
x_offset=x_i_top + spacing_top * i, y_offset=d - cover - dia_top / 2
108+
)
109+
110+
geom = (geom - bar) + bar
111+
112+
# add bot bars
113+
for i in range(n_bot):
114+
if area_bot:
115+
bar = primitive_sections.circular_section_by_area(
116+
area=area_bot, n=n_circle, material=steel_mat
117+
)
118+
else:
119+
bar = primitive_sections.circular_section(
120+
d=dia_bot, n=n_circle, material=steel_mat
88121
)
89122

90-
geom += bar.shift_section(x_offset=x_i + spacing * i, y_offset=cover + dia / 2)
123+
bar = bar.shift_section(
124+
x_offset=x_i_bot + spacing_bot * i, y_offset=cover + dia_bot / 2
125+
)
126+
127+
geom = (geom - bar) + bar
91128

92129
return geom
93130

@@ -97,38 +134,48 @@ def concrete_tee_section(
97134
d: float,
98135
b_f: float,
99136
d_f: float,
100-
dia: float,
101-
n_bar: int,
137+
dia_top: float,
138+
n_top: int,
139+
dia_bot: float,
140+
n_bot: int,
102141
n_circle: int,
103142
cover: float,
104-
area: float = None,
143+
area_top: float = None,
144+
area_bot: float = None,
105145
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
106146
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
107147
) -> geometry.CompoundGeometry:
108-
"""Constructs a concrete tee section of width *b*, depth *d*, flange width *b_f* and flange
109-
depth *d_f* with *n_bar* steel bars of diameter *dia*, discretised with *n_circle* points with
110-
equal side and bottom *cover* to the steel.
148+
"""Constructs a concrete tee section of width *b*, depth *d*, flange width *b_f*
149+
and flange depth *d_f*, with *n_top* top steel bars of diameter *dia_top*, *n_bot*
150+
bottom steel bars of diameter *dia_bot*, discretised with *n_circle* points with
151+
equal side and top/bottom *cover* to the steel.
111152
112153
:param float b: Concrete section width
113154
:param float d: Concrete section depth
114155
:param float b_f: Concrete section flange width
115156
:param float d_f: Concrete section flange depth
116-
:param float dia: Diameter of the steel reinforcing bars
117-
:param int n_bar: Number of steel reinforcing bars
157+
:param float dia_top: Diameter of the top steel reinforcing bars
158+
:param int n_top: Number of top steel reinforcing bars
159+
:param float dia_bot: Diameter of the bottom steel reinforcing bars
160+
:param int n_bot: Number of bottom steel reinforcing bars
118161
:param int n_circle: Number of points discretising the steel reinforcing bars
119162
:param float cover: Side and bottom cover to the steel reinforcing bars
120-
:param float area: If provided, constructs reinforcing bars based on their area
121-
rather than a diameter (prevents the underestimation of steel area due to
163+
:param float area_top: If provided, constructs top reinforcing bars based on their
164+
area rather than diameter (prevents the underestimation of steel area due to
122165
circle discretisation)
123-
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
124-
the concrete
125-
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
126-
the steel
166+
:param float area_bot: If provided, constructs bottom reinforcing bars based on
167+
their area rather than diameter (prevents the underestimation of steel area due
168+
to circle discretisation)
169+
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate
170+
with the concrete
171+
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to
172+
associate with the steel
127173
128-
:raises ValueErorr: If the number of bars is not greater than or equal to 2
174+
:raises ValueErorr: If the number of bars is not greater than or equal to 2 in an
175+
active layer
129176
130-
The following example creates a 900D x 450W concrete beam with a 1200W x 250D flange, with 5N24
131-
steel reinforcing bars and 30 mm cover::
177+
The following example creates a 900D x 450W concrete beam with a 1200W x 250D
178+
flange, with 5N24 steel reinforcing bars and 30 mm cover::
132179
133180
from sectionproperties.pre.library.concrete_sections import concrete_tee_section
134181
from sectionproperties.pre.pre import Material
@@ -143,8 +190,8 @@ def concrete_tee_section(
143190
)
144191
145192
geometry = concrete_tee_section(
146-
b=450, d=900, b_f=1200, d_f=250, dia=24, n_bar=5, n_circle=24, cover=30,
147-
conc_mat=concrete, steel_mat=steel
193+
b=450, d=900, b_f=1200, d_f=250, dia_top=24, n_top=0, dia_bot=24, n_bot=5,
194+
n_circle=24, cover=30, conc_mat=concrete, steel_mat=steel
148195
)
149196
geometry.create_mesh(mesh_sizes=[500])
150197
@@ -161,27 +208,53 @@ def concrete_tee_section(
161208
Mesh generated from the above geometry.
162209
"""
163210

164-
if n_bar < 2:
165-
raise ValueError("Please provide 2 or more steel reinforcing bars.")
211+
if n_top == 1 or n_bot == 1:
212+
raise ValueError("If adding a reinforcing layer, provide 2 or more bars.")
166213

214+
# generate tee-section
167215
geom = primitive_sections.rectangular_section(b=b, d=d - d_f, material=conc_mat)
168216
flange = primitive_sections.rectangular_section(b=b_f, d=d_f, material=conc_mat)
169217
geom += flange.align_center(align_to=geom).align_to(other=geom, on="top")
170218

171-
x_i = cover + dia / 2
172-
spacing = (b - 2 * cover - dia) / (n_bar - 1)
219+
# calculate reinforcing bar dimensions
220+
x_i_top = cover + dia_top / 2 + 0.5 * (b - b_f)
221+
x_i_bot = cover + dia_bot / 2
222+
spacing_top = (b_f - 2 * cover - dia_top) / (n_top - 1)
223+
spacing_bot = (b - 2 * cover - dia_bot) / (n_bot - 1)
173224

174-
for i in range(n_bar):
175-
if area:
225+
# add top bars
226+
for i in range(n_top):
227+
if area_top:
176228
bar = primitive_sections.circular_section_by_area(
177-
area=area, n=n_circle, material=steel_mat
229+
area=area_top, n=n_circle, material=steel_mat
178230
)
179231
else:
180232
bar = primitive_sections.circular_section(
181-
d=dia, n=n_circle, material=steel_mat
233+
d=dia_top, n=n_circle, material=steel_mat
234+
)
235+
236+
bar = bar.shift_section(
237+
x_offset=x_i_top + spacing_top * i, y_offset=d - cover - dia_top / 2
238+
)
239+
240+
geom = (geom - bar) + bar
241+
242+
# add bot bars
243+
for i in range(n_bot):
244+
if area_bot:
245+
bar = primitive_sections.circular_section_by_area(
246+
area=area_bot, n=n_circle, material=steel_mat
182247
)
248+
else:
249+
bar = primitive_sections.circular_section(
250+
d=dia_bot, n=n_circle, material=steel_mat
251+
)
252+
253+
bar = bar.shift_section(
254+
x_offset=x_i_bot + spacing_bot * i, y_offset=cover + dia_bot / 2
255+
)
183256

184-
geom += bar.shift_section(x_offset=x_i + spacing * i, y_offset=cover + dia / 2)
257+
geom = (geom - bar) + bar
185258

186259
return geom
187260

@@ -193,32 +266,35 @@ def concrete_circular_section(
193266
n_bar: int,
194267
n_circle: int,
195268
cover: float,
196-
area: float = None,
269+
area_conc: float = None,
270+
area_bar: float = None,
197271
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
198272
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
199273
) -> geometry.CompoundGeometry:
200-
"""Constructs a concrete circular section of diameter *d* discretised with *n* points, with
201-
*n_bar* steel bars of diameter *dia*, discretised with *n_circle* points with equal side and
202-
bottom *cover* to the steel.
274+
"""Constructs a concrete circular section of diameter *d* discretised with *n*
275+
points, with *n_bar* steel bars of diameter *dia*, discretised with *n_circle*
276+
points with equal side and bottom *cover* to the steel.
203277
204278
:param float d: Concrete diameter
205279
:param float n: Number of points discretising the concrete section
206280
:param float dia: Diameter of the steel reinforcing bars
207281
:param int n_bar: Number of steel reinforcing bars
208282
:param int n_circle: Number of points discretising the steel reinforcing bars
209283
:param float cover: Side and bottom cover to the steel reinforcing bars
210-
:param float area: If provided, constructs reinforcing bars based on their area
211-
rather than a diameter (prevents the underestimation of steel area due to
284+
:param float area_conc: If provided, constructs the concrete based on its area
285+
rather than diameter (prevents the underestimation of concrete area due to
212286
circle discretisation)
213-
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
214-
the concrete
215-
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
216-
the steel
287+
:param float area_bar: If provided, constructs reinforcing bars based on their area
288+
rather than diameter (prevents the underestimation of steel area due to
289+
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate
290+
with the concrete
291+
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to
292+
associate with the steel
217293
218294
:raises ValueErorr: If the number of bars is not greater than or equal to 2
219295
220-
The following example creates a 450DIA concrete column with with 6N20 steel reinforcing bars
221-
and 45 mm cover::
296+
The following example creates a 450DIA concrete column with with 6N20 steel
297+
reinforcing bars and 45 mm cover::
222298
223299
from sectionproperties.pre.library.concrete_sections import concrete_circular_section
224300
from sectionproperties.pre.pre import Material
@@ -253,23 +329,32 @@ def concrete_circular_section(
253329
if n_bar < 2:
254330
raise ValueError("Please provide 2 or more steel reinforcing bars.")
255331

256-
geom = primitive_sections.circular_section(d=d, n=n, material=conc_mat)
332+
# create circular geometry
333+
if area_conc:
334+
geom = primitive_sections.circular_section_by_area(
335+
area=area_conc, n=n, material=conc_mat
336+
)
337+
else:
338+
geom = primitive_sections.circular_section(d=d, n=n, material=conc_mat)
257339

340+
# calculate bar geometry
258341
r = d / 2 - cover - dia / 2
259342
d_theta = 2 * np.pi / n_bar
260343

261344
for i in range(n_bar):
262-
if area:
345+
if area_bar:
263346
bar = primitive_sections.circular_section_by_area(
264-
area=area, n=n_circle, material=steel_mat
347+
area=area_bar, n=n_circle, material=steel_mat
265348
)
266349
else:
267350
bar = primitive_sections.circular_section(
268351
d=dia, n=n_circle, material=steel_mat
269352
)
270353

271-
geom += bar.shift_section(
354+
bar = bar.shift_section(
272355
x_offset=r * np.cos(i * d_theta), y_offset=r * np.sin(i * d_theta)
273356
)
274357

358+
geom = (geom - bar) + bar
359+
275360
return geom

0 commit comments

Comments
 (0)