Hydrogen (or other pure gas phase species) depressurization calculations

Overview

DOI license buil codecov Streamlit App CodeQL status

HydDown

Hydrogen (or other pure gas phase species) depressurization calculations

This code is published under an MIT license.

Install as simple as:

pip install hyddown

In the case of an error in installing relation to python2, for example:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement hyddown (from versions: none)
ERROR: No matching distribution found for hyddown

please instead install with

python3 -m pip install hyddown

or try

pip3 install hyddown

Run the code as simple as:

python main.py input.yml

where main.py is the main script and input.yml is the input file in Yaml syntax.

Consult the manual for a more rigorous explanation of the software, the implemented methods, and its usage. Further, the manual also contains a few validation studies.

IMPORTANT NOTICE:

This package, or CoolProp to be more precise, runs on python 3.8 and apparently the CoolProp pip package has issues with python 3.9. Maybe compiling from source works, but this has not been tested. Hence, it is highly recommended that python 3.8 is used.

Demonstration

The easiest way to explore the capability of HydDown is the streamlit app. This version allows calculation of:

  • filling of vessel with gas (pressurisation)
  • discharge of gas (depressurisation)
  • various gases (H2, N2, CH4, He, Air)
  • variable size pressure cylinder/vessel
  • heat transfer between gas and vessel wall can be turned on/off

Background

This is a small spare time project for calculation of vessel filling/depressurisation behaviour. This is mainly to demonstrate, that although perceived as a very tedious/difficult/complex problem to solve, actually a fairly limited amount of code is necessary if you have a good thermodynamic backend.

A few choices is made to keep things simple to begin with:

  • Coolprop 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
  • No temperture gradient through vessel wall

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:

  • Isothermal i.e. constant temperature of the fluid during depressurisation (for a very slow process with a large heat reservoir)
  • Isenthalpic/Adiabatic (no heat transfer with surroundings, no work performed by the expanding fluid)
  • 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

Various mass flow equations are enabled:

  • Orifice
  • Control valve
  • 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.

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)
  • Calculation setup (time step, end time)
  • Type of gas

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)
  • 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
Comments
  • Usage and examples

    Usage and examples

    While the manual provides additional information about where to find various main programs, some clarification in the README and comments in the code are strongly needed to make the software more intuitive (Don't do anything yet, I am still working on the manual)

    opened by mefuller 8
  • Installations instructions are either incorrect or not generic

    Installations instructions are either incorrect or not generic

    For review https://github.com/openjournals/joss-reviews/issues/3695 :

    I am running a fully updated Fedora 34 system with Python 3.9 (Python 2 deprecated).

    I am unable to use pip to install the hyddown package per the instructions:

    $ pip install hyddown
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
    Defaulting to user installation because normal site-packages is not writeable
    ERROR: Could not find a version that satisfies the requirement hyddown (from versions: none)
    ERROR: No matching distribution found for hyddown
    $ pip install hyddown --user
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
    ERROR: Could not find a version that satisfies the requirement hyddown (from versions: none)
    ERROR: No matching distribution found for hyddown
    
    documentation good first issue 
    opened by mefuller 5
  • Installation instructions do not include instructions to install dependencies

    Installation instructions do not include instructions to install dependencies

    The installation instructions in the README say to pip install hyddown, but the runtime dependencies are not included.

    I was able to find the requirements.txt and install them manually, but I would suggest either setting up the distribution so pip can install the dependencies automatically, or include installing the dependencies in the installation instructions.

    opened by bocklund 2
  • Contributing, reporting, and support

    Contributing, reporting, and support

    For review openjournals/joss-reviews#3695 :

    Other than the default github features (author identification, issue tracker, pull requests), there is no explicit mention in the README or elsewhere as to how one contributes to the software, reports, bugs (and requests enhancements) or asks for support. Given the nature of the github interface, I do not think this is strictly required, but it would be beneficial to add text on this to the README file

    documentation 
    opened by mefuller 2
  • Documentation/instructions for running tests

    Documentation/instructions for running tests

    I was able to run pytest from the main repo and run 33 tests in src/hyddown/test_all.py, however there were no instructions for running these and I'm not sure if I'm testing everything that was intended to be tested. The documentation could use a short statement on the correct procedure for running the automated tests.

    opened by bocklund 1
  • Error when running example `input.yml`

    Error when running example `input.yml`

    Running the input.yml at the root directory with the main.py script fails with the traceback:

    {'calculation': [{'eta': ['unknown field']}]}
    Traceback (most recent call last):
      File "main.py", line 21, in <module>
        hdown=HydDown(input)
      File "/Users/brandon/Projects/hyddown-rev/HydDown/src/hyddown/hdclass.py", line 31, in __init__
        self.validate_input()
      File "/Users/brandon/Projects/hyddown-rev/HydDown/src/hyddown/hdclass.py", line 47, in validate_input
        raise ValueError("Error in input file")
    ValueError: Error in input file
    

    Steps to reproduce:

    1. Clone the HydDown repository
    2. cd hyddown
    3. pip install .
    4. python src/main.py input.yml
    opened by bocklund 1
  • fix spelling, grammar, formatting

    fix spelling, grammar, formatting

    As mentioned in https://github.com/andr1976/HydDown/issues/59 , additional information defining the meaning of h, U and Q and their units for heat transfer models must be added tot he documentation.

    opened by mefuller 1
Releases(v0.16.2)
  • v0.16.2(Oct 4, 2021)

    Hydrogen (or other pure gas phase species) pressure vessel filling and discharge calculations.

    All basic functionality for single component gas pressurisation/depressurisation implemented. For steel vessels the results have been validated against experiments from the scientific literature. Rudimentary multicomponent capability.

    Source code(tar.gz)
    Source code(zip)
  • v0.15.1(Aug 2, 2021)

    Hydrogen (or other pure gas phase species) pressure vessel filling and discharge calculations.

    All basic functionality for single component gas pressurisation/depressurisation implemented. For steel vessels the results have been validated against experiments from the scientific literature. Rudimentary multicomponent capability.

    This version is the first to be accompanied by a PyPi release.

    Source code(tar.gz)
    Source code(zip)
  • v0.14-alpha(May 11, 2021)

    All basic functionality for single component gas pressurisation/depressurisation implemented. For steel vessels the results have been validated against experiments from the scientific literature.

    Source code(tar.gz)
    Source code(zip)
  • v0.13(Apr 21, 2021)

    First version working reasonably well with most needed features implemeting. Some work is required to provide meaningful messages to errors in input/yaml. Some convienece features are also lacking such as result arrays stored as pandas dataframe, optimisation/solvers for valve sizing is also lacking. More elaboration on heat transfer correlations is required as well as a transient 1-D heat transfer model to handle other materials than fairly dense metals.

    Source code(tar.gz)
    Source code(zip)
  • v0.12(Apr 13, 2021)

    The first version with basic functionality implemented: testing, input file format, and schema check, calculation class and utility functions. Most calculation methods and combinations are implemeted except fire (variable) external heat load. Some validation pending for filling.

    Source code(tar.gz)
    Source code(zip)
  • v0.11(Apr 6, 2021)

Owner
Anders Andreasen
Chemical Engineer, working within process and energy technology
Anders Andreasen
Tablexplore is an application for data analysis and plotting built in Python using the PySide2/Qt toolkit.

Tablexplore is an application for data analysis and plotting built in Python using the PySide2/Qt toolkit.

Damien Farrell 81 Dec 26, 2022
Full ELT process on GCP environment.

Rent Houses Germany - GCP Pipeline Project: The goal of the project is to extract data about house rentals in Germany, store, process and analyze it u

Felipe Demenech Vasconcelos 2 Jan 20, 2022
Project: Netflix Data Analysis and Visualization with Python

Project: Netflix Data Analysis and Visualization with Python Table of Contents General Info Installation Demo Usage and Main Functionalities Contribut

Kathrin Hälbich 2 Feb 13, 2022
DenseClus is a Python module for clustering mixed type data using UMAP and HDBSCAN

DenseClus is a Python module for clustering mixed type data using UMAP and HDBSCAN. Allowing for both categorical and numerical data, DenseClus makes it possible to incorporate all features in cluste

Amazon Web Services - Labs 53 Dec 08, 2022
PyNHD is a part of HyRiver software stack that is designed to aid in watershed analysis through web services.

A part of HyRiver software stack that provides access to NHD+ V2 data through NLDI and WaterData web services

Taher Chegini 23 Dec 14, 2022
cLoops2: full stack analysis tool for chromatin interactions

cLoops2: full stack analysis tool for chromatin interactions Introduction cLoops2 is an extension of our previous work, cLoops. From loop-calling base

YaqiangCao 25 Dec 14, 2022
Python dataset creator to construct datasets composed of OpenFace extracted features and Shimmer3 GSR+ Sensor datas

Python dataset creator to construct datasets composed of OpenFace extracted features and Shimmer3 GSR+ Sensor datas

Gabriele 3 Jul 05, 2022
Pypeln is a simple yet powerful Python library for creating concurrent data pipelines.

Pypeln Pypeln (pronounced as "pypeline") is a simple yet powerful Python library for creating concurrent data pipelines. Main Features Simple: Pypeln

Cristian Garcia 1.4k Dec 31, 2022
PyClustering is a Python, C++ data mining library.

pyclustering is a Python, C++ data mining library (clustering algorithm, oscillatory networks, neural networks). The library provides Python and C++ implementations (C++ pyclustering library) of each

Andrei Novikov 1k Jan 05, 2023
Flenser is a simple, minimal, automated exploratory data analysis tool.

Flenser Have you ever been handed a dataset you've never seen before? Flenser is a simple, minimal, automated exploratory data analysis tool. It runs

John McCambridge 79 Sep 20, 2022
An extension to pandas dataframes describe function.

pandas_summary An extension to pandas dataframes describe function. The module contains DataFrameSummary object that extend describe() with: propertie

Mourad 450 Dec 30, 2022
apricot implements submodular optimization for the purpose of selecting subsets of massive data sets to train machine learning models quickly.

Please consider citing the manuscript if you use apricot in your academic work! You can find more thorough documentation here. apricot implements subm

Jacob Schreiber 457 Dec 20, 2022
Hatchet is a Python-based library that allows Pandas dataframes to be indexed by structured tree and graph data.

Hatchet Hatchet is a Python-based library that allows Pandas dataframes to be indexed by structured tree and graph data. It is intended for analyzing

Lawrence Livermore National Laboratory 14 Aug 19, 2022
PyChemia, Python Framework for Materials Discovery and Design

PyChemia, Python Framework for Materials Discovery and Design PyChemia is an open-source Python Library for materials structural search. The purpose o

Materials Discovery Group 61 Oct 02, 2022
Investigating EV charging data

Investigating EV charging data Introduction: Got an opportunity to work with a home monitoring technology company over the last 6 months whose goal wa

Yash 2 Apr 07, 2022
WithPipe is a simple utility for functional piping in Python.

A utility for functional piping in Python that allows you to access any function in any scope as a partial.

Michael Milton 1 Oct 26, 2021
Fitting thermodynamic models with pycalphad

ESPEI ESPEI, or Extensible Self-optimizing Phase Equilibria Infrastructure, is a tool for thermodynamic database development within the CALPHAD method

Phases Research Lab 42 Sep 12, 2022
PrimaryBid - Transform application Lifecycle Data and Design and ETL pipeline architecture for ingesting data from multiple sources to redshift

Transform application Lifecycle Data and Design and ETL pipeline architecture for ingesting data from multiple sources to redshift This project is composed of two parts: Part1 and Part2

Emmanuel Boateng Sifah 1 Jan 19, 2022
A Numba-based two-point correlation function calculator using a grid decomposition

A Numba-based two-point correlation function (2PCF) calculator using a grid decomposition. Like Corrfunc, but written in Numba, with simplicity and hackability in mind.

Lehman Garrison 3 Aug 24, 2022
Unsub is a collection analysis tool that assists libraries in analyzing their journal subscriptions.

About Unsub is a collection analysis tool that assists libraries in analyzing their journal subscriptions. The tool provides rich data and a summary g

9 Nov 16, 2022