HydDown: A Python package for calculation of hydrogen (or other gas) pressure vessel filling and discharge

HydDown (Andreasen, 2021) is a Python package for calculation of pressure vessel behaviour during filling (pressurisation) or discharge (depressurisation/blow-down). More specifically, the software allows calculation of vessel pressure, fluid inventory temperature as well as vessel wall temperature as a function of time during either filling or discharge operations. The applications are manifold and some examples are:


Summary
HydDown ) is a Python package for calculation of pressure vessel behaviour during filling (pressurisation) or discharge (depressurisation/blow-down). More specifically, the software allows calculation of vessel pressure, fluid inventory temperature as well as vessel wall temperature as a function of time during either filling or discharge operations. The applications are manifold and some examples are: • Rapid filling of vehicle high-pressure hydrogen cylinders • Rapid emergency discharge from high-pressure gas cylinders • Dynamic pressure safety valve behaviour for gas-filled pressure vessels subject to fire heat load A typical system modelled is shown in Figure 1 and it visualizes the key parameters and transport phenomena during gas vessel filling or discharging. The thermodynamic state inside the vessel changes over time as seen from immediately observable variables temperature (T) and pressure (P). This is caused by a change in fluid inventory (density) due to flow of gas either in or out of the vessel. Furthermore, heat is transfered from or to the surroundings via convective heat transfer on the in-and outside of the vessel -with heat being conducted through the vessel wall. The easiest way to explore the basic capabilities fo the code is via the HydDown Streamlit app. In its essence, the code solves the mass and energy balances with gas thermodynamics calculated using the CoolProp library (Bell et al., 2014) including both real gas equation of state and gas transport properties. The energy balance is the first law of thermodynamics for an open system exchanging both heat and mass with the surroundings (Smith et al., 1996). Heat transfer between gas inventory and vessel wall is accounted for using either natural convection or mixed forced convection/natural convection (Geankoplis, 1993;Woodfield et al., 2007). The mass balance is closed using an applicable flow equation e.g. orifice (Bosch & Weterings, 2005), relief valve (API, 2014), control valve (Borden, 1998;IEC, 2011;ISA, 1995), a fixed mass rate or a predefined mass rate in or out of the pressure vessel. The code also allows an external heat load to be applied using the Stefan-Boltzmann equation for fire heat load mimicking background heat load from both pool and jet fire (API, 2014; Hekkelstrand & Skulstad, 2004).
A few choices have been made to keep things simple: • Coolprop is used as thermodynamic backend • Gas phase only • No temperature stratification in vessel inventory • No temperature gradient through vessel wall (applicable for high heat conductivity / thin-walled vessels) Still, the code allows a variety of mass flow devices and heat transfer both with ambient air and also considering fire heat loads, with the vessel fluid inventory being rigorously described by a Helmholtz energy formulation of a real gas equation of state. Typical calculation output is shown in Figure 2 and Figure 3 with experimental data included for comparison.

Statement of need
With an increasing demand of clean(er) energy and associated storage such as e.g. on-board hydrogen storage for hydrogen powered vehicles, compressed air energy storage (CAES), compressed biogas, compressed natural gas (CNG) etc., the need for tools, which can simulate the filling and emptying of the pressure containers holding the fluid is indeed present both for operational reasons, but even more importantly for safety reasons.
Apparently, no free (as in speach, as in beer) tool exists today which accomplishes the same tasks as HydDown. It has been one of the main goals in producing this software to provide a free tool, which can calculate the pressure vessel response during filling and discharge of gas. There are, however, many tools available which can do a subset of HydDown capabilities, the same as HydDown, or even more. Most of these tools are commercial/proprietary (and closed source) and come with a significant license cost. A single tool has been identified, which is free (as in beer), but still closed source (Kuroki et al., 2021). Below is a partial list of tools, which have comparable capabilities as HydDown -for review of more codes, please refer to Shafiq et al. (2020).  (D'Alessandro et al., 2015) N/A Discharge No BLOWSIM (Mahgerefteh et al., 2002) N/A Discharge Yes H2FillS (Kuroki et al., 2021) Free Filling No Compared to other software codes, HydDown has a number of advantages: It is open source, computations are fast -especially for single component gas, the code is simple to install, the code is easy to run using a simple input file format, both filling and discharge can be handled and fire heat load can be handled for calculations of emergency response. In this way, the code has advantages over existing codes on one or more parameters. However, the code is still limited to gas phase behaviour and heat transfer through the vessel wall is not rigorously modelled. Hence composite cylinders with different layers of material may give inaccurate results, especially for low heat conductivity materials. Some of the above codes can handle this.
It is the intent that the present software can be of use for a number of tasks including (but not limited to): • Design aid for experimental facilities for e.g. mass flow device sizing e.g. orifice, control valve etc. • Benchmarking of other software codes. • Safety device sizing and review (blow-down valve, pressure safety valve), for instance how fast shall blow-down be? How large should an installed pressure safety valve be? • Thermal response of vessel during filling/discharge. Is the design (lower/upper) temperatures exceeded? Should the rate be lower? Is any pre-cooling/heating required?