Skip to content
Snippets Groups Projects
Commit d179eea4 authored by Henry's avatar Henry
Browse files

constTransport: Handle the case of nMoles = 0 in += and -= operators

Resolves bug-report http://openfoam.org/mantisbt/view.php?id=1348
parent 6cb5391c
Branches
Tags
No related merge requests found
......@@ -153,11 +153,14 @@ inline void Foam::constTransport<Thermo>::operator+=
Thermo::operator+=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
if (mag(molr1) + mag(st.nMoles()) > SMALL)
{
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
mu_ = molr1*mu_ + molr2*st.mu_;
rPr_ = 1.0/(molr1/rPr_ + molr2/st.rPr_);
mu_ = molr1*mu_ + molr2*st.mu_;
rPr_ = 1.0/(molr1/rPr_ + molr2/st.rPr_);
}
}
......@@ -171,11 +174,14 @@ inline void Foam::constTransport<Thermo>::operator-=
Thermo::operator-=(st);
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
if (mag(molr1) + mag(st.nMoles()) > SMALL)
{
molr1 /= this->nMoles();
scalar molr2 = st.nMoles()/this->nMoles();
mu_ = molr1*mu_ - molr2*st.mu_;
rPr_ = 1.0/(molr1/rPr_ - molr2/st.rPr_);
mu_ = molr1*mu_ - molr2*st.mu_;
rPr_ = 1.0/(molr1/rPr_ - molr2/st.rPr_);
}
}
......
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