Added missing operators in const and Sutherland Transport: bug fix vanilla

This commit is contained in:
Hrvoje Jasak 2015-11-11 16:51:50 +00:00
parent 9b52ac2156
commit 5027a4fdce
4 changed files with 106 additions and 8 deletions

View file

@ -143,10 +143,13 @@ public:
// Member operators // Member operators
inline constTransport& operator= inline constTransport& operator=(const constTransport&);
(
const constTransport& inline void operator+=(const constTransport&);
);
inline void operator-=(const constTransport&);
inline void operator*=(const scalar);
// Friend operators // Friend operators

View file

@ -134,6 +134,52 @@ inline constTransport<thermo>& constTransport<thermo>::operator=
} }
template<class thermo>
inline void Foam::constTransport<thermo>::operator+=
(
const constTransport<thermo>& st
)
{
scalar molr1 = this->nMoles();
thermo::operator+=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
Mu = molr1*Mu + molr2*st.Mu;
rPr = 1.0/(molr1/rPr + molr2/st.rPr);
}
template<class thermo>
inline void Foam::constTransport<thermo>::operator-=
(
const constTransport<thermo>& st
)
{
scalar molr1 = this->nMoles();
thermo::operator-=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
Mu = molr1*Mu - molr2*st.Mu;
rPr = 1.0/(molr1/rPr - molr2/st.rPr);
}
template<class thermo>
inline void Foam::constTransport<thermo>::operator*=
(
const scalar s
)
{
thermo::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo> template<class thermo>

View file

@ -165,10 +165,13 @@ public:
// Member operators // Member operators
inline sutherlandTransport& operator= inline sutherlandTransport& operator=(const sutherlandTransport&);
(
const sutherlandTransport& inline void operator+=(const sutherlandTransport&);
);
inline void operator-=(const sutherlandTransport&);
inline void operator*=(const scalar);
// Friend operators // Friend operators

View file

@ -173,6 +173,52 @@ inline sutherlandTransport<thermo>& sutherlandTransport<thermo>::operator=
} }
template<class thermo>
inline void Foam::sutherlandTransport<thermo>::operator+=
(
const sutherlandTransport<thermo>& st
)
{
scalar molr1 = this->nMoles();
thermo::operator+=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
As = molr1*As + molr2*st.As;
Ts = molr1*Ts + molr2*st.Ts;
}
template<class thermo>
inline void Foam::sutherlandTransport<thermo>::operator-=
(
const sutherlandTransport<thermo>& st
)
{
scalar molr1 = this->nMoles();
thermo::operator-=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
As = molr1*As - molr2*st.As;
Ts = molr1*Ts - molr2*st.Ts;
}
template<class thermo>
inline void Foam::sutherlandTransport<thermo>::operator*=
(
const scalar s
)
{
thermo::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo> template<class thermo>