Stress analysis#

The following example from the ogs benchmark collection is used for the stress analysis:

<https://www.opengeosys.org/stable/docs/benchmarks/thermo-mechanics/creepafterexcavation/>

import ogstools as ot
from ogstools import examples

mesh = examples.load_mesh_mechanics_2D()
fig = ot.plot.contourf(mesh, ot.variables.displacement)
plot solid mechanics

Tensor components#

We can inspect the stress (or strain) tensor components by indexing.

fig = ot.plot.contourf(mesh, ot.variables.stress["xx"])
fig = ot.plot.contourf(mesh, ot.variables.stress["xy"])
  • plot solid mechanics
  • plot solid mechanics

Principal stresses#

Let’s plot the the principal stress components and also overlay the direction of the corresponding eigenvector in the plot. Note: the eigenvalues are sorted by increasing order, i.e. eigenvalue[0] is the most negative / largest compressive principal stress.

eigvecs = ot.variables.stress.eigenvectors
fig = ot.plot.contourf(mesh, variable=ot.variables.stress.eigenvalues[0])
ot.plot.quiver(mesh, ax=fig.axes[0], variable=eigvecs[0], glyph_type="line")
plot solid mechanics
fig = ot.plot.contourf(mesh, variable=ot.variables.stress.eigenvalues[1])
ot.plot.quiver(mesh, ax=fig.axes[0], variable=eigvecs[1], glyph_type="line")
plot solid mechanics
fig = ot.plot.contourf(mesh, variable=ot.variables.stress.eigenvalues[2])
ot.plot.quiver(mesh, ax=fig.axes[0], variable=eigvecs[2], glyph_type="line")
plot solid mechanics

We can also plot the mean of the principal stress, i.e. the magnitude of the hydrostatic component of the stress tensor. see: ogstools.variables.tensor_math.mean()

fig = ot.plot.contourf(mesh, ot.variables.stress.tensor_mean)
plot solid mechanics

Von Mises stress#

see: ogstools.variables.tensor_math.von_mises()

fig = ot.plot.contourf(mesh, ot.variables.stress.von_Mises)
plot solid mechanics

octahedral shear stress#

see: ogstools.variables.tensor_math.octahedral_shear()

fig = ot.plot.contourf(mesh, ot.variables.stress.octahedral_shear)
plot solid mechanics

Stresses in polar coordinates#

You can inspect stresses in a polar coordinate system by deriving a new Variable from the stress Variable. Specify the polar center and, if needed, the rotation axis (default is z-axis: [0, 0, 1]).

polar_stress = ot.variables.stress.to_polar(center=(150, -650, 0))
fig = ot.plot.contourf(mesh, polar_stress["rr"])
fig = ot.plot.contourf(mesh, polar_stress["tt"])
fig = ot.plot.contourf(mesh, polar_stress["pp"])
  • plot solid mechanics
  • plot solid mechanics
  • plot solid mechanics

Here is a 3D example with a cylindrical hole at (0, 0, 0) in y direction:

mesh_3D = examples.load_mesh_mechanics_3D_sphere()
polar_stress_3D = ot.variables.stress.to_polar()
for comp in ["rr", "tt", "pp"]:
    pl = ot.plot.contourf(mesh_3D, polar_stress_3D[comp])
    pl.view_xz()
    pl.show()
plot solid mechanics
plot solid mechanics
plot solid mechanics

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