Commit 2fa4c1b3 by Edward Andò

### geers parallelised

parent 03a90685
 ... @@ -370,11 +370,11 @@ class testAll(unittest.TestCase): ... @@ -370,11 +370,11 @@ class testAll(unittest.TestCase): displacements = (pointsDef - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements = (pointsDef - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements2D = (pointsDef2D - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) displacements2D = (pointsDef2D - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing, verbose=True) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D, verbose=False) ev = spam.deformation.decomposeFfield(Ffield, ["vol"])["vol"] ev = spam.deformation.decomposeFfield(Ffield, ["vol"], verbose=False)["vol"] ev2D = spam.deformation.decomposeFfield(Ffield2D, ["vol"])["vol"] ev2D = spam.deformation.decomposeFfield(Ffield2D, ["vol"], verbose=False)["vol"] self.assertAlmostEqual(ev.mean(), 3. * (dilation - 1), places=3) self.assertAlmostEqual(ev.mean(), 3. * (dilation - 1), places=3) self.assertAlmostEqual(ev2D.mean(), 2. * (dilation - 1), places=3) self.assertAlmostEqual(ev2D.mean(), 2. * (dilation - 1), places=3) ... @@ -386,7 +386,7 @@ class testAll(unittest.TestCase): ... @@ -386,7 +386,7 @@ class testAll(unittest.TestCase): # Deform the points by spreading them apart -- this is dilating so positive volumetric strain # Deform the points by spreading them apart -- this is dilating so positive volumetric strain displacements = (pointsRef * [zStretch, 1.0, 1.0] - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements = (pointsRef * [zStretch, 1.0, 1.0] - pointsRef).reshape(dims[0], dims[1], dims[2], 3) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing, verbose=False) # only compute on internal nodes, we know there's a problem at the edges # only compute on internal nodes, we know there's a problem at the edges self.assertAlmostEqual(Ffield[1:-1,1:-1,1:-1,0,0].mean(), zStretch, places=3) self.assertAlmostEqual(Ffield[1:-1,1:-1,1:-1,0,0].mean(), zStretch, places=3) ... @@ -401,8 +401,8 @@ class testAll(unittest.TestCase): ... @@ -401,8 +401,8 @@ class testAll(unittest.TestCase): # Deform the points by spreading them apart -- this is dilating so positive volumetric strain # Deform the points by spreading them apart -- this is dilating so positive volumetric strain displacements = (pointsRef * [1.0, yStretch, 1.0] - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements = (pointsRef * [1.0, yStretch, 1.0] - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements2D = (pointsRef2D * [1.0, yStretch, 1.0] - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) displacements2D = (pointsRef2D * [1.0, yStretch, 1.0] - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing, verbose=False) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D, verbose=False) # only compute on internal nodes, we know there's a problem at the edges # only compute on internal nodes, we know there's a problem at the edges self.assertAlmostEqual(Ffield[1:-1,1:-1,1:-1,0,0].mean(), 1.0, places=3) self.assertAlmostEqual(Ffield[1:-1,1:-1,1:-1,0,0].mean(), 1.0, places=3) ... @@ -433,12 +433,12 @@ class testAll(unittest.TestCase): ... @@ -433,12 +433,12 @@ class testAll(unittest.TestCase): displacements = (pointsRotated - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements = (pointsRotated - pointsRef).reshape(dims[0], dims[1], dims[2], 3) displacements2D = (pointsRotated2D - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) displacements2D = (pointsRotated2D - pointsRef2D).reshape(dims2D[0], dims2D[1], dims2D[2], 3) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing) Ffield = spam.deformation.FfieldRegularGeers(displacements, nodeSpacing, verbose=False) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D) Ffield2D = spam.deformation.FfieldRegularGeers(displacements2D, nodeSpacing2D, verbose=False) # Compute strains # Compute strains decomposedF = spam.deformation.decomposeFfield(Ffield, ["r", "vol", "dev"]) decomposedF = spam.deformation.decomposeFfield(Ffield, ["r", "vol", "dev"], verbose=False) decomposedF2D = spam.deformation.decomposeFfield(Ffield2D, ["r", "vol", "dev"]) decomposedF2D = spam.deformation.decomposeFfield(Ffield2D, ["r", "vol", "dev"], verbose=False) self.assertAlmostEqual(decomposedF['r'][1:-1,1:-1,1:-1, 0].mean(), rotAngle, places=3) self.assertAlmostEqual(decomposedF['r'][1:-1,1:-1,1:-1, 0].mean(), rotAngle, places=3) self.assertAlmostEqual(decomposedF['r'][1:-1,1:-1,1:-1, 1].mean(), 0.0, places=3) self.assertAlmostEqual(decomposedF['r'][1:-1,1:-1,1:-1, 1].mean(), 0.0, places=3) ... @@ -555,6 +555,7 @@ class testAll(unittest.TestCase): ... @@ -555,6 +555,7 @@ class testAll(unittest.TestCase): self.assertEqual(numpy.isnan(Ffield[:,:,:,2,2]).sum(), 1) self.assertEqual(numpy.isnan(Ffield[:,:,:,2,2]).sum(), 1) self.assertEqual(numpy.isnan(Ffield2D[:,:,:,2,2]).sum(), 1) self.assertEqual(numpy.isnan(Ffield2D[:,:,:,2,2]).sum(), 1) def test_bagiStrain(self): def test_bagiStrain(self): ####################################################### ####################################################### # Check triangulation and strains # Check triangulation and strains ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!