From c5b1a8a31ffb6d81a1e97152084e7bad340ea16a Mon Sep 17 00:00:00 2001 From: Anders Andreasen <58475535+andr1976@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:57:46 +0100 Subject: [PATCH 1/2] Example WIP --- src/hyddown/examples/LPG.yml | 19 +++++++++---------- src/hyddown/examples/relief.yml | 4 +--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/hyddown/examples/LPG.yml b/src/hyddown/examples/LPG.yml index 2190449..813814d 100644 --- a/src/hyddown/examples/LPG.yml +++ b/src/hyddown/examples/LPG.yml @@ -1,27 +1,26 @@ vessel: - length: 2.26 - diameter: 0.51 + length: 4.64 + diameter: 1.7 orientation: "horizontal" heat_capacity: 500 density: 7700 - thickness: 0.010 - liquid_level: 0.22 + thickness: 0.01185 + liquid_level: 0.4668 initial: temperature: 298.15 - pressure: 610000 + pressure: 550000 fluid: "propane" - #fluid: "N2[0.99]&O2[0.01]" calculation: type: "energybalance" time_step: 1 - end_time: 480. + end_time: 900. valve: flow: "discharge" type: "psv" - diameter: 0.012 + diameter: 0.040 discharge_coef: 0.975 - set_pressure: 1790000 - blowdown: 0.1 + set_pressure: 1430000 + blowdown: 0.20 back_pressure: 101300. heat_transfer: type: "s-b" diff --git a/src/hyddown/examples/relief.yml b/src/hyddown/examples/relief.yml index 59aa9db..70af1e9 100644 --- a/src/hyddown/examples/relief.yml +++ b/src/hyddown/examples/relief.yml @@ -9,9 +9,7 @@ vessel: initial: temperature: 298.15 pressure: 10000000 - fluid: "N2[0.99]&O2[0.01]" - #fluid: "Methane[0.9]&Ethane[0.1]" - #fluid: "N2" + fluid: "N2" calculation: type: "energybalance" time_step: 1 From 1b294e64a74aeec63f787646cd474b973cc461fd Mon Sep 17 00:00:00 2001 From: Anders Andreasen <58475535+andr1976@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:42:28 +0100 Subject: [PATCH 2/2] Updated docs --- Manual.md | 10 ++++++---- README.md | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Manual.md b/Manual.md index 9bbd474..9826307 100644 --- a/Manual.md +++ b/Manual.md @@ -11,7 +11,7 @@ listings: True --- # Introduction -HydDown is an open source python3 tool for calculation of hydrogen (or other pure gas phase species) vessel/container depressurization and filling. +HydDown is an open source python3 tool for calculation of hydrogen (or other pure component) vessel/container depressurization and filling. The HydDown logo shown in [@Fig:logo] 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 change in fluid inventory (density) due to flow of gas either in or out of the vessel. @@ -64,7 +64,6 @@ A few choices has been made to keep things simple: - [Coolprop](http://www.coolprop.org/) is used as thermodynamic backend - Only pure substances are considered (limited multi-component capabilities are included) -- Gas phase only - No temperature stratification in the gas phase - A default of of no temperature gradient through vessel wall. - Heat transfer is modelled as constant or simplified using empirical @@ -75,7 +74,7 @@ First of all, the the pure substance Helmholtz energy based equation of state (H Using only a single gas phase species also means that component balances is redundant and 2 or 3-phase flash calculations are not required. That being said, the principle used for a single component is more or less the same, even for multicomponent mixtures with potentially more than one phase. -In the latest revision 1-D transient heat conduction through the vessel wall is now an option if required for low thermal conductivity materials and e.g. type III/IV vessels. +In the latest revision 1-D transient heat conduction through the vessel wall is now an option if required for low thermal conductivity materials and e.g. type III/IV vessels (1-D heat transfer not yet implemented for fire heat load). Further, rigorous two-phase calculations are now possible by specifying a liquid level in the vessel (1-D heat transfer not yet implemented, only 0-D). ## Getting the software The source code can be obtained either from GitHub (via `git` or via the latest tar-ball release) or via **pip** . No packaged releases have currently been planned for **conda**. @@ -228,12 +227,13 @@ The following methods are implemented: - Isentropic: constant entropy of the fluid, no heat transfer with surroundings, PV work performed by the expanding fluid - Isenergetic: constant internal energy of the fluid - Energy balance: this is the most general case and is based on the first law of thermodynamics applied to a flow process. +- Relief: Relief valve dimensioning for gas filled vessels subject to fire. This method provides a dynamic approach to relief valve dimensioning providing realistic orifice size, compared to the very conservative API521 approach. For `isothermal`/`isenthalpic`/`isentropic`/`isenergetic` calculations the minimal input required are: - Initial conditions (pressure, temperature) - vessel dimensions (ID, length) -- valve parameters (Cd, diameter, backpressure) +- valve parameters (Cd, diameter, back-pressure) - Calculation setup (time step, end time) - Type of gas @@ -406,6 +406,8 @@ vessel: liner_density: number, required only for bi-material 1-D transient heat transfer liner_thermal_conductivity: number, required only for bi-material 1-D transient heat transfer orientation: string, required when heat transfer is calculated + liquid_level: number, optional for two-phase + type: string, optional for heads other than flat-end, "DIN", "ASME F&D", or "Hemispherical" ~~~ ### Initial diff --git a/README.md b/README.md index e8b9296..1663129 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ [![status](https://joss.theoj.org/papers/0eed2a25a99589ed8dcdc785c890fb25/status.svg)](https://joss.theoj.org/papers/0eed2a25a99589ed8dcdc785c890fb25) # HydDown -Hydrogen (or other pure gas phase species as well as mixtures) depressurization/pressurisation calculations incorporating heat transfer effetcs. It also models vessel response (pressure/temperature) to external heat loads e.g. external fire (pool/jet) incorporating the Stefan-Boltzmann approach. +Hydrogen (or other pure components) depressurization/pressurisation calculations incorporating heat transfer effects. The software also models vessel response (pressure/temperature) to external heat loads e.g. external fire (pool/jet) incorporating the Stefan-Boltzmann approach. + +NEW: HydDown now supports single component two-phase modelling, including heat transfer to both gas and liquid phase allowing different temperatures to be estimated for the vessel wall in contact with gas and liquid, respectively. This code is published under an MIT license. @@ -52,12 +54,11 @@ This is a small spare time project for calculation of vessel filling/depressuris A few choices is made to keep things simple to begin with: - [Coolprop](http://www.coolprop.org/) is used as thermodynamic backend -- Mainly pure substances are considered (mixtures can be handled - but calculations can be slow) -- Gas phase only -- No temperture stratification in the gas phase -- Default option of no temperture gradient through vessel wall (now extended with a 1-D transient heat conduction model to allow modelling of vessels with low thermal conductivety e.g. type III/IV vessels). +- Mainly pure substances are considered (mixtures can be handled - but calculations can be very slow) +- No temperature stratification +- Default option of no temperature gradient through vessel wall (now extended with a 1-D transient heat conduction model to allow modelling of vessels with low thermal conductivity e.g. type III/IV vessels). -The code is as simple as possible. The above choices makes the problem a lot more simple to solve, First of all the pure substance Helmholtz energy based equation of state (HEOS) in coolprop offers a lot of convenience in terms of the property pairs/state variables that can be set independently. Using only a single gas phase species also means that component balances is redundant and 2 or 3-phase flash calculations are not required. That being said the principle used for a single component is more or less the same, even for multicomponent mixtures with potentially more than one phase. +The code is as simple as possible. The above choices makes the problem a lot more simple to solve, First of all the pure substance Helmholtz energy based equation of state (HEOS) in CoolProp offers a lot of convenience in terms of the property pairs/state variables that can be set independently. Using only a single gas phase species also means that component balances is redundant and 2 or 3-phase flash calculations are not required. That being said the principle used for a single component is more or less the same, even for multicomponent mixtures with potentially more than one phase. ## Description The following methods are implemented: @@ -67,6 +68,7 @@ The following methods are implemented: - Isentropic (no heat transfer with surroundings, PV work performed by the expanding fluid) - Constant internal energy - Energy balance. This is the most general case and includes the ability to transfer heat with surroundings +- Relief: Relief valve dimensioning for gas filled vessels subject to fire. This method provides a dynamic approach to relief valve dimensioning providing realistic orifice size, compared to the very conservative API521 approach. Various mass flow equations are enabled: @@ -75,21 +77,21 @@ Various mass flow equations are enabled: - Relief valve (discharge only) - Constant mass flow -A simple (naive) explicit Euler scheme is implemented to integrate the mass balance over time, with the mass rate being calculated from an orifice/valve equation. For each step, the mass relief/ left in the vessel is known. Since the volume is fixed the mass density is directly given. For the simple methods (isentropic,isenthalpic,isenergetic etc), Coolprop allows specifying density and either H,S or U directly - this is very handy and normally only TP, PH, TS property pairs are implemented, and you would need to code a second loop to make it into am UV, VH or SV calculation. Coolprop is very convenient for this, however for a cubic EOS and for multicomponent Helmholtz energy EOS coolprop only supports a subset of state variables to be specified directly (T,P,quality). For this reason single component HEOS is the main target of this small project. In case the "Energy balance" method is applied, the heat added from convection and work is accounted for. +A simple (naive) explicit Euler scheme is implemented to integrate the mass balance over time, with the mass rate being calculated from an orifice/valve equation. For each step, the mass relief/ left in the vessel is known. Since the volume is fixed the mass density is directly given. For the simple methods (isentropic, isenthalpic, isenergetic etc), CoolProp allows specifying density and either H,S or U directly - this is very handy and normally only TP, PH, TS property pairs are implemented, and you would need to code a second loop to make it into am UV, VH or SV calculation. CoolProp is very convenient for this, however for a cubic EOS and for multicomponent Helmholtz energy EOS CoolProp only supports a subset of state variables to be specified directly (T,P,quality). For this reason single component HEOS is the main target of this small project. In case the "Energy balance" method is applied, the heat added from convection and work is accounted for. ## Basic usage The Yaml input file is edited to reflect the system of interest. For isothermal/isenthalpic/isentropic/isenergetic calculations the minimal input required are: - Initial conditions (pressure, temperature) - vessel dimensions (ID/length) -- valve parameters (Cd, diameter, backpressure) +- valve parameters (Cd, diameter, back-pressure) - Calculation setup (time step, end time) -- Type of gas +- Type of component If heat transfer is to be considered the calculation type "energybalance" is required. A few options are possible: - Fixed U (U-value required, and ambient temperature) -- Fixed Q (Q to be applied to the fluid is requried) +- Fixed Q (requires Q to be applied to the fluid) - Specified h, the external heat transfer coefficient is provided and either the internal is provided or calculated from assumption of natural convection from a vertical cylinder at high Gr number. Ambient temperature is required. - Detailed - Fire with heat load calculated from the Stefan-Boltzmann equation