Skip to content

3.2 Read the data

Eric Breitbarth edited this page Sep 3, 2024 · 3 revisions

The first step for CrackPy is to read in the data.

# Imports
import os
from crackpy.fracture_analysis.data_processing import InputData
from crackpy.structure_elements.data_files import Nodemap
from crackpy.structure_elements.material import Material

# Settings
NODEMAP_FILE = 'Dummy2_WPXXX_DummyVersuch_2_dic_results_1_53.txt'
NODEMAP_PATH = os.path.join('..', '..', 'test_data', 'crack_detection', 'Nodemaps')

# Get nodemap data
nodemap = Nodemap(name=NODEMAP_FILE, folder=NODEMAP_PATH)
material = Material(E=72000, nu_xy=0.33, sig_yield=350)
data = InputData(nodemap)
data.calc_stresses(material)
data.calc_eps_vm()
data.transform_data(x_shift=0.0, y_shift=0.0, angle=0.0)
  • calc_stresses calculates stresses using Hook's law for plane stress conditions using $E$ and $\nu_{xy}$.
  • calc_eps_vm calculates the von Mises equivalent strain under the assumption of plane stress with $\nu_{xy} = 0.5$.
  • transform_data is a transformation of the coordinate system in the xy-plane.

The data can then be accessed in the form of lists for further processing:

x = data.coor_x
y = data.coor_y
z = data.coor_z
u_x = data.disp_x
u_y = data.disp_y
u_z = data.disp_z
eps_x = data.eps_x
eps_y = data.eps_y
eps_xy = data.eps_xy
eps_vm = data.eps_vm
sig_x = data.sig_x
sig_y = data.sig_y
sig_xy = data.sig_xy
sig_vm = data.sig_vm 

Calculate the Von Mises equivalent strain

Von Mises Equivalent Strain ($\varepsilon_{\text{VM}}$) is calculated based on infinitesimal strain theory.

To derive $\varepsilon_{\text{VM}}$, we first determine the strain component, $\varepsilon_z$, assuming a Poisson's ratio ($\nu$) with $\nu = 0.5$ under plane stress conditions:

$$ \varepsilon_z = -\frac{\nu}{1 - \nu} (\varepsilon_x + \varepsilon_y) $$

Next, the full strain tensor $\varepsilon$ is constructed:

$$ \varepsilon = \begin{bmatrix} \varepsilon_x & \varepsilon_{xy} & 0 \\ \varepsilon_{xy} & \varepsilon_y & 0 \\ 0 & 0 & \varepsilon_z \end{bmatrix} $$

Subsequently, the deviatoric strain ($\varepsilon_{\text{dev}}$) is computed:

$$ \varepsilon_{\text{dev}} = \varepsilon - \frac{1}{3} \text{tr}(\varepsilon) \cdot \mathbf{I} $$

Finally, the Von Mises equivalent strain, $\varepsilon_{\text{VM}}$, is obtained:

$$ \varepsilon_{\text{VM}} = \sqrt{\frac{2}{3} \varepsilon_{\text{dev}} : \varepsilon_{\text{dev}}} $$

import numpy as np
from numpy import linalg as LA


#Strain tensor from ARAMIS nodemap export
eps_x = -0.048588741570711 / 100
eps_y = 1.085232496261597 / 100
eps_xy = -0.003783278865740
eps_eqv = 1.301692605018616 / 100

eps = np.array([[eps_x, eps_xy], [eps_xy, eps_y]])

# GOM Aramis implementation of equivalent strain using large strain theory
w, v = LA.eig(eps)
eps_1 = w[0]
eps_2 = w[1]
phi_1 = np.log(1 + eps_1)
phi_2 = np.log(1 + eps_2)
phi_3 = phi_1 + phi_2

phi_M = np.sqrt(2 / 3 * (phi_1 ** 2 + phi_2 ** 2 + phi_3 ** 2))
eps_M_large_strains = np.exp(phi_M) - 1

# small strains
w, v = LA.eig(eps)
eps_1 = w[0]
eps_2 = w[1]
eps_3 = eps_1 + eps_2

eps_M_small_strains = np.sqrt(2 / 3 * (eps_1 ** 2 + eps_2 ** 2 + eps_3 ** 2))

# Wikipedia
# https://en.wikipedia.org/wiki/Infinitesimal_strain_theory#Equivalent_strain

nu = 0.5  # !!!
eps_z = -nu/(1-nu)*(eps_x + eps_y)
eps = np.array([[eps_x, eps_xy, 0], [eps_xy, eps_y, 0], [0, 0, eps_z]])
eps_dev = eps - 1 / 3 * np.trace(eps) * np.eye(3)
eps_vm = np.sqrt(2 / 3 * np.trace(eps_dev @ eps_dev))  # @ is matrix multiplication

print(f"Wikipedia with nu={nu}:   {eps_vm}")
print(f"ARAMIS nodemap export:    {eps_eqv}")
print(f"ARAMIS (large strains):   {eps_M_large_strains}")
print(f"ARAMIS (small strains):   {eps_M_small_strains}")

Reference: https://en.wikipedia.org/wiki/Infinitesimal_strain_theory#Equivalent_strain