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
Bamboolib - a GUI for pandas DataFrames

Community repository of bamboolib bamboolib is joining forces with Databricks. For more information, please read our announcement. Please note that th

Tobias Krabel 863 Jan 08, 2023
Working Time Statistics of working hours and working conditions by industry and company

Working Time Statistics of working hours and working conditions by industry and company

Feng Ruohang 88 Nov 04, 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
CSV database for chihuahua (HUAHUA) blockchain transactions

super-fiesta Shamelessly ripped components from https://github.com/hodgerpodger/staketaxcsv - Thanks for doing all the hard work. This code does only

Arlene Macciaveli 1 Jan 07, 2022
Hydrogen (or other pure gas phase species) depressurization calculations

HydDown Hydrogen (or other pure gas phase species) depressurization calculations This code is published under an MIT license. Install as simple as: pi

Anders Andreasen 13 Nov 26, 2022
A tool to compare differences between dataframes and create a differences report in Excel

similarpanda A module to check for differences between pandas Dataframes, and generate a report in Excel format. This is helpful in a workplace settin

Andre Pretorius 9 Sep 15, 2022
Retentioneering 581 Jan 07, 2023
INFO-H515 - Big Data Scalable Analytics

INFO-H515 - Big Data Scalable Analytics Jacopo De Stefani, Giovanni Buroni, Théo Verhelst and Gianluca Bontempi - Machine Learning Group Exercise clas

Yann-Aël Le Borgne 58 Dec 11, 2022
Streamz helps you build pipelines to manage continuous streams of data

Streamz helps you build pipelines to manage continuous streams of data. It is simple to use in simple cases, but also supports complex pipelines that involve branching, joining, flow control, feedbac

Python Streamz 1.1k Dec 28, 2022
Python script for transferring data between three drives in two separate stages

Waterlock Waterlock is a Python script meant for incrementally transferring data between three folder locations in two separate stages. It performs ha

David Swanlund 13 Nov 10, 2021
Display the behaviour of a realtime program with a scope or logic analyser.

1. A monitor for realtime MicroPython code This library provides a means of examining the behaviour of a running system. It was initially designed to

Peter Hinch 17 Dec 05, 2022
Monitor the stability of a pandas or spark dataframe ⚙︎

Population Shift Monitoring popmon is a package that allows one to check the stability of a dataset. popmon works with both pandas and spark datasets.

ING Bank 403 Dec 07, 2022
Weather Image Recognition - Python weather application using series of data

Weather Image Recognition - Python weather application using series of data

Kushal Shingote 1 Feb 04, 2022
Functional tensors for probabilistic programming

Funsor Funsor is a tensor-like library for functions and distributions. See Functional tensors for probabilistic programming for a system description.

208 Dec 29, 2022
fds is a tool for Data Scientists made by DAGsHub to version control data and code at once.

Fast Data Science, AKA fds, is a CLI for Data Scientists to version control data and code at once, by conveniently wrapping git and dvc

DAGsHub 359 Dec 22, 2022
pandas: powerful Python data analysis toolkit

pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive.

pandas 36.4k Jan 03, 2023
Analysiscsv.py for extracting analysis and exporting as CSV

wcc_analysis Lichess page documentation: https://lichess.org/page/world-championships Each WCC has a study, studies are fetched using: https://lichess

32 Apr 25, 2022
MeSH2Matrix - A set of Python codes for the generation of biomedical ontologies from the MeSH keywords of the PubMed scholarly publications

A set of Python codes for the generation of biomedical ontologies from the MeSH keywords of the PubMed scholarly publications

SisonkeBiotik 6 Nov 30, 2022
PyEmits, a python package for easy manipulation in time-series data.

PyEmits, a python package for easy manipulation in time-series data. Time-series data is very common in real life. Engineering FSI industry (Financial

Thompson 5 Sep 23, 2022
Pipeline to convert a haploid assembly into diploid

HapDup (haplotype duplicator) is a pipeline to convert a haploid long read assembly into a dual diploid assembly. The reconstructed haplotypes

Mikhail Kolmogorov 50 Jan 05, 2023