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
Finding project directories in Python (data science) projects, just like there R rprojroot and here packages

Find relative paths from a project root directory Finding project directories in Python (data science) projects, just like there R here and rprojroot

Daniel Chen 102 Nov 16, 2022
Employee Turnover Analysis

Employee Turnover Analysis Submission to the DataCamp competition "Can you help reduce employee turnover?"

Jannik Wiedenhaupt 1 Feb 13, 2022
A Python Tools to imaging the shallow seismic structure

ShallowSeismicImaging Tools to imaging the shallow seismic structure, above 10 km, based on the ZH ratio measured from the ambient seismic noise, and

Xiao Xiao 9 Aug 09, 2022
Analysis of a dataset of 10000 passwords to find common trends and mistakes people generally make while setting up a password.

Analysis of a dataset of 10000 passwords to find common trends and mistakes people generally make while setting up a password.

Aryan Raj 7 Sep 04, 2022
MapReader: A computer vision pipeline for the semantic exploration of maps at scale

MapReader A computer vision pipeline for the semantic exploration of maps at scale MapReader is an end-to-end computer vision (CV) pipeline designed b

Living with Machines 25 Dec 26, 2022
Renato 214 Jan 02, 2023
Python package to transfer data in a fast, reliable, and packetized form.

pySerialTransfer Python package to transfer data in a fast, reliable, and packetized form.

PB2 101 Dec 07, 2022
Open-Domain Question-Answering for COVID-19 and Other Emergent Domains

Open-Domain Question-Answering for COVID-19 and Other Emergent Domains This repository contains the source code for an end-to-end open-domain question

7 Sep 27, 2022
TheMachineScraper šŸ±ā€šŸ‘¤ is an Information Grabber built for Machine Analysis

TheMachineScraper šŸ±ā€šŸ‘¤ is a tool made purely for analysing machine data for any reason.

doop 5 Dec 01, 2022
Automatic earthquake catalog building workflow: EQTransformer + Siamese EQTransformer + PickNet + REAL + HypoInverse

Automatic regional-scale earthquake catalog building workflow: EQTransformer + Siamese EQTransforme

Xiao Zhuowei 9 Nov 27, 2022
Program that predicts the NBA mvp based on data from previous years.

NBA MVP Predictor A machine learning model using RandomForest Regression that predicts NBA MVP's using player data. Explore the docs Ā» View Demo Ā· Rep

Muhammad Rabee 1 Jan 21, 2022
Vaex library for Big Data Analytics of an Airline dataset

Vaex-Big-Data-Analytics-for-Airline-data A Python notebook (ipynb) created in Jupyter Notebook, which utilizes the Vaex library for Big Data Analytics

Nikolas Petrou 1 Feb 13, 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
A simple and efficient tool to parallelize Pandas operations on all availableĀ CPUs

PandaralĀ·lel Without parallelization With parallelization Installation $ pip install pandarallel [--upgrade] [--user] Requirements On Windows, Pandara

Manu NALEPA 2.8k Dec 31, 2022
MoRecon - A tool for reconstructing missing frames in motion capture data.

MoRecon - A tool for reconstructing missing frames in motion capture data.

Yuki Nishidate 38 Dec 03, 2022
Open-source Laplacian Eigenmaps for dimensionality reduction of large data in python.

Fast Laplacian Eigenmaps in python Open-source Laplacian Eigenmaps for dimensionality reduction of large data in python. Comes with an wrapper for NMS

17 Jul 09, 2022
Option Pricing Calculator using the Binomial Pricing Method (No Libraries Required)

Binomial Option Pricing Calculator Option Pricing Calculator using the Binomial Pricing Method (No Libraries Required) Background A derivative is a fi

sammuhrai 1 Nov 29, 2021
Python library for creating data pipelines with chain functional programming

PyFunctional Features PyFunctional makes creating data pipelines easy by using chained functional operators. Here are a few examples of what it can do

Pedro Rodriguez 2.1k Jan 05, 2023
Time ranges with python

timeranges Time ranges. Read the Docs Installation pip timeranges is available on pip: pip install timeranges GitHub You can also install the latest v

Micael Jarniac 2 Sep 01, 2022
NFCDS Workshop Beginners Guide Bioinformatics Data Analysis

Genomics Workshop FIXME: overview of workshop Code of Conduct All participants s

Elizabeth Brooks 2 Jun 13, 2022