Skip to content

Commit

Permalink
Update stress.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jbjacob94 authored Dec 12, 2023
1 parent 74ebe0e commit 6e70510
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions ImageD11/stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def strain2stress_Lab(self, m=1, debug=0):
"""
Compute elastic strain and stress in Lab coordinates for all ubis, using the stiffness matrix in self.Cij. Computation is done first in
the grain coordinate system, and then stress in lab coordinates is obtained by rotating the 3x3 stress tensor from the grain to the lab
coordinate system using the following transormation : σ' = UT.Cij.U where U is the rotation matrix yielded by the polar decomposition
of the finite deormation gradient tensor F.
coordinate system using the following transormation : σ' = RT.σ.R where R is the rotation matrix yielded by the polar decomposition
of the finite deformation gradient tensor F.
Returns strain and stress as two lists of 3x3 symmetric tensors 'eps_Lab' and 'sigma_Lab'.
Expand Down Expand Up @@ -332,37 +332,43 @@ def deviatoric_tensors(self, debug=0):



def invariant_props(self, dname):
def invariant_props(self, dname):
# NOTE : not sure about the expression of von Mises strain. In any case it is related to √J2 by a multiplication factor k, but it seems to be different from
# the definition of von Mises stress √(3.J2). see https://www.continuummechanics.org/vonmisesstress.html
"""
compute invariant properties for selected data column
compute invariant properties for selected data column: volumetric strain / pressure (-I1/3) and von mises strain /stress (√3.J2)
dname (str) : name of the input data column. Must be a non-deviatoric 3x3 tensors
Returns
----------
New instances added to EpsSigSolver, containing list of floats
if strain tensor in input
dname+'_vol' : volumetric strain
dname+'_vM' : von Mises strain (√2.J2)
if stress tensor in input:
dname+'_P_hyd' : hydrostatic Pressure (if stress tensor in input)
dname+'_vol' : volumetric strain (if strain tensor in input)
dname+'_tau_oct' : octahedral shear strain /stress
dname+'_vM' : von Mises stress (√3.J2)
"""
assert dname in dir(self), 'dname not recognized'

assert '_d_' not in dname, 'tensor is deviatoric. Please use the non-deviatoric tensor'

tensor_list = self.__getattribute__(dname)
assert np.all([T.shape == (3,3) for T in tensor_list])
Invts = [invariants_quantities(T) for T in tensor_list]
Inv1 = [i[0] for i in Invts]
Inv2 = [i[1] for i in Invts]
# tensor is already deviatoric :
assert '_d_' not in dname, 'tensor is deviatoric. Please use the non-deviatoric tensor'

tensor_list_dev = [deviatoric(T) for T in tensors_list]
Invts = [invariants(T) for T in tensor_list]
Invts_dev = [invariants(T) for T in tensor_list_dev]

Inv1 = [-i[0]/3 for i in Invts]
Inv2 = [np.sqrt(3*i[1]) for i in Invts_dev]

if 'eps' in dname:
setattr(self, dname+'_vol', Inv1)
else:
setattr(self, dname+'_P_hyd', Inv1)

setattr(self, dname+'_tau_oct', Inv2)
setattr(self, dname+'_vM', Inv2)



Expand Down Expand Up @@ -480,7 +486,7 @@ def vector_to_full_3x3(vec, input_format='default', is_strain=True):


def rotate_3x3_tensor(S, R, tol = 1e-6):
"""Express 3x3 matrix in rotated coordinate system
"""Return 3x3 matrix in rotated coordinate system
Parameters
-----------
Expand All @@ -502,7 +508,7 @@ def rotate_3x3_tensor(S, R, tol = 1e-6):

def build_6x6_rot_mat(R, tol):
"""
Return 6x6 transormation matrix corresponding to rotation R for a 6x6 stiffness / compliance tensor
Return 6x6 transormation matrix corresponding to rotation R for a Voigt 6x6 stiffness tensor
Parameters
-----------
Expand Down Expand Up @@ -585,6 +591,8 @@ def invariants(T):
I3 = np.linalg.det(T)

return I1, I2, I3



# Cij_symmetry for stiffness tensor (from Mouhat & Coudert 2014)
########################
Expand Down

0 comments on commit 6e70510

Please sign in to comment.