mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -404,13 +404,8 @@ inline Cmpt invariantII(const SymmTensor<Cmpt>& st)
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
0.5*sqr(tr(st))
|
st.xx()*st.yy() + st.yy()*st.zz() + st.xx()*st.zz()
|
||||||
- 0.5*
|
- sqr(st.xy()) - sqr(st.yz()) - sqr(st.xz())
|
||||||
(
|
|
||||||
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()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -659,13 +659,8 @@ inline Cmpt invariantII(const Tensor<Cmpt>& t)
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
0.5*sqr(tr(t))
|
t.xx()*t.yy() + t.yy()*t.zz() + t.xx()*t.zz()
|
||||||
- 0.5*
|
- t.xy()*t.yx() - t.yz()*t.zy() - t.xz()*t.zx()
|
||||||
(
|
|
||||||
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()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user