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
MS in Data Science capstone project. Studying attacks on autonomous vehicles.

Surveying Attack Models for CAVs Guide to Installing CARLA and Collecting Data Our project focuses on surveying attack models for Connveced Autonomous

Isabela Caetano 1 Dec 09, 2021
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
Analyze the Gravitational wave data stored at LIGO/VIRGO observatories

Gravitational-Wave-Analysis This project showcases how to analyze the Gravitational wave data stored at LIGO/VIRGO observatories, using Python program

1 Jan 23, 2022
Lale is a Python library for semi-automated data science.

Lale is a Python library for semi-automated data science. Lale makes it easy to automatically select algorithms and tune hyperparameters of pipelines that are compatible with scikit-learn, in a type-

International Business Machines 293 Dec 29, 2022
Renato 214 Jan 02, 2023
Data Analytics on Genomes and Genetics

Data Analytics performed on On genomes and Genetics dataset to predict genetic disorder and disorder subclass. DONE by TEAM SIGMA!

1 Jan 12, 2022
A meta plugin for processing timelapse data timepoint by timepoint in napari

napari-time-slicer A meta plugin for processing timelapse data timepoint by timepoint. It enables a list of napari plugins to process 2D+t or 3D+t dat

Robert Haase 2 Oct 13, 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
Additional tools for particle accelerator data analysis and machine information

PyLHC Tools This package is a collection of useful scripts and tools for the Optics Measurements and Corrections group (OMC) at CERN. Documentation Au

PyLHC 3 Apr 13, 2022
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
A 2-dimensional physics engine written in Cairo

A 2-dimensional physics engine written in Cairo

Topology 38 Nov 16, 2022
CubingB is a timer/analyzer for speedsolving Rubik's cubes, with smart cube support

CubingB is a timer/analyzer for speedsolving Rubik's cubes (and related puzzles). It focuses on supporting "smart cubes" (i.e. bluetooth cubes) for recording the exact moves of a solve in real time.

Zach Wegner 5 Sep 18, 2022
TE-dependent analysis (tedana) is a Python library for denoising multi-echo functional magnetic resonance imaging (fMRI) data

tedana: TE Dependent ANAlysis TE-dependent analysis (tedana) is a Python library for denoising multi-echo functional magnetic resonance imaging (fMRI)

136 Dec 22, 2022
Kennedy Institute of Rheumatology University of Oxford Project November 2019

TradingBot6M Kennedy Institute of Rheumatology University of Oxford Project November 2019 Run Change api.txt to binance api key: https://www.binance.c

Kannan SAR 2 Nov 16, 2021
ELFXtract is an automated analysis tool used for enumerating ELF binaries

ELFXtract ELFXtract is an automated analysis tool used for enumerating ELF binaries Powered by Radare2 and r2ghidra This is specially developed for PW

Monish Kumar 49 Nov 28, 2022
CRISP: Critical Path Analysis of Microservice Traces

CRISP: Critical Path Analysis of Microservice Traces This repo contains code to compute and present critical path summary from Jaeger microservice tra

Uber Research 110 Jan 06, 2023
talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

David Cournapeau 76 Nov 30, 2022
Python Practicum - prepare for your Data Science interview or get a refresher.

Python-Practicum Python Practicum - prepare for your Data Science interview or get a refresher. Data Data visualization using data on births from the

Jovan Trajceski 1 Jul 27, 2021
Bigdata Simulation Library Of Dream By Sandman Books

BIGDATA SIMULATION LIBRARY OF DREAM BY SANDMAN BOOKS ================= Solution Architecture Description In the realm of Dreaming, its ruler SANDMAN,

Maycon Cypriano 3 Jun 30, 2022
PyIOmica (pyiomica) is a Python package for omics analyses.

PyIOmica (pyiomica) This repository contains PyIOmica, a Python package that provides bioinformatics utilities for analyzing (dynamic) omics datasets.

G. Mias Lab 13 Jun 29, 2022