Tank - Mixer

Model description

The component models a tank that mixes multiple incoming fluid streams into a single outgoing stream. The mixing process assumes perfect mixing, resulting in uniform temperature and pressure at the tank exhaust.

Class description

class component.tank.tank_mixer.TankMixer(n_inlets=None)[source]

Component: Tank Mixer

Model: Steady-state perfect mixer

Reference: /

Description:

This model simulates a perfectly mixed tank where multiple inlet streams of the same fluid are combined into a single outlet stream. It computes the outlet specific enthalpy and mass flow rate based on an energy balance with no heat losses and no accumulation.

Assumptions:

  • Steady-state operation.

  • Perfect mixing (single outlet enthalpy and pressure).

  • All inlet streams must contain the same working fluid.

  • All inlet pressures must be within a fixed tolerance (default: 100 Pa).

  • No heat exchange with the environment (adiabatic mixing).

  • No phase change during mixing (inherent in the use of enthalpy balance).

Connectors:

su (MassConnector): Mass connector for the suction side ((su_1, su_2, …, su_n).

ex (MassConnector): Mass connector for the exhaust side.

Parameters:

n_inlets : Number of inlet streams to be mixed [-]

Inputs:

For each inlet stream i from 1 to n_inlets:

P_su_i: Suction side pressure. [Pa]

T_su_i: Suction side temperature. [K]

m_dot_su_i: Suction side mass flow flow rate. [kg/s]

fluid: Working fluid [-]

Ouputs:

P_ex: Outlet pressure [Pa] (mean of inlet pressures)

h_ex: Exhaust side specific enthalpy. [J/kg]

Example of use

# -*- coding: utf-8 -*-
"""
Created on Fri May 10 14:42:00 2024

@author: Basile
"""

from labothappy.component.tank.tank_mixer import TankMixer 
from CoolProp.CoolProp import PropsSI


"--------- 1) Data ------------------------------------------------------------------------------------------"

"Instanciation"

Mixer = TankMixer(n_inlets = 2)
 
Mixer.set_inputs(
    T_su_1 = 50 + 273.15, # K
    P_su_1 = 2*1e5, # Pa
    m_dot_su_1 = 1, # kg/s
    fluid_su_1 = 'Water',
    
    T_su_2 = 100 + 273.15, # K
    P_su_2 = 2*1e5, # Pa
    m_dot_su_2 = 1, # kg/s
    fluid_su_2 = 'Water'
    )

"--------- 2) Solve ------------------------------------------------------------------------------------------"
Mixer.solve()


"--------- 3) Results ------------------------------------------------------------------------------------------"
print("\n=== Mixer Output Results ===")
print(f"Outlet fluid: {Mixer.ex.fluid}")
print(f"Outlet pressure: {Mixer.ex.p:.2f} Pa")
print(f"Outlet mass flow rate: {Mixer.ex.m_dot:.2f} kg/s")
print(f"Outlet enthalpy: {Mixer.ex.h:.2f} J/kg")

try:
    T_out = PropsSI('T', 'P', Mixer.ex.p, 'H', Mixer.ex.h, Mixer.ex.fluid)
    print(f"Outlet temperature: {T_out - 273.15:.2f} °C")
except:
    print("Could not calculate outlet temperature.")
    
fig = Mixer.plot_thermo_states()
fig.show()

References

/