Skip to content

Commit

Permalink
Convert pressure_drop to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-nunn committed Nov 8, 2024
1 parent 2f067da commit 8c38f88
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 163 deletions.
176 changes: 161 additions & 15 deletions process/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
pfcoil_variables,
buildings_variables,
error_handling,
fw_module,
)
from process.utilities.f2py_string_patch import f2py_compatible_to_string
from process.coolprop_interface import FluidProperties
Expand Down Expand Up @@ -493,7 +494,7 @@ def primary_coolant_properties(self, output: bool):
"Calculated using mid temp(s) of system (or systems if use different collant types).",
)

# FW (or FW/BB)!!!!!!!!!!!!!!!!!!
# FW (or FW/BB)
if fwbs_variables.ipump == 1:
po.osubhd(self.outfile, "First Wall :")

Expand Down Expand Up @@ -543,7 +544,7 @@ def primary_coolant_properties(self, output: bool):
"OP ",
)

# BB !!!!!!!!!!!!!!!!!!!!!!!!!!!!
# BB
if fwbs_variables.ipump == 1:
po.osubhd(self.outfile, "Breeding Blanket :")

Expand Down Expand Up @@ -1270,11 +1271,11 @@ def liquid_breeder_properties(self, output: bool = False):

# Temporary - should be updated with information from Li reviews conducted at CCFE once completed
# Li Properties from [Mal1995] at 300 Celcius
# den_liq = 505 !! kg/m3
# specific_heat_liq = 4260 !! J kg-1 K-1
# thermal_conductivity_liq = 46 !! W m-1 K-1
# dynamic_viscosity_liq = 1.0D-6 !! m2 s-1
# electrical_conductivity_liq = 3.03D6 !! A V-1 m-1
# den_liq = 505 kg/m3
# specific_heat_liq = 4260 J kg-1 K-1
# thermal_conductivity_liq = 46 W m-1 K-1
# dynamic_viscosity_liq = 1.0D-6 m2 s-1
# electrical_conductivity_liq = 3.03D6 A V-1 m-1

# New from 'Application of lithium in systems of fusion reactors. 1. Physical and chemical properties of lithium'
# Lyublinski et al., 2009, Plasma Devicec and Operations
Expand Down Expand Up @@ -1923,7 +1924,7 @@ def thermo_hydraulic_model(self, output: bool):
self.outfile, "Summary of first wall and blanket thermohydraulics"
)

# FW !!!!!!!!!!!!!!!!!!!!!!!!!!!!
# FW
po.osubhd(self.outfile, "First wall: ")

po.ovarst(
Expand Down Expand Up @@ -1990,7 +1991,7 @@ def thermo_hydraulic_model(self, output: bool):
"OP ",
)

# BB !!!!!!!!!!!!!!!!!!!!!!!!!!!!
# BB
po.osubhd(self.outfile, "Breeding Blanket (primary): ")

po.ovarin(
Expand Down Expand Up @@ -2036,7 +2037,7 @@ def thermo_hydraulic_model(self, output: bool):
"OP ",
)

# BB Liquid Metal Breeder !!!!!!!
# BB Liquid Metal Breeder !
if fwbs_variables.icooldual > 0:
po.osubhd(self.outfile, "Breeding Blanket (breeder): ")

Expand Down Expand Up @@ -2082,7 +2083,7 @@ def thermo_hydraulic_model(self, output: bool):
"OP ",
)

# Pumping Power !!!!!!!!!!!!!!!!!!!!!!!!
# Pumping Power
po.osubhd(self.outfile, "Mechanical pumping power: ")

if fwbs_variables.ipump == 1:
Expand Down Expand Up @@ -2169,9 +2170,7 @@ def deltap_tot(
:param no180: Number of 180 degree bends in pipe
"""
# Friction - for all coolants
frict_drop = blanket_library.pressure_drop(
int(output),
self.outfile,
frict_drop = self.pressure_drop(
icoolpump,
no90,
no180,
Expand All @@ -2180,6 +2179,7 @@ def deltap_tot(
coolant_dynamic_viscosity,
flow_velocity,
label,
output=output,
)

if icoolpump == 2:
Expand Down Expand Up @@ -2216,6 +2216,152 @@ def deltap_tot(

return deltap_tot

def pressure_drop(
self,
i_ps: int,
num_90: float,
num_180: float,
l_pipe: float,
den: float,
vsc: float,
vv: float,
label: str,
output: bool = False,
):
"""Pressure drops are calculated for a pipe with a number of 90
and 180 degree bends. The pressure drop due to frictional forces along
the total straight length of the pipe is calculated, then the pressure
drop due to the bends is calculated. The total pressure drop is the sum
of all contributions.
original author: P. J. Knight, CCFE
moved from previous version of pumppower function by: G Graham, CCFE
:param i_ps: switch for primary or secondary coolant
:param num_90: number of 90 degree bends in the pipe
:param num_180: number of 180 degree bends in the pipe
:param l_pipe: total flow length along pipe (m)
:param den: coolant density (kg/m3)
:param vsc: coolant viscosity (Pa s)
:param vv: coolant flow velocity (m/s)
:param label: component name
:param output: boolean of whether to write data to output file
N.B Darcy-Weisbach Equation (straight pipe):
kstrght = lambda * L/D
pressure drop = kstrght * (rho*V^2)/2
lambda - Darcy friction factor, L - pipe length, D - hydraulic diameter,
rho - fluid density, V - fluid flow average velocity
This function also calculates pressure drop equations for elbow bends,
with modified coefficients.
N.B. Darcy friction factor is estimated from the Haaland approximation.
"""

# Calculate hydraulic dimater for round or retancular pipe (m)
dh = blanket_library.hydraulic_diameter(i_ps)

# Reynolds number
reyn = den * vv * dh / vsc

# Calculate Darcy friction factor
# N.B. friction function Uses Haaland approx. which assumes a filled circular pipe.
# Use dh which allows us to do fluid calculations for non-cicular tubes
# (dh is estimate appropriate for fully developed flow).
lamda = fw_module.friction(reyn)

# Pressure drop coefficient !!!!!

# Straight section
kstrght = lamda * l_pipe / dh

# In preveious version of pumppower:
# - elbow radius assumed = 0.018m for 90 degree elbow, from WCLL
# - elbow radius assumed half that of 90 deg case for 180 deg elbow
# Intialised value for afw is 0.006m, so elbow radius = 3 * afw,
# aka 1.5 * pipe diameter, which seems to be engineering standard for
# a steel pipe long-radius elbow (short-radius elbow = 2 * afw).

# If primary coolant...
if i_ps == 1:
elbow_radius = 3 * fwbs_variables.afw
# If secondary coolant...
else:
# See DCLL
elbow_radius = fwbs_variables.b_bz_liq

# 90 degree elbow pressure drop coefficient
kelbwn = blanket_library.elbow_coeff(elbow_radius, 90.0, lamda, dh)

# 180 degree elbow pressure drop coefficient
kelbwt = blanket_library.elbow_coeff(elbow_radius / 2, 180.0, lamda, dh)

# Total (Pa)
pdropstraight = kstrght * 0.5 * den * vv * vv
pdrop90 = num_90 * kelbwn * 0.5 * den * vv * vv
pdrop180 = num_180 * kelbwt * 0.5 * den * vv * vv

pressure_drop = pdropstraight + pdrop90 + pdrop180

if output:
po.osubhd(self.outfile, f"Pressure drop (friction) for {label}")
po.ovarre(self.outfile, "Reynolds number", "(reyn)", reyn, "OP ")
po.ovarre(self.outfile, "Darcy friction factor", "(lambda)", lamda, "OP ")
po.ovarre(
self.outfile,
"Pressure drop (Pa)",
"(pressure_drop)",
pressure_drop,
"OP ",
)
po.ocmmnt(self.outfile, "This is the sum of the following:")
po.ovarre(
self.outfile,
" Straight sections (Pa)",
"(pdropstraight)",
pdropstraight,
"OP ",
)
po.ovarre(
self.outfile,
" 90 degree bends (Pa)",
"(pdrop90)",
pdrop90,
"OP ",
)
po.ovarre(
self.outfile,
" 180 degree bends (Pa)",
"(pdrop180)",
pdrop180,
"OP ",
)

# TN: always write verbose stuff, it has no harm
po.ovarre(
self.outfile,
"Straight section pressure drop coefficient",
"(kstrght)",
kstrght,
"OP ",
)
po.ovarre(
self.outfile, "90 degree elbow coefficient", "(kelbwn)", kelbwn, "OP "
)
po.ovarre(
self.outfile,
"180 degree elbow coefficient coefficient",
"(kelbwt)",
kelbwt,
"OP ",
)

return pressure_drop

def pumppower(
self,
output,
Expand Down Expand Up @@ -2247,7 +2393,7 @@ def pumppower(
:param primary_coolant_switch: Switch for FW/blanket coolant, (1=He or 2=H2O) if icoolpump=1
:param coolant_density: Density of coolant or liquid breeder
"""
# Pumping power !!!!!!!!!!!!!!!!!
# Pumping power !

# Outlet pressure is 'pressure'
# Inlet pressure (Pa)
Expand Down
Loading

0 comments on commit 8c38f88

Please sign in to comment.