File: bend_rounded_Crane_plot.py

package info (click to toggle)
python-fluids 1.0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,384 kB
  • sloc: python: 59,459; f90: 1,033; javascript: 49; makefile: 47
file content (22 lines) | stat: -rw-r--r-- 824 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import UnivariateSpline

from fluids.fittings import bend_rounded_Crane_fds, bend_rounded_Crane_ratios
from fluids.optional.pychebfun import chebfun

ratios = np.linspace(1, 20, 1000)

bend_rounded_Crane_obj = UnivariateSpline(bend_rounded_Crane_ratios, bend_rounded_Crane_fds, s=0)
fun = chebfun(f=bend_rounded_Crane_obj, domain=[1,20], N=10)


plt.plot(bend_rounded_Crane_ratios, bend_rounded_Crane_fds, 'x', label='Crane data')
plt.plot(ratios, bend_rounded_Crane_obj(ratios), label='Cubic spline')
plt.plot(ratios, fun(ratios), label='Chebyshev approximation')

plt.legend()
plt.title("Interpolation of Crane ft multipliers for pipe bend losses")
plt.xlabel('Bend radius/pipe diameter ratio')
plt.ylabel('Friction factor multiplier')
#plt.show()