The medium submodule
Fluid medium properties and shared unit infrastructure.
This module defines the unit registry used across fluidsolve and provides the
Medium class, which encapsulates fluid-state properties required by
component and network calculations.
External dependencies:
pintfor unit-safe quantities,thermofor fluid property lookup from product names.
Main capabilities:
expose shared unit aliases (
unitRegistry,u,Quantity),define reference constants at normal conditions,
create media from known thermo products,
support user-defined media by overriding key properties (rho, mu, k).
Why this module is central:
Most hydraulic equations in the package convert between pressure, head, velocity, and flow, all of which depend on medium properties and unit consistency. This module provides that common foundation.
Typical usage:
water = Medium(prd='water')
custom = Medium(name='custom_mix', rho=950 * u.kg / u.m**3, mu=1.5e-3 * u.Pa * u.s)
rho = water.rho
References:
- fluidsolve.medium.CTE_G = <Quantity(9.80665, 'meter / second ** 2')>
Normal temperature.
- fluidsolve.medium.CTE_NT = <Quantity(20.0, 'degree_Celsius')>
Normal pressure.
- fluidsolve.medium.CTE_NP = <Quantity(101325.0, 'pascal')>
Water at normal conditions.
- fluidsolve.medium.CTE_WATER = <Chemical [water], T=293.15 K, P=101325 Pa>
Water density.
- fluidsolve.medium.CTE_RHO = <Quantity(998.223864, 'kilogram / meter ** 3')>
Dynamic viscosity.
- fluidsolve.medium.CTE_MU = <Quantity(0.00100205815, 'pascal * second')>
Kinematic viscosity.
- fluidsolve.medium.CTE_NU = <Quantity(1.00384111e-06, 'meter ** 2 / second')>
Thermal conductivity of water.
- fluidsolve.medium.CTE_K = <Quantity(0.586078571, 'watt / meter / kelvin')>
Absolute roughness (epsilon) of stainless steel.
- class fluidsolve.medium.Medium(**kwargs: int)[source]
Bases:
objectClass representing a medium.
It can be created from a thermo product name. It can also be user-defined by explicitly providing properties such as rho, mu, and k.
- Parameters:
prd (str, optional) – Product name known to thermo.
name (str, optional) – Medium name.
T (int | float | Quantity, optional) – Temperature.
p (int | float | Quantity, optional) – Pressure.
rho (int | float | Quantity, optional) – Density.
mu (int | float | Quantity, optional) – Dynamic viscosity.
k (int | float | Quantity, optional) – Thermal conductivity.
- Returns:
None
- property name: str
Name property.
- Returns:
Name property.
- Return type:
str
- property cprd: str
underlying chemical object.
- Returns:
cprd property.
- Return type:
Any
- property T: Quantity
Temperature property.
- Returns:
Temperature in degC (internally stored in K).
- Return type:
Quantity
- property p: Quantity
Pressure property.
- Returns:
Pressure property (bar).
- Return type:
Quantity
- property rho: Quantity
Density property.
- Returns:
Density property (kg/m3).
- Return type:
Quantity
- property mu: Quantity
Dynamic viscosity property.
- Returns:
Dynamic viscosity property (Pa.s).
- Return type:
Quantity
- property k: Quantity
Thermal conductivity property.
- Returns:
Thermal conductivity property (W/m/K).
- Return type:
Quantity