# Constant Volume Chamber (2P)

Chamber with fixed volume of two-phase fluid and variable number of ports

**Library:**Simscape / Foundation Library / Two-Phase Fluid / Elements

## Description

The Constant Volume Chamber (2P) block models the
accumulation of mass and energy in a chamber containing a fixed volume of two-phase fluid. The
chamber can have between one and four inlets, labeled from **A**
to **D**, through which fluid can flow. The fluid volume can
exchange heat with a thermal network, such as a network that represents the chamber
surroundings, through the thermal port **H**.

The mass of the fluid in the chamber varies with density, a property that is generally a function of pressure and temperature for a two-phase fluid. Fluid enters when the pressure upstream of the inlet rises above the pressure in the chamber and exits when the pressure gradient reverses. The effect in a model is often to smooth out sudden changes in pressure, much like an electrical capacitor does with voltage.

The flow resistance between the inlet and interior of the chamber is assumed to be negligible. The pressure in the interior is therefore equal to that at the inlet. Similarly, the thermal resistance between the thermal port and interior of the chamber is assumed to be negligible. The temperature in the interior is equal to the temperature at the thermal port.

### Mass Balance

Mass can enter and exit the chamber through ports **A**,
**B**, **C**, and **D**. The volume of the chamber is fixed but the compressibility of
the fluid means that its mass can change with pressure and temperature. The rate of mass
accumulation in the chamber must exactly equal the mass flow rate through ports **A**, **B**, **C**, and **D**,

$$\left[{\left(\frac{\partial \rho}{\partial p}\right)}_{u}\frac{dp}{dt}+{\left(\frac{\partial \rho}{\partial u}\right)}_{p}\frac{du}{dt}\right]V={\dot{m}}_{\text{A}}+{\dot{m}}_{\text{B}}+{\dot{m}}_{\text{C}}+{\dot{m}}_{\text{D}}+{\u03f5}_{M},$$

where the left-hand side is the rate of mass accumulation and:

*ρ*is the density.*p*is the pressure.*u*is the specific internal energy.*V*is the volume.$$\dot{m}$$ is the mass flow rate.

*ϵ*_{M}is a correction term that accounts for a numerical error caused by the smoothing of the partial derivatives.

**Correction Term for Partial-Derivative Smoothing**

The block computes the partial derivatives in the mass balance equation by applying the finite-difference method to the tabulated data in the Two-Phase Fluid Properties (2P) block and interpolating the results. The block then smooths the partial derivatives at the phase-transition boundaries by means of cubic polynomial functions. These functions apply between:

The subcooled liquid and two-phase mixture phase domains when the vapor quality is in the 0–0.1 range.

The two-phase mixture and superheated vapor phase domains when the vapor quality is in the 0–0.9 range.

The smoothing introduces a small numerical error that the block adjusts for by adding
to the mass balance the correction term *ϵ*_{M},
defined as:

$${\u03f5}_{M}=\frac{M-V/\nu}{\tau}.$$

where:

*M*is the fluid mass in the chamber.*ν*is the specific volume.*τ*is the characteristic duration of a phase-change event.

The block obtains the fluid mass in the chamber from the equation:

$$\frac{dM}{dt}={\dot{m}}_{A}+{\dot{m}}_{\text{B}}+{\dot{m}}_{\text{C}}+{\dot{m}}_{\text{D}}.$$

### Energy Balance

Energy can enter and exit the chamber in two ways: with fluid flow through ports
**A**, **B**, **C**, and **D**, and with the heat flow
through port **H**. No work is done on or by the fluid inside
the chamber. The rate of energy accumulation in the internal fluid volume must then equal
the sum of the energy flow rates in through ports **A**,
**B**, **C**, **D**, and **H**,

$$\dot{E}={\varphi}_{\text{A}}+{\varphi}_{\text{B}}+{\varphi}_{\text{C}}+{\varphi}_{\text{D}}+\text{}{Q}_{\text{H}},$$

where:

*ϕ*is energy flow rate.*Q*is heat flow rate.*E*is total energy.

Neglecting the kinetic energy of the fluid, the total energy in the chamber is:

$$E=Mu.$$

### Momentum Balance

The pressure drop due to viscous friction between the individual ports and the interior
of the chamber is assumed to be negligible. Gravity is ignored, as are other body forces.
The pressure in the internal fluid volume must therefore equal the pressure at ports
**A**, **B**, **C**, and **D**:

$$p={p}_{\text{A}}={p}_{\text{B}}={p}_{\text{C}}={p}_{\text{D}}.$$

### Assumptions and Limitations

The chamber has a fixed volume of fluid.

The flow resistance between the inlet and the interior of the chamber is negligible.

The thermal resistance between the thermal port and the interior of the chamber is negligible.

The kinetic energy of the fluid in the chamber is negligible.

## Ports

### Conserving

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2015b**