Pump - Nouman090/ThermoSim GitHub Wiki
A pump compresses a liquid from low pressure to high pressure, consuming work.
Physics
h_out = h_in + (h_out,isen - h_in) / Ρ_isen
W = ᚠà (h_out - h_in) / Ρ_mech
Ex_D = W + Ex_in - Ex_out
Syntax
Pump(Model, ID, In_state, Out_state,
Compressibility='Compressible', n_isen=1.0, n_mech=1.0,
Calculate=False)
| Parameter | Type | Default | Description |
|---|---|---|---|
Model |
ThermodynamicModel | â | The model object |
ID |
str | â | Unique component name |
In_state |
str | â | Inlet state point name |
Out_state |
str | â | Outlet state point name |
Compressibility |
str | 'Compressible' |
'Compressible' or 'Incompressible' |
n_isen |
float | 1.0 | Isentropic efficiency (0â1) |
n_mech |
float | 1.0 | Mechanical efficiency (0â1) |
Calculate |
bool | False | Solve immediately if True |
Output Attributes
| Attribute | Type | Unit | Description |
|---|---|---|---|
.work |
float | W | Work input (consumed) |
.Ex_D |
float/str | W | Exergy destruction |
.Solution_Status |
bool | â | True if solved |
.In |
Prop | â | Inlet state point object |
.Out |
Prop | â | Outlet state point object |
Cases
Case 1: Known Inlet, Unknown Outlet (Forward â Most Common)
from ThermoSim import ThermodynamicModel, Pump
Model = ThermodynamicModel()
Model.set_dead_state()
# Inlet: saturated liquid at condenser pressure
Model.add_point('water', 'a', P=0.008e6, Q=0, Mass_flowrate=1)
# Outlet: only pressure known
Model.add_point('water', 'b', P=8e6)
Pump(Model, 'P1', 'a', 'b', n_isen=0.85, Calculate=True)
print(f"Work input: {Model.Component['P1'].work:.2f} W")
print(f"Outlet T: {Model.Point['b'].T - 273.15:.2f} °C")
print(f"Outlet H: {Model.Point['b'].H:.0f} J/kg")
Case 2: Known Outlet, Unknown Inlet (Reverse)
Model = ThermodynamicModel()
Model.set_dead_state()
# Inlet: only pressure known
Model.add_point('water', 'a', P=0.008e6, Mass_flowrate=1)
# Outlet: fully defined
Model.add_point('water', 'b', P=8e6, H=200000)
Pump(Model, 'P1', 'a', 'b', n_isen=0.85, Calculate=True)
print(f"Inlet T: {Model.Point['a'].T - 273.15:.2f} °C")
print(f"Inlet H: {Model.Point['a'].H:.0f} J/kg")
Case 3: Both Known
Model = ThermodynamicModel()
Model.set_dead_state()
Model.add_point('water', 'a', P=0.008e6, Q=0, Mass_flowrate=1)
Model.add_point('water', 'b', P=8e6, H=200000)
Pump(Model, 'P1', 'a', 'b', n_isen=0.85, Calculate=True)
print(f"Work: {Model.Component['P1'].work:.2f} W")
Case 4: Incompressible Pump
For fluids where density doesn't change significantly with pressure:
Model = ThermodynamicModel()
Model.set_dead_state()
Model.add_point('water', 'a', P=0.008e6, Q=0, Mass_flowrate=1)
Model.add_point('water', 'b', P=8e6)
Pump(Model, 'P1', 'a', 'b',
Compressibility='Incompressible', n_isen=0.85,
Calculate=True)
print(f"Work input: {Model.Component['P1'].work:.2f} W")
The incompressible model uses:
w_ideal = (P_out - P_in) / Ď
w_actual = w_ideal / Ρ_isen
Case 5: Isentropic Pump (Ρ = 1)
Pump(Model, 'P1', 'a', 'b', n_isen=1.0, Calculate=True)
# Outlet entropy equals inlet entropy
Case 6: Mass Flow Not Given
If neither side has mass flow, the pump assumes 1 kg/s with a warning.
Model.add_point('water', 'a', P=0.008e6, Q=0) # no mass flow
Model.add_point('water', 'b', P=8e6)
Pump(Model, 'P1', 'a', 'b', n_isen=0.85, Calculate=True)
# Warning: Mass flowrate through P1 set to 1 kg/s
Case 7: Low Efficiency Pump (More Work Required)
# Isentropic pump
Model1 = ThermodynamicModel()
Model1.set_dead_state()
Model1.add_point('water', 'a', P=0.008e6, Q=0, Mass_flowrate=1)
Model1.add_point('water', 'b', P=8e6)
Pump(Model1, 'P1', 'a', 'b', n_isen=1.0, Calculate=True)
print(f"Isentropic work: {Model1.Component['P1'].work:.2f} W")
# Real pump with 80% efficiency
Model2 = ThermodynamicModel()
Model2.set_dead_state()
Model2.add_point('water', 'a', P=0.008e6, Q=0, Mass_flowrate=1)
Model2.add_point('water', 'b', P=8e6)
Pump(Model2, 'P1', 'a', 'b', n_isen=0.80, Calculate=True)
print(f"Real pump work: {Model2.Component['P1'].work:.2f} W")
Print Component Data
print(Model.Component['P1'])
Output:
P1 (Pump):
P_in : 0.08 bar
P_out : 80.00 bar
Ρ_isen : 85.0 %
Ρ_mech : 100.0 %
Work : XXXXX.XX W
Exergy dest.: XXXXX.XX
Solved : True
Complete Example
from ThermoSim import ThermodynamicModel, Pump
# Create model
Model = ThermodynamicModel()
Model.set_dead_state()
# Define state points
Model.add_point('water', 'pump_in', P=0.008e6, Q=0, Mass_flowrate=1)
Model.add_point('water', 'pump_out', P=8e6)
# Add pump
Pump(Model, 'FeedPump', 'pump_in', 'pump_out',
n_isen=0.85, n_mech=0.95, Calculate=True)
# Access results
pump = Model.Component['FeedPump']
print(f"Work input: {pump.work/1e3:.2f} kW")
print(f"Exergy destruction: {pump.Ex_D/1e3:.4f} kW")
print(f"Outlet temperature: {Model.Point['pump_out'].T - 273.15:.2f} °C")
print(f"Outlet enthalpy: {Model.Point['pump_out'].H:.0f} J/kg")
print(f"Pressure rise: {(Model.Point['pump_out'].P - Model.Point['pump_in'].P)/1e5:.2f} bar")
Pump vs Compressor
| Feature | Pump | Compressor |
|---|---|---|
| Intended for | Liquids | Gases |
| Density change | Small | Large |
| Incompressible mode | â Yes | â No |
| Tracks pressure ratio | â No | â Yes |
| Physics | Identical | Identical |