Inflation of a hyperelastic balloon#

This example requires external packages.

pip install contique

With the help of contique it is possible to apply a numerical parameter continuation algorithm on any system of equilibrium equations. This advanced tutorial demonstrates the usage of FElupe in conjunction with contique. The unstable inflation of a rectangular hyperelastic balloon demonstrates this powerful approach. The deformed model and the pressure - displacement curve is plotted.

../_images/ex04_balloon_sketch.png

First, setup a problem in FElupe as usual (mesh, region, field, boundaries, umat, solid and a pressure boundary). For the material definition we use the Neo-Hooke built-in hyperelastic material formulation, see Eq. (1).

(1)#\[\psi = \frac{\mu}{2} \left( \text{tr}(\boldsymbol{C}) - \ln(\det(\boldsymbol{C})) \right)\]
import contique
import numpy as np

import felupe as fem

mesh = fem.Rectangle(b=(1, 25), n=(2, 6))
region = fem.RegionQuad(mesh)
field = fem.FieldContainer([fem.FieldAxisymmetric(region, dim=2)])
bounds = {"fix-y": fem.Boundary(field[0], fy=mesh.y.max(), mode="or", skip=(0, 1))}
dof0, dof1 = fem.dof.partition(field, bounds)

umat = fem.NeoHookeCompressible(mu=1)
solid = fem.SolidBodyNearlyIncompressible(umat, field, bulk=5000)

region_for_pressure = fem.RegionQuadBoundary(mesh, mask=(mesh.x == 0), ensure_3d=True)
field_for_pressure = fem.FieldContainer(
    [fem.FieldAxisymmetric(region_for_pressure, dim=2)]
)

pressure = fem.SolidBodyPressure(field_for_pressure)

The next step involves the problem definition for contique. For details have a look at its README.

def fun(x, lpf, *args):
    "The system vector of equilibrium equations."

    field[0].values.ravel()[dof1] = x
    pressure.update(lpf)

    return fem.tools.fun([solid, pressure], field)[dof1]


def dfundx(x, lpf, *args):
    """The jacobian of the system vector of equilibrium equations w.r.t. the
    primary unknowns."""

    K = fem.tools.jac([solid, pressure], field)

    return fem.solve.partition(field, K, dof1, dof0)[2]


def dfundl(x, lpf, *args):
    """The jacobian of the system vector of equilibrium equations w.r.t. the
    load proportionality factor."""

    pressure.update(1)

    return fem.tools.fun([pressure], field)[dof1]

Next we have to init the problem and specify the initial values of unknowns (the undeformed configuration). After each completed step of the numeric continuation the results are saved.

Res = contique.solve(
    fun=fun,
    jac=[dfundx, dfundl],
    x0=field[0][dof1],
    lpf0=0,
    control0=(0, 1),
    maxsteps=150,
    rebalance=True,
    tol=1e-2,
)
X = np.array([res.x for res in Res])
|Step,C.| Control Component | Norm (Iter.#) | Message     |
|-------|-------------------|---------------|-------------|
|   1,1 |     0+  =>     0+ | 1.1e-06 ( 3#) |             |
|   2,1 |     0+  =>     0+ | 8.4e-07 ( 3#) |             |
|   3,1 |     0+  =>     0+ | 6.4e-07 ( 3#) |             |
|   4,1 |     0+  =>     0+ | 3.4e-06 ( 3#) |             |
|   5,1 |     0+  =>     0+ | 1.4e-05 ( 3#) |             |
|   6,1 |     0+  =>     0+ | 4.9e-05 ( 3#) |             |
|   7,1 |     0+  =>     0+ | 3.2e-04 ( 3#) |             |
|   8,1 |     0+  =>     0+ | 2.1e-03 ( 3#) |             |
|   9,1 |     0+  =>     0+ | 7.8e-03 ( 3#) |             |
|  10,1 |     0+  =>     0+ | 5.1e-08 ( 6#) |             |
|  11,1 |     0+  =>     0+ | 6.4e-06 ( 6#) |             |
|  12,1 |     0+  =>     0+ | 2.3e-04 ( 7#) |             |
|  13,1 |     0+  =>     0+ | 7.8e-03 ( 7#) |             |
/home/docs/checkouts/readthedocs.org/user_builds/felupe/envs/v8.8.0/lib/python3.12/site-packages/felupe/constitution/hyperelasticity/core/_neo_hooke_compressible.py:176: RuntimeWarning: invalid value encountered in log
  lnJ = np.log(J, out=J)
/home/docs/checkouts/readthedocs.org/user_builds/felupe/envs/v8.8.0/lib/python3.12/site-packages/felupe/constitution/hyperelasticity/core/_neo_hooke_compressible.py:216: RuntimeWarning: invalid value encountered in log
  lnJ = np.log(J, out=J)
|  14,1 |     0+  =>    22- | 4.6e+11 ( 8#) |Failed       |
|  15,1 |     0+  =>     0+ | 7.5e-01 ( 8#) |Failed       |
|  16,1 |     0+  =>     0+ | 4.4e-05 ( 3#) |             |
|  17,1 |     0+  =>     0+ | 4.3e-05 ( 3#) |             |
|  18,1 |     0+  =>     0+ | 6.6e-05 ( 3#) |             |
|  19,1 |     0+  =>     0+ | 2.6e-04 ( 3#) |             |
|  20,1 |     0+  =>     0+ | 9.6e-04 ( 3#) |             |
|  21,1 |     0+  =>     0+ | 5.0e-03 ( 3#) |             |
|  22,1 |     0+  =>     0+ | 1.1e-04 ( 6#) |             |
|  23,1 |     0+  =>     0+ | 1.8e+02 ( 8#) |Failed       |
|  24,1 |     0+  =>     0+ | 8.6e-03 ( 4#) |             |
|  25,1 |     0+  =>     0+ | 2.4e-03 ( 3#) |             |
|  26,1 |     0+  =>     0+ | 2.8e-03 ( 3#) |             |
|  27,1 |     0+  =>     0+ | 6.0e-03 ( 3#) |             |
|  28,1 |     0+  =>     0+ | 1.7e-05 ( 6#) |             |
|  29,1 |     0+  =>     8- | 1.5e+03 ( 8#) |Failed       |
|  30,1 |     0+  =>     0+ | 4.8e-07 ( 6#) |             |
|  31,1 |     0+  =>     0+ | 4.4e-03 ( 3#) |             |
|  32,1 |     0+  =>     0+ | 4.8e-03 ( 3#) |             |
|  33,1 |     0+  =>     0+ | 9.1e-03 ( 3#) |             |
|  34,1 |     0+  =>     0+ | 3.9e-04 ( 7#) |             |
|  35,1 |     0+  =>    12- | 1.5e+06 ( 8#) |Failed       |
|  36,1 |     0+  =>    17+ | 2.2e+04 ( 8#) |Failed       |
|  37,1 |     0+  =>     0+ | 3.5e-03 ( 3#) |             |
|  38,1 |     0+  =>     0+ | 5.4e-04 ( 3#) |             |
|  39,1 |     0+  =>     0+ | 5.6e-04 ( 3#) |             |
|  40,1 |     0+  =>     0+ | 1.5e-03 ( 3#) |             |
|  41,1 |     0+  =>     0+ | 3.9e-03 ( 3#) |             |
|  42,1 |     0+  =>     0+ | 9.3e-03 ( 3#) |             |
|  43,1 |     0+  =>     0+ | 5.0e-05 ( 6#) |             |
|  44,1 |     0+  =>     0+ | 9.1e-08 ( 6#) |             |
|  45,1 |     0+  =>    22+ | 7.6e+06 ( 8#) |Failed       |
|  46,1 |     0+  =>    22- | 4.8e+08 ( 8#) |Failed       |
|  47,1 |     0+  =>     8+ | 9.8e+02 ( 8#) |Failed       |
|  48,1 |     0+  =>     0+ | 6.8e-05 ( 3#) |             |
|  49,1 |     0+  =>     0+ | 2.8e-05 ( 3#) |             |
|  50,1 |     0+  =>     0+ | 2.8e-05 ( 3#) |             |
|  51,1 |     0+  =>     0+ | 1.1e-04 ( 3#) |             |
|  52,1 |     0+  =>     0+ | 4.1e-04 ( 3#) |             |
|  53,1 |     0+  =>     0+ | 1.3e-03 ( 3#) |             |
|  54,1 |     0+  =>     0+ | 3.6e-03 ( 3#) |             |
|  55,1 |     0+  =>     0+ | 9.2e-03 ( 3#) |             |
|  56,1 |     0+  =>     0+ | 2.1e-09 ( 6#) |             |
|  57,1 |     0+  =>     0+ | 1.0e-08 ( 6#) |             |
|  58,1 |     0+  =>     0+ | 2.5e-09 ( 6#) |             |
|  59,1 |     0+  =>     0+ | 3.9e+02 ( 8#) |Failed       |
|  60,1 |     0+  =>     0+ | 2.3e-05 ( 6#) |             |
|  61,1 |     0+  =>     0+ | 4.1e-03 ( 4#) |             |
|  62,1 |     0+  =>     0+ | 4.2e-03 ( 4#) |             |
|  63,1 |     0+  =>     0+ | 7.0e-10 ( 6#) |             |
|  64,1 |     0+  =>     0+ | 9.5e-09 ( 6#) |             |
|  65,1 |     0+  =>     0+ | 3.6e-06 ( 6#) |             |
|  66,1 |     0+  =>     0+ | 1.6e-08 ( 6#) |             |
|  67,1 |     0+  =>     6+ | 1.5e+03 ( 8#) |Failed       |
|  68,1 |     0+  =>     0+ | 6.6e-03 ( 5#) |             |
|  69,1 |     0+  =>     0+ | 4.1e-03 ( 4#) |             |
|  70,1 |     0+  =>     0+ | 3.9e-03 ( 4#) |             |
|  71,1 |     0+  =>     0+ | 5.6e-03 ( 5#) |             |
|  72,1 |     0+  =>     0+ | 8.8e-07 ( 6#) |             |
|  73,1 |     0+  =>     0+ | 3.3e-06 ( 6#) |             |
|  74,1 |     0+  =>     0+ | 3.2e-05 ( 6#) |             |
|  75,1 |     0+  =>     0+ | 8.5e-04 ( 6#) |             |
|  76,1 |     0+  =>     0+ | 1.4e-01 ( 8#) |Failed       |
|  77,1 |     0+  =>     0+ | 7.0e-03 ( 4#) |             |
|  78,1 |     0+  =>     0+ | 6.4e-03 ( 4#) |             |
|  79,1 |     0+  =>     0+ | 6.6e-03 ( 4#) |             |
|  80,1 |     0+  =>     8+ | 1.6e+03 ( 8#) |Failed       |
|  81,1 |     0+  =>     0+ | 2.9e-07 ( 6#) |             |
|  82,1 |     0+  =>     0+ | 1.8e-04 ( 4#) |             |
|  83,1 |     0+  =>     0+ | 1.9e-04 ( 4#) |             |
|  84,1 |     0+  =>     0+ | 1.0e-03 ( 4#) |             |
|  85,1 |     0+  =>     0+ | 7.5e-03 ( 4#) |             |
|  86,1 |     0+  =>     2+ | 3.1e+02 ( 8#) |Failed       |
|  87,1 |     0+  =>     2- | 2.4e+04 ( 8#) |Failed       |
|  88,1 |     0+  =>     0+ | 1.4e-04 ( 3#) |             |
|  89,1 |     0+  =>     0+ | 1.1e-04 ( 3#) |             |
|  90,1 |     0+  =>     0+ | 1.1e-04 ( 3#) |             |
|  91,1 |     0+  =>     0+ | 5.2e-04 ( 3#) |             |
|  92,1 |     0+  =>     0+ | 3.1e-03 ( 3#) |             |
|  93,1 |     0+  =>     0+ | 5.1e-04 ( 4#) |             |
|  94,1 |     0+  =>     0+ | 1.0e-03 ( 4#) |             |
|  95,1 |     0+  =>    22- | 2.7e+10 ( 8#) |Failed       |
|  96,1 |     0+  =>     0+ | 4.7e-02 ( 8#) |Failed       |
|  97,1 |     0+  =>     0+ | 3.5e-05 ( 3#) |             |
|  98,1 |     0+  =>     0+ | 3.4e-05 ( 3#) |             |
|  99,1 |     0+  =>     0+ | 3.2e-05 ( 3#) |             |
| 100,1 |     0+  =>     0+ | 1.6e-04 ( 3#) |             |
| 101,1 |     0+  =>     0+ | 9.4e-04 ( 3#) |             |
| 102,1 |     0+  =>     0+ | 7.9e-03 ( 3#) |             |
| 103,1 |     0+  =>     0+ | 4.3e-04 ( 4#) |             |
| 104,1 |     0+  =>     0+ | 3.5e-05 ( 7#) |             |
| 105,1 |     0+  =>     0+ | 2.3e-05 ( 6#) |             |
| 106,1 |     0+  =>    14+ | 1.9e+04 ( 8#) |Failed       |
| 107,1 |     0+  =>     0+ | 2.1e-08 ( 6#) |             |
| 108,1 |     0+  =>     0+ | 4.8e-03 ( 3#) |             |
| 109,1 |     0+  =>     0+ | 4.5e-03 ( 3#) |             |
| 110,1 |     0+  =>     0+ | 4.0e-03 ( 4#) |             |
| 111,1 |     0+  =>     0+ | 6.1e-02 ( 8#) |Failed       |
| 112,1 |     0+  =>     0+ | 6.6e-04 ( 3#) |             |
| 113,1 |     0+  =>     0+ | 6.3e-04 ( 3#) |             |
| 114,1 |     0+  =>     0+ | 6.1e-04 ( 3#) |             |
| 115,1 |     0+  =>     0+ | 7.9e-03 ( 3#) |             |
| 116,1 |     0+  =>     0+ | 9.9e-06 ( 6#) |             |
| 117,1 |     0+  =>     0+ | 1.1e-03 ( 8#) |             |
| 118,1 |     0+  =>     0+ | 2.7e-03 ( 7#) |             |
| 119,1 |     0+  =>     0+ | 1.7e-07 ( 6#) |             |
| 120,1 |     0+  =>     0+ | 7.6e-08 ( 6#) |             |
| 121,1 |     0+  =>     0+ | 2.6e+01 ( 8#) |Failed       |
| 122,1 |     0+  =>     0+ | 6.7e-03 ( 3#) |             |
| 123,1 |     0+  =>     0+ | 6.5e-03 ( 3#) |             |
| 124,1 |     0+  =>     0+ | 6.6e-03 ( 3#) |             |
| 125,1 |     0+  =>     0+ | 1.8e-04 ( 6#) |             |
| 126,1 |     0+  =>     0+ | 5.9e-06 ( 6#) |             |
| 127,1 |     0+  =>     0+ | 2.1e-08 ( 6#) |             |
| 128,1 |     0+  =>     0+ | 1.5e+01 ( 8#) |Failed       |
| 129,1 |     0+  =>     0+ | 5.1e-03 ( 3#) |             |
| 130,1 |     0+  =>     0+ | 5.2e-03 ( 3#) |             |
| 131,1 |     0+  =>     0+ | 5.3e-03 ( 3#) |             |
| 132,1 |     0+  =>     0+ | 1.0e-03 ( 4#) |             |
| 133,1 |     0+  =>     0+ | 1.1e-07 ( 6#) |             |
| 134,1 |     0+  =>     0+ | 9.7e-07 ( 6#) |             |
| 135,1 |     0+  =>     0+ | 2.4e-07 ( 6#) |             |
| 136,1 |     0+  =>     0+ | 5.4e+01 ( 8#) |Failed       |
| 137,1 |     0+  =>     0+ | 8.4e-01 ( 8#) |Failed       |
| 138,1 |     0+  =>     0+ | 1.2e-04 ( 3#) |             |
| 139,1 |     0+  =>     0+ | 1.2e-04 ( 3#) |             |
| 140,1 |     0+  =>     0+ | 1.2e-04 ( 3#) |             |
| 141,1 |     0+  =>     0+ | 7.7e-04 ( 3#) |             |
| 142,1 |     0+  =>     0+ | 6.1e-03 ( 3#) |             |
| 143,1 |     0+  =>     0+ | 6.4e-03 ( 4#) |             |
| 144,1 |     0+  =>     0+ | 3.3e-07 ( 6#) |             |
| 145,1 |     0+  =>     0+ | 1.4e-03 ( 7#) |             |
| 146,1 |     0+  =>     0+ | 9.2e-04 ( 6#) |             |
| 147,1 |     0+  =>     0+ | 1.0e-04 ( 6#) |             |
| 148,1 |     0+  =>     5+ | 9.0e+03 ( 8#) |Failed       |
| 149,1 |     0+  =>    17+ | 4.7e+03 ( 8#) |Failed       |
| 150,1 |     0+  =>     0+ | 3.4e-03 ( 6#) |             |

The unstable pressure-controlled equilibrium path is plotted as pressure-displacement curve.

import matplotlib.pyplot as plt

plt.plot(X[:, 0], X[:, -1], "x-", lw=3)
plt.xlabel(r"Max. Displacement $u_1(X_1=X_2=0)$ $\longrightarrow$")
plt.ylabel(r"Load-Proportionality-Factor $\lambda$ $\longrightarrow$")
ex04 balloon

The 3d-deformed configuration of the solid body is plotted.

mesh_3d = mesh.revolve(phi=90, n=6)
region_3d = fem.RegionHexahedron(mesh_3d)
values = mesh.copy(points=field[0].values).revolve(phi=90, n=6).points
u_3d = fem.Field(region_3d, values=values, dim=3)
field_3d = fem.FieldContainer([u_3d])
solid_3d = fem.SolidBodyNearlyIncompressible(umat, field_3d, bulk=5000)
solid_3d.plot("Principal Values of Cauchy Stress", project=fem.topoints).show()
ex04 balloon

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

Gallery generated by Sphinx-Gallery