diff --git a/python/damask/dadf5.py b/python/damask/dadf5.py index 59b3f0c4e..0d62c9f8e 100644 --- a/python/damask/dadf5.py +++ b/python/damask/dadf5.py @@ -630,7 +630,7 @@ class DADF5(): self.__add_generic_pointwise(__add_calculation,requested,pass_through) - def add_strain_tensor(self,F='F',t='U',ord=0): + def add_strain_tensor(self,F='F',t='U',m=0): """ Add strain tensor calculated from a deformation gradient. @@ -643,15 +643,15 @@ class DADF5(): t : {‘V’, ‘U’}, optional Type of the polar decomposition, ‘V’ for right stretch tensor and ‘U’ for left stretch tensor. Defaults value is ‘U’. - ord : float, optional + m : float, optional Order of the strain calculation. Default value is ‘0.0’. """ - def __add_strain_tensor(F,t,ord): + def __add_strain_tensor(F,t,m): return { - 'data': mechanics.strain_tensor(F['data'],t,ord), - 'label': 'epsilon_{}^{}({})'.format(t,ord,F['label']), + 'data': mechanics.strain_tensor(F['data'],t,m), + 'label': 'epsilon_{}^{}({})'.format(t,m,F['label']), 'meta': { 'Unit': F['meta']['Unit'], 'Description': 'Strain tensor of {} ({})'.format(F['label'],F['meta']['Description']), @@ -661,7 +661,7 @@ class DADF5(): requested = [{'label':F,'arg':'F'}] - self.__add_generic_pointwise(__add_strain_tensor,requested,{'t':t,'ord':ord}) + self.__add_generic_pointwise(__add_strain_tensor,requested,{'t':t,'m':m}) def add_principal_components(self,x): diff --git a/python/damask/mechanics.py b/python/damask/mechanics.py index 9b6112eb4..c89d16918 100644 --- a/python/damask/mechanics.py +++ b/python/damask/mechanics.py @@ -21,12 +21,12 @@ def Cauchy(F,P): return symmetric(sigma) -def strain_tensor(F,t,ord): +def strain_tensor(F,t,m): """ Return strain tensor calculated from deformation gradient. - For details refer to Albrecht Bertram: Elasticity and Plasticity of Large Deformations: - An Introduction (3rd Edition, 2012), p. 102. + For details refer to https://en.wikipedia.org/wiki/Finite_strain_theory and + https://de.wikipedia.org/wiki/Verzerrungstensor Parameters ---------- @@ -34,23 +34,29 @@ def strain_tensor(F,t,ord): Deformation gradient. t : {‘V’, ‘U’} Type of the polar decomposition, ‘V’ for right stretch tensor and ‘U’ for left stretch tensor. - ord : float + m : float Order of the strain. - """ + """ + F_ = F.reshape((1,3,3)) if F.shape == (3,3) else F if t == 'U': - B = np.matmul(F,transpose(F)) - U,n = np.linalg.eigh(B) - lmd = np.log(U) if ord == 0 else \ - U**ord - (np.broadcast_to(np.ones(3),[U.shape[0],3]) if len(F.shape) == 3 else np.ones(3)) + B = np.matmul(F_,transpose(F_)) + w,n = np.linalg.eigh(B) elif t == 'V': - C = np.matmul(transpose(F),F) - V,n = np.linalg.eigh(C) - lmd = np.log(V) if ord == 0 else \ - - 1.0/V**ord + (np.broadcast_to(np.ones(3),[V.shape[0],3]) if len(F.shape) == 3 else np.ones(3)) - - return np.dot(n,np.dot(np.diag(l),n.T)) if np.shape(F) == (3,3) else \ - np.matmul(n,np.einsum('ij,ikj->ijk',lmd,n)) + C = np.matmul(transpose(F_),F_) + w,n = np.linalg.eigh(C) + + if m > 0.0: + eps = 1.0/(2.0*abs(m)) * (+ np.matmul(n,np.einsum('ij,ikj->ijk',w**m,n)) + - np.broadcast_to(np.ones(3),[F_.shape[0],3])) + elif m < 0.0: + eps = 1.0/(2.0*abs(m)) * (- np.matmul(n,np.einsum('ij,ikj->ijk',w**m,n)) + + np.broadcast_to(np.ones(3),[F_.shape[0],3])) + else: + eps = np.matmul(n,np.einsum('ij,ikj->ijk',0.5*np.log(w),n)) + + return eps.reshape((3,3)) if np.shape(F) == (3,3) else \ + eps def deviatoric_part(x):