Skip to content

Commit 4802013

Browse files
authored
Merge pull request #5 from rydyb/90-degree-bends
adds pressure_drop for (90-degree) bend structures
2 parents 564cfa3 + c0a0a4e commit 4802013

File tree

9 files changed

+165
-57
lines changed

9 files changed

+165
-57
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "HeatTransferFluids"
22
uuid = "44505bb3-94ea-493c-a20c-f0ca548ab76b"
33
authors = ["Bodo Kaiser"]
4-
version = "0.1.1"
4+
version = "0.2.0"
55

66
[deps]
77
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"

src/HeatTransferFluids.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using DynamicQuantities
55
include("fluid.jl")
66
include("structure.jl")
77
include("flow.jl")
8+
include("friction.jl")
89
include("pressure_drop.jl")
910
include("heat_transfer.jl")
1011

src/flow.jl

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export reynolds_number, nusselt_number, prandtl_number
1+
export reynolds_number, nusselt_number, prandtl_number, dean_number
22

33
"""
44
reynolds_number(f::Fluid, t::Tube)
@@ -21,6 +21,32 @@ function reynolds_number(f::Fluid, t::Tube)
2121
return ustrip* v * D / μ)
2222
end
2323

24+
function critical_reynolds_number(t::Tube)
25+
return 2300
26+
end
27+
28+
"""
29+
pressure_drop(h::Helix)
30+
31+
Computes the critical Reynolds number for a Helix.
32+
33+
See VDI Heat Atlas, p. 1062 to 1063 for details.
34+
35+
# Arguments
36+
- `h::Helix`: the coiled tube through which the fluid flows
37+
38+
# Returns
39+
- `DynamicQuantity.AbstractQuantity`: the pressure drop of the fluid flowing through the tube
40+
"""
41+
function critical_reynolds_number(h::Helix)
42+
Dw = h.diameter
43+
H = h.pitch
44+
D = Dw * (1 + (H /* Dw))^2)
45+
d = h.tube.diameter
46+
47+
return ustrip(2300 * (1 + 8.6 * (d / D)^0.45))
48+
end
49+
2450
"""
2551
prandtl_number(f::Fluid)
2652
@@ -86,3 +112,12 @@ function nusselt_number_turbulent(f::Fluid, t::Tube)
86112

87113
return ((ξ / 8)Re * Pr) * (1 + λ^(2 / 3)) / (1 + 12.7/ 8)^(1 / 2) * (Pr^(2 / 3) - 1))
88114
end
115+
116+
function dean_number(f::Fluid, b::Bend)
117+
Re = reynolds_number(f, b.tube)
118+
119+
d = b.tube.diameter
120+
D = 2 * b.radius
121+
122+
return Re * (d / D)
123+
end

src/friction.jl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""
2+
pressure_drop(f::Fluid, t::Tube)
3+
4+
Computes the friction coefficient of a `fluid` flowing through a `tube`.
5+
6+
See VDI Heat Atlas, p. 1057 for details.
7+
8+
# Arguments
9+
- `f::Fluid`: the fluid flowing through the tube
10+
- `t::Tube`: the tube through which the fluid flows
11+
12+
# Keywords
13+
- `friction::Float`: the friction factor of the fluid flowing through the tube
14+
15+
# Returns
16+
- `DynamicQuantities.AbstractQuantity`: the pressure drop of the fluid flowing through the tube
17+
"""
18+
function friction(f::Fluid, t::Tube)
19+
Re = reynolds_number(f, t)
20+
Re_c = critical_reynolds_number(t)
21+
22+
# laminar regime
23+
if Re < Re_c
24+
return 64 / Re
25+
end
26+
# turbulent regime
27+
if Re > Re_c
28+
# Blasius equation
29+
if Re > 3000 && Re < 2e4
30+
return 0.316 / Re^0.25
31+
end
32+
# Hermann equation
33+
if Re > 2e4 && Re < 2e6
34+
return 0.0054 + 0.3964 / Re^0.3
35+
end
36+
end
37+
38+
throw(DomainError(Re, "no analytical formula for flow regime"))
39+
end
40+
41+
function friction(f::Fluid, b::Bend)
42+
De = dean_number(f, b)
43+
ξ = friction(f, b.tube)
44+
45+
# laminar flow as in straight tube
46+
if De < 11.6
47+
return ξ
48+
end
49+
# laminar flow with additional friction
50+
if De >= 11.6 && De <= 2000
51+
return ξ / (1 - (1 - (11.6 / De)^0.45)^(1 / 0.45))
52+
end
53+
54+
r = b.tube.diameter / 2
55+
R = b.radius
56+
57+
# turbulent flow
58+
Re_c = critical_reynolds_number(b.tube) * 7.5 * (r / R)^0.25
59+
Re = reynolds_number(f, b.tube)
60+
if Re > Re_c
61+
return (r / R)^0.5 * (0.003625 + 0.038 * (Re * (r / R)^2)^-0.25)
62+
end
63+
64+
throw(DomainError(De, "no analytical formula for flow regime"))
65+
end

src/pressure_drop.jl

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,36 @@ See VDI Heat Atlas, p. 1057 for details.
1717
# Returns
1818
- `DynamicQuantities.AbstractQuantity`: the pressure drop of the fluid flowing through the tube
1919
"""
20-
function pressure_drop(f::Fluid, t::Tube; friction = nothing)
20+
function pressure_drop(f::Fluid, t::Tube; friction = friction(f,t))
2121
Re = reynolds_number(f, t)
2222
L = t.length
2323
d = t.diameter
2424
ρ = f.density
2525
u = f.velocity
26-
27-
if friction === nothing
28-
ξ = 64 / Re
29-
else
30-
ξ = friction
31-
end
26+
ξ = friction
3227

3328
return uconvert(us"bar", ξ * (L / d) ** u^2 / 2))
3429
end
3530

3631
"""
37-
pressure_drop(f::Fluid, c::Coil)
38-
39-
Computes the pressure drop of a `fluid` flowing through a coiled tube.
32+
pressure_drop(f::Fluid, h::Helix)
4033
41-
See VDI Heat Atlas, p. 1062 to 1063 for details.
34+
Computes the pressure drop of a `fluid` flowing through a `helix`.
4235
4336
# Arguments
4437
- `f::Fluid`: the fluid flowing through the tube
45-
- `c::Coil`: the coiled tube through which the fluid flows
38+
- `h::Helix`: the helix through which the fluid flows
4639
4740
# Returns
4841
- `DynamicQuantity.AbstractQuantity`: the pressure drop of the fluid flowing through the tube
4942
"""
50-
function critical_reynolds_number(f::Fluid, h::Helix)
51-
Dw = h.diameter
52-
H = h.pitch
53-
D = Dw * (1 + (H /* Dw))^2)
54-
d = h.tube.diameter
55-
56-
return ustrip(2300 * (1 + 8.6 * (d / D)^0.45))
57-
end
58-
5943
function pressure_drop(f::Fluid, h::Helix)
6044
Dw = h.diameter
6145
H = h.pitch
6246
D = Dw * (1 + (H /* Dw))^2)
6347
d = h.tube.diameter
6448
Re = reynolds_number(f, h.tube)
65-
Re_crit = critical_reynolds_number(f, h)
49+
Re_crit = critical_reynolds_number(h)
6650

6751
if 1 < (Re * sqrt(d / D)) < (Re_crit * sqrt(d / D))
6852
ξ = (64 / Re) * (1 + 0.033(log10(Re * sqrt(d / D)))^4.0)
@@ -73,24 +57,6 @@ function pressure_drop(f::Fluid, h::Helix)
7357
return pressure_drop(f, h.tube, friction = ξ)
7458
end
7559

76-
"""
77-
function pressure_drop(f::Fluid, r::RectangularCoil; friction = nothing)
78-
Re = reynolds_number(f, r)
79-
L = r.length
80-
d = r.diameter
81-
ρ = r.density
82-
u = r.velocity
83-
ξb = r.friction
84-
n = r.turns
85-
86-
ptube = pressure_drop(f, r.tube; friction = friction)
87-
pbend = ξb*(ρ*u^2/2)
88-
return ustrip(ptube + n*4*pbend)
89-
90-
end
91-
92-
"""
93-
9460
"""
9561
pressure_drop(f::Fluid, v::Valve)
9662
@@ -114,3 +80,23 @@ function pressure_drop(f::Fluid, v::Valve)
11480

11581
return p₀ * (Q / Kv)^2 * ρ / ρ₀
11682
end
83+
84+
"""
85+
pressure_drop(f::Fluid, b::Bend)
86+
87+
Computes the pressure drop of a `fluid` flowing through a `bend`.
88+
89+
So far, we only support 90-degree bends, see Spedding, P.L., Bernard, E. and McNally, G.M., ‘Fluid flow through 90 degree bends’, Dev. Chem. Eng Mineral Process, 12: 107–128, 2004.
90+
91+
# Arguments
92+
- `f::Fluid`: the fluid flowing through the tube
93+
- `b::Bend`: the valve through which the fluid flows
94+
95+
# Returns
96+
- `DynamicQuantity.AbstractQuantity`: the pressure drop of the fluid flowing through the tube
97+
"""
98+
function pressure_drop(f::Fluid, b::Bend)
99+
@assert b.angle == 90u"deg" "only 90-degree bends are supported at the moment"
100+
101+
return pressure_drop(f, b.tube; friction=friction(f, b))
102+
end

src/structure.jl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export Structure, Tube, Helix, Valve
1+
export Structure, Tube, Helix, Valve, Bend, Elbow
22

33
"""
44
Structure
@@ -75,18 +75,19 @@ struct Valve{T<:AbstractQuantity} <: Structure
7575
end
7676
end
7777

78-
"""
79-
struct Rectangular_Coil{T<:Tube,V<:AbstractQuantity} <: Structure
80-
tube::T
81-
turns::V
82-
friction::V
83-
84-
function Rectangular_Coil(t::T; turns::V, friction::V) where {T,V}
85-
@assert dimension(turns) == dimension(u"") "turns must be dimensionless"
86-
@assert dimension(friction) == dimension(u"") "friction must be dimensionless"
87-
@assert ustrip(turns) > 0 "turns must be positive"
88-
@assert ustrip(friction) > 0 "friction must be positive"
89-
new{T,V}(t, turns, friction)
78+
struct Bend{T<:AbstractQuantity} <: Structure
79+
tube::Tube
80+
radius::T
81+
angle::T
82+
83+
function Bend(tube::Tube; radius::T, angle::T) where {T}
84+
@assert dimension(radius) == dimension(u"m") "radius must have units of length"
85+
@assert dimension(angle) == dimension(u"rad") "angle must have units of angle"
86+
@assert ustrip(radius) > 0 "radius must be positive"
87+
@assert angle > 0u"deg" "angle must be positive"
88+
@assert angle < 180u"deg" "angle must be less than 180 degrees"
89+
new{T}(tube, radius, angle)
9090
end
91+
end
9192

92-
"""
93+
Elbow(tube::Tube; radius::AbstractQuantity) = Bend(tube, radius = radius, angle = π / 2u"rad")

test/flow.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
@test nusselt_number(fluid, tube) 5 atol = 1
1616
end
1717

18+
@testset "dean_number" begin
19+
@test dean_number(fluid, Elbow(tube, radius = 10u"mm")) 1561 * (2.7 / 20) atol = 1
20+
end
21+
1822
end

test/pressure_drop.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@test pressure_drop(fluid, tube) 0.25u"bar" atol = 0.01u"bar"
88
@test pressure_drop(Water(velocity = 3u"m/s", temperature = 262.15u"K"), Tube(diameter = 5u"mm", length = 1u"m")) 0.25u"bar" atol = 0.3u"bar"
99
end
10-
10+
1111
@testset "coil" begin
1212
@test pressure_drop(fluid, Helix(tube, diameter = 63.1u"mm", pitch = 2.6u"mm")) 0.56u"bar" atol =
1313
0.01u"bar"
@@ -18,4 +18,8 @@
1818
0.0017u"bar" atol = 0.0001u"bar"
1919
end
2020

21+
@testset "bend" begin
22+
@test pressure_drop(fluid, Elbow(tube, radius = 10u"mm")) 0.7u"bar" atol = 0.1u"bar"
23+
end
24+
2125
end

test/structure.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,16 @@
2525
@test_throws AssertionError Valve(flow_rate = 10u"L/hr", flow_factor = 1.5u"m^2/hr")
2626
end
2727

28+
@testset "Bend" begin
29+
t = Elbow(tube, radius = 10u"mm")
30+
@test t.tube == tube
31+
@test t.radius == 10u"mm"
32+
@test t.angle == 90u"deg"
33+
34+
@test_throws AssertionError Elbow(tube, radius = 0u"mm")
35+
@test_throws AssertionError Elbow(tube, radius = -10u"mm")
36+
@test_throws AssertionError Bend(tube, radius = 10u"m", angle = 0u"deg")
37+
@test_throws AssertionError Bend(tube, radius = 10u"m", angle = 180u"deg")
38+
end
39+
2840
end

0 commit comments

Comments
 (0)