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
BigDL - Evaluate the performance of BigDL (Distributed Deep Learning on Apache Spark) in big data analysis problems

Evaluate the performance of BigDL (Distributed Deep Learning on Apache Spark) in big data analysis problems.

Vo Cong Thanh 1 Jan 06, 2022
Anomaly Detection with R

AnomalyDetection R package AnomalyDetection is an open-source R package to detect anomalies which is robust, from a statistical standpoint, in the pre

Twitter 3.5k Dec 27, 2022
A fast, flexible, and performant feature selection package for python.

linselect A fast, flexible, and performant feature selection package for python. Package in a nutshell It's built on stepwise linear regression When p

88 Dec 06, 2022
Analysis scripts for QG equations

qg-edgeofchaos Analysis scripts for QG equations FIle/Folder Structure eigensolvers.py - Spectral and finite-difference solvers for Rossby wave eigenf

Norman Cao 2 Sep 27, 2022
Falcon: Interactive Visual Analysis for Big Data

Falcon: Interactive Visual Analysis for Big Data Crossfilter millions of records without latencies. This project is work in progress and not documente

Vega 803 Dec 27, 2022
Parses data out of your Google Takeout (History, Activity, Youtube, Locations, etc...)

google_takeout_parser parses both the Historical HTML and new JSON format for Google Takeouts caches individual takeout results behind cachew merge mu

Sean Breckenridge 27 Dec 28, 2022
An Integrated Experimental Platform for time series data anomaly detection.

Curve Sorry to tell contributors and users. We decided to archive the project temporarily due to the employee work plan of collaborators. There are no

Baidu 486 Dec 21, 2022
SparseLasso: Sparse Solutions for the Lasso

SparseLasso: Sparse Solutions for the Lasso Introduction SparseLasso provides a Scikit-Learn based estimation of the Lasso with cross-validation tunin

Gabriel Okasa 1 Nov 08, 2021
:truck: Agile Data Preparation Workflows made easy with dask, cudf, dask_cudf and pyspark

To launch a live notebook server to test optimus using binder or Colab, click on one of the following badges: Optimus is the missing framework to prof

Iron 1.3k Dec 30, 2022
PipeChain is a utility library for creating functional pipelines.

PipeChain Motivation PipeChain is a utility library for creating functional pipelines. Let's start with a motivating example. We have a list of Austra

Michael Milton 2 Aug 07, 2022
songplays datamart provide details about the musical taste of our customers and can help us to improve our recomendation system

Songplays User activity datamart The following document describes the model used to build the songplays datamart table and the respective ETL process.

Leandro Kellermann de Oliveira 1 Jul 13, 2021
Tools for analyzing data collected with a custom unity-based VR for insects.

unityvr Tools for analyzing data collected with a custom unity-based VR for insects. Organization: The unityvr package contains the following submodul

Hannah Haberkern 1 Dec 14, 2022
Describing statistical models in Python using symbolic formulas

Patsy is a Python library for describing statistical models (especially linear models, or models that have a linear component) and building design mat

Python for Data 866 Dec 16, 2022
Data Science Environment Setup in single line

datascienv is package that helps your to setup your environment in single line of code with all dependency and it is also include pyforest that provide single line of import all required ml libraries

Ashish Patel 55 Dec 16, 2022
Gaussian processes in TensorFlow

Website | Documentation (release) | Documentation (develop) | Glossary Table of Contents What does GPflow do? Installation Getting Started with GPflow

GPflow 1.7k Jan 06, 2023
vartests is a Python library to perform some statistic tests to evaluate Value at Risk (VaR) Models

gg I wasn't satisfied with any of the other available Gemini clients, so I wrote my own. Requires Python 3.9 (maybe older, I haven't checked) and opti

RAFAEL RODRIGUES 5 Jan 03, 2023
Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.

Stock Statistics/Indicators Calculation Helper VERSION: 0.3.2 Introduction Supply a wrapper StockDataFrame based on the pandas.DataFrame with inline s

Cedric Zhuang 1.1k Dec 28, 2022
Python Package for DataHerb: create, search, and load datasets.

The Python Package for DataHerb A DataHerb Core Service to Create and Load Datasets.

DataHerb 4 Feb 11, 2022
Retentioneering 581 Jan 07, 2023
Python Implementation of Scalable In-Memory Updatable Bitmap Indexing

PyUpBit CS490 Large Scale Data Analytics — Implementation of Updatable Compressed Bitmap Indexing Paper Table of Contents About The Project Usage Cont

Hyeong Kyun (Daniel) Park 1 Jun 28, 2022