# Problem 14.06 Required Volume for a Gas Storage Tank for Ammonia¶

50 m^3 of liquid ammonia is stored at the conditions 50 °C and 100 bar. The vessel fails, and the contents empties into a backup containment vessel. The backup vessel has a maximum pressure of 10 bar. What volume must be vessel be to not exceed this pressure?

## Solution¶

This is straightforward; energy is conserved and a pressure is specified. Find the amount of ammonia in the original vessel; find the molar volume of ammonia in the new vessel; and multiply that by the amount of ammonia.

Ammonia is a highly non-ideal fluid, so we use a high-precision EOS.

:

# Set the conditions and imports
from scipy.constants import bar
from thermo import ChemicalConstantsPackage, PRMIX, CEOSLiquid, CoolPropLiquid, CEOSGas, CoolPropGas, FlashPureVLS
fluid = 'ammonia'
constants, correlations = ChemicalConstantsPackage.from_IDs([fluid])

T1 = 50 + 273.15
P1 = 100*bar
P2 = 10*bar
zs = 
volume_1 = 50

backend = 'HEOS'
gas = CoolPropGas(backend, fluid, T=T1, P=1e5, zs=zs)
liquid = CoolPropLiquid(backend, fluid, T=T1, P=1e5, zs=zs)

flasher = FlashPureVLS(constants, correlations, gas=gas, liquids=[liquid], solids=[])

:

# Flash at inlet conditions to obtain initial enthalpy
state_1 = flasher.flash(T=T1, P=P1)
moles = volume_1/state_1.V()
state_2 = flasher.flash(P=P2, H=state_1.H())

volume_2 = moles*state_2.V()
print(f'The thermodynamically required secondary containment volume is {volume_2: .2f} m^3')

The thermodynamically required secondary containment volume is  433.83 m^3