ensure correct Mises mode

This commit is contained in:
Martin Diehl 2020-11-05 23:47:37 +01:00
parent 30938a8278
commit 58a5d2666c
2 changed files with 18 additions and 1 deletions

View File

@ -790,7 +790,8 @@ class Result:
@staticmethod
def _add_Mises(T_sym,kind):
if kind is None:
k = kind
if k is None:
if T_sym['meta']['Unit'] == '1':
k = 'strain'
elif T_sym['meta']['Unit'] == 'Pa':

View File

@ -210,6 +210,22 @@ class TestResult:
in_file = default.read_dataset(loc['sigma_vM'],0)
assert np.allclose(in_memory,in_file)
def test_add_Mises_invalid(self,default):
default.add_Cauchy('P','F')
default.add_calculation('sigma_y','#sigma#',unit='y')
default.add_Mises('sigma_y')
assert default.get_dataset_location('sigma_y_vM') == []
def test_add_Mises_stress_strain(self,default):
default.add_Cauchy('P','F')
default.add_calculation('sigma_y','#sigma#',unit='y')
default.add_calculation('sigma_x','#sigma#',unit='x')
default.add_Mises('sigma_y',kind='strain')
default.add_Mises('sigma_x',kind='stress')
loc = {'y' :default.get_dataset_location('sigma_y_vM'),
'x' :default.get_dataset_location('sigma_x_vM')}
assert not np.allclose(default.read_dataset(loc['y'],0),default.read_dataset(loc['x'],0))
def test_add_norm(self,default):
default.add_norm('F',1)
loc = {'F': default.get_dataset_location('F'),