When calling a PC-SAFT mixture with a quadrupolar component and calling the quadrupolar component with molefrac[i] = 0.0
the alphar function returns "NaN".
auto eval(const TTYPE& T, const RhoType& rho_A3, const EtaType& eta, const VecType& mole_fractions) const {
auto alpha2 = get_alpha2QQ(T, rho_A3, eta, mole_fractions);
auto alpha3 = get_alpha3QQ(T, rho_A3, eta, mole_fractions);
- auto alpha = forceeval(alpha2/(1.0-alpha3/alpha2)); // <-- problematic line
+ auto alpha = (alpha2 == 0.0) ? 0.0 : forceeval(alpha2/(1.0 - alpha3/alpha2)); <-- suggested fix
using alpha2_t = decltype(alpha2);
using alpha3_t = decltype(alpha3);
using alpha_t = decltype(alpha);
struct QuadrupolarContributionTerms{
alpha2_t alpha2;
alpha3_t alpha3;
alpha_t alpha;
};
return QuadrupolarContributionTerms{alpha2, alpha3, alpha};
}
If alpha2 and alpha3 are zero, we need the ternary to return just zero.
Hey everyone,
When calling a PC-SAFT mixture with a quadrupolar component and calling the quadrupolar component with molefrac[i] = 0.0
the alphar function returns "NaN".
The causes lies in:
If alpha2 and alpha3 are zero, we need the ternary to return just zero.
Sven