Tensor, SymmTensor: Simplified invariantII

Now the calculation of the 2nd-invariant is more efficient and
accumulates less round-off error.
This commit is contained in:
Henry Weller
2016-04-21 21:07:39 +01:00
parent 5f13806591
commit 9d0f4997d3
2 changed files with 4 additions and 14 deletions

View File

@ -659,13 +659,8 @@ inline Cmpt invariantII(const Tensor<Cmpt>& t)
{
return
(
0.5*sqr(tr(t))
- 0.5*
(
t.xx()*t.xx() + t.xy()*t.xy() + t.xz()*t.xz()
+ t.yx()*t.yx() + t.yy()*t.yy() + t.yz()*t.yz()
+ t.zx()*t.zx() + t.zy()*t.zy() + t.zz()*t.zz()
)
t.xx()*t.yy() + t.yy()*t.zz() + t.xx()*t.zz()
- t.xy()*t.yx() - t.yz()*t.zy() - t.xz()*t.zx()
);
}