Equation of State

PorousMaterials.jl provides Peng-Robinson and van der Waals equation of state calculations to find the properties of a real fluid.

Peng-Robinson equation of state

The Peng-Robinson equation of state can be written as:

PREOS

where $V_{m}$ is the molar volume, $R$ is the gas constant, and $T$ is temperature.

Variables $a$ and $b$ can be calculated using the critical temperature, $T_{c}$ and pressure, $P_{c}$, of the fluid:

PREOS_a

PREOS_b

and $\alpha$ can be calculated using acentric factor $\omega$ and critical temperature:

PREOS_alpha

where

PREOS_kappa

and

PREOS_Tr

Van der Waals equation of state

The van der Waals equation can be written as:

VDWEOS

where $a$ and $b$ are the van der Waals constants. $a$ and $b$ can be calculated from fluid critical propertis, but PorousMaterials.jl reads them in as experimentally determined values.

reading in fluid characteristics

PengRobinsonFluid and VdWFluid are structs defining the characteristics of a fluid of interest, depending on which equation of state is used.

For Peng-Robinson fluids, PorousMaterials.jl reads in the critical temperature, critical pressure, and acentric factor of fluid::Symbol from the properties .csv file rc[:paths][:data], "PengRobinson_fluid_props.csv").

For van der Waals fluids, van der Waals constants of fluid::Symbol are read in from the properties .csv file joinpath(rc[:paths][:data], "VdW_fluid_props.csv").

*** NOTE: DO NOT DELETE LAST THREE COMMENT LINES IN PengRobinson_fluid_props.csv AND VdW_fluid_props.csv

The characteristics can be read as:

For Peng-Robinson fluids

fluid = PengRobinsonFluid(:Xe)       # Input fluid as a symbol. The fluids reader stores the information in fluid as a struct
fluid.fluid                          # The name of the fluid
fluid.Pc                             # The critical pressure of the fluid
fluid.Tc                             # The critical temperature of the fluid
fluid.ω                              # The acentric factor of the fluid

For van der Waals fluids

fluid = VdWFluid(:Xe)                # Input fluid as a symbol. The fluids reader stores the information in fluid as a struct
fluid.fluid                          # The name of the fluid
fluid.a                              # The van der Waals constant a of the fluid
fluid.b                              # The van der Waals constant b of the fluid

calculating density, fugacity, and molar volume

Using a given temperature and pressure, PorousMaterials.jl the equation of state can be used to calculate the dnesity, fugacity, and molar volume of a real fluid, stored as a dictionary.

T = 298.0 # K                        # The temperature in Kelvin of interest type Float64.
P = 1.0 # bar                        # The pressure in bar of interest type Float64.
props = calculate_properties(fluid, T, P, verbose=true) # verbose::Bool will print results if `true`
# output
Xe properties at T = 298.000000 K, P = 1.000000 bar:
	compressibility factor: 0.995117906779058
	fugacity coefficient: 0.9951492697826048
	molar volume (L/mol): 24.65612613988038
	fugacity (bar): 0.9951492697826048
	density (mol/m³): 40.55787167565373
Dict{String, Float64} with 5 entries:
  "compressibility factor" => 0.995118
  "fugacity coefficient"   => 0.995149
  "molar volume (L/mol)"   => 24.6561
  "fugacity (bar)"         => 0.995149
  "density (mol/m³)"       => 40.5579

The output is a dictionary containing the following keys:

props["compressibility factor"]    # the compressibility factor
props["density (mol/m³)"]          # fluid density in mol/m³
props["fugacity (bar)"]            # the fugacity in bar
props["fugacity coefficient"]      # the fugacity coefficient
props["molar volume (L/mol)"]      # the molar volume in L/mol

detailed docs

PorousMaterials.PengRobinsonFluidType
fluid = PengRobinsonFluid(fluid)

Reads in critical temperature, critical pressure, and acentric factor of the fluid::Symbol from the properties .csv file joinpath(PorousMaterials.rc[:paths][:data], "PengRobinson_fluid_props.csv") and returns a complete PengRobinsonFluid data structure. **NOTE: Do not delete the last three comment lines in PengRobinsonfluidprops.csv

Arguments

  • fluid::Symbol: The fluid molecule you wish to construct a PengRobinsonFluid struct for

Returns

  • PengRobinsonFluid::struct: Data structure containing Peng-Robinson fluid parameters.
source
PorousMaterials.VdWFluidType
fluid = VdWFluid(fluid)

Reads in van der Waals constants of the fluid::Symbol from the properties .csv file joinpath(PorousMaterials.rc[:paths][:data], "VdW_fluid_props.csv") and returns a complete VdWFluid data structure. ***NOTE: Do not delete the last three comment lines in VdWfluidprops.csv

Arguments

  • fluid::Symbol: The fluid you wish to construct a VdWFluid struct for

Returns

  • VdWFluid::struct: Data structure containing van der Waals constants
source
PorousMaterials.calculate_propertiesFunction
props = calculate_properties(fluid, T, P, verbose=true)

Use equation of state to calculate density, fugacity, and molar volume of a real fluid at a given temperature and pressure.

Arguments

  • fluid::Union{PengRobinsonFluid, VdWFluid}: Peng-Robinson/ van der Waals fluid data structure
  • T::Float64: Temperature (units: Kelvin)
  • P::Float64: Pressure (units: bar)
  • verbose::Bool: will print results if true

Returns

  • prop_dict::Dict: Dictionary of Peng-Robinson/ van der Waals fluid properties
source