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
|
||||
(
|
||||
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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user