contimech : tools and functions useful in Continuum Mechanics


In [1]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt
from simmit import smartplus as sim
import os

tr(vec)

Provides the trace of a second order tensor written as a vector v in the SMART+ formalism. Return a double. Example:


In [2]:
v = np.random.rand(6)
trace = sim.tr(v)
print v
print trace


[ 0.28777037  0.55493192  0.7106877   0.96855799  0.07231218  0.7315952 ]
1.55338999261

dev(vec)

Provides the deviatoric part of a second order tensor written as a vector v in the SMART+ formalism. Return a vec. Example:


In [3]:
v = np.random.rand(6)
v_dev = sim.dev(v)
print v
print v_dev


[ 0.40330907  0.43654552  0.03692462  0.84959309  0.01720095  0.57147467]
[ 0.11104933  0.14428579 -0.25533512  0.84959309  0.01720095  0.57147467]

Mises_stress(vec)

Provides the Von Mises stress $\sigma^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.


In [4]:
v = np.random.rand(6)
Mises_sig = sim.Mises_stress(v)
print v
print Mises_sig


[ 0.08265583  0.46738729  0.2036261   0.05221762  0.20770369  0.79026151]
1.45851065101

Mises_strain(vec)

Provides the Von Mises strain $\varepsilon^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.


In [5]:
v = np.random.rand(6)
Mises_eps = sim.Mises_strain(v)
print v
print Mises_eps


[ 0.23840514  0.66176294  0.22875825  0.23593975  0.64093744  0.96164564]
0.738416328564

eta_stress(vec)

Provides the stress flow:

$$\eta_{stress}=\frac{3/2\sigma_{dev}}{\sigma_{Mises}}$$

from a second order stress tensor written as a vector v in the SMART+ formalism (i.e. the shear terms are multiplied by 2, providing shear angles). Return a vec.


In [6]:
v = np.random.rand(6)
sigma_f = sim.eta_stress(v)
print v
print sigma_f


[ 0.49763588  0.28708324  0.72151363  0.60466712  0.59883081  0.25298088]
[-0.00420851 -0.203707    0.20791551  1.1458434   1.1347836   0.47939843]

eta_strain(vec)

Provides the strain flow

$$\eta_{strain}=\frac{2/3\varepsilon_{dev}}{\varepsilon_{Mises}}$$

from a second order strain tensor written as a vector v in the SMART+ formalism (i.e. the shear terms are multiplied by 2, providing shear angles). Return a vec.


In [7]:
v = np.random.rand(6)
eps_f = sim.eta_strain(v)
print v
print eps_f


[ 0.1048527   0.45000922  0.38179737  0.78738433  0.17847086  0.07292651]
[-0.2692624   0.17891713  0.09034527  1.0224044   0.23174121  0.09469376]

v2t_stress(vec)

Converts a second order stress tensor written as a vector v in the SMART+ formalism into a second order stress tensor written as a matrix m. Return a mat.


In [8]:
v = np.random.rand(6)
m = sim.v2t_stress(v);
print v
print m


[ 0.78149732  0.57208072  0.81330331  0.80857062  0.80308309  0.64530481]
[[ 0.78149732  0.80857062  0.80308309]
 [ 0.80857062  0.57208072  0.64530481]
 [ 0.80308309  0.64530481  0.81330331]]

t2v_stress(vec)

Converts a second order stress tensor written as a matrix m in the SMART+ formalism into a second order stress tensor written as a vector v. Return a vec.


In [9]:
m = np.random.rand(3,3)
m_symm = (m + m.T)/2
v = sim.t2v_stress(m_symm);
print m_symm
print v


[[ 0.55364159  0.35478884  0.36243601]
 [ 0.35478884  0.06697403  0.19396412]
 [ 0.36243601  0.19396412  0.17517464]]
[ 0.55364159  0.06697403  0.17517464  0.35478884  0.36243601  0.19396412]

v2t_strain(vec)

Converts a second order strain tensor written as a vector v in the SMART+ formalism into a second order strain tensor written as a matrix m. Return a mat.


In [10]:
v = np.random.rand(6)
m = sim.v2t_strain(v);
print v
print m


[ 0.00950847  0.77374737  0.33445427  0.29650873  0.79819359  0.11979222]
[[ 0.00950847  0.14825437  0.3990968 ]
 [ 0.14825437  0.77374737  0.05989611]
 [ 0.3990968   0.05989611  0.33445427]]

t2v_strain(vec)

Converts a second order strain tensor written as a matrix m in the SMART+ formalism into a second order strain tensor written as a vector v. Return a vec.


In [11]:
m = np.random.rand(3,3)
m_symm = (m + m.T)/2
v = sim.t2v_strain(m_symm);
print m_symm
print v


[[ 0.75617204  0.56086584  0.10789849]
 [ 0.56086584  0.52855813  0.65860435]
 [ 0.10789849  0.65860435  0.43186393]]
[ 0.75617204  0.52855813  0.43186393  1.12173167  0.21579698  1.3172087 ]

J2_stress(vec)

Provides the second invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.

$$ J_2 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{ij} $$

In [12]:
v = np.random.rand(6)
J2 = sim.J2_stress(v)
print v
print J2


[ 0.20629024  0.73186445  0.01382952  0.55772089  0.60645481  0.36546341]
0.950544125031

J2_strain(vec)

Provides the second invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec.

$$ J_2 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{ij} $$

In [13]:
v = np.random.rand(6)
J2 = sim.J2_strain(v)
print v
print J2


[ 0.58021933  0.68753395  0.78512884  0.16526677  0.90063365  0.9848156 ]
0.462583810197

J3_stress(vec)

Provides the third invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.

$$ J_3 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{jk} \sigma_{ki} $$

In [14]:
v = np.random.rand(6)
J3 = sim.J3_stress(v)
print v
print J3


[ 0.9077335   0.0125445   0.60970762  0.46758587  0.88186709  0.81557739]
0.753375029015

J3_strain(vec)

Provides the third invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec.

$$ J_3 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{jk} \varepsilon_{ki} $$

In [15]:
v = np.random.rand(6)
J3 = sim.J3_strain(v)
print v
print J3


[ 0.39472022  0.9450546   0.3415536   0.48283776  0.29197769  0.57909501]
0.0528158566489

In [ ]: