.. _section-5.3.2:

Compressible Volumes With Cover Gas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A compressible volume with cover gas is treated in a fashion similar to
that without cover gas except that the compression of the liquid is
neglected compared with the compression of the gas, so that all of the
expansion or compression is attributed entirely to the gas. The cover
gas is assumed to expand or compress due to changes in volume, temperature, and mass.
These changes are assumed to occur independently of each other. An increase in
the gas volume is equal to the decrease in the liquid volume. The
accompanying rise or fall in the level of the gas-liquid interface is
taken as the volume change divided by the area of the compressible
volume. In addition, the conservation of mass and the conservation of
energy principles are observed. The conservation of mass is applied by
taking the increase in the mass of the liquid in a compressible volume
as the difference between the liquid flowing in and that flowing out
during a time step, and the conservation of energy is taken as the
increase in the mass of the liquid in the compressible volume times its
temperature as the difference between the mass times temperature flowing
in and that flowing out during a time step.

The liquid pressure at an elevation, :math:`z_{\text{r}}`, in the compressible
volume is given by

.. math::
    :label: (5.3-13)

    p_{\text{l}} = p_{\text{g}} + \rho_{\text{l}}g \left( z_{\text{i}} - z_{\text{r}} \right)

where

:math:`p_{\text{l}}` = the pressure in the liquid

:math:`p_{\text{g}}` = the pressure of the cover gas above the liquid

:math:`\rho_{\text{l}}` = the liquid density

:math:`g` = the acceleration of gravity

:math:`z_{\text{i}}` = the height of the liquid gas interface

:math:`z_{\text{r}}` = the reference height for the compressible volume, :sasinp:`ZCVL`

and the change in the liquid pressure in the compressible volume is
obtained by taking differentials of :eq:`(5.3-13)`:

.. math::
    :label: (5.3-14)

    \Delta p_{\text{l}} = \Delta p_{\text{g}} + g\left( z_{\text{i}} - z_{\text{r}} \right) \Delta\rho_{\text{l}} + \rho_{\text{l}} g \Delta z_{\text{i}}

Cover Gas Contribution
^^^^^^^^^^^^^^^^^^^^^^

Adiabatic compression of the cover gas is taken as

.. math::
    :label: (5.3-15)

    p_{\text{g}} V_{\text{g}}^{\gamma} = \text{const}

where

:math:`V_{\text{g}}` = the volume of the cover gas

:math:`\gamma` = the ratio of the specific heat at constant pressure to that at
constant volume for the cover gas

and in differential form becomes:

.. math::
    :label: (5.3-16a)

    \frac{\Delta p_{\text{g,v}}}{p_{\text{g}}} + \gamma \frac{\Delta V_{\text{g}}}{V_{\text{g}}} = 0

where :math:`\Delta p_{\text{g,v}}` is the change in gas pressure due to the change in gas volume. To account for the change in gas pressure
due to the change in gas temperature, :eq:`5.7-3` can be used to determine the change in gas temperature:

.. math::
    :label: (5.3-16b)

    \Delta T_{\text{g}} = \Delta t \frac{T_{\text{l}} - T_{\text{g}}}{\Delta t + \tau}

where

:math:`T_{\text{g}}` = cover gas temperature,

:math:`\tau` = cover gas temperature time constant, :sasinp:`TAUGAS`.

Using the ideal gas law:

.. math::
    :label: (5.3-16c)

    \frac{p_{\text{g}}}{T_{\text{g}}} = \text{const}

.. math::
    :label: (5.3-16d)

    \Delta p_{\text{g,t}} = \frac{p_{\text{g}} \Delta T_{\text{g}}}{T_{\text{g}}} =  \frac{p_{\text{g}} \Delta t \left(T_{\text{l}} - T_{\text{g}}\right)}{T_{\text{g}}\left(\Delta t + \tau\right)}

where :math:`\Delta p_{\text{g,t}}` is the change in gas pressure due to the change in gas temperature. To account for the change in gas pressure
due to the change in gas mass, :eq:`5.7-14` can be used:

.. math::
    :label: (5.3-16e)

    \Delta p_{\text{g,m}} = p_{\text{g}}\varepsilon

.. math::
    :label: (5.3-16f)

    \varepsilon = \frac{\gamma \Delta t \frac{\text{d}m_{\text{g3}}}{\text{dt}}  }{m_{\text{g}}}

where :math:`\frac{\text{d}m_{\text{g3}}}{\text{dt}}` is from the previous time step.
At each time step, the new value is calculated as

.. math::
    :label: (5.3-16g)

    \frac{\text{d}m_{\text{g4}}}{\text{dt}} = \frac{\Delta t_{\text{max}}}{\Delta t_{\text{max}} + \Delta t}  \frac{\text{d}m_{\text{g3}}}{\text{dt}}
    + \frac{\Delta t}{\Delta t_{\text{max}} + \Delta t} \frac{\Delta m_{\text{g}}}{\Delta t}

where :math:`\Delta t_{\text{max}}` is :sasinp:`DTPMAX`. Finally, let

.. math::
    :label: (5.3-16h)

    \Delta p_{\text{g,m}} = \frac{p_{\text{g}}\varepsilon}{1 + 10 \varepsilon^{2}}

:eq:`(5.3-16g)` and :eq:`(5.3-16h)` are used to dampen oscillations caused by the first order approximations. Combining the previous equations:

.. math::
    :label: (5.3-16i)

    \Delta p_{\text{g}} = \Delta p_{\text{g,v}} + \Delta p_{\text{g,t}} + \Delta p_{\text{g,m}}

Liquid Volume Contribution
^^^^^^^^^^^^^^^^^^^^^^^^^^

The conservation of liquid mass for a compressible volume gives

.. math::
    :label: (5.3-17)

    \Delta m_{\text{l}} = \Delta t \left\lbrack \sum{{\overline{w}}_{\text{in}} - \sum{\overline{w}}_{\text{out}}} \right\rbrack

where

:math:`\Delta m_{\text{l}}` = the liquid mass increase in the
compressible volume during the time step

:math:`\Delta t` = the time-step size

:math:`\sum{\overline{w}}_{\text{in}}` = the sum of
the average liquid mass flow rates into the compressible volumes during
the time step

:math:`\sum{\overline{w}}_{\text{out}}` = the sum of
the average liquid mass flow rates out from the compressible volume
during the time step.

The conservation of energy for a compressible volume yields

.. math::
    :label: (5.3-18)

    \left( m_{\text{l}} + \Delta m_{\text{l}} \right) \left( T_{\text{l}} + \Delta T_{\text{l}} \right) = m_{\text{l}} T_{\text{l}} + \Delta t \left\lbrack \sum{{\overline{w}}_{\text{in}} T_{\text{in}} - \sum{{\overline{w}}_{\text{out}} T_{\text{out}} }} \right\rbrack
    + \frac{\left( T_{\text{w}} - T_{\text{l}} \right) H_{\text{w}}A_{\text{w}} \Delta t}{C_{\text{p}}}

where

:math:`m_{\text{l}}` = the liquid mass at the beginning of the time
step

:math:`\Delta T_{\text{l}}` = the increase in liquid temperature in
the compressible volume during the time step

:math:`\sum{{\overline{w}}_{\text{in}} T_{\text{in}}}` =
the sum of the average liquid mass flow rates times temperatures
entering the compressible volume during the time step

:math:`\sum{\overline{w}}_{\text{out}} T_{\text{out}}` =
sum of the average liquid mass flow rates times temperatures leaving the
compressible volume during the time step

:math:`T_{\text{w}}` = the compressible volume wall temperature at the beginning of the time step

:math:`H_{\text{w}}` = the compressible volume wall-coolant heat-transfer coefficient, :sasinp:`HWALL`

:math:`A_{\text{w}}` = the compressible volume wall surface area, :sasinp:`AWALL`

:math:`C_{\text{p}}` = the liquid specific heat.

In the present version of the code, :math:`\Delta m_{\text{l}}` is neglected in
comparison with :math:`m`, giving

.. math::
    :label: (5.3-19)

    \Delta T_{\text{l}} = \frac{\Delta t}{m_{\text{l}}} \left\lbrack \sum{{\overline{w}}_{\text{in}} T_{\text{in}} - \sum{{\overline{w}}_{\text{out}} T_{\text{out}}}} \right\rbrack
    + \Delta T_{\text{wc}}

where

:math:`\Delta T_{\text{wc}}` = liquid temperature change due to heat transfer from wall to coolant, :math:`\frac{\left( T_{\text{w}} - T_{\text{l}} \right) H_{\text{w}}A_{\text{w}} \Delta t}{m_{\text{l}}C_{\text{p}}}`

Numerical Implementation
^^^^^^^^^^^^^^^^^^^^^^^^

In addition to the above equations, we take

.. math::
    :label: (5.3-20)

    \Delta V_{\text{g}} =  - \Delta V_{\text{l}}

.. math::
    :label: (5.3-21)

    V_{\text{l}} = \frac{m_{\text{l}}}{\rho_{\text{l}}}

.. math::
    :label: (5.3-22)

    \Delta z_{\text{i}} = \frac{\Delta V_{\text{l}}}{A}

where

:math:`V_{\text{l}}` = the volume of the liquid in the compressible
volume at the beginning of a time step

:math:`m_{\text{l}}` = the mass of the liquid in the compressible
volume at the beginning of a time step

:math:`\rho_{\text{l}}` = the density of the liquid

:math:`A` = the area of the liquid-gas interface in the compressible volume, :sasinp:`AREAIN`.

Differencing :eq:`(5.3-21)`, we have

.. math::
    :label: (5.3-23)

    \Delta V_{\text{l}} = \frac{\Delta m_{\text{l}}}{\rho _{\text{l}}} - \frac{m_{\text{l}}}{\rho_{\text{l}}^{2}} \Delta \rho_{\text{l}}

and taking

.. math::
    :label: (5.3-24)

    \Delta \rho_{\text{l}} = \frac{\partial \mathrm{\rho}}{\partial \text{T}} \Delta T_{\text{l}}

we can write the following expression for the change in the liquid
pressure during a time step as

.. math::
    :label: (5.3-25)

    \Delta p_{\text{l}} = \left( \gamma \frac{p_{\text{g}}}{V_{\text{g}}}
    + \frac{\rho_{\text{l}}g}{A} \right) \left( \frac{\Delta m_{\text{l}}}{\rho  _{\text{l}}}
    - \frac{m_{\text{l}}}{\rho  _{\text{l}}^{2}} \frac{\partial\rho}{\partial \text{T}} \Delta T_{\text{l}} \right)
    + \Delta p_{\text{g,t}} + \Delta p_{\text{g,m}}
    + g\left( z_{\text{i}} - z_{\text{r}} \right) \frac{\partial\rho}{\partial \text{T}} \Delta T_{\text{l}}

Inserting :eq:`(5.3-17)` for :math:`\Delta m_{\text{l}}`\ and :eq:`(5.3-19)`
for :math:`\Delta T_{\text{l}}` and then comparing with :eq:`5.2-19`,
we see that the values of the :math:`b`'s for a compressible volume with a
cover gas are

.. math::
    :label: (5.3-26)

    b_{0} = \begin{cases}
    0 & \text{if pipe rupture source} \\
    \Delta p_{\text{g,t}} & \text{if pipe rupture sink and } z_{\text{i}} \leq z_{\text{r}} \\
    \Delta p_{\text{g,t}} + \Delta p_{\text{g,m}}
    - g \left( z_{\text{r}} - z_{\text{i}} \right) \frac{\partial \mathrm{\rho}}{\partial \text{T}} \Delta T_{\text{wc}} - \Delta z_{\text{i}} \left(\rho g + \frac{A \gamma p_{\text{g}}}{V_{\text{g}}} \right)  & \text{if pressurizer or pump bowl} \\
    \Delta p_{\text{g,t}} + \Delta p_{\text{g,m}} & \text{otherwise}\\
    \end{cases}

.. math::
    :label: (5.3-27)

    b_{1} = \begin{cases}
    0 & \text{if pipe rupture source} \\
    \Delta t \left[ \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho } \right] & \text{if pipe rupture sink and } z_{\text{i}} \leq z_{\text{r}}\\
    \Delta t \left[ \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho } + \frac{g}{A} \right] & \text{otherwise} \\
    \end{cases}

.. math::
    :label: (5.3-28)

     b_{2} = \begin{cases}
     0 & \text{if pipe rupture source or sink with } z_{\text{i}} \leq z_{\text{r}} \\
     \Delta t \frac{\partial\rho}{\partial \text{T}} \left\lbrack \frac{g\left( z_{\text{i}} - z_{\text{r}} \right)}{m_{\text{l}}} + \frac{1}{\rho} \left( \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho} + \frac{g}{A} \right)  \right\rbrack & \text{otherwise} \\
     \end{cases}

:math:`b_{0}` accounts for the change in pressure due to changes in gas mass and temperature.
Different CV types have different contributions to :math:`b_{0}`. The pressurizer (:sasinp:`ITYPCV` = 9) and pump bowl (:sasinp:`ITYPCV` = 10) CVs
consider heat transfer from the wall to the coolant which impacts the coolant level.

The pipe rupture sink CV (:sasinp:`ITYPCV` = 6)
assumes that the gas mass does not change (i.e. the volume is a closed container) and that the liquid level and temperature do not change
when the liquid gas interface height is below the reference height (i.e. the break location).
These assumptions simplify the :math:`b_{0}` and :math:`b_{1}` coefficients, and result in a :math:`b_{2}` coefficient of zero.
If the liquid gas interface height is higher than the reference height, the pipe rupture sink is treated as a pool.

Lastly, the pipe rupture source CV (:sasinp:`ITYPCV` = 5) is assumed to maintain a constant pressure and temperature, so all of the :math:`b` coefficients are zero.

Common Cover Gas
^^^^^^^^^^^^^^^^

A CV with cover gas can share a common cover gas with another CV (see :sasinp:`ICCVFS` and :sasinp:`NCCV`). For a pool or outlet plenum with common cover gas,
it is assumed that the total mass and volume available to the cover gas does not change. For a pressurizer or pump bowl with common cover gas,
it is assumed that the total mass available to the cover gas does not change. The values of the :math:`b`'s
for a compressible volume with common cover gas are

.. math::
    :label: (5.3-26b)

    b_{0}^{*} = \begin{cases}
    0 & \text{if pipe rupture source} \\
    \Delta p_{\text{g,t}}
    - g \left( z_{\text{r}} - z_{\text{i}} \right) \frac{\partial \mathrm{\rho}}{\partial \text{T}} \Delta T_{\text{wc}} - \Delta z_{\text{i}} \left(\rho g + \frac{A \gamma p_{\text{g}}}{V_{\text{g}}} \right)  & \text{if pressurizer or pump bowl} \\
    \Delta p_{\text{g,t}} & \text{otherwise} \\
    \end{cases}

.. math::
    :label: (5.3-26c)

    b_{0} = \frac{\sum_{\text{i=CCG1}}^{\text{CCGN}}{m_{\text{g},i} b_{\text{0},i}^{*}}}{\sum_{\text{i=CCG1}}^{\text{CCGN}}{m_{\text{g},i} }}
    + \gamma \Delta t p_{\text{g}}\frac{\sum_{\text{i=CCG1}}^{\text{CCGN}}{\frac{\text{d}m_{\text{g},i}}{\text{dt}}}}{\sum_{\text{i=CCG1}}^{\text{CCGN}}{m_{\text{g},i}}}

where CCG1 is the first CV with common cover gas (:sasinp:`ICCVFS`) and CCGN is the last (:sasinp:`ICCVFS` + :sasinp:`NCCV`).
:math:`b_{0}^{*}` is calculated for each CV that shares a common cover gas. CVs with common cover gas have the same :math:`b_{0}`
which is calculated using :eq:`(5.3-26c)`.

.. math::
    :label: (5.3-27b)

    b_{1} = \begin{cases}
    0 & \text{if pipe rupture source} \\
    \Delta t \left[ \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho } \right] & \text{if pipe rupture sink and } z_{\text{i}} \leq z_{\text{r}} \\
    \Delta t \left[ \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho } + \frac{g}{A} \right] & \text{if pressurizer or pump bowl} \\
    \Delta t \left[\frac{g}{A} \right] & \text{otherwise} \\
    \end{cases}

.. math::
    :label: (5.3-28b)

     b_{2} = \begin{cases}
     0 & \text{if pipe rupture source or sink with } z_{\text{i}} \leq z_{\text{r}} \\
     \Delta t \frac{\partial\rho}{\partial \text{T}} \left\lbrack \frac{g\left( z_{\text{i}} - z_{\text{r}} \right)}{m_{\text{l}}} + \frac{1}{\rho} \left( \frac{\gamma p_{\text{g}}}{V_{\text{g}}\rho} + \frac{g}{A} \right)  \right\rbrack & \text{if pressurizer or pump bowl} \\
     \Delta t \frac{\partial\rho}{\partial \text{T}} \left\lbrack \frac{g\left( z_{\text{i}} - z_{\text{r}} \right)}{m_{\text{l}}} + \frac{1}{\rho} \left( \frac{g}{A} \right)  \right\rbrack & \text{otherwise} \\
     \end{cases}