The comp_resist submodule
Passive hydraulic resistance components. Most classes in this module inherit from generic base component types.
This module groups components that consume energy in a hydraulic network, such as static head terms, generic appendages, pipes, bends, reducers, orifices, and other flow resistances.
Main component families in this module include:
fixed static head elements,
generic appendage-based loss models,
tube and fitting components parameterized by geometry,
loss elements that can be derived from working-point or coefficient data.
Design rules:
Mounting direction is port 1 -> port 2.
Flow direction is given by
sense.sense = +1means flow follows mounting direction.sense = -1means flow is opposite to mounting direction.
In practice, most classes in this module implement one of these patterns:
a fixed head contribution,
a resistance coefficient or loss relation,
a geometry-dependent pressure drop derived from diameter, length, roughness, and medium properties.
Modeling intent:
Use these classes to represent passive losses in branches and loops.
Combine with pump/source components from other modules for full systems.
Keep
senseexplicit when assembling networks so directional loss signs stay consistent in both continuity and loop-energy equations.
These classes are intended to be combined inside a network where topology is handled by the network model and the local hydraulic behavior is handled by the component itself.
Typical usage:
Create a resistance component with its geometric or catalogue data.
Set the medium if different from the default.
Use
calcHorcalcPto evaluate the hydraulic loss for a flow rate.Insert the component into a network segment.
Example:
comp = Comp_Hstatic(Hs_pos=3 * u.m)
head = comp.calcH(1.2 * u.m**3 / u.h, sense=1)
The sign conventions in this module are chosen to stay consistent with the rest of fluidsolve, especially when the same component is traversed in either direction during network solving.
For advanced usage, several classes expose helper methods for coefficient evaluation, making it easier to calibrate components from measured data or catalogue values before running a network solve.
- class fluidsolve.comp_resist.Comp_Hstatic(**kwargs: Any)[source]
Bases:
Comp_BaseHydraulic component representing fixed static head. Can be a pressure source (+) or a resistance term (-).
- Parameters:
Hs_pos (int | float | Quantity, optional) – Positive (source) static head (default in m).
Hs_neg (int | float | Quantity, optional) – Negative (resistance) static head (default in m).
- _group: str = 'Resistance'
- _part: str = 'Hstatic'
- _prefix: str = 'Hs'
- property Hs: Quantity
Component static head property.
- Returns:
Head (in m) property.
- Return type:
Quantity
- class fluidsolve.comp_resist.Comp_Appendage(**kwargs: Any)[source]
Bases:
Comp_BaseGeneric resistance component class.
- Parameters:
H (int | float | Quantity, optional) – Static head when applicable.
L (int | float | Quantity, optional) – Length when applicable.
D (int | float | Quantity, optional) – Diameter when applicable.
e (float | Quantity, optional) – Absolute wall roughness when applicable.
- _group: str = 'Resistance'
- _part: str = 'Appendage'
- _prefix: str = 'R'
- property K: int | float
Component head loss coefficient property.
- Returns:
Head loss coefficient.
- Return type:
int | float
- calcK(Q: Quantity, sense: int, pin: int = 1, pout: int = 2) float[source]
Head loss coefficient. Override in subclasses.
- calcH(Q: Quantity, sense: int = 1, pin: int = 1, pout: int = 2) Quantity[source]
Calculate head loss from loss coefficient and flow velocity.
- Parameters:
Q (Quantity) – Flow rate.
sense (int, optional) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Head loss in equivalent meters of fluid.
- Return type:
Quantity
- class fluidsolve.comp_resist.Comp_Tube(**kwargs: Any)[source]
Bases:
Comp_AppendageStraight pipe component with friction and static head.
- Parameters:
L (int | float | Quantity) – Pipe length (default in m).
D (int | float | Quantity) – Inner diameter (default in mm).
Hs_pos (int | float | Quantity, optional) – Positive static head (default in m).
Hs_neg (int | float | Quantity, optional) – Negative static head (default in m).
- _part: str = 'Tube'
- _prefix: str = 'Tu'
- property L: Quantity
Component length property.
- Returns:
Length (in m) property.
- Return type:
Quantity
- property D: Quantity
Component diameter property.
- Returns:
Diameter property.
- Return type:
Quantity
- property Hs: Quantity
Component static head property.
- Returns:
Head (in m) property.
- Return type:
Quantity
- class fluidsolve.comp_resist.Comp_Bend(**kwargs: int)[source]
Bases:
Comp_AppendageHydraulic component representing a pipe bend.
- Parameters:
n (int, optional) – Number of bends with these properties.
D (int | float | Quantity, optional) – Diameter (mm).
A (int | float | Quantity, optional) – Bend angle (degrees).
R (int | float, optional) – Bend radius (to center of pipe) in times the diameter of the pipe.
e (float | Quantity, optional) – Absolute wall roughness.
- _part: str = 'Bend'
- _prefix: str = 'B'
- property n: int
Fixed number of bends property.
- Returns:
Number of bends.
- Return type:
int
- property D: Quantity
Diameter property.
- Returns:
Diameter (default in mm).
- Return type:
int
- property A: Quantity
Angle of the bend property.
- Returns:
Angle of the bend (default in degrees).
- Return type:
int
- property R: int | float
Bend radius (to center of pipe) in times the diameter of the pipe property.
- Returns:
Bend radius (to center of pipe) in times the diameter of the pipe.
- Return type:
int
- class fluidsolve.comp_resist.Comp_BendLong(**kwargs: int)[source]
Bases:
Comp_AppendageHydraulic component representing a pipe bend.
- Parameters:
D (int | float | Quantity, optional) – Diameter (in mm). Defaults to 100.0*u.mm.
n (int, optional) – Number of bends with these properties.
A (int | float | Quantity, optional) – Bend angle (degrees).
Lu (int | float, optional) – Unimpeded length (mm).
e (float | Quantity, optional) – Absolute wall roughness.
- _part: str = 'BendLong'
- _prefix: str = 'B'
- property n: int
Fixed number of bends property.
- Returns:
Number of bends.
- Return type:
int
- property D: Quantity
Diameter property.
- Returns:
Diameter (default in mm).
- Return type:
int
- property A: Quantity
Angle of the bend property.
- Returns:
Angle of the bend (default in degrees).
- Return type:
int
- property Lu: Quantity
Unimpeded length property.
- Returns:
Unimpeded length (default in mm).
- Return type:
float
- class fluidsolve.comp_resist.Comp_Entrance(**kwargs: Any)[source]
Bases:
Comp_AppendagePipe entrance (or exit under reversed flow) component.
- Parameters:
D (int | float | Quantity) – Diameter (in mm).
- _part: str = 'Entrance'
- _prefix: str = 'E'
- property D: Quantity
Diameter property.
- Returns:
Diameter (default in mm).
- Return type:
int
- calcK(Q: Quantity, sense: int, pin: int = 1, pout: int = 2) float[source]
Calculate entrance or exit loss coefficient.
- Parameters:
Q (Quantity) – Flow rate.
sense (int) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Loss coefficient for the active flow direction.
- Return type:
float
- class fluidsolve.comp_resist.Comp_SharpReduction(**kwargs: Any)[source]
Bases:
Comp_AppendagePipe contraction (or diffuser under reversed flow) component.
- Parameters:
D1 (int | float | Quantity) – Starting (larger) diameter (in mm).
D2 (int | float | Quantity) – Ending (smaller) diameter (in mm).
n (int, optional) – Number of instances in series.
- _part: str = 'SharpReduction'
- _prefix: str = 'Re'
- property n: int
Fixed number of components property.
- Returns:
Number of components.
- Return type:
int
- property D1: int | float
Component starting diameter property.
- Returns:
Starting diameter property.
- Return type:
Quantity
- property D2: int | float
Component ending diameter property.
- Returns:
Ending diameter property.
- Return type:
Quantity
- calcK(Q: Quantity, sense: int, pin: int = 1, pout: int = 2) float[source]
Calculate contraction or diffuser loss coefficient.
- Parameters:
Q (Quantity) – Flow rate.
sense (int) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Loss coefficient for the active flow direction.
- Return type:
float
- class fluidsolve.comp_resist.Comp_ConicalReduction(**kwargs: int)[source]
Bases:
Comp_AppendageConical contraction (or diffuser under reversed flow) component.
- Parameters:
n (int | float, optional) – Number of components.
D1 (int | float | Quantity, optional) – Starting diameter (mm).
D2 (int | float | Quantity, optional) – Ending diameter (mm).
L (int | float | Quantity, optional) – Contraction length (mm).
- _part: str = 'ConicalReduction'
- _prefix: str = 'Re'
- property n: int
Fixed number of components property.
- Returns:
Number of components.
- Return type:
int
- property D1: int | float
Component starting diameter property.
- Returns:
Starting diameter property.
- Return type:
Quantity
- property D2: int | float
Component ending diameter property.
- Returns:
Ending diameter property.
- Return type:
Quantity
- class fluidsolve.comp_resist.C_EntranceBeveled(**kwargs: int)[source]
Bases:
Comp_AppendageHydraulic component representing a beveled entrance. Reverse-flow behavior is not implemented.
- Parameters:
D (int | float | Quantity, optional) – Pipe diameter (mm).
Lb (int | float | Quantity, optional) – Bevel length measured parallel to the pipe (mm).
R (int | float | Quantity, optional) – Bevel angle with respect to pipe axis (degrees).
- _part: str = 'EntranceBeveled'
- _prefix: str = 'E'
- class fluidsolve.comp_resist.Comp_PHE(**kwargs: int)[source]
Bases:
Comp_AppendageHydraulic component representing a plate heat exchanger (PHE).
- Parameters:
Nplaten (int) – Number of plates.
Npasses (int) – Number of passes.
Phi (float) – Ratio of real to projected plate surface.
Lplaat (int | float | Quantity) – Plate length (default in mm).
Bplaat (int | float | Quantity) – Plate length (default in mm).
Dkanaal (int | float | Quantity) – Distance between two plates or channel width (mm).
Npoorten (int) – Number of ports.
Dpoort (int | float | Quantity) – Port diameter (mm).
- _part: str = 'PHE'
- _prefix: str = 'PHE'
- calcK(Q: int | float | Quantity, sense: int, pin: int = 1, pout: int = 2) float[source]
- Calculate head loss coefficient K.
Speed is a derived value calculated using Dpoort.
- Parameters:
Q (int | float | Quantity) – Flow rate (default in m3/h).
- Returns:
Head loss coefficient K.
- Return type:
int | float
- class fluidsolve.comp_resist.Comp_Serial(**kwargs: int)[source]
Bases:
Comp_AppendageSerial combination of components.
- Parameters:
item (list, optional) – List of Comp_Base components to connect in series.
- _part: str = 'SERIAL'
- _prefix: str = 'ser'
- property components: list
- calcH(Q: int | float | Quantity, sense: int = 1, pin: int = 1, pout: int = 2) Any[source]
Calculate total head change across all series components.
- Parameters:
Q (int | float | Quantity) – Flow rate (default in m3/h).
sense (int, optional) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Summed head change across all components.
- Return type:
Any
- calcHprofile(Q: int | float | Quantity, sense: int, pin: int = 1, pout: int = 2, incr: bool = False) Any[source]
Calculate per-component head profile for a given flow.
- Parameters:
Q (int | float | Quantity) – Flow rate (default in m3/h).
sense (int) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
incr (bool, optional) – If True, accumulate head over the series.
- Returns:
List of working-point entries for each component and total.
- Return type:
Any
- class fluidsolve.comp_resist.Comp_Parallel(**kwargs: int)[source]
Bases:
Comp_AppendageParallel combination of components.
- Parameters:
item (list, optional) – List of Comp_Base components to connect in parallel.
guess (int | float | list, optional) – Initial flow guess for the solver (in m3/h).
- _part: str = 'PARALLEL'
- _prefix: str = 'par'
- property guess: list
Guess values for nonlinear solver retries.
- Returns:
Guess.
- Return type:
list
- property components: list
- calcH(Q: int | float | Quantity, sense: int = 1, pin: int = 1, pout: int = 2) Any[source]
Solve branch flows and return common head loss for parallel components.
- Parameters:
Q (int | float | Quantity) – Total flow rate (default in m3/h).
sense (int, optional) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Common head value for the parallel block.
- Return type:
Any
- class fluidsolve.comp_resist.Comp_Parallel2(**kwargs: int)[source]
Bases:
Comp_AppendageParallel combination of exactly two components.
- Parameters:
item (list, optional) – List of exactly two Comp_Base components to connect in parallel.
guess (int | float, optional) – Initial flow guess for the solver (in m3/h).
- _part: str = 'PARALLEL2'
- _prefix: str = 'par2'
- property guess: list
Guess values for nonlinear solver retries.
- Returns:
Guess.
- Return type:
list
- property components: list
- calcH(Q: int | float | Quantity, sense: int = 1, pin: int = 1, pout: int = 2) Any[source]
Solve flow split for two parallel branches and return common head.
- Parameters:
Q (int | float | Quantity) – Total flow rate (default in m3/h).
sense (int, optional) – Flow direction indicator.
pin (int, optional) – Inlet port index.
pout (int, optional) – Outlet port index.
- Returns:
Common head value for the two-branch parallel block.
- Return type:
Any