pyskyfire.common.friction

Duct friction physics shared by cooling channels and piping.

This module is deliberately geometry-agnostic. Every entry point takes plain scalars – a Reynolds number, a hydraulic diameter, an absolute roughness, a signed radius of curvature – so the same physics serves a regen cooling channel marching on an axial coordinate and a pipe run marching on arc length. Anything that knows about contours, centerlines or stations belongs elsewhere.

Two interchangeable backends are provided:

"native"

The correlations pyskyfire has always used, inherited from the RL10 modelling work of Binder et al. Laminar 64/Re, Petukhov (smooth) or Colebrook-White (rough) in the turbulent branch, linearly blended across 2300 < Re < 3500, with an Ito-type curvature multiplier.

"fluids"

The same quantities taken from the fluids library. The straight-duct factor blends the laminar and Clamond branches smoothly from Re=2040; curved ducts use the same transition policy starting at Schmidt’s curvature-dependent critical Reynolds number. The curvature multiplier is the ratio of the blended Schmidt curved factor to the blended straight factor, with the same roughness in both.

The native backend remains the default for validation while the fluids backend is evaluated. Comparing them measures model sensitivity; it does not establish a bound on modelling uncertainty.

Notes

Both curvature multipliers are helical-coil correlations. They model curvature as an enhanced local wall friction over a continuously curved duct, which fits a cooling channel bending gently over many diameters. They are not a model for a discrete pipe bend, where the loss is set by secondary-flow development and its decay downstream. Use a fitting loss coefficient for those.

Attributes

Exceptions

FrictionCorrelationWarning

A friction correlation is being extrapolated beyond a documented limit.

Functions

annulus_laminar_factor(radius_ratio)

Return a concentric annulus' laminar f*Re relative to a pipe's 64.

curvature_multiplier(ReDh, Dh, R_curv, *[, roughness, ...])

Return the friction multiplier due to streamwise curvature.

darcy_friction_factor(ReDh, Dh[, roughness, model, ...])

Return the Darcy friction factor for a straight duct.

friction_pressure_gradient(ReDh, Dh, rho, velocity, *)

Return the irreversible pressure gradient dp/ds [Pa m⁻¹].

resolve_friction_model(model)

Return a validated backend name.

transition_weight(Re, Re_critical)

Return the shared laminar-to-turbulent blending weight.

Module Contents

pyskyfire.common.friction.annulus_laminar_factor(radius_ratio)

Return a concentric annulus’ laminar f*Re relative to a pipe’s 64.

The exact fully developed solution on the hydraulic diameter 2*(r_o - r_i) is f*Re = 64*(1-k)**2 / (1 + k**2 + (1-k**2)/ln k) with k = r_i/r_o. It runs from 1 for a pipe (k = 0) to 1.5 for parallel plates (k -> 1). Turbulent friction on the same hydraulic diameter differs from a pipe’s by only a few percent and is not corrected.

Parameters:
radius_ratiofloat

Inner over outer radius, in [0, 1].

Returns:
float

Multiplier on the laminar 64/Re.

pyskyfire.common.friction.curvature_multiplier(ReDh, Dh, R_curv, *, roughness=0.0, model='native')

Return the friction multiplier due to streamwise curvature.

Parameters:
ReDhfloat

Reynolds number on the hydraulic diameter.

Dhfloat

Hydraulic diameter [m].

R_curvfloat

Signed radius of curvature of the duct centerline [m]. Use np.inf for a straight duct. The native backend ignores the sign; so does the fluids backend.

roughnessfloat, optional

Absolute wall roughness [m]. Zero or None means smooth. Used in both factors of the fluids curved/straight ratio; ignored by the native curvature correlation. Use the same value as for the straight factor being multiplied.

model{‘native’, ‘fluids’}, optional

Backend to evaluate. Default 'native'.

Returns:
float

Multiplier on the straight-duct Darcy factor. Exactly 1.0 for a straight duct; native also returns one below its activation threshold.

Warns:
FrictionCorrelationWarning

For the fluids curved model, when ReDh <= 100, ReDh > 150000, or Dh/(2*abs(R_curv)) >= 0.14. The last limit is the recommendation for the Schmidt transition criterion; upstream does not specify a separate curvature range for the friction fits. Extrapolated results are returned without clipping or model switching.

Notes

Limits are from the fluids.friction documentation for helical_laminar_fd_Schmidt, helical_turbulent_fd_Schmidt and helical_transition_Re_Schmidt. These warnings concern the coil models, not straight-pipe Colebrook numerical accuracy or two-phase validity.

pyskyfire.common.friction.darcy_friction_factor(ReDh, Dh, roughness=0.0, *, model='native', laminar_factor=1.0)

Return the Darcy friction factor for a straight duct.

Parameters:
ReDhfloat

Reynolds number on the hydraulic diameter.

Dhfloat

Hydraulic diameter [m].

roughnessfloat, optional

Absolute wall roughness [m]. Zero or None means hydraulically smooth. Default 0.

model{‘native’, ‘fluids’}, optional

Backend to evaluate. Default 'native'.

laminar_factorfloat, optional

Multiplier on the laminar branch’s 64/Re for a non-circular section, such as annulus_laminar_factor(). Default 1.

Returns:
float

Darcy friction factor (dimensionless).

pyskyfire.common.friction.friction_pressure_gradient(ReDh, Dh, rho, velocity, *, roughness=0.0, R_curv=np.inf, curvature_correction=True, model='native')

Return the irreversible pressure gradient dp/ds [Pa m⁻¹].

This is the friction term of the one-dimensional momentum equation only. The reversible acceleration term -rho u du/ds depends on the state at both ends of a segment rather than on a local gradient, so the caller applies it while marching.

Parameters:
ReDhfloat

Reynolds number on the hydraulic diameter.

Dhfloat

Hydraulic diameter [m].

rhofloat

Bulk density [kg m⁻³].

velocityfloat

Bulk velocity [m s⁻¹].

roughnessfloat, optional

Absolute wall roughness [m]. Default 0.

R_curvfloat, optional

Signed radius of curvature [m]. Default np.inf (straight).

curvature_correctionbool, optional

Apply curvature_multiplier(). Default True.

model{‘native’, ‘fluids’}, optional

Backend to evaluate. Default 'native'.

Returns:
float

Pressure gradient with respect to arc length [Pa m⁻¹]. Negative for flow in the positive arc-length direction.

pyskyfire.common.friction.resolve_friction_model(model)

Return a validated backend name.

Parameters:
modelstr

Backend name, case-insensitive. One of FRICTION_MODELS.

Returns:
str

The normalized (lower-case) backend name.

Raises:
ValueError

If model is not a recognized backend.

pyskyfire.common.friction.transition_weight(Re, Re_critical)

Return the shared laminar-to-turbulent blending weight.

The weight is zero through Re_critical and one from Re_critical * (3500/2300) onward. Between those limits it follows the cubic smoothstep 3*x**2 - 2*x**3, giving continuous values and first derivatives where the pure laminar and turbulent branches are joined.

The fixed critical value 2040 is used for straight ducts. Curved ducts supply Schmidt’s geometry-dependent critical Reynolds number.

Parameters:
Refloat

Reynolds number.

Re_criticalfloat

Reynolds number at the start of transition.

Returns:
float

Turbulent-branch weight in the closed interval [0, 1].

pyskyfire.common.friction.FRICTION_MODELS = ('native', 'fluids')
pyskyfire.common.friction.ReDh_laminar = 2300
pyskyfire.common.friction.ReDh_turbulent = 3500