Skip to content

Commit acc3660

Browse files
Update plastic centroid algorithm to search over entire section depth and remove pc_region
1 parent 9ee1886 commit acc3660

File tree

10 files changed

+135
-159
lines changed

10 files changed

+135
-159
lines changed
-686 Bytes
Binary file not shown.
-2.98 KB
Binary file not shown.
-7.63 KB
Binary file not shown.

docs/build/html/_modules/sectionproperties/analysis/cross_section.html

Lines changed: 83 additions & 87 deletions
Large diffs are not rendered by default.

docs/build/html/_modules/sectionproperties/pre/pre.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h1>Source code for sectionproperties.pre.pre</h1><div class="highlight"><pre>
158158
<span class="kn">import</span> <span class="nn">meshpy.triangle</span> <span class="k">as</span> <span class="nn">triangle</span>
159159

160160

161-
<div class="viewcode-block" id="Material"><a class="viewcode-back" href="../../../rst/api.html#sectionproperties.pre.pre.Material">[docs]</a><span class="k">class</span> <span class="nc">Material</span><span class="p">:</span>
161+
<div class="viewcode-block" id="Material"><a class="viewcode-back" href="../../../rst/geom_mesh.html#sectionproperties.pre.pre.Material">[docs]</a><span class="k">class</span> <span class="nc">Material</span><span class="p">:</span>
162162
<span class="sd">&quot;&quot;&quot;Class for structural materials.</span>
163163

164164
<span class="sd"> Provides a way of storing material properties related to a specific</span>

docs/build/html/_modules/sectionproperties/pre/sections.html

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

docs/build/html/rst/analysis.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ <h2>Plastic Analysis<a class="headerlink" href="#plastic-analysis" title="Permal
403403
</div>
404404
<dl class="method">
405405
<dt>
406-
<code class="descclassname">CrossSection.</code><code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>pc_region=[0.95, 0.95, 0.95, 0.95], time_info=False, verbose=False, debug=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#CrossSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a></dt>
406+
<code class="descclassname">CrossSection.</code><code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>time_info=False</em>, <em>verbose=False</em>, <em>debug=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#CrossSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a></dt>
407407
<dd><p>Calculates the plastic properties of the cross-section and stores
408408
the, in the
409409
<a class="reference internal" href="api.html#sectionproperties.analysis.cross_section.SectionProperties" title="sectionproperties.analysis.cross_section.SectionProperties"><code class="xref py py-class docutils literal notranslate"><span class="pre">SectionProperties</span></code></a>
@@ -413,12 +413,6 @@ <h2>Plastic Analysis<a class="headerlink" href="#plastic-analysis" title="Permal
413413
<col class="field-body" />
414414
<tbody valign="top">
415415
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
416-
<li><strong>pc_region</strong> (<em>list</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) – Region of cross-section in which to search for the
417-
plastic centroids. The value represents the fraction of the depth
418-
to search within perpendicular to the axis being considered
419-
[x-axis, y-axis, 11-axis, 22-axis]. Ensure 0 &lt; pc_region[i] &lt; 1.
420-
The default scheme searches 95% of the section depth (ie. centroid
421-
<span class="math notranslate nohighlight">\(\pm\)</span> 47.5%)</li>
422416
<li><strong>time_info</strong> (<em>bool</em>) – If set to True, a detailed description of the
423417
computation and the time cost is printed to the terminal.</li>
424418
<li><strong>verbose</strong> (<em>bool</em>) – If set to True, the number of iterations required

docs/build/html/rst/api.html

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ <h4>CrossSection Class<a class="headerlink" href="#crosssection-class" title="Pe
17281728

17291729
<dl class="method">
17301730
<dt id="sectionproperties.analysis.cross_section.CrossSection.calculate_plastic_properties">
1731-
<code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>pc_region=[0.95, 0.95, 0.95, 0.95], time_info=False, verbose=False, debug=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#CrossSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.CrossSection.calculate_plastic_properties" title="Permalink to this definition"></a></dt>
1731+
<code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>time_info=False</em>, <em>verbose=False</em>, <em>debug=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#CrossSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.CrossSection.calculate_plastic_properties" title="Permalink to this definition"></a></dt>
17321732
<dd><p>Calculates the plastic properties of the cross-section and stores
17331733
the, in the
17341734
<a class="reference internal" href="#sectionproperties.analysis.cross_section.SectionProperties" title="sectionproperties.analysis.cross_section.SectionProperties"><code class="xref py py-class docutils literal notranslate"><span class="pre">SectionProperties</span></code></a>
@@ -1738,12 +1738,6 @@ <h4>CrossSection Class<a class="headerlink" href="#crosssection-class" title="Pe
17381738
<col class="field-body" />
17391739
<tbody valign="top">
17401740
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1741-
<li><strong>pc_region</strong> (<em>list</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) – Region of cross-section in which to search for the
1742-
plastic centroids. The value represents the fraction of the depth
1743-
to search within perpendicular to the axis being considered
1744-
[x-axis, y-axis, 11-axis, 22-axis]. Ensure 0 &lt; pc_region[i] &lt; 1.
1745-
The default scheme searches 95% of the section depth (ie. centroid
1746-
<span class="math notranslate nohighlight">\(\pm\)</span> 47.5%)</li>
17471741
<li><strong>time_info</strong> (<em>bool</em>) – If set to True, a detailed description of the
17481742
computation and the time cost is printed to the terminal.</li>
17491743
<li><strong>verbose</strong> (<em>bool</em>) – If set to True, the number of iterations required
@@ -2724,7 +2718,7 @@ <h4>PlasticSection Class<a class="headerlink" href="#plasticsection-class" title
27242718

27252719
<dl class="method">
27262720
<dt id="sectionproperties.analysis.cross_section.PlasticSection.calculate_plastic_properties">
2727-
<code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>cross_section</em>, <em>pc_region</em>, <em>verbose</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#PlasticSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.PlasticSection.calculate_plastic_properties" title="Permalink to this definition"></a></dt>
2721+
<code class="descname">calculate_plastic_properties</code><span class="sig-paren">(</span><em>cross_section</em>, <em>verbose</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#PlasticSection.calculate_plastic_properties"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.PlasticSection.calculate_plastic_properties" title="Permalink to this definition"></a></dt>
27282722
<dd><p>Calculates the location of the plastic centroid with respect to the
27292723
centroidal and principal bending axes, the plastic section moduli and
27302724
shape factors and stores the results to the supplied
@@ -2736,8 +2730,6 @@ <h4>PlasticSection Class<a class="headerlink" href="#plasticsection-class" title
27362730
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
27372731
<li><strong>cross_section</strong> (<a class="reference internal" href="#sectionproperties.analysis.cross_section.CrossSection" title="sectionproperties.analysis.cross_section.CrossSection"><code class="xref py py-class docutils literal notranslate"><span class="pre">CrossSection</span></code></a>) – Cross section object that uses the same geometry
27382732
and materials specified in the class constructor</li>
2739-
<li><strong>pc_region</strong> (<em>list</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) – Region of cross-section in which to search for the
2740-
plastic centroids.</li>
27412733
<li><strong>verbose</strong> (<em>bool</em>) – If set to True, the number of iterations required
27422734
for each plastic axis is printed to the terminal.</li>
27432735
</ul>
@@ -2843,10 +2835,10 @@ <h4>PlasticSection Class<a class="headerlink" href="#plasticsection-class" title
28432835

28442836
<dl class="method">
28452837
<dt id="sectionproperties.analysis.cross_section.PlasticSection.pc_algorithm">
2846-
<code class="descname">pc_algorithm</code><span class="sig-paren">(</span><em>u</em>, <em>dlim</em>, <em>axis</em>, <em>pc_region</em>, <em>verbose</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#PlasticSection.pc_algorithm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.PlasticSection.pc_algorithm" title="Permalink to this definition"></a></dt>
2838+
<code class="descname">pc_algorithm</code><span class="sig-paren">(</span><em>u</em>, <em>dlim</em>, <em>axis</em>, <em>verbose</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/sectionproperties/analysis/cross_section.html#PlasticSection.pc_algorithm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sectionproperties.analysis.cross_section.PlasticSection.pc_algorithm" title="Permalink to this definition"></a></dt>
28472839
<dd><p>An algorithm used for solving for the location of the plastic
28482840
centroid. The algorithm searches for the location of the axis, defined
2849-
by unit vector <em>u</em> and within limits <em>pc_region</em>, that satisfies force
2841+
by unit vector <em>u</em> and within the section depth, that satisfies force
28502842
equilibrium.</p>
28512843
<table class="docutils field-list" frame="void" rules="none">
28522844
<col class="field-name" />
@@ -2858,8 +2850,6 @@ <h4>PlasticSection Class<a class="headerlink" href="#plasticsection-class" title
28582850
centroid to the extreme fibres perpendicular to the axis</li>
28592851
<li><strong>axis</strong> (<em>int</em>) – The current axis direction: 1 (e.g. x or 11) or
28602852
2 (e.g. y or 22)</li>
2861-
<li><strong>pc_region</strong> (<em>list</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) – Region of cross-section in which to search for the
2862-
plastic centroids.</li>
28632853
<li><strong>verbose</strong> (<em>bool</em>) – If set to True, the number of iterations required
28642854
for each plastic axis is printed to the terminal.</li>
28652855
</ul>

docs/build/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sectionproperties/analysis/cross_section.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -694,21 +694,13 @@ def calculate_frame():
694694
self.section_props.iyy_c, self.section_props.ixy_c,
695695
self.section_props.j, self.section_props.phi)
696696

697-
def calculate_plastic_properties(self, pc_region=[0.95, 0.95, 0.95, 0.95],
698-
time_info=False,
699-
verbose=False, debug=False):
697+
def calculate_plastic_properties(self, time_info=False, verbose=False,
698+
debug=False):
700699
"""Calculates the plastic properties of the cross-section and stores
701700
the, in the
702701
:class:`~sectionproperties.analysis.cross_section.SectionProperties`
703702
object contained in the ``section_props`` class variable.
704703
705-
:param pc_region: Region of cross-section in which to search for the
706-
plastic centroids. The value represents the fraction of the depth
707-
to search within perpendicular to the axis being considered
708-
[x-axis, y-axis, 11-axis, 22-axis]. Ensure 0 < pc_region[i] < 1.
709-
The default scheme searches 95% of the section depth (ie. centroid
710-
:math:`\pm` 47.5%)
711-
:type pc_region: list[float, float, float, float]
712704
:param bool time_info: If set to True, a detailed description of the
713705
computation and the time cost is printed to the terminal.
714706
:param bool verbose: If set to True, the number of iterations required
@@ -750,11 +742,11 @@ def calc_plastic():
750742

751743
# calculate plastic properties
752744
try:
753-
plastic_section.calculate_plastic_properties(
754-
self, pc_region, verbose)
745+
plastic_section.calculate_plastic_properties(self, verbose)
755746
except ValueError:
756747
str = "Plastic section properties calculation failed. "
757-
str += "Consider increasing pc_region bounds."
748+
str += "Contact robbie.vanleeuwen@gmail.com "
749+
str += "with your analysis parameters."
758750
raise RuntimeError(str)
759751

760752
if time_info:
@@ -1815,7 +1807,7 @@ def calculate_centroid(self, elements):
18151807

18161808
return (qy / ea, qx / ea)
18171809

1818-
def calculate_plastic_properties(self, cross_section, pc_region, verbose):
1810+
def calculate_plastic_properties(self, cross_section, verbose):
18191811
"""Calculates the location of the plastic centroid with respect to the
18201812
centroidal and principal bending axes, the plastic section moduli and
18211813
shape factors and stores the results to the supplied
@@ -1825,9 +1817,6 @@ def calculate_plastic_properties(self, cross_section, pc_region, verbose):
18251817
and materials specified in the class constructor
18261818
:type cross_section:
18271819
:class:`~sectionproperties.analysis.cross_section.CrossSection`
1828-
:param pc_region: Region of cross-section in which to search for the
1829-
plastic centroids.
1830-
:type pc_region: list[float, float, float, float]
18311820
:param bool verbose: If set to True, the number of iterations required
18321821
for each plastic axis is printed to the terminal.
18331822
"""
@@ -1838,7 +1827,7 @@ def calculate_plastic_properties(self, cross_section, pc_region, verbose):
18381827

18391828
# 1a) Calculate x-axis plastic centroid
18401829
(y_pc, r, f, c_top, c_bot) = self.pc_algorithm(
1841-
np.array([1, 0]), fibres[2:], 1, pc_region[1], verbose)
1830+
np.array([1, 0]), fibres[2:], 1, verbose)
18421831

18431832
self.check_convergence(r, 'x-axis')
18441833
cross_section.section_props.y_pc = y_pc
@@ -1849,7 +1838,7 @@ def calculate_plastic_properties(self, cross_section, pc_region, verbose):
18491838

18501839
# 1b) Calculate y-axis plastic centroid
18511840
(x_pc, r, f, c_top, c_bot) = self.pc_algorithm(
1852-
np.array([0, 1]), fibres[0:2], 2, pc_region[0], verbose)
1841+
np.array([0, 1]), fibres[0:2], 2, verbose)
18531842

18541843
self.check_convergence(r, 'y-axis')
18551844
cross_section.section_props.x_pc = x_pc
@@ -1872,7 +1861,7 @@ def calculate_plastic_properties(self, cross_section, pc_region, verbose):
18721861

18731862
# 2a) Calculate 11-axis plastic centroid
18741863
(y22_pc, r, f, c_top, c_bot) = self.pc_algorithm(
1875-
ux, fibres[2:], 1, pc_region[3], verbose)
1864+
ux, fibres[2:], 1, verbose)
18761865

18771866
# calculate the centroids in the principal coordinate system
18781867
c_top_p = fea.principal_coordinate(
@@ -1889,7 +1878,7 @@ def calculate_plastic_properties(self, cross_section, pc_region, verbose):
18891878

18901879
# 2b) Calculate 22-axis plastic centroid
18911880
(x11_pc, r, f, c_top, c_bot) = self.pc_algorithm(
1892-
uy, fibres[0:2], 2, pc_region[2], verbose)
1881+
uy, fibres[0:2], 2, verbose)
18931882

18941883
# calculate the centroids in the principal coordinate system
18951884
c_top_p = fea.principal_coordinate(
@@ -2036,10 +2025,10 @@ def evaluate_force_eq(self, d, u, u_p, verbose):
20362025
# return the force norm
20372026
return f_norm
20382027

2039-
def pc_algorithm(self, u, dlim, axis, pc_region, verbose):
2028+
def pc_algorithm(self, u, dlim, axis, verbose):
20402029
"""An algorithm used for solving for the location of the plastic
20412030
centroid. The algorithm searches for the location of the axis, defined
2042-
by unit vector *u* and within limits *pc_region*, that satisfies force
2031+
by unit vector *u* and within the section depth, that satisfies force
20432032
equilibrium.
20442033
20452034
:param u: Unit vector defining the direction of the axis
@@ -2049,9 +2038,6 @@ def pc_algorithm(self, u, dlim, axis, pc_region, verbose):
20492038
:type dlim: list[float, float]
20502039
:param int axis: The current axis direction: 1 (e.g. x or 11) or
20512040
2 (e.g. y or 22)
2052-
:param pc_region: Region of cross-section in which to search for the
2053-
plastic centroids.
2054-
:type pc_region: list[float, float, float, float]
20552041
:param bool verbose: If set to True, the number of iterations required
20562042
for each plastic axis is printed to the terminal.
20572043
:return: The distance to the plastic centroid axis *d*, the result
@@ -2062,17 +2048,14 @@ def pc_algorithm(self, u, dlim, axis, pc_region, verbose):
20622048
list[float, float], list[float, float])
20632049
"""
20642050

2065-
D = dlim[1] - dlim[0] # depth of the section perpendicular to the axis
2066-
20672051
# calculate vector perpendicular to u
20682052
if axis == 1:
20692053
u_p = np.array([-u[1], u[0]])
20702054
else:
20712055
u_p = np.array([u[1], -u[0]])
20722056

2073-
x = (1 - pc_region) / 2
2074-
a = dlim[0] + x * D
2075-
b = dlim[1] - x * D
2057+
a = dlim[0]
2058+
b = dlim[1]
20762059

20772060
(d, r) = brentq(self.evaluate_force_eq, a, b, args=(u, u_p, verbose),
20782061
full_output=True, disp=False, xtol=1e-6, rtol=1e-6)
@@ -2117,6 +2100,14 @@ def calculate_plastic_force(self, elements, u, p):
21172100
qx_bot += qx_el
21182101
qy_bot += qy_el
21192102

2103+
# if there are no elements in the top/bottom prevent division by zero
2104+
# N.B. the algorithm will never converge at this point, this is purely
2105+
# done to ensure a 100% search range
2106+
if ea_top == 0:
2107+
ea_top = 1
2108+
if ea_bot == 0:
2109+
ea_bot = 1
2110+
21202111
# calculate the centroid of the top and bottom segments and save
21212112
self.c_top = [qy_top / ea_top, qx_top / ea_top]
21222113
self.c_bot = [qy_bot / ea_bot, qx_bot / ea_bot]
@@ -2220,6 +2211,11 @@ def add_line(self, geometry, line):
22202211
int_pts.append(new_pt)
22212212
fct_idx.append(idx)
22222213

2214+
# if less than 2 intersection points are found, we are at the edge of
2215+
# the section, therefore no line to add
2216+
if len(int_pts) < 2:
2217+
return
2218+
22232219
# sort intersection points and facet list first by x, then by y
22242220
int_pts = np.array(int_pts)
22252221
idx_sort = np.lexsort((int_pts[:, 0], int_pts[:, 1]))

0 commit comments

Comments
 (0)