Commit 9d0f4997 authored by Henry Weller's avatar Henry Weller
Browse files

Tensor, SymmTensor: Simplified invariantII

Now the calculation of the 2nd-invariant is more efficient and
accumulates less round-off error.
parent 5f138065
......@@ -404,13 +404,8 @@ inline Cmpt invariantII(const SymmTensor<Cmpt>& st)
{
return
(
0.5*sqr(tr(st))
- 0.5*
(
st.xx()*st.xx() + st.xy()*st.xy() + st.xz()*st.xz()
+ st.xy()*st.xy() + st.yy()*st.yy() + st.yz()*st.yz()
+ st.xz()*st.xz() + st.yz()*st.yz() + st.zz()*st.zz()
)
st.xx()*st.yy() + st.yy()*st.zz() + st.xx()*st.zz()
- sqr(st.xy()) - sqr(st.yz()) - sqr(st.xz())
);
}
......
......@@ -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()
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment