mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
specieThermo: Add guard in K(T) to protect against 0 moles in composition
This commit is contained in:
@ -297,18 +297,25 @@ Foam::species::thermo<Thermo, Type>::A(const scalar p, const scalar T) const
|
|||||||
template<class Thermo, template<class> class Type>
|
template<class Thermo, template<class> class Type>
|
||||||
inline Foam::scalar
|
inline Foam::scalar
|
||||||
Foam::species::thermo<Thermo, Type>::K(const scalar p, const scalar T) const
|
Foam::species::thermo<Thermo, Type>::K(const scalar p, const scalar T) const
|
||||||
|
{
|
||||||
|
if (equal(this->nMoles(), SMALL))
|
||||||
|
{
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
scalar arg = -this->nMoles()*this->g(p, T)/(this->RR*T);
|
scalar arg = -this->nMoles()*this->g(p, T)/(this->RR*T);
|
||||||
|
|
||||||
if (arg < 600.0)
|
if (arg < 600.0)
|
||||||
{
|
{
|
||||||
return ::exp(arg);
|
return exp(arg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return VGREAT;
|
return VGREAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Thermo, template<class> class Type>
|
template<class Thermo, template<class> class Type>
|
||||||
|
|||||||
Reference in New Issue
Block a user