Note
Go to the end to download the full example code.
Non-homogeneous Deformations#
In this tutorial you’ll learn how to plot multiple force-displacement curves along with
views on deformed meshes in one single matplotlib figure. We start with a
Third-Order-Deformation
isotropic hyperelastic
material formulation. Hyperelastic
provides a
plot()
-method to preview force-stretch curves on
incompressible elementary deformations.
We’d like to generate force-displacement characteristic curves for the
non-homogeneous deformations uniaxial
and
planar
obtained by simulations using the finite element
method. Therefore, let’s define a meshed Cube
with 5
hexahedron
cells and a
region
.
mesh = fem.Cube(n=6)
region = fem.RegionHexahedron(mesh)
We need to initiate a matplotlib Figure
with multiple
subplots. The force-displacement curve is tracked and
plotted
during
evaluation
of a CharacteristicCurve
-job
for a uniaxial
compression/tension load case.
These force-displacement curves are also evaluated for
planar
(shear) tension and equi-
biaxial
tension. When we plot the planar and biaxial
force-displacement curves, the ax["right"]
-object already has x- and y-labels
defined and we only need to set the line labels accordingly. Finally, let’s add the
name and the parameters of the
Third-Order-Deformation
material formulation
to the title of the figure.
import matplotlib.pyplot as plt
fig, ax = plt.subplot_mosaic(
[["upper left", "right"], ["lower left", "right"]],
layout="constrained",
figsize=(6, 4),
gridspec_kw=dict(width_ratios=[1, 2]),
)
# uniaxial
field = fem.FieldContainer([fem.Field(region, dim=3)])
boundaries, loadcase = fem.dof.uniaxial(field, clamped=True)
solid = fem.SolidBodyNearlyIncompressible(umat, field, bulk=5000)
move = fem.math.linsteps([-0.1, 0, 0.9], num=[1, 9])
step = fem.Step(items=[solid], ramp={boundaries["move"]: move}, boundaries=boundaries)
job = fem.CharacteristicCurve(steps=[step], boundary=boundaries["move"]).evaluate()
ax["upper left"] = field.imshow(
"Principal Values of Logarithmic Strain", ax=ax["upper left"]
)
ax["upper left"].set_title("Uniaxial", fontdict=dict(fontsize="small"))
fig, ax["right"] = job.plot(
xlabel="Stretch $l/L$ in mm/mm $\longrightarrow$",
ylabel="Normal Force per Undeformed Area \n $N/A$ in N/mm$^2$ $\longrightarrow$",
label="Uniaxial",
ax=ax["right"],
)
# planar
field = fem.FieldContainer([fem.Field(region, dim=3)])
boundaries, loadcase = fem.dof.biaxial(field, moves=(0, 0), clampes=(True, False))
solid = fem.SolidBodyNearlyIncompressible(umat, field, bulk=5000)
step = fem.Step(
items=[solid], ramp={boundaries["move-right-0"]: move}, boundaries=boundaries
)
job = fem.CharacteristicCurve(
steps=[step], boundary=boundaries["move-right-0"]
).evaluate()
ax["lower left"] = field.imshow(
"Principal Values of Logarithmic Strain", ax=ax["lower left"]
)
ax["lower left"].set_title("Planar", fontdict=dict(fontsize="small"))
fig, ax["right"] = job.plot(ax=ax["right"], label="Planar")
title = " ".join([name.title() for name in umat.fun.__name__.split("_")])
fig.suptitle(title, weight="bold")
ax["right"].set_title(
", ".join([f"{key}={value}" for key, value in kwargs.items()]),
fontdict=dict(fontsize="small"),
)
ax["right"].legend()
ax["right"].grid()
/home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/latest/docs/tutorial/examples/extut04_elementary_deformations.py:23: SyntaxWarning: invalid escape sequence '\l'
material formulation. :class:`~felupe.Hyperelastic` provides a
/home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/latest/docs/tutorial/examples/extut04_elementary_deformations.py:24: SyntaxWarning: invalid escape sequence '\l'
:meth:`~felupe.Hyperelastic.plot`-method to preview force-stretch curves on
If the data of the force-displacement curves is needed for the calibration of the material parameters on given experimentally determined force-displacement curves, the data is available in the axes object of the plot.
Total running time of the script: (0 minutes 6.373 seconds)