API Reference

Preliminary

Delimited-separated values (DSV file) — a text file representing tabular data by using a column delimiter char (e.g. .tsv, .csv).

DSV file size

As the package is built upon DelimitedFiles, a source file is loaded to RAM. Keep in mind size of your DSV files.

We suppose that a row of source datafile uniquely determined by values at first K columns (e.g. names of components). We called these columns primary keys or just keys.

Main module

CubicEoSDatabaseModule

Provides interface for loading parameteres of components and mixtures from separated values files.

See ComponentDatabase, BinaryMixtureDatabase, getentry, getmatrix.

Out-of-box database stored in CubicEoSDatabase.Data module.

Types and accessors

Private types

Accessors

CubicEoSDatabase.dataFunction
data(x::AbstractTabularDatabase)

Returns matrix with parsed data stored in x.

CubicEoSDatabase.headerFunction
header(x::AbstractTabularDatabase)

Returns collection of source file headers of x.

Base.keysMethod
keys(atd::AbstractTabularDatabase{K})

Return an iterator over all keys in atd.

For AbstractTabularDatabase{1} key is string.

For AbstractTabularDatabase{K≥2} key is Tuple of length K with strings.

Public types

CubicEoSDatabase.ComponentDatabaseType
ComponentDatabase(source[; delim, reference]) <: AbstractTabularDatabase{1}

Wraps source DSV-file formatted as separated values.

Aimed at tables with single primary key (e.g. component name).

Arguments

  • source::AbstractString: path to source file
  • delim::AbstractChar=',': column delimiter used in source
  • reference::AbstractString: optional biblio-reference describing source
CubicEoSDatabase.MixtureDatabaseType
MixtureDatabase(source[; delim, reference]) <: AbstractTabularDatabase{2}

Wraps source file formatted as separated values.

Aimed at tables with two primary keys (e.g. two names of components).

Arguments

  • source::AbstractString: path to source file
  • delim::AbstractChar=',': column delimiter used in source
  • reference::AbstractString: optional biblio-reference describing source

Database requests

Linear request time

Current implementation of requests takes $O(N)$ time, where $N$ is number of rows in source file.

CubicEoSDatabase.getentryFunction
getentry(from::AbstractTabularDatabase{1}, key::AbstractString)

Searches database from for row (entry) with first item equal to key.

Returns Dict which keys are header(from) and values are corresponding data.

Throws CubicEoSDatabase.NotFoundError if key was not found.

getentry(from::AbstractTabularDatabase{2}, key₁, key₂[; keeporder])

Searches database from for row (entry) which first two items are equal to key₁ and key₂. If keeporder is true then the keys are assumed to be ordered pair (default is false).

Returns Dict which keys are header(from), and values are corresponding data.

Throws CubicEoSDatabase.NotFoundError if key pair was not found.

CubicEoSDatabase.getmatrixFunction
getmatrix(from::AbstractTabularDatabase{2}, keys[; diag])

Extracts matrices from from by unordered key pairs generated from keys.

Each matrix corresponds to a data column in from. Indices of a matrix are same as in keys. The returned matrices are symmetric with diagonal elements diag=0.0.

Returns Dict which keys are header(from) and values are matrices.

Throws CubicEoSDatabase.NotFoundError if a key pair was not found.

Arguments

  • keys: collection, must support eachindex method

Error handling

CubicEoSDatabase.NotFoundErrorType
CubicEoSDatabase.NotFoundError(what, where) <: Exception

Describes where what was not found. The where should be database object.

Data submodule

CubicEoSDatabase.jl comes with out-of-box database. It lives in public Data submodule. See Out-of-box database for details.

Databases are cached

Each database presented in Data is cached. So only first call will allocate memory.

CubicEoSDatabase.DataModule

Repository database of thermodynamical properties.

Exported methods are

  • martinez()::ComponentDatabase: gas properties of substances;
  • brusilovsky_comp()::ComponentDatabase: parameters of A I Brusilovskii equation of state for pure components;
  • brusilovsky_mix()::MixtureDatabase: binary parameters of A I Brusilovskii equation of state for mixtures.

Internals