transferring post processing capabilities

This commit is contained in:
Martin Diehl 2019-07-15 13:55:14 -07:00
parent fa6e88970c
commit c51cf8d506
1 changed files with 29 additions and 0 deletions

View File

@ -234,6 +234,35 @@ class DADF5():
self.add_generic_pointwise(np.linalg.det,args,result) self.add_generic_pointwise(np.linalg.det,args,result)
def add_spherical(self,a):
"""Adds the spherical component of a tensor"""
def spherical(m):
return (m[0,0]+m[1,1]+m[2,2])/3.0
# ToDo: The output unit should be the input unit
args = [{'label':a,'shape':[3,3],'unit':None}]
result = {'label':'sph({})'.format(a),
'unit':'n/a',
'Description': 'Spherical component of a tensor'}
self.add_generic_pointwise(spherical,args,result)
def add_deviator(self,a):
"""Adds the deviator of a tensor"""
def deviator(m):
return m - np.eye(3)*(m[0,0]+m[1,1]+m[2,2])/3.0
# ToDo: The output unit should be the input unit
args = [{'label':a,'shape':[3,3],'unit':'Pa'}]
result = {'label':'dev({})'.format(a),
'unit':'n/a',
'Description': 'Deviatoric component of a tensor'}
self.add_generic_pointwise(deviator,args,result)
def add_strain_tensors(self,defgrad='F'): def add_strain_tensors(self,defgrad='F'):
"""Adds a strain definition""" """Adds a strain definition"""
def strain(defgrad): def strain(defgrad):