在上面的方程中,我要解f,并传入Re,D和epsilon。下面是我的代码:
import math
from scipy.optimize import fsolve
# Colebrook Turbulent Friction Factor Correlation
def colebrook(Re, D, eps):
return fsolve(-(1 / math.sqrt(f)) - 2 * math.log10(((eps / D) / 3.7) + (2.51 / Re * math.sqrt(f))), f)
我会使用fsolve()还是solve()?我在Python的主站点上阅读了fsolve(),但是我不理解它想要的一些输入。提前谢谢!你知道吗
另外,我正在使用Spyder(Python3.6)
wikipedia page on "Darcy friction factor formulae"在Colebrook equation上有一个部分,它展示了如何使用Lambert W function用其他参数来表示f。你知道吗
SciPy has an implementation of the Lambert W function,因此您可以使用它来计算f,而不必使用数值解算器:
例如
作为比较,https://www.engineeringtoolbox.com/colebrook-equation-d_1031.html处的计算器给出0.0197。你知道吗
相关问题 更多 >
编程相关推荐