Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- THIS CODE IS BROUGHT TO YOU FROM FELLOW REDDITR BEKOSS
- colebrookMoody[f_, ReD_, epsD_] :=
- 1/(f^(1/2)) + 2.0 Log10[(epsD)/3.7 + 2.51/(ReD f^(1/2))]
- f[ReD_, epsD_] :=
- FindRoot[colebrookMoody[x, ReD, epsD] == 0, {x, 0.01}][[1, 2]]
- ReDValues = Range[10^3, 10^8, 10000];
- fValuesLaminar = If[# <= 2300, 64/#, Indeterminate] & /@ ReDValues;
- fValues = f[#, 0.000001] & /@ ReDValues;
- fValues2 = f[#, 0.000005] & /@ ReDValues;
- fValues3 = f[#, 0.00001] & /@ ReDValues;
- fValues4 = f[#, 0.00005] & /@ ReDValues;
- fValues5 = f[#, 0.0001] & /@ ReDValues;
- fValues6 = f[#, 0.0002] & /@ ReDValues;
- fValues7 = f[#, 0.0004] & /@ ReDValues;
- fValues8 = f[#, 0.0008] & /@ ReDValues;
- fValues9 = f[#, 0.001] & /@ ReDValues;
- fValues10 = f[#, 0.002] & /@ ReDValues;
- fValues11 = f[#, 0.004] & /@ ReDValues;
- fValues12 = f[#, 0.006] & /@ ReDValues;
- fValues13 = f[#, 0.008] & /@ ReDValues;
- fValues14 = f[#, 0.01] & /@ ReDValues;
- fValues15 = f[#, 0.015] & /@ ReDValues;
- fValues16 = f[#, 0.02] & /@ ReDValues;
- fValues17 = f[#, 0.03] & /@ ReDValues;
- fValues18 = f[#, 0.04] & /@ ReDValues;
- fValues19 = f[#, 0.05] & /@ ReDValues;
- dataLaminar = Transpose[{ReDValues, fValuesLaminar}];
- data = Transpose[{ReDValues, fValues}];
- data2 = Transpose[{ReDValues, fValues2}];
- data3 = Transpose[{ReDValues, fValues3}];
- data4 = Transpose[{ReDValues, fValues4}];
- data5 = Transpose[{ReDValues, fValues5}];
- data6 = Transpose[{ReDValues, fValues6}];
- data7 = Transpose[{ReDValues, fValues7}];
- data8 = Transpose[{ReDValues, fValues8}];
- data9 = Transpose[{ReDValues, fValues9}];
- data10 = Transpose[{ReDValues, fValues10}];
- data11 = Transpose[{ReDValues, fValues11}];
- data12 = Transpose[{ReDValues, fValues12}];
- data13 = Transpose[{ReDValues, fValues13}];
- data14 = Transpose[{ReDValues, fValues14}];
- data15 = Transpose[{ReDValues, fValues15}];
- data16 = Transpose[{ReDValues, fValues16}];
- data17 = Transpose[{ReDValues, fValues17}];
- data18 = Transpose[{ReDValues, fValues18}];
- data19 = Transpose[{ReDValues, fValues19}];
- graph0 =
- ListPlot[dataLaminar,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for Laminar flow case",
- PlotStyle -> Red, PlotLegends -> "Laminar Flow",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph1 =
- ListPlot[data,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotStyle -> Blue, PlotLegends -> "Turbulent Flow",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph2 =
- ListPlot[data2,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph3 =
- ListPlot[data3,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph4 =
- ListPlot[data4,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph5 =
- ListPlot[data5,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph6 =
- ListPlot[data6,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph7 =
- ListPlot[data7,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph8 =
- ListPlot[data8,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph9 =
- ListPlot[data9,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph10 =
- ListPlot[data10,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph11 =
- ListPlot[data11,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph12 =
- ListPlot[data12,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph13 =
- ListPlot[data13,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph14 =
- ListPlot[data14,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph15 =
- ListPlot[data15,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph16 =
- ListPlot[data16,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph17 =
- ListPlot[data17,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph18 =
- ListPlot[data18,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- graph19 =
- ListPlot[data19,
- AxesLabel -> {"Reynolds Number", "Darcy Friction Factor"},
- PlotLabel -> "Colebrook-Moody Equation for epsD set",
- PlotRange -> {{10^3, 10^8}, {0.008, 0.1}},
- ScalingFunctions -> {"Log", "Linear"}]
- Show[graph0, graph1, graph2, graph3, graph4, graph5, graph6, graph7, \
- graph8, graph9, graph10, graph11, graph12, graph13, graph14, graph15, \
- graph16, graph17, graph18, graph19]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement