Skip to content

Commit

Permalink
Merge pull request #93 from andr1976/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
andr1976 authored Feb 4, 2025
2 parents 69711f9 + 5496676 commit ddd45c6
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --ignore=F821
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ src/hyddown/__pycache__/hdclass.cpython-310.pyc
src/hyddown/__pycache__/thermesh.cpython-310.pyc
src/hyddown/__pycache__/transport.cpython-310.pyc
src/hyddown/__pycache__/validator.cpython-310.pyc
src/hyddown/__pycache__/fire.cpython-311.pyc
src/hyddown/__pycache__/hdclass.cpython-311.pyc
src/hyddown/__pycache__/thermesh.cpython-311.pyc
src/hyddown/__pycache__/transport.cpython-311.pyc
src/hyddown/__pycache__/validator.cpython-311.pyc
src/HydDown.egg-info/PKG-INFO
src/HydDown.egg-info/dependency_links.txt
src/hyddown/__pycache__/__init__.cpython-311.pyc
src/HydDown.egg-info/top_level.txt
src/HydDown.egg-info/dependency_links.txt
src/HydDown.egg-info/PKG-INFO
19 changes: 13 additions & 6 deletions Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ This manual can be cited as [@Andreasen2024]:
Anders Andreasen. HydDown - User guide and technical reference. 2024. ⟨hal-04858235⟩

@report{Andreasen2024,
url = {https://hal.science/hal-04858235v1},
url = {https://hal.science/hal-04858235},
year = {2024},
publisher = {HAL open science},
author = {Anders Andreasen},
Expand Down Expand Up @@ -1150,7 +1150,7 @@ and 1.130 m respectively. The wall thickness is 59 mm. For modelling the length
The minimum gas temperature simulated by HydDown -6 C, compared to the minimum measured average gas temperature of
-10.3 C. The difference in measured vs calculated wall temperature is 2.3 C, with a lower measured wall temperature.

<!--

## 1-D transient heat transfer
A few notes about vessels with poor thermal conductivity and composite materials. When modelling systems with high Biot number and in particular composite materials the complexity increases significantly. Not just because of the more difficult numerical problem, but even more so because of uncertainty in key parameters such as thermal conductivity, density and heat capacity. Composite materials such as carbon fibre or glass fibre reinforced epoxy systems can be manufactured in many different ways (fibre orientation etc.) which effects the previously mentioned properties. These properties, in particular the thermal conductivity, will influence the results significantly. If these properties are not accurately informed for the system to be analysed, sourcing data from literature shall be done with caution.

Expand Down Expand Up @@ -1274,11 +1274,18 @@ The results of HydDown simulation with the *artificial* type III cylinder is sho

![Calculations of vessel wall temperature (inner/outer) with 1D transient heat conduction during helium discharge for a hypothetical type III cylinder with dimensions similar to the KIT type IV cylinder.](docs/img/KIT_type_III.png){#fig:KIT_typeIII}

In Figure [@fig:KIT_typeIV_temp] and [@fig:KIT_typeIII_temp] the simulated temperature across the vessel liner/composite wall is shown for the real type IV cylinder from the KIT experiment and for the *artificial* type III cylinder, respectively. As seen there is a significant difference between the two bi-materials. The type III cylinder has almost zero temperature gradient across the aluminum liner, which can be rationalised by the very high thermal conductivity. Thus, the entire thermal gradient is over the composite shell material. These observations are in-line with simulation results from ref. [@MELIDEO20177304].
In Figures [@fig:KIT_typeIV_temp1] [@fig:KIT_typeIII_temp2] the simulated temperature across the vessel liner/composite wall is shown for the real type IV cylinder from the KIT experiment and for the *artificial* type III cylinder, respectively. As seen there is a significant difference between the two bi-materials. The type III cylinder has almost zero temperature gradient across the aluminum liner, which can be rationalised by the very high thermal conductivity. Thus, the entire thermal gradient is over the composite shell material. These observations are in-line with simulation results from ref. [@MELIDEO20177304].

![Calculations of type IV vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell](docs/img/KIT_II_tprofile2.png){ width = 50% }{#fig:KIT_typeIV_temp1}

![Calculations of type IV vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell](docs/img/KIT_II_tprofile1.png){ width = 50% }{#fig:KIT_typeIV_temp2}


![Calculations of type III vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell](docs/img/KIT_III_tprofile2.png){ width = 50% }{#fig:KIT_typeIII_temp1}


![Calculations of type IV vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell,](docs/img/KIT_TypeIV_temp.png){#fig:KIT_typeIV_temp}
![Calculations of type III vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell](docs/img/KIT_III_tprofile1.png){ width = 50% }{#fig:KIT_typeIII_temp2}

![Calculations of type III vessel wall temperature profile with 1D transient heat conduction. z=0 is the bonding interfance between liner and composite, z<0 is the liner and z>0 is the composite shell,](docs/img/KIT_TypeIII_temp.png){#fig:KIT_typeIII_temp}

## Validation against Type III cylinder filling experiments
For HydDown type III cylinder filling experimental validation, the work of Dicken and Mérida [@Dicken] is used. They conducted experiments of filling a 74 liter type III cylinder and also compared measurements with CFD calculations. Details of type III cyinder tested is shown in Table [@tbl:Dicken-TypeIII]. For HydDown simulation the length of a flat-ended cylinder has been adjusted to give a total cylinder volume of 74 liter. The time-dependent filling mass flow has been sourced from ref. [@Dicken] and scaled in order to match the final experimental pressure.
Expand Down Expand Up @@ -1318,4 +1325,4 @@ In lack of measured vessel inner wall temperature (liner) the values calculated
To be written

# Future developmet of HydDown
To be written -->
To be written
Binary file added docs/img/KIT_III_tprofile1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/KIT_III_tprofile2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/KIT_II_tprofile1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/KIT_II_tprofile2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion scripts/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ def read_input():
back_pressure = float(back_pressure) * 1e5

#fluid = st.selectbox('Select fluid', ('H2', 'He', 'N2', 'air', 'CH4', 'O2'))
fluid = st.selectbox('Select fluid', ('H2', 'NG', 'He', 'N2', 'air', 'CH4','O2'))
fluid = st.selectbox('Select fluid', ('H2', 'NG', 'NG1', 'He', 'N2', 'air', 'CH4','O2'))
if fluid == 'NG':
fluid = "Methane[0.89571]&Ethane[5.6739e-02]&Propane[2.30395e-02]&Butane[1.03E-02]&Pentane[2.67E-03]&CO2[0.84e-02]&N2[0.3080e-2]"
if fluid == 'NG1':
fluid = "Methane[0.860231]&Ethane[0.078217]&Propane[0.033786]&Butane[9.210E-03]&Pentane[2.573E-03]&Hexane[3.560E-04]&CO2[1.206E-02]&N2[3.701E-03]"

mode = st.selectbox('Select mode', ('filling', 'discharge'))
temp = st.text_input("Initial temp. (C):", 25)
temp = float(temp) + 273.15
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ packages = find:
scripts =
scripts/hyddown_main.py
scripts/streamlit_app.py
python_requires = >=3.6
python_requires = >=3.6, <3.12
include_package_data = True
install_requires =
tqdm
Expand Down
22 changes: 20 additions & 2 deletions src/HydDown.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Requires-Dist: scipy>=1.6.0
[![status](https://joss.theoj.org/papers/0eed2a25a99589ed8dcdc785c890fb25/status.svg)](https://joss.theoj.org/papers/0eed2a25a99589ed8dcdc785c890fb25)

# HydDown
Hydrogen (or other pure gas phase species) depressurization calculations
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.

This code is published under an MIT license.

Expand Down Expand Up @@ -60,8 +60,26 @@ where main.py is the main script and input.yml is the input file in Yaml syntax.

Consult the [manual](https://github.com/andr1976/HydDown/raw/main/docs/MANUAL.pdf) for a more rigorous explanation of the software, the implemented methods, and its usage. Further, the manual also contains a few validation studies.

## Citing HydDown

Please cite the following reference:

Andreasen, A., (2021). HydDown: A Python package for calculation of hydrogen (or other gas) pressure vessel filling and discharge. Journal of Open Source Software, 6(66), 3695, https://doi.org/10.21105/joss.03695

@article{Andreasen2021,
doi = {10.21105/joss.03695},
url = {https://doi.org/10.21105/joss.03695},
year = {2021},
publisher = {The Open Journal},
volume = {6},
number = {66},
pages = {3695},
author = {Anders Andreasen},
title = {HydDown: A Python package for calculation of hydrogen (or other gas) pressure vessel filling and discharge},
journal = {Journal of Open Source Software}
}
## Demonstration
The easiest way to explore the capability of HydDown is the [streamlit app](https://share.streamlit.io/andr1976/hyddown/main/scripts/streamlit_app.py). This version allows calculation of:
The easiest way to explore the capability of HydDown is the [streamlit app](https://hyddown-jltaqjxtrsflh2famtkgsj.streamlit.app/). This version allows calculation of:

- filling of vessel with gas (pressurisation)
- discharge of gas (depressurisation)
Expand Down
1 change: 1 addition & 0 deletions src/HydDown.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ src/hyddown/__init__.py
src/hyddown/fire.py
src/hyddown/hdclass.py
src/hyddown/test_all.py
src/hyddown/thermesh.py
src/hyddown/transport.py
src/hyddown/validator.py
src/hyddown/examples/controlvalve.yml
Expand Down
Binary file not shown.
15 changes: 8 additions & 7 deletions src/hyddown/hdclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ def run(self, disable_pbar=True):
):
nn = 11 # number of nodes
z = np.linspace(0, self.thickness, nn)
self.z = z
mesh = tm.Mesh(
z, tm.LinearElement
) # Or `QuadraticElement` to
Expand Down Expand Up @@ -908,10 +909,10 @@ def plot(self, filename=None, verbose=True):
"g+",
label="Inner wall",
)
if "wall_high" in temp:
if "wall_low" in temp:
plt.plot(
np.asarray(temp["wall_high"]["time"]),
np.asarray(temp["wall_high"]["temp"]) - 273.15,
np.asarray(temp["wall_low"]["time"]),
np.asarray(temp["wall_low"]["temp"]) - 273.15,
"g-.",
label="Wall high",
)
Expand Down Expand Up @@ -1014,7 +1015,7 @@ def plot_tprofile(self, filename=None, verbose=True):
import numpy as np

if filename != None:
plt.figure(3, figsize=(12, 7), dpi=300)
plt.figure(3, figsize=(8, 6))
else:
plt.figure(3, figsize=(8, 6))

Expand All @@ -1035,10 +1036,10 @@ def plot_tprofile(self, filename=None, verbose=True):


if filename != None:
plt.savefig(filename + "_tprofile1.png")
plt.savefig(filename + "_tprofile1.png", dpi=300)

if filename != None:
plt.figure(4, figsize=(12, 7), dpi=300)
plt.figure(4, figsize=(8, 6))
else:
plt.figure(4, figsize=(8, 6))

Expand All @@ -1052,7 +1053,7 @@ def plot_tprofile(self, filename=None, verbose=True):
plt.title("Temperature distribution")

if filename != None:
plt.savefig(filename + "_tprofile2.png")
plt.savefig(filename + "_tprofile2.png", dpi=300)
if verbose:
plt.show()

Expand Down
2 changes: 1 addition & 1 deletion src/hyddown/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def validate_mandatory_ruleset(input):
},
},
},
"wall_high": {
"wall_low": {
"required": False,
"type": "dict",
"contains": ["time", "temp"],
Expand Down

0 comments on commit ddd45c6

Please sign in to comment.