Skip to content

Commit c2c2f23

Browse files
committed
Re-black
1 parent 77afad8 commit c2c2f23

File tree

4 files changed

+56
-56
lines changed

4 files changed

+56
-56
lines changed

sectionproperties/analysis/fea.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def shear_load_vectors(self, ixx, iyy, ixy, nu):
155155
Ny = np.dot(N, np.transpose(self.coords[1, :]))
156156

157157
# determine shear parameters
158-
r = Nx ** 2 - Ny ** 2
158+
r = Nx**2 - Ny**2
159159
q = 2 * Nx * Ny
160160
d1 = ixx * r - ixy * q
161161
d2 = ixy * r + ixx * q
@@ -225,19 +225,19 @@ def shear_warping_integrals(self, ixx, iyy, ixy, omega):
225225
sc_xint += (
226226
gp[0]
227227
* (iyy * Nx + ixy * Ny)
228-
* (Nx ** 2 + Ny ** 2)
228+
* (Nx**2 + Ny**2)
229229
* j
230230
* self.material.elastic_modulus
231231
)
232232
sc_yint += (
233233
gp[0]
234234
* (ixx * Ny + ixy * Nx)
235-
* (Nx ** 2 + Ny ** 2)
235+
* (Nx**2 + Ny**2)
236236
* j
237237
* self.material.elastic_modulus
238238
)
239239
q_omega += gp[0] * Nomega * j * self.material.elastic_modulus
240-
i_omega += gp[0] * Nomega ** 2 * j * self.material.elastic_modulus
240+
i_omega += gp[0] * Nomega**2 * j * self.material.elastic_modulus
241241
i_xomega += gp[0] * Nx * Nomega * j * self.material.elastic_modulus
242242
i_yomega += gp[0] * Ny * Nomega * j * self.material.elastic_modulus
243243

@@ -276,7 +276,7 @@ def shear_coefficients(self, ixx, iyy, ixy, psi_shear, phi_shear, nu):
276276
Ny = np.dot(N, np.transpose(self.coords[1, :]))
277277

278278
# determine shear parameters
279-
r = Nx ** 2 - Ny ** 2
279+
r = Nx**2 - Ny**2
280280
q = 2 * Nx * Ny
281281
d1 = ixx * r - ixy * q
282282
d2 = ixy * r + ixx * q
@@ -466,7 +466,7 @@ def element_stress(
466466
(Nx_11, Ny_22) = principal_coordinate(phi, Nx, Ny)
467467

468468
# determine shear parameters
469-
r = Nx ** 2 - Ny ** 2
469+
r = Nx**2 - Ny**2
470470
q = 2 * Nx * Ny
471471
d1 = ixx * r - ixy * q
472472
d2 = ixy * r + ixx * q
@@ -475,12 +475,12 @@ def element_stress(
475475

476476
# calculate element stresses
477477
sig_zz_mxx_gp[i, :] = self.material.elastic_modulus * (
478-
-(ixy * Mxx) / (ixx * iyy - ixy ** 2) * Nx
479-
+ (iyy * Mxx) / (ixx * iyy - ixy ** 2) * Ny
478+
-(ixy * Mxx) / (ixx * iyy - ixy**2) * Nx
479+
+ (iyy * Mxx) / (ixx * iyy - ixy**2) * Ny
480480
)
481481
sig_zz_myy_gp[i, :] = self.material.elastic_modulus * (
482-
-(ixx * Myy) / (ixx * iyy - ixy ** 2) * Nx
483-
+ (ixy * Myy) / (ixx * iyy - ixy ** 2) * Ny
482+
-(ixx * Myy) / (ixx * iyy - ixy**2) * Nx
483+
+ (ixy * Myy) / (ixx * iyy - ixy**2) * Ny
484484
)
485485
sig_zz_m11_gp[i, :] = self.material.elastic_modulus * M11 / i11 * Ny_22
486486
sig_zz_m22_gp[i, :] = self.material.elastic_modulus * -M22 / i22 * Nx_11

sectionproperties/analysis/section.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def shear_centres():
492492
* (1 + self.section_props.nu_eff)
493493
* (
494494
self.section_props.ixx_c * self.section_props.iyy_c
495-
- self.section_props.ixy_c ** 2
495+
- self.section_props.ixy_c**2
496496
)
497497
)
498498
x_se = (1 / Delta_s) * (
@@ -511,14 +511,14 @@ def shear_centres():
511511
- self.section_props.iyy_c * i_yomega
512512
) / (
513513
self.section_props.ixx_c * self.section_props.iyy_c
514-
- self.section_props.ixy_c ** 2
514+
- self.section_props.ixy_c**2
515515
)
516516
y_st = (
517517
self.section_props.ixx_c * i_xomega
518518
- self.section_props.ixy_c * i_yomega
519519
) / (
520520
self.section_props.ixx_c * self.section_props.iyy_c
521-
- self.section_props.ixy_c ** 2
521+
- self.section_props.ixy_c**2
522522
)
523523

524524
return (Delta_s, x_se, y_se, x11_se, y22_se, x_st, y_st)
@@ -543,7 +543,7 @@ def shear_centres():
543543
# calculate warping constant
544544
self.section_props.gamma = (
545545
i_omega
546-
- q_omega ** 2 / self.section_props.ea
546+
- q_omega**2 / self.section_props.ea
547547
- y_se * i_xomega
548548
+ x_se * i_yomega
549549
)
@@ -579,14 +579,14 @@ def assemble_shear_deformation():
579579
(kappa_x, kappa_y, kappa_xy) = assemble_shear_deformation()
580580

581581
# calculate shear areas wrt global axis
582-
self.section_props.A_sx = Delta_s ** 2 / kappa_x
583-
self.section_props.A_sy = Delta_s ** 2 / kappa_y
584-
self.section_props.A_sxy = Delta_s ** 2 / kappa_xy
582+
self.section_props.A_sx = Delta_s**2 / kappa_x
583+
self.section_props.A_sy = Delta_s**2 / kappa_y
584+
self.section_props.A_sxy = Delta_s**2 / kappa_xy
585585

586586
# calculate shear areas wrt principal bending axis:
587-
alpha_xx = kappa_x * self.section_props.area / Delta_s ** 2
588-
alpha_yy = kappa_y * self.section_props.area / Delta_s ** 2
589-
alpha_xy = kappa_xy * self.section_props.area / Delta_s ** 2
587+
alpha_xx = kappa_x * self.section_props.area / Delta_s**2
588+
alpha_yy = kappa_y * self.section_props.area / Delta_s**2
589+
alpha_xy = kappa_xy * self.section_props.area / Delta_s**2
590590

591591
# rotate the tensor by the principal axis angle
592592
phi_rad = self.section_props.phi * np.pi / 180
@@ -716,11 +716,11 @@ def calculate_frame():
716716
# calculate second moments of area about the centroidal xy axis
717717
self.section_props.ixx_c = (
718718
self.section_props.ixx_g
719-
- self.section_props.qx ** 2 / self.section_props.ea
719+
- self.section_props.qx**2 / self.section_props.ea
720720
)
721721
self.section_props.iyy_c = (
722722
self.section_props.iyy_g
723-
- self.section_props.qy ** 2 / self.section_props.ea
723+
- self.section_props.qy**2 / self.section_props.ea
724724
)
725725
self.section_props.ixy_c = (
726726
self.section_props.ixy_g
@@ -730,7 +730,7 @@ def calculate_frame():
730730
# calculate the principal axis angle
731731
Delta = (
732732
((self.section_props.ixx_c - self.section_props.iyy_c) / 2) ** 2
733-
+ self.section_props.ixy_c ** 2
733+
+ self.section_props.ixy_c**2
734734
) ** 0.5
735735

736736
i11_c = (self.section_props.ixx_c + self.section_props.iyy_c) / 2 + Delta
@@ -4248,7 +4248,7 @@ def plot_mohrs_circles(self, x, y, title=None, **kwargs):
42484248
tractions = []
42494249
for col in range(3):
42504250
ss = n_inv[:, col].T @ np.diag(s) @ n_inv[:, col]
4251-
ts = np.sqrt(np.linalg.norm(np.diag(s) @ n_inv[:, col]) ** 2 - ss ** 2)
4251+
ts = np.sqrt(np.linalg.norm(np.diag(s) @ n_inv[:, col]) ** 2 - ss**2)
42524252
tractions.append((ss, ts))
42534253

42544254
def plot_circle(ax, c, R, col, label=None, fill=None):
@@ -4470,23 +4470,23 @@ def calculate_combined_stresses(self):
44704470
self.sig_zz_m = (
44714471
self.sig_zz_mxx + self.sig_zz_myy + self.sig_zz_m11 + self.sig_zz_m22
44724472
)
4473-
self.sig_zxy_mzz = (self.sig_zx_mzz ** 2 + self.sig_zy_mzz ** 2) ** 0.5
4474-
self.sig_zxy_vx = (self.sig_zx_vx ** 2 + self.sig_zy_vx ** 2) ** 0.5
4475-
self.sig_zxy_vy = (self.sig_zx_vy ** 2 + self.sig_zy_vy ** 2) ** 0.5
4473+
self.sig_zxy_mzz = (self.sig_zx_mzz**2 + self.sig_zy_mzz**2) ** 0.5
4474+
self.sig_zxy_vx = (self.sig_zx_vx**2 + self.sig_zy_vx**2) ** 0.5
4475+
self.sig_zxy_vy = (self.sig_zx_vy**2 + self.sig_zy_vy**2) ** 0.5
44764476
self.sig_zx_v = self.sig_zx_vx + self.sig_zx_vy
44774477
self.sig_zy_v = self.sig_zy_vx + self.sig_zy_vy
4478-
self.sig_zxy_v = (self.sig_zx_v ** 2 + self.sig_zy_v ** 2) ** 0.5
4478+
self.sig_zxy_v = (self.sig_zx_v**2 + self.sig_zy_v**2) ** 0.5
44794479
self.sig_zz = self.sig_zz_n + self.sig_zz_m
44804480
self.sig_zx = self.sig_zx_mzz + self.sig_zx_v
44814481
self.sig_zy = self.sig_zy_mzz + self.sig_zy_v
4482-
self.sig_zxy = (self.sig_zx ** 2 + self.sig_zy ** 2) ** 0.5
4482+
self.sig_zxy = (self.sig_zx**2 + self.sig_zy**2) ** 0.5
44834483
self.sig_1 = self.sig_zz / 2 + np.sqrt(
4484-
(self.sig_zz / 2) ** 2 + self.sig_zxy ** 2
4484+
(self.sig_zz / 2) ** 2 + self.sig_zxy**2
44854485
)
44864486
self.sig_3 = self.sig_zz / 2 - np.sqrt(
4487-
(self.sig_zz / 2) ** 2 + self.sig_zxy ** 2
4487+
(self.sig_zz / 2) ** 2 + self.sig_zxy**2
44884488
)
4489-
self.sig_vm = (self.sig_zz ** 2 + 3 * self.sig_zxy ** 2) ** 0.5
4489+
self.sig_vm = (self.sig_zz**2 + 3 * self.sig_zxy**2) ** 0.5
44904490

44914491

44924492
@dataclass
@@ -4692,8 +4692,8 @@ def calculate_centroidal_properties(self, mesh):
46924692
"""
46934693

46944694
# calculate second moments of area about the centroidal xy axis
4695-
self.ixx_c = self.ixx_g - self.qx ** 2 / self.ea
4696-
self.iyy_c = self.iyy_g - self.qy ** 2 / self.ea
4695+
self.ixx_c = self.ixx_g - self.qx**2 / self.ea
4696+
self.iyy_c = self.iyy_g - self.qy**2 / self.ea
46974697
self.ixy_c = self.ixy_g - self.qx * self.qy / self.ea
46984698

46994699
# calculate section moduli about the centroidal xy axis
@@ -4712,7 +4712,7 @@ def calculate_centroidal_properties(self, mesh):
47124712
self.ry_c = (self.iyy_c / self.ea) ** 0.5
47134713

47144714
# calculate principal 2nd moments of area about the centroidal xy axis
4715-
Delta = (((self.ixx_c - self.iyy_c) / 2) ** 2 + self.ixy_c ** 2) ** 0.5
4715+
Delta = (((self.ixx_c - self.iyy_c) / 2) ** 2 + self.ixy_c**2) ** 0.5
47164716
self.i11_c = (self.ixx_c + self.iyy_c) / 2 + Delta
47174717
self.i22_c = (self.ixx_c + self.iyy_c) / 2 - Delta
47184718

sectionproperties/pre/library/bridge_sections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def super_t_girder_section(
111111

112112
# Origin is middle at level of bottom of top flange
113113
# Some geometrics of the slope
114-
web_hyp = np.sqrt(1 + web_slope ** 2)
114+
web_hyp = np.sqrt(1 + web_slope**2)
115115
web_horiz = t_w * web_slope / web_hyp
116116
x_fillet = w_nom / 2 - d_fillet * 1 / web_hyp
117117

sectionproperties/tests/test_rectangle.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,72 +30,72 @@ def test_rectangular_section_geometric():
3030
check.almost_equal(rectangle_section.section_props.qx, 100 * 50 * 50, rel=tol)
3131
check.almost_equal(rectangle_section.section_props.qy, 100 * 50 * 25, rel=tol)
3232
check.almost_equal(
33-
rectangle_section.section_props.ixx_g, 50 * 100 ** 3 / 3, rel=tol
33+
rectangle_section.section_props.ixx_g, 50 * 100**3 / 3, rel=tol
3434
)
3535
check.almost_equal(
36-
rectangle_section.section_props.iyy_g, 100 * 50 ** 3 / 3, rel=tol
36+
rectangle_section.section_props.iyy_g, 100 * 50**3 / 3, rel=tol
3737
)
3838
check.almost_equal(
3939
rectangle_section.section_props.ixy_g, 100 * 50 * 50 * 25, rel=tol
4040
)
4141
check.almost_equal(rectangle_section.section_props.cx, 50 / 2, rel=tol)
4242
check.almost_equal(rectangle_section.section_props.cy, 100 / 2, rel=tol)
4343
check.almost_equal(
44-
rectangle_section.section_props.ixx_c, 50 * 100 ** 3 / 12, rel=tol
44+
rectangle_section.section_props.ixx_c, 50 * 100**3 / 12, rel=tol
4545
)
4646
check.almost_equal(
47-
rectangle_section.section_props.iyy_c, 100 * 50 ** 3 / 12, rel=tol
47+
rectangle_section.section_props.iyy_c, 100 * 50**3 / 12, rel=tol
4848
)
4949
check.almost_equal(rectangle_section.section_props.ixy_c, 0, abs=tol)
5050
check.almost_equal(
51-
rectangle_section.section_props.zxx_plus, 50 * 100 ** 2 / 6, rel=tol
51+
rectangle_section.section_props.zxx_plus, 50 * 100**2 / 6, rel=tol
5252
)
5353
check.almost_equal(
54-
rectangle_section.section_props.zxx_minus, 50 * 100 ** 2 / 6, rel=tol
54+
rectangle_section.section_props.zxx_minus, 50 * 100**2 / 6, rel=tol
5555
)
5656
check.almost_equal(
57-
rectangle_section.section_props.zyy_plus, 100 * 50 ** 2 / 6, rel=tol
57+
rectangle_section.section_props.zyy_plus, 100 * 50**2 / 6, rel=tol
5858
)
5959
check.almost_equal(
60-
rectangle_section.section_props.zyy_minus, 100 * 50 ** 2 / 6, rel=tol
60+
rectangle_section.section_props.zyy_minus, 100 * 50**2 / 6, rel=tol
6161
)
6262
check.almost_equal(
6363
rectangle_section.section_props.rx_c,
64-
(50 * 100 ** 3 / 12 / 100 / 50) ** 0.5,
64+
(50 * 100**3 / 12 / 100 / 50) ** 0.5,
6565
rel=tol,
6666
)
6767
check.almost_equal(
6868
rectangle_section.section_props.ry_c,
69-
(100 * 50 ** 3 / 12 / 100 / 50) ** 0.5,
69+
(100 * 50**3 / 12 / 100 / 50) ** 0.5,
7070
rel=tol,
7171
)
7272
check.almost_equal(
73-
rectangle_section.section_props.i11_c, (50 * 100 ** 3 / 12), rel=tol
73+
rectangle_section.section_props.i11_c, (50 * 100**3 / 12), rel=tol
7474
)
7575
check.almost_equal(
76-
rectangle_section.section_props.i22_c, (100 * 50 ** 3 / 12), rel=tol
76+
rectangle_section.section_props.i22_c, (100 * 50**3 / 12), rel=tol
7777
)
7878
check.almost_equal(rectangle_section.section_props.phi, 0, rel=tol)
7979
check.almost_equal(
80-
rectangle_section.section_props.z11_plus, 50 * 100 ** 2 / 6, rel=tol
80+
rectangle_section.section_props.z11_plus, 50 * 100**2 / 6, rel=tol
8181
)
8282
check.almost_equal(
83-
rectangle_section.section_props.z11_minus, 50 * 100 ** 2 / 6, rel=tol
83+
rectangle_section.section_props.z11_minus, 50 * 100**2 / 6, rel=tol
8484
)
8585
check.almost_equal(
86-
rectangle_section.section_props.z22_plus, 100 * 50 ** 2 / 6, rel=tol
86+
rectangle_section.section_props.z22_plus, 100 * 50**2 / 6, rel=tol
8787
)
8888
check.almost_equal(
89-
rectangle_section.section_props.z22_minus, 100 * 50 ** 2 / 6, rel=tol
89+
rectangle_section.section_props.z22_minus, 100 * 50**2 / 6, rel=tol
9090
)
9191
check.almost_equal(
9292
rectangle_section.section_props.r11_c,
93-
(50 * 100 ** 3 / 12 / 100 / 50) ** 0.5,
93+
(50 * 100**3 / 12 / 100 / 50) ** 0.5,
9494
rel=tol,
9595
)
9696
check.almost_equal(
9797
rectangle_section.section_props.r22_c,
98-
(100 * 50 ** 3 / 12 / 100 / 50) ** 0.5,
98+
(100 * 50**3 / 12 / 100 / 50) ** 0.5,
9999
rel=tol,
100100
)
101101

@@ -104,10 +104,10 @@ def test_rectangular_section_plastic():
104104
check.almost_equal(rectangle_section.get_pc(), (50 / 2, 100 / 2))
105105
check.almost_equal(rectangle_section.get_pc_p(), (50 / 2, 100 / 2))
106106
check.almost_equal(
107-
rectangle_section.get_s(), (50 * 100 ** 2 / 4, 100 * 50 ** 2 / 4)
107+
rectangle_section.get_s(), (50 * 100**2 / 4, 100 * 50**2 / 4)
108108
)
109109
check.almost_equal(
110-
rectangle_section.get_sp(), (50 * 100 ** 2 / 4, 100 * 50 ** 2 / 4)
110+
rectangle_section.get_sp(), (50 * 100**2 / 4, 100 * 50**2 / 4)
111111
)
112112
check.almost_equal(rectangle_section.get_sf(), (1.5, 1.5, 1.5, 1.5))
113113
check.almost_equal(rectangle_section.get_sf_p(), (1.5, 1.5, 1.5, 1.5))

0 commit comments

Comments
 (0)