Skip to content

Commit

Permalink
Convert flow_velocity to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-nunn committed Nov 6, 2024
1 parent e3e3650 commit d772de4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 42 deletions.
24 changes: 24 additions & 0 deletions process/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,30 @@ def blanket_mod_pol_height(self):
0.5 * ptor * (1.0 - fwbs_variables.fdiv) / fwbs_variables.nblktmodpo
)

def flow_velocity(self, i_channel_shape, mass_flow_rate, flow_density):
"""Calculate the coolant flow velocity (m/s) for given pipe mass flow rate and pipe size/shape.
N.B. Assumed that primary BB and FW coolants have same pipe radius (= afw).
author: G. Graham, CCFE
:param i_channel_shape: Switch for circular or rectangular channel crossection.
Shape depends on whether primary or secondary coolant.
1: circle (primary)
2: rectangle (secondary)
:param mass_flow_rate: Coolant mass flow rate per pipe (kg/s)
:param flow_density: Coolant density
"""

if i_channel_shape == 1:
return mass_flow_rate / (
flow_density * np.pi * fwbs_variables.afw * fwbs_variables.afw
)

# If secondary coolant then rectangular channels assumed
if i_channel_shape == 2:
return mass_flow_rate / (
flow_density * fwbs_variables.a_bz_liq * fwbs_variables.b_bz_liq
)

def thermo_hydraulic_model(self, output: bool):
"""
Thermo-hydraulic model for first wall and blanket
Expand Down
42 changes: 0 additions & 42 deletions source/fortran/blanket_library.f90
Original file line number Diff line number Diff line change
Expand Up @@ -197,48 +197,6 @@ end subroutine init_blanket_library
!!! - pumppower
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

function flow_velocity(i_channel_shape, mass_flow_rate, flow_density)

!! Calculate the coolant flow velocity (m/s) for given pipe mass flow rate and pipe size/shape.
!! N.B. Assumed that primary BB and FW coolants have same pipe radius (= afw).
!! author: G. Graham, CCFE
!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

use fwbs_variables, only: afw, a_bz_liq, b_bz_liq
use constants, only: pi

implicit none

!! Function return parameter !!!!!

real(dp) :: flow_velocity

!! Arguments !!!!!!!!!!!!!!!!!!!!!

!! Swicth for circular or rectangular channel crossection.
!! Shape depends on whether primary or secondary coolant.
!! - =1 circle (primary)
!! - =2 rectangle (secondary)
integer, intent(in) :: i_channel_shape

!! Coolant mass flow rate per pipe (kg/s)
real(dp), intent(in) :: mass_flow_rate

!! Coolant density
real(dp), intent(in) :: flow_density

!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!! If primary coolant then circular channels assumed
if (i_channel_shape==1) flow_velocity = mass_flow_rate / (flow_density*pi*afw*afw)

!! If secondary coolant then rectangular channels assumed
if (i_channel_shape==2) flow_velocity = mass_flow_rate / (flow_density * a_bz_liq * b_bz_liq)

end function flow_velocity

!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine liquid_breeder_properties(ip, ofile)

!! Calculates the fluid properties of the Liquid Metal Breeder/Coolant in the Blanket BZ
Expand Down

0 comments on commit d772de4

Please sign in to comment.