Skip to content

Commit b6fe647

Browse files
committed
Added mesh plots as example
1 parent 2f4f5b6 commit b6fe647

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

examples/01-advanced/05_trapz_approximation.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
# Here we bring in the primative section shapes and also the more generic
2525
# Shapely `Polygon` object. We also use the nifty `tqdm` package to provide
2626
# a progress bar on computations.
27-
from tqdm import tqdm
2827
import numpy as np
2928
import matplotlib.pyplot as plt
3029
from shapely.geometry import Polygon
@@ -47,7 +46,7 @@ def get_section_j(geom, ms, plot_geom=False):
4746
if plot_geom:
4847
section.plot_mesh()
4948
section.calculate_geometric_properties()
50-
section.calculate_warping_properties(solver_type="cgs")
49+
section.calculate_warping_properties()
5150
return section.get_j()
5251

5352

@@ -56,8 +55,8 @@ def get_section_j(geom, ms, plot_geom=False):
5655
# =======================
5756
# The number of elements per unit area is an important input to the calculations
5857
# even though we are only examining ratios of the results. A nominal value of 100
59-
# is reasonable; but sovler errors occur sometimes, so use 110.
60-
n = 110 # mesh density
58+
# is reasonable.
59+
n = 100 # mesh density
6160

6261
#%%
6362
# Create and Analyze the Section
@@ -91,6 +90,14 @@ def do_section(b, S, d_mid=1, plot_geom=False):
9190
return jt, jr, d1, d2
9291

9392

93+
#%%
94+
# Example Section
95+
# ===============
96+
# The analysis for a particular section looks as follows:
97+
b, S = 4.0, 0.3
98+
jt, jr, d1, d2 = do_section(b, S, plot_geom=True)
99+
print(f"{b=}; {S=}; {jr=}; {jt=}; {jr/jt}")
100+
94101
#%%
95102
# Create Loop Variables
96103
# =====================
@@ -109,8 +116,8 @@ def do_section(b, S, d_mid=1, plot_geom=False):
109116
# We also use `tqdm` to provide progress bars.
110117
#
111118
# An optional deugging line is left in for development but commented out.
112-
for i, b in enumerate(tqdm(b_list)):
113-
for j, S in enumerate(tqdm(S_list, leave=False)):
119+
for i, b in enumerate(b_list):
120+
for j, S in enumerate(S_list):
114121
jt, jr, d1, d2 = do_section(b, S)
115122
j_trap[i][j] = jt
116123
j_rect[i][j] = jr

0 commit comments

Comments
 (0)