Test Example#

[1]:
from planestress.analysis import PlaneStress
from planestress.pre import AnalysisCase
from planestress.pre.boundary_condition import LineLoad, LineSupport
from planestress.pre.library import circle, rectangle, steel_material
[2]:
d = 300
b = 250
h_r = 25
t = 16
sig = 100
w = sig * t
[3]:
steel = steel_material(thickness=t)
rect = rectangle(0.5 * d, 0.5 * b, material=steel)
hole = circle(h_r, n=64)
geom = rect - hole
geom.plot_geometry()
../_images/examples_test_3_0.svg
[3]:
<Axes: title={'center': 'Geometry'}>
[4]:
lhs_support = LineSupport((0, h_r), (0, 0.5 * d), "x", 0.0)
bot_support = LineSupport((25, 0), (125, 0), "y", 0.0)
load = LineLoad((0, 0.5 * d), (0.5 * b, 0.5 * d), "y", w)
case = AnalysisCase([lhs_support, bot_support, load])
[5]:
geom.create_mesh(mesh_sizes=10, mesh_order=2)
geom.plot_mesh()
../_images/examples_test_5_0.svg
[5]:
<Axes: title={'center': 'Finite Element Mesh'}>
[6]:
ps = PlaneStress(geom, [case])
results_list = ps.solve()
res = results_list[0]
[7]:
res.plot_deformed_shape(200)
../_images/examples_test_7_0.svg
[7]:
<Axes: title={'center': 'Deformed Shape [ds = 200]'}>
[8]:
res.plot_displacement_contour("x", normalize=False, colormap="viridis")
res.plot_displacement_contour("y", normalize=False, colormap="viridis", contours=True)
res.plot_displacement_contour("xy", normalize=False, colormap="viridis")
../_images/examples_test_8_0.svg
../_images/examples_test_8_1.svg
../_images/examples_test_8_2.svg
[8]:
<Axes: title={'center': 'Displacement Contours [xy]'}>
[9]:
res.plot_stress("xx")
res.plot_stress(
    "yy", normalize=False, colormap="viridis", colorbar_format="{x:.2f}", num_levels=15
)
res.plot_stress("xy", contours=True)
../_images/examples_test_9_0.svg
../_images/examples_test_9_1.svg
../_images/examples_test_9_2.svg
[9]:
<Axes: title={'center': 'Stress Contour Plot - $\\sigma_{xy}$'}>
[10]:
res.plot_principal_stress_vectors(
    "11", colormap="Reds", alpha=0.05, colorbar_format="{x:.2f}"
)
res.plot_principal_stress_vectors(
    "22", colormap="Blues_r", alpha=0.05, colorbar_format="{x:.2f}"
)
res.plot_stress(
    "vm", normalize=False, colormap="viridis", alpha=0.05, colorbar_format="{x:.2f}"
)
../_images/examples_test_10_0.svg
../_images/examples_test_10_1.svg
../_images/examples_test_10_2.svg
[10]:
<Axes: title={'center': 'Stress Contour Plot - $\\sigma_{vM}$'}>