Skip to content

Commit 3ac060d

Browse files
Merge branch 'master' of github.com:robbievanleeuwen/section-properties
2 parents 658b28b + 4fbbd3b commit 3ac060d

File tree

7 files changed

+101
-12
lines changed

7 files changed

+101
-12
lines changed
75.6 KB
Loading
194 KB
Loading

docs/source/rst/advanced_geom.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ In creating this geometry consider the following:
262262

263263
To create the nested geometry using shapely, the code would be as follows::
264264

265-
mat1 = Material(name="Material 1", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, color="yellow")
266-
mat2 = Material(name="Material 2", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, color="orange")
267-
mat3 = Material(name="Material 3", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, color="red")
265+
mat1 = Material(name="Material 1", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, density=1e-6, color="yellow")
266+
mat2 = Material(name="Material 2", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, density=1e-6, color="orange")
267+
mat3 = Material(name="Material 3", elastic_modulus=100, poissons_ratio=0.3, yield_strength=10, density=1e-6, color="red")
268268

269269
sq1 = sections.rectangular_section(100, 100, material=mat1).align_center()
270270
sq2 = sections.rectangular_section(75, 75, material=mat2).align_center()

docs/source/rst/api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ circular_section
106106
""""""""""""""""
107107
.. autofunction:: sectionproperties.pre.library.primitive_sections.circular_section
108108

109+
circular_section_by_area
110+
""""""""""""""""""""""""
111+
.. autofunction:: sectionproperties.pre.library.primitive_sections.circular_section_by_area
112+
109113
elliptical_section
110114
""""""""""""""""""
111115
.. autofunction:: sectionproperties.pre.library.primitive_sections.elliptical_section

docs/source/rst/section_library.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Circular Section
2121
.. autofunction:: sectionproperties.pre.library.primitive_sections.circular_section
2222
:noindex:
2323

24+
Circular Section By Area
25+
------------------------
26+
.. autofunction:: sectionproperties.pre.library.primitive_sections.circular_section_by_area
27+
:noindex:
28+
2429
Elliptical Section
2530
------------------
2631
.. autofunction:: sectionproperties.pre.library.primitive_sections.elliptical_section

sectionproperties/pre/library/concrete_sections.py

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def concrete_rectangular_section(
1212
n_bar: int,
1313
n_circle: int,
1414
cover: float,
15+
area: float = None,
1516
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
1617
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
1718
) -> geometry.CompoundGeometry:
@@ -25,6 +26,9 @@ def concrete_rectangular_section(
2526
:param int n_bar: Number of steel reinforcing bars
2627
:param int n_circle: Number of points discretising the steel reinforcing bars
2728
: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
31+
circle discretision)
2832
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
2933
the concrete
3034
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
@@ -39,10 +43,12 @@ def concrete_rectangular_section(
3943
from sectionproperties.pre.pre import Material
4044
4145
concrete = Material(
42-
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32, color='lightgrey'
46+
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32,
47+
density=2.4e-6, color='lightgrey'
4348
)
4449
steel = Material(
45-
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500, color='grey'
50+
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500,
51+
density=7.85e-6, color='grey'
4652
)
4753
4854
geometry = concrete_rectangular_section(
@@ -72,7 +78,15 @@ def concrete_rectangular_section(
7278
spacing = (b - 2 * cover - dia) / (n_bar - 1)
7379

7480
for i in range(n_bar):
75-
bar = primitive_sections.circular_section(d=dia, n=n_circle, material=steel_mat)
81+
if area:
82+
bar = primitive_sections.circular_section_by_area(
83+
area=area, n=n_circle, material=steel_mat
84+
)
85+
else:
86+
bar = primitive_sections.circular_section(
87+
d=dia, n=n_circle, material=steel_mat
88+
)
89+
7690
geom += bar.shift_section(x_offset=x_i + spacing * i, y_offset=cover + dia / 2)
7791

7892
return geom
@@ -87,6 +101,7 @@ def concrete_tee_section(
87101
n_bar: int,
88102
n_circle: int,
89103
cover: float,
104+
area: float = None,
90105
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
91106
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
92107
) -> geometry.CompoundGeometry:
@@ -102,6 +117,9 @@ def concrete_tee_section(
102117
:param int n_bar: Number of steel reinforcing bars
103118
:param int n_circle: Number of points discretising the steel reinforcing bars
104119
: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
122+
circle discretision)
105123
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
106124
the concrete
107125
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
@@ -116,10 +134,12 @@ def concrete_tee_section(
116134
from sectionproperties.pre.pre import Material
117135
118136
concrete = Material(
119-
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32, color='lightgrey'
137+
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32,
138+
density=2.4e-6, color='lightgrey'
120139
)
121140
steel = Material(
122-
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500, color='grey'
141+
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500,
142+
density=7.85e-6, color='grey'
123143
)
124144
125145
geometry = concrete_tee_section(
@@ -152,7 +172,15 @@ def concrete_tee_section(
152172
spacing = (b - 2 * cover - dia) / (n_bar - 1)
153173

154174
for i in range(n_bar):
155-
bar = primitive_sections.circular_section(d=dia, n=n_circle, material=steel_mat)
175+
if area:
176+
bar = primitive_sections.circular_section_by_area(
177+
area=area, n=n_circle, material=steel_mat
178+
)
179+
else:
180+
bar = primitive_sections.circular_section(
181+
d=dia, n=n_circle, material=steel_mat
182+
)
183+
156184
geom += bar.shift_section(x_offset=x_i + spacing * i, y_offset=cover + dia / 2)
157185

158186
return geom
@@ -165,6 +193,7 @@ def concrete_circular_section(
165193
n_bar: int,
166194
n_circle: int,
167195
cover: float,
196+
area: float = None,
168197
conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
169198
steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
170199
) -> geometry.CompoundGeometry:
@@ -178,6 +207,9 @@ def concrete_circular_section(
178207
:param int n_bar: Number of steel reinforcing bars
179208
:param int n_circle: Number of points discretising the steel reinforcing bars
180209
: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
212+
circle discretision)
181213
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
182214
the concrete
183215
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
@@ -192,10 +224,12 @@ def concrete_circular_section(
192224
from sectionproperties.pre.pre import Material
193225
194226
concrete = Material(
195-
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32, color='lightgrey'
227+
name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32,
228+
density=2.4e-6, color='lightgrey'
196229
)
197230
steel = Material(
198-
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500, color='grey'
231+
name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500,
232+
density=7.85e-6, color='grey'
199233
)
200234
201235
geometry = concrete_circular_section(
@@ -225,7 +259,15 @@ def concrete_circular_section(
225259
d_theta = 2 * np.pi / n_bar
226260

227261
for i in range(n_bar):
228-
bar = primitive_sections.circular_section(d=dia, n=n_circle, material=steel_mat)
262+
if area:
263+
bar = primitive_sections.circular_section_by_area(
264+
area=area, n=n_circle, material=steel_mat
265+
)
266+
else:
267+
bar = primitive_sections.circular_section(
268+
d=dia, n=n_circle, material=steel_mat
269+
)
270+
229271
geom += bar.shift_section(
230272
x_offset=r * np.cos(i * d_theta), y_offset=r * np.sin(i * d_theta)
231273
)

sectionproperties/pre/library/primitive_sections.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,44 @@ def circular_section(
8888
return geometry.Geometry(circle, material)
8989

9090

91+
def circular_section_by_area(
92+
area: float, n: int, material: pre.Material = pre.DEFAULT_MATERIAL
93+
) -> geometry.Geometry:
94+
"""Constructs a solid circle centered at the origin *(0, 0)* defined by its *area*,
95+
using *n* points to construct the circle.
96+
97+
:param float area: Area of the circle
98+
:param int n: Number of points discretising the circle
99+
:param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry
100+
101+
The following example creates a circular geometry with an area of 200 with 32 points,
102+
and generates a mesh with a maximum triangular area of 5::
103+
104+
from sectionproperties.pre.library.primitive_sections import circular_section_by_area
105+
106+
geometry = circular_section_by_area(area=310, n=32)
107+
geometry.create_mesh(mesh_sizes=[5])
108+
109+
.. figure:: ../images/sections/circle_area_geometry.png
110+
:align: center
111+
:scale: 50 %
112+
113+
Circular section by area geometry.
114+
115+
.. figure:: ../images/sections/circle_area_mesh.png
116+
:align: center
117+
:scale: 50 %
118+
119+
Mesh generated from the above geometry.
120+
"""
121+
122+
s = 2 * np.sqrt(area / n) * np.sqrt(np.tan(np.pi / n))
123+
a = s / (2 * np.tan(np.pi / n))
124+
d = np.sqrt(a * a + (0.5 * s) * (0.5 * s)) * 2
125+
126+
return circular_section(d=d, n=n, material=material)
127+
128+
91129
def elliptical_section(
92130
d_y: float, d_x: float, n: int, material: pre.Material = pre.DEFAULT_MATERIAL
93131
) -> geometry.Geometry:

0 commit comments

Comments
 (0)