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.

import felupe as fem

strain_energy_function = fem.third_order_deformation
kwargs = dict(C10=0.5, C01=0.1, C11=0.0, C20=-0.1, C30=0.02)

umat = fem.Hyperelastic(strain_energy_function, **kwargs)
ax = umat.plot(incompressible=True)
Hyperelastic (Third Order Deformation), C10=0.5, C01=0.1, C11=0, C20=-0.1, C30=0.02

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()
extut04 elementary deformationsextut04 elementary deformationsThird Order Deformation, Uniaxial, C10=0.5, C01=0.1, C11=0.0, C20=-0.1, C30=0.02, Planar
/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.

data = [(line.get_xdata(), line.get_ydata()) for line in ax["right"].lines]

Total running time of the script: (0 minutes 6.373 seconds)

Gallery generated by Sphinx-Gallery