bugfixes:

- vonMises calculation was wrong
- wrong type of data used in some add_XXX
This commit is contained in:
Martin Diehl 2019-10-21 18:06:16 +02:00
parent ac0149e55e
commit 578cbf9bbf
2 changed files with 10 additions and 9 deletions

View File

@ -462,9 +462,10 @@ class DADF5():
""" """
def __add_Mises(x): def __add_Mises(x):
t = 'strain' if x['Unit'] == '1' else 'stress' t = 'strain' if x['meta']['Unit'] == '1' else \
'stress'
return { return {
'data': mechanics.Mises_strain(x) if t=='strain' else mechanics.Mises_stress(x), 'data': mechanics.Mises_strain(x['data']) if t=='strain' else mechanics.Mises_stress(x['data']),
'label': '{}_vM'.format(x['label']), 'label': '{}_vM'.format(x['label']),
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'Unit': x['meta']['Unit'],
@ -589,7 +590,7 @@ class DADF5():
raise ValueError raise ValueError
return { return {
'data': mechanics.spherical_part(x), 'data': mechanics.spherical_part(x['data']),
'label': 'p_{}'.format(x['label']), 'label': 'p_{}'.format(x['label']),
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'Unit': x['meta']['Unit'],
@ -725,7 +726,7 @@ class DADF5():
def __add_principal_components(x): def __add_principal_components(x):
return { return {
'data': mechanics.principal_components(x), 'data': mechanics.principal_components(x['data']),
'label': 'lambda_{}'.format(x['label']), 'label': 'lambda_{}'.format(x['label']),
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'Unit': x['meta']['Unit'],
@ -752,7 +753,7 @@ class DADF5():
def __add_maximum_shear(x): def __add_maximum_shear(x):
return { return {
'data': mechanics.maximum_shear(x), 'data': mechanics.maximum_shear(x['data']),
'label': 'max_shear({})'.format(x['label']), 'label': 'max_shear({})'.format(x['label']),
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'Unit': x['meta']['Unit'],

View File

@ -101,8 +101,8 @@ def Mises_stress(sigma):
""" """
s = deviatoric_part(sigma) s = deviatoric_part(sigma)
return np.sqrt(3.0/2.0*np.trace(s)) if np.shape(sigma) == (3,3) else \ return np.sqrt(3.0/2.0*(np.sum(s**2.0))) if np.shape(sigma) == (3,3) else \
np.sqrt(3.0/2.0*np.einsum('ijk->i',s)) np.sqrt(3.0/2.0*np.einsum('ijk->i',s**2.0))
def Mises_strain(epsilon): def Mises_strain(epsilon):
@ -116,8 +116,8 @@ def Mises_strain(epsilon):
""" """
s = deviatoric_part(epsilon) s = deviatoric_part(epsilon)
return np.sqrt(2.0/3.0*np.trace(s)) if np.shape(epsilon) == (3,3) else \ return np.sqrt(3.0/2.0*(np.sum(s**2.0))) if np.shape(epsilon) == (3,3) else \
np.sqrt(2.0/3.0*np.einsum('ijk->i',s)) np.sqrt(3.0/2.0*np.einsum('ijk->i',s**2.0))
def symmetric(x): def symmetric(x):