Home

Loading parameters of equations of state from source files.

The package provides wrappers (see Types and accessors) for separated-values files and request methods (see Database requests).

Features

Quick start

Obtaining parameters of components

Suppose a file brusilovsky.csv which collects eos-parameters of components

julia> read(open("brusilovsky.csv"), String) |> printname,critical_compressibility,critical_omega,psi
nitrogen,0.34626,0.75001,0.37182
methane,0.33294,0.7563,0.37447
n-butane,0.31232,0.76921,0.57594
n-hexane,C5+,C5+,C5+

To obtain parameters of a component (e.g. methane) wrap the source file with ComponentDatabase and use getentry

julia> using CubicEoSDatabase
julia> comp_eos = ComponentDatabase("brusilovsky.csv");
julia> getentry(comp_eos, "methane")Dict{Symbol, Any} with 4 entries: :critical_omega => 0.7563 :name => "methane" :critical_compressibility => 0.33294 :psi => 0.37447

Obtaining parameters of pair of components

Some parameters of equation of state are determined by pair of components (e.g. binary interaction).

Suppose a file brusilovsky_mix.csv collecting binary interaction parameters.

julia> read(open("brusilovsky_mix.csv"), String) |> printcomp1,comp2,constant,linear,quadratic
nitrogen,n-heptane,0.168,0.000558,0
methane,ethane,-0.015,0.000123,-0.41
methane,propane,0.019,0.000502,0
methane,n-butane,0.031,0.000502,0
propane,n-butane,-0.063,0.000559,0

To obtain parameters of methane + ethane wrap the source file with MixtureDatabase and use getentry

julia> using CubicEoSDatabase
julia> mix_eos = MixtureDatabase("brusilovsky_mix.csv");
julia> getentry(mix_eos, "methane", "ethane")Dict{Symbol, Any} with 5 entries: :comp1 => "methane" :linear => 0.000123 :constant => -0.015 :comp2 => "ethane" :quadratic => -0.41

Obtaining matrices of binary parameters

Actually, the file brusilovsky_mix.csv stores three matrices with coefficients

  • $C_{ij}$ in column 'constant'
  • $L_{ij}$ in column 'linear'
  • $Q_{ij}$ in column 'quadratic'

where $i, j$ are names of components (columns 'comp1' and 'comp2').

To obtain these matrices for mixture of methane, propane and n-butane, do the following

julia> using CubicEoSDatabase
julia> mix_eos = MixtureDatabase("brusilovsky_mix.csv");
julia> getmatrix(mix_eos, ("methane", "propane", "n-butane"); diag=0.0)Dict{Symbol, Matrix{Float64}} with 3 entries: :linear => [0.0 0.000502 0.000502; 0.000502 0.0 0.000559; 0.000502 0.00055… :constant => [0.0 0.019 0.031; 0.019 0.0 -0.063; 0.031 -0.063 0.0] :quadratic => [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0]

Index