Skip to content
Snippets Groups Projects
Commit 385de091 authored by Florian Zill's avatar Florian Zill
Browse files

[propertylib] new example for stress analysis

parent aebb3d2b
No related branches found
No related tags found
1 merge request!119Stress Analysis and Refactoring
"""
Stress analysis
===============
.. sectionauthor:: Florian Zill (Helmholtz Centre for Environmental Research GmbH - UFZ)
The following example from the ogs benchmark collection is used for the
stress analysis:
<https://www.opengeosys.org/docs/benchmarks/thermo-mechanics/creepafterexcavation/>
"""
# %%
# sphinx_gallery_start_ignore
# sphinx_gallery_thumbnail_number = -1
# sphinx_gallery_end_ignore
from ogstools.meshplotlib import examples, plot, setup
from ogstools.meshplotlib.plot_features import plot_streamlines
from ogstools.propertylib import presets
setup.reset()
setup.length.output_unit = "km"
mesh = examples.mesh_mechanics
fig = plot(mesh, presets.displacement)
# %% [markdown]
# Tensor components
# -----------------
# We can inspect the stress (or strain) tensor components by indexing.
# %%
fig = plot(mesh, presets.stress["xx"])
fig = plot(mesh, presets.stress["xy"])
# %% [markdown]
# Principal stresses
# ------------------
# Let's calculate the the principal stress components and overlay the direcetion
# of the corresponding eigenvector. Note: the eigenvalues are sorted by
# increasing order, i.e. eigenvalue[0] is the most negative / largest
# compressive principal stress.
# %%
eigvecs = presets.stress.eigenvectors
fig = plot(mesh, mesh_property=presets.stress.eigenvalues[0])
plot_streamlines(ax=fig.axes[0], mesh=mesh, property=eigvecs[0], arrows=True)
# %%
fig = plot(mesh, mesh_property=presets.stress.eigenvalues[1])
plot_streamlines(ax=fig.axes[0], mesh=mesh, property=eigvecs[1], arrows=True)
# %%
fig = plot(mesh, mesh_property=presets.stress.eigenvalues[2])
plot_streamlines(ax=fig.axes[0], mesh=mesh, property=eigvecs[2], arrows=True)
# %% [markdown]
# We can also plot the mean of the principal stress, i.e. the magnitude of the
# hydrostatic component of the stress tensor.
# see: :py:func:`ogstools.propertylib.tensor_math.mean`
# %%
fig = plot(mesh, presets.stress.mean)
# %% [markdown]
# Von Mises stress
# ----------------
# see: :py:func:`ogstools.propertylib.tensor_math.von_mises`
# %%
fig = plot(mesh, presets.stress.von_Mises)
# %% [markdown]
# octahedral shear stress
# -----------------------
# see: :py:func:`ogstools.propertylib.tensor_math.octahedral_shear`
# %%
fig = plot(mesh, presets.stress.octahedral_shear)
# %% [markdown]
# Integrity criteria
# ==================
# Evaluate models regarding their integrity is often dependent on the geometry,
# e.g. for a hypothetical water column proportional to the depth. Presets which
# fall under this category make use of
# :py:mod:`ogstools.propertylib.mesh_dependent`.
# %% [markdown]
# Dilantancy criterion
# --------------------
# see: :py:func:`ogstools.propertylib.mesh_dependent.dilatancy_critescu`
# %%
fig = plot(mesh, presets.dilatancy_critescu)
fig = plot(mesh, presets.dilatancy_critescu_eff)
# %% [markdown]
# Fluid pressure criterion
# ------------------------
# see: :py:func:`ogstools.propertylib.mesh_dependent.fluid_pressure_criterion`
# %%
fig = plot(mesh, presets.fluid_pressure_crit)
This diff is collapsed.
import pyvista as pv
from ogstools.definitions import ROOT_DIR
from ogstools.meshlib import MeshSeries
......@@ -9,3 +11,6 @@ meshseries_XDMF = MeshSeries(
str(examples / "2D_single_fracture_HT_2D_single_fracture.xdmf"),
time_unit="s",
)
mesh_mechanics = pv.XMLUnstructuredGridReader(
str(examples / "mechanics_example.vtu")
).read()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment