https://github.com/avinashresearch1/multicomponentflash.jl

https://github.com/avinashresearch1/multicomponentflash.jl

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: avinashresearch1
  • License: mit
  • Default Branch: main
  • Size: 324 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Fork of moyner/MultiComponentFlash.jl
Created over 3 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

MultiComponentFlash

Stable Dev Build Status Coverage

Introduction

This package implements several equations of state for multicomponent vapor-liquid equilibrium, also called flash, for mixtures. These can be used to determine vapor fractions, molar partition between the phases and predict properties such as density and volume.

The following equations of state (EOS) are implemented as a class of generic cubics:

The code is fully type stable, easy to use and fairly performant, with additional options to avoid allocations if you need to perform many flashes. The main implementation goal is to have a compact, performant and easy to use code suitable for integration in simulators of multiphase flow.

Highlights

We highlight a few of the features. For more details, please see the API and the Basic usage examples.

  • Support for different solution methods (successive substition (SSI), Newton, SSI+Newton) and type dispatch makes it easy for users to add their own.
  • User friendly interface - with options to pre-allocate for increase performance.
  • Compatible with AD. Mostly tested with ForwardDiff.
  • Phase stability test.
  • Rachford-Rice for constant K-values.
  • Useful utilities for molar density, molar volume, single-phase liquid-vapor estimation and Lohrenz-Bray-Clark viscosity correlations that are compatible with custom types and AD.

For more details, please see the documentation

Quick start

Vapor fraction for constant K-values

We solve the Rachford-Rice equations: julia using MultiComponentFlash K = [0.1, 9.0] # K-values z = [0.7, 0.3] # Mole fractions V = solve_rachford_rice(K, z) V now holds the vapor fraction: 0.24583333333333332

Flash with cubic equations of state

Solve vapor-liquid equilibrium with a two-component mixture and the Peng-Robinson equation of state: ```julia props = MolecularProperty.(["Methane", "n-Decane"]) mixture = MultiComponentMixture(props) eos = GenericCubicEOS(mixture, PengRobinson())

Define conditions to flash at

p = 5e6 # 5 000 000 Pa, or 50 bar T = 303.15 # 30 °C = 303.15 °K z = [0.4, 0.6] # 4 mole methane per 6 moles of decane conditions = (p = p, T = T, z = z)

Perform a flash to get the vapor fraction

V = flash_2ph(eos, conditions) ```

julia julia> V 0.20785284212697513

Get K-values and calculate liquid and vapor mole fractions

If we also want to know how the components are partitioned in the two phases, we can turn on the extra_out flag. julia V, K, = flash_2ph(eos, conditions, extra_out = true) x = liquid_mole_fraction.(z, K, V) y = vapor_mole_fraction.(z, K, V)

```julia julia> x 2-element Vector{Float64}: 0.24266084237653415 0.7573391576234659

julia> y 2-element Vector{Float64}: 0.999634651410856 0.00036534858914410106

julia> K 2-element Vector{Float64}: 4.119472435769978 0.00048241080032170367 ```

Generation of phase diagrams

More examples, and details are found in the documentation. Here is a p-T phase diagram for methane, n-decane and carbon dioxide found in the advanced examples: Phase diagram

Owner

  • Name: Avinash Subramanian
  • Login: avinashresearch1
  • Kind: user
  • Location: Trondheim, Norway
  • Company: JuliaHub

Simulation & Control at JuliaHub

GitHub Events

Total
Last Year