mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Limit relative roughness to avoid singularity in Haaland friction factor calculations
This commit is contained in:
@@ -54,12 +54,14 @@ ValueType haalandFormular(const ValueType& re,
|
|||||||
const Scalar diameter,
|
const Scalar diameter,
|
||||||
const Scalar roughness)
|
const Scalar roughness)
|
||||||
{
|
{
|
||||||
const ValueType value = -3.6 * log10(6.9 / re + std::pow(roughness / (3.7 * diameter), 10. / 9.) );
|
// Since we currently do not guard for high roughness values in input we can end up with unrealistic friction factors.
|
||||||
|
// In particular, there could be a singularity in f(Re) if 1 \in image(X) in log10(X) below. In calculations we therefore
|
||||||
// sqrt(1/f) should be non-positive
|
// limit the relative roughness to ensure the singularity never occurs in the relevant range (Re >= 4000).
|
||||||
assert(value >= 0.0);
|
assert( re >= 4000. );
|
||||||
|
constexpr Scalar MAX_REL_ROUGHNESS = 3.7 * std::pow((1.0 - 1.0e-6) - 6.9/4000.0, 9. / 10.);
|
||||||
return 1. / (value * value);
|
const Scalar rel_roughness = std::min(MAX_REL_ROUGHNESS, roughness/diameter);
|
||||||
|
const ValueType value = -3.6 * log10(6.9 / re + std::pow(rel_roughness / 3.7, 10. / 9.) );
|
||||||
|
return 1.0 / (value*value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// water in oil emulsion viscosity
|
// water in oil emulsion viscosity
|
||||||
|
|||||||
Reference in New Issue
Block a user