c3d / db48x

RPL runtime for the DM42 calculator, in the spirit of HP48/49/50
http://48calc.org
GNU Lesser General Public License v3.0
111 stars 13 forks source link

Equs in "Flow In Full Pipe" require the FANNING & DARCY functions (Low priority) #1142

Open Wiljea opened 2 months ago

Wiljea commented 2 months ago

Finally all the eqns in "FLUIDS" do work as expected in the HP50G with their respective units and prescribed values. But some eqns in the last section "Flow In Full Pipe" require: 1) the FANNING(x1, x2) function to calculate the FANNING friction factor of the fluid flow. See HP50G_AUR.pdf 3-84. 2) the DARCY(x1, x2) function to calculate the Darcy friction factor of the fluid flow. See HP50G_AUR.pdf 3-49. In the SOLVER, a factor f appears as being implicitly calculated (no input is necessary from the user) and is probably the output of the FANNING eqn. It is not clear if both eqns are required here, but it is probable. The way the calculator HP50G proceeds internally remains unclear. This is strange and similar to the function SIDENS case (see issue #1141). Another strange fact is this absolute roughness coefficient ϵ_in which is defined as a variable in both the HP50G and the manual but here it is completely absent from all actual eqns! The user has to input its prescribed value but what the calculator does with it remains a complete mystery.

Wiljea commented 2 months ago

COMPLETE SOLUTION of this issue:

Searching the Web for the reference 6: Serghides, T. K. “Estimate Friction Factor Accurately,” In Chemical Engineering, Mar. 5, 1984.

which remains unreachable, I instead found the links http://www.idrologia.unimore.it/pizzileo/web-archive/af/lezione1/Darcy%20friction%20factor%20formulae.pdf and https://en.wikipedia.org/wiki/Darcy_friction_factor_formulae

Which gives the following information and formulas: "It is also known as the Darcy-Weisbach friction factor, resistance coefficient or  simply friction factor and is four times larger than the Fanning friction factor."

Therefore, the Fanning Factor f and the Darcy Weisbach Factor fD are related by: f = (1/4)۰fD and are both function of the Relative Roughness ϵ/D (D being the inner pipe diameter with the same dimension as ϵ) and the Reynold Number Re For Re > 2100 (transitional and turbulent flow) the solution is (attributed to ref 6):

if Re > 2100; f^(-1/2) = 4.781 - ((Ψ1 - 4.781)^2/(Ψ2 - 2۰Ψ1 + 4.781)) Ψ1 = -2۰log((ϵ/D)/3.7 + 12/Re) Ψ2 = -2۰log((ϵ/D)/3.7 + 2.51۰Ψ1/Re)

And for laminar flow Re ≤ 2100, the reference 9: Welty, Wicks, and Wilson. Fundamentals of Momentum, Heat and Mass Transfer. John Wiley & Sons, 1969. indicates that "the friction factor is not a function of pipe roughness for values of Re < 2300, but varies only with the Reynolds number". With the following Relation (valid for round tubes):

if Re ≤ 2100; f = 16/Re

To conclude, the 2 solutions are now complete to produce both functions in db48x in accordance with the requirements of the HP50G Library Equation: fD = darcy(ϵ/D; Re) = 4۰f f = fanning(ϵ/D; Re) is calculated by the formulas given above.

The issue will be closed by implementing these formulas and in the db48x, and an explicit call to this function is required to calculate the factor f and a line will be added to that effect.

Wiljea commented 2 months ago

Either the developer defines the function FANNING((ϵ_m)/(D_m); Reynolds) internally or I calculate them directly in the Equation Library. The function is:

FANNING((ϵ_m)/(D_m); Reynolds) = IFTE(Reynolds ≤ 2100 ; 16/Reynolds; (4.781 - ((-2۰log(((ϵ_m)/(D_m))/3.7 + 12/Reynolds) - 4.781)^2/((-2۰log(((ϵ_m)/(D_m))/3.7 + 2.51۰(-2۰log(((ϵ_m)/(D_m))/3.7 + 12/Reynolds))/Reynolds)) - 2۰(-2۰log(((ϵ_m)/(D_m))/3.7 + 12/Reynolds)) + 4.781)))^-2)

DARCY((ϵ_m)/(D_m); Reynolds) = 4۰FANNING((ϵ_m)/(D_m); Reynolds)

Note that even if the DARCY function is supposedly defined in the HP50G (see HP50G_AUR p. 3-49), its explicit use appears nowhere in the Equation Library, only the FANNING function is invoked.