function coeficienteAtrito input Real Re; input Real epsilon; output Real f; protected Real s, sl; parameter Real erro = 0.0001; parameter Real eps = 100.0; algorithm f := 0.02; s := 1 / sqrt(f); sl := 10000; while abs(s - sl) > erro loop sl := s; s := -2 * log10(epsilon / 3.7 + 2.51 / Re * s); end while; f := if Re > 2000 then 1 / s ^ 2 else if Re <> 0 then 64 / Re else 0.1; annotation(Diagram(coordinateSystem(extent = {{-148.5, -105}, {148.5, 105}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5}))); end coeficienteAtrito;