Skip to content

Class: TypeOfFlow

The TypeOfFlow class determines the type of fluid flow based on the Reynolds number (Re).
It is part of the ProcessPI Calculations module and inherits from CalculationBase.


๐Ÿ“– Description

The flow regime describes how fluid moves through a pipe or channel.
It is classified into Laminar, Transitional, or Turbulent flow, depending on the Reynolds number.

  • Laminar Flow โ†’ Smooth, orderly flow with little mixing (Re < 2000)
  • Transitional Flow โ†’ Unstable regime, switching between laminar & turbulent (2000 โ‰ค Re โ‰ค 4000)
  • Turbulent Flow โ†’ Chaotic, highly mixed flow (Re > 4000)

๐Ÿ“Š Formula / Criteria

The classification is based on the Reynolds number:

\[ Re = \frac{\rho \cdot v \cdot D}{\mu} \]

Where:

Symbol Description Units
\( Re \) Reynolds number โ€“ (dimensionless)
\( \rho \) Fluid density kg/mยณ
\( v \) Fluid velocity m/s
\( D \) Pipe diameter m
\( \mu \) Dynamic viscosity Paยทs

โš™๏ธ Inputs

  • reynolds_number โ†’ Reynolds number (dimensionless)

๐Ÿ“ค Output

Returns a StringUnit object containing the determined flow type:
- "Laminar"
- "Transitional"
- "Turbulent"


๐Ÿ› ๏ธ Methods

validate_inputs()
Ensures the required input reynolds_number is provided.
Raises ValueError if missing.


calculate()
Classifies the flow regime based on Reynolds number:

  • If Re < 2000 โ†’ "Laminar"
  • If 2000 โ‰ค Re โ‰ค 4000 โ†’ "Transitional"
  • If Re > 4000 โ†’ "Turbulent"

Returns:
StringUnit: The computed flow type.


๐Ÿ’ป Example Usage

Using the TypeOfFlow

from processpi.calculations import TypeOfFlow
from processpi.units import Dimensionless

# Example Reynolds number
Re = Dimensionless(3500)

# Create calculation instance
flow_calc = TypeOfFlow(reynolds_number=Re)

# Perform calculation
flow_type = flow_calc.calculate()

print(f"Flow Type: {flow_type}")

**Using the CalculationEngine

from processpi.engine import CalculationEngine
from processpi.units import Dimensionless

# Initialize engine
engine = CalculationEngine()

# Example Reynolds number
Re = Dimensionless(3500)

# Perform flow type classification using the engine
flow_type = engine.calculate(
    "type_of_flow",
    reynolds_number=Re
)

print(f"Flow Type (via Engine): {flow_type}")