The path submodule
One-dimensional hydraulic path model (series-connected components).
This module implements a simplified hydraulic topology for ordered component
chains. A Path is effectively a restricted network with:
no branches,
no cycles,
explicit component order,
explicit per-component flow direction (sense).
Compared with the full network solver, this representation is easier to build and reason about when modeling single-line circuits or pump-and-piping strings.
Main responsibilities:
store and validate ordered component entries,
evaluate total head/pressure behavior along the chain,
solve for operating points when combined with pump/circuit relations,
expose convenience views for plotting and reporting.
Conventions:
each entry stores
comp,sense,pin, andpout,component physics is delegated to each component’s
calcH/calcP,path-level solve routines aggregate these local relations in order.
Typical usage:
p = Path(name='loop', components=[
{'comp': pump, 'sense': +1, 'pin': 1, 'pout': 2},
{'comp': tube, 'sense': +1, 'pin': 1, 'pout': 2},
])
H = p.calcH(2.0 * u.m**3 / u.h)
Use Path when a full graph-based network is unnecessary and a deterministic
series model is sufficient.
- class fluidsolve.path.Path(**kwargs: Any)[source]
Bases:
Comp_BaseOne-dimensional hydraulic path of series-connected components.
Ordered, branch-free, cycle-free subset of a network with an explicit flow direction per component.
- Parameters:
name (str, optional) – Path label.
components (list, optional) – Ordered list of component dicts to add via addComponents.
- property name: str
Path name.
- property components: Any
Ordered list of component entries (comp, sense, pin, pout).
- getComp(idx: int) dict[source]
Return the component entry at index
idx.- Parameters:
idx (int) – Component index.
- Returns:
Component entry with keys
comp,sense,pin,pout.- Return type:
dict
- setComp(idx: int, item: dict) dict[source]
Replace the component entry at index
idx.- Parameters:
idx (int) – Component index.
item (dict) – Component entry with keys
comp,sense,pin,pout.
- Returns:
Stored component entry.
- Return type:
dict
- addComponents(components: list) None[source]
Append components to the path.
- Parameters:
components (list) – List of dicts with keys
comp, optionalsense,pin, andpout.
- calcH(Q: Quantity, sense: int = 1, pin: Any | None = None, pout: Any | None = None) Quantity[source]
Calculate total head change along the path.
- Parameters:
Q – Flow rate.
sense – Path flow direction (+1 or -1).
- Returns:
Total head change (m).
- Return type:
Quantity
- calcP(Q: Quantity, sense: int = 1, pin: Any | None = None, pout: Any | None = None) Quantity[source]
Calculate total pressure change along the path.
- Parameters:
Q – Flow rate.
sense – Path flow direction (+1 or -1).
- Returns:
Total pressure change.
- Return type:
Quantity
- calcHprofile(Q: int | float | Quantity, sense: int = 1, pin: int = 1, pout: int = 2, incr: bool = False) Any[source]
Build a list of working points over the path.
- Parameters:
Q (int | float | Quantity) – Flow rate.
sense (int, optional) – Path flow direction (+1 or -1).
pin (int, optional) – Unused compatibility argument.
pout (int, optional) – Unused compatibility argument.
incr (bool, optional) – If True, head is accumulated component by component.
- Returns:
Working points per component plus total.
- Return type:
list[flswp.Wpoint]
- __str__() str[source]
Return a compact string representation.
- Returns:
Compact path summary.
- Return type:
str