Skip to content

Commit

Permalink
Two minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Aug 18, 2024
1 parent 8ce051b commit 4486fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions fluids/two_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2259,10 +2259,16 @@ def Lockhart_Martinelli(m, x, rhol, rhog, mul, mug, D, L=1.0, Re_c=2000.0):
C = 20.0

# Frictoin factor as in the original model
fd_l = 64./Re_l if Re_l < Re_c else 0.184*Re_l**-0.2
dP_l = fd_l*L/D*(0.5*rhol*v_l**2)
x_only_liquid_tol = 1e-30
x_only_vapor_tol = 1e-13
fd_g = 64./Re_g if Re_g < Re_c else 0.184*Re_g**-0.2
dP_g = fd_g*L/D*(0.5*rhog*v_g**2)
if x > 1 - x_only_vapor_tol:
return dP_g
fd_l = 64./Re_l if Re_l < Re_c else 0.184*Re_l**-0.2
dP_l = fd_l*L/D*(0.5*rhol*v_l**2)
if x < x_only_liquid_tol:
return dP_l

X = sqrt(dP_l/dP_g)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,8 +1338,8 @@ def test_circle_segment_h_from_A():
assert_close(circle_segment_h_from_A(D=20, A=137.113), 8.99999918630794, rtol=1e-13)

# Point at low area
assert_close(circle_segment_h_from_A(D=20, A=.006), 0.010042502885593678, rtol=1e-12)
assert_close(circle_segment_h_from_A(D=20, A=1e-20), 4.443057211031748e-08, rtol=1e-12)
assert_close(circle_segment_h_from_A(D=20, A=.006), 0.010042502885593678, rtol=1e-10)
assert_close(circle_segment_h_from_A(D=20, A=1e-20), 4.443057211031748e-08, rtol=1e-10)

# Special cases
assert circle_segment_h_from_A(0.0, 4.5) == 0.0
Expand Down

0 comments on commit 4486fc0

Please sign in to comment.