# Tank (G-IL)

**Libraries:**

Simscape /
Fluids /
Isothermal Liquid /
Tanks & Accumulators

## Description

The Tank (G-IL) block models the accumulation of mass and energy in a chamber with separate gas and isothermal liquid volumes. The total fluid volume is fixed, but the individual gas and isothermal liquid volumes can to vary. Two gas ports allow for gas flow and a variable number of isothermal liquid ports, ranging from one to six, allow for isothermal liquid flow. The isothermal liquid ports can be at different elevations.

The tank is pressurized, but the pressurization is not fixed. It changes during simulation corresponding to the pressure in the gas volume. The pressure rises when the pressure of the gas volume rises and falls when the pressure of the gas volume falls. The block assumes that the isothermal liquid volume is at equilibrium with the gas volume and its pressure is the same as that of the gas. The two fluid volumes go not exchange energy with each other, but energy exchanges with other components can occur through the gas ports.

### Isothermal Liquid Ports

You can specify the number of isothermal liquid ports using the **Number
of inlets** parameter:

Number of inlets | Exposed isothermal liquid ports |
---|---|

`1` | Port A2 |

`2` | Ports A2 and
B2 |

`3` | Ports A2, B2, and
C2 |

`4` | Ports A2, B2,
C2, and D2 |

`5` | Ports A2, B2,
C2, D2, and
E2 |

`6` | Ports A2, B2,
C2, D2,
E2, and F2 |

### Fluid Volumes

The total volume of the tank is the sum of the gas and isothermal liquid volumes that it contains,

$${V}_{\text{T}}={V}_{\text{L}}+{V}_{\text{G}},$$

where *V* is the volume and
*T*, *L*, and *G* stand for
total, liquid, and gas. Because the total volume is fixed, the time rate of change
of the gas volume must be the reverse of the time rate of change for the isothermal
liquid volume,

$${\dot{V}}_{\text{G}}=-{\dot{V}}_{\text{L}}.$$

The block calculates the time rate of change of the isothermal liquid volume by differentiating the expression

$${M}_{\text{L}}={\rho}_{\text{L}}{V}_{\text{L}},$$

where *M* is mass and *ρ* is
density. The differentiation gives the mass flow rate into the isothermal liquid volume,

$${\dot{M}}_{\text{L}}={V}_{\text{L}}{\dot{\rho}}_{\text{L}}+{\dot{V}}_{\text{L}}{\rho}_{\text{L}}.$$

The rate of change of the isothermal liquid volume and, by extension, of the gas volume is

$${\dot{V}}_{\text{G}}=-{\dot{V}}_{\text{L}}\approx {V}_{\text{L}}\frac{{\dot{p}}_{\text{L}}}{{\rho}_{\text{L}}}\frac{d{\rho}_{L}}{dp}|-\frac{{\dot{M}}_{\text{L}}}{{\rho}_{\text{L}}},$$

where *p* is the pressure.

### Mass Balance

The rate of mass accumulation in each fluid volume is equal to the net mass flow rate into that fluid volume. In the isothermal liquid volume

$${\dot{M}}_{\text{L}}={\displaystyle \sum _{i=\text{A2,B2,}\mathrm{...}\text{F2}}{\dot{m}}_{i}},$$

where *M _{L}* is the rate of
mass accumulation in the isothermal liquid volume and $${\dot{m}}_{i}$$ are the individual mass flow rates into that volume through the
isothermal liquid ports

**A2**,

**B2**,

**C2**,

**D2**,

**E2**, or

**F2**.

In the gas volume

$${\dot{M}}_{\text{G}}={\displaystyle \sum _{i=\text{A1,B1}}{\dot{m}}_{i}},$$

*M _{G}* is the rate of mass accumulation in the
gas volume and $${\dot{m}}_{i}$$ are the individual mass flow rates into that volume through the
gas ports

**A1**and

**B1**. The rate of mass accumulation for the gas volume contains contributions from pressure, temperature, and volume change,

$${\dot{M}}_{\text{G}}={\frac{dM}{dp}|}_{\text{G}}{\dot{p}}_{\text{G}}+{\frac{dM}{dT}|}_{\text{G}}{\dot{T}}_{\text{G}}+{\dot{V}}_{\text{G}}{\rho}_{\text{G}},$$

where *T* is the temperature and the pressure
and temperature derivatives depend on the type of gas specified in the
Gas Properties (G) block.
The equations section of the Translational Mechanical Converter
(G) page defines the derivatives. The mass balance equation for
the gas volume is

$${\dot{p}}_{\text{G}}{\frac{dM}{dp}|}_{\text{G}}+{\dot{T}}_{\text{G}}{\frac{dM}{dT}|}_{\text{G}}+{\dot{p}}_{\text{G}}\frac{{\rho}_{\text{G}}}{{\rho}_{L}}{V}_{\text{L}}\frac{d{\rho}_{L}}{dp}|={\displaystyle \sum _{i=\text{A1,B1}}{\dot{m}}_{i}}+\frac{{\rho}_{\text{G}}}{{\rho}_{\text{L}}}{\displaystyle \sum _{i=\text{A2,B2,}\mathrm{...}\text{F2}}{\dot{m}}_{i}},$$

### Energy Balance

The rate of energy accumulation in the gas volume is

$${\dot{p}}_{\text{G}}{\frac{dU}{dp}|}_{\text{G}}+{\dot{T}}_{\text{G}}{\frac{dU}{dT}|}_{\text{G}}+{\dot{p}}_{\text{G}}\frac{{\rho}_{\text{G}}}{{\rho}_{L}}{h}_{\text{G}}{V}_{\text{L}}\frac{d{\rho}_{L}}{dp}|={Q}_{\text{H1}}+{\displaystyle \sum _{i=\text{A1,B1}}{\varphi}_{i}}+\frac{{\rho}_{\text{G}}}{{\rho}_{\text{L}}}{h}_{\text{G}}{\displaystyle \sum _{i=\text{A2,B2,}\mathrm{...}\text{F2}}{\dot{m}}_{i}}$$

where:

*U*is the total energy of the fluid volume.*h*is the fluid enthalpy.*Q*is the heat flow rate through the thermal port.*ϕ*are the energy flow rates through the fluid inlets._{i}

The pressure and temperature derivatives depend on the type of gas specified in the Gas Properties (G) block. See the equations section of the Translational Mechanical Converter (G) page for the definitions.

### Momentum Balance

The block ignores flow resistance due to friction or other causes in both fluid volumes. The block also ignores the effect of elevation on inlet pressure, but only on the gas side. The gas inlet pressures are equal to each other and to the internal pressure of the gas volume:

$${p}_{\text{A1}}={p}_{\text{B1}}={p}_{\text{G}}.$$

The isothermal liquid inlet pressures are each a function of inlet depth. The
internal pressure of the isothermal liquid volume is equal to the gas volume, *p _{L}* =

*p*. The block includes dynamic pressures,

_{G}*p*, at the inlets by using the equation

_{i,dyn}$${p}_{i}+{p}_{i,\text{dyn}}={p}_{\text{G}}+{\rho}_{\text{L}}\left(y-{y}_{i}\right)g,$$

where *y* is the elevation of the isothermal
liquid surface, *y*_{i} is the elevation of the
isothermal liquid inlet, and *g* is the gravitational constant. The
term *y* -
*y _{i}* gives the depth of the isothermal liquid inlet with respect to the
gas-isothermal liquid boundary. The dynamic pressure at each isothermal liquid inlet
depends on the direction of flow at that inlet

$${p}_{i,\text{dyn}}=\{\begin{array}{cc}\frac{1}{2}{\rho}_{i}{v}_{i}^{2},& \text{if}{\dot{m}}_{i}0\\ 0,& \text{if}{\dot{m}}_{i}\ge 0\end{array}$$

where *v _{i}* is the flow
velocity.

### Variables

To set the priority and initial target values for the block variables prior to simulation, use
the **Initial Targets** section in the block dialog box or Property
Inspector. For more information, see Set Priority and Initial Target for Block Variables and Initial Conditions for Blocks with Finite Gas Volume.

Nominal values provide a way to specify the expected magnitude of a variable in a model.
Using system scaling based on nominal values increases the simulation robustness. Nominal
values can come from different sources, one of which is the **Nominal
Values** section in the block dialog box or Property Inspector. For more
information, see Modify Nominal Values for a Block Variable.

### Assumptions and Limitations

Fluid momentum is lost at the tank inlet due to the sudden expansion into the tank volume.

## Ports

### Output

### Conserving

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2023b**