Skip to content

Commit

Permalink
Add Phase speeds as vis for stiffness tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoguaro committed Jul 2, 2020
1 parent 6a87e36 commit 48dbef7
Show file tree
Hide file tree
Showing 7 changed files with 2,698 additions and 26 deletions.
9 changes: 5 additions & 4 deletions continuum_mechanics/visualization.py
Expand Up @@ -9,6 +9,7 @@
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.linalg import eigvalsh
from continuum_mechanics.tensor import christ_stiff

Expand Down Expand Up @@ -287,12 +288,12 @@ def plot_surf(R, phi, theta, title="Wave speed", **kwargs):

# Phi is the azimut angle
# theta is the cenital angle
V1, V2, V3, phi_vec, theta_vec = christofel_eig(C)
V1, V2, V3, phi_vec, theta_vec = christofel_eig(C, 100, 100)
V1 = np.sqrt(V1*1e9/rho)
V2 = np.sqrt(V2*1e9/rho)
V3 = np.sqrt(V3*1e9/rho)

plot_surf(V1, phi_vec, theta_vec, title="qS1 speed")
plot_surf(V2, phi_vec, theta_vec, title="qS2 speed")
plot_surf(V3, phi_vec, theta_vec, title="qP speed")
plot_surf(V1, phi_vec, theta_vec)
plot_surf(V2, phi_vec, theta_vec)
plot_surf(V3, phi_vec, theta_vec)
plt.show()
Binary file added docs/img/qP.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/qS1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/qS2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions docs/usage.rst
Expand Up @@ -322,3 +322,71 @@ Now, let us visualize the tensor
.. image:: img/mohr3d_2.png
:width: 600px
:align: center


Elasticity tensor visualization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let us consider β-brass that is a cubic material and
has the following material properties in Voigt notation:

.. math::
C_{11} = 52\text{ GPa},\quad
C_{12} = 27.5\text{ GPa},\quad
C_{44} = 173\text{ GPa}.
.. code:: python
C11 = 52e9
C12 = 27.5e9
C44 = 173e9
rho = 7600
C = np.zeros((6, 6))
C[0:3, 0:3] = np.array([[C11, C12, C12],
[C12, C11, C12],
[C12, C12, C11]])
C[3:6, 3:6] = np.diag([C44, C44, C44])
One way to visualize a stiffness tensor is to use the
Christofel equation

.. math::
\det(\Gamma_{ij} - v_p^2\delta_{ij}) = 0\, ,
where :math:`\Gamma_{ij}` is the Christofel stiffness and depends
on the material properties (:math:`c_{ijkl}`) and unit vectors
(:math`n_i`):

.. math:
\Gamma_{ij} = c_{iklj}n_k n_l\, .
This provides the eigenvalues that represent the phase
speed for three propagation modes in the material.


.. code:: python
V1, V2, V3, phi_vec, theta_vec = christofel_eig(C, 100, 100)
V1 = np.sqrt(V1/rho)
V2 = np.sqrt(V2/rho)
V3 = np.sqrt(V3/rho)
Phase speed for the first quasi-transverse mode.

.. image:: img/qS1.png
:width: 600px
:align: center

Phase speed for the second quasi-transverse mode.

.. image:: img/qS2.png
:width: 600px
:align: center

Phase speed for the quasi-longitudinal mode.

.. image:: img/qP.png
:width: 600px
:align: center
2,642 changes: 2,621 additions & 21 deletions docs/visualization.ipynb

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion setup.py
Expand Up @@ -11,7 +11,10 @@
with open('HISTORY.rst') as history_file:
history = history_file.read()

requirements = [ ]
requirements = ['sympy>=1.3',
'matplotlib>=3',
'numpy',
'scipy']

setup_requirements = ['pytest-runner', ]

Expand Down

0 comments on commit 48dbef7

Please sign in to comment.