Tina Düren

Research Group

  • Home
  • Research
  • People
  • Publications
  • Teaching
  • Contact

 


Department of Chemical Engineering, University of Bath

Music links

  • Back to main Music tutorial page
  • Music pages at Northwestern
  • Music documentation at Northwestern
  • Back to main research page

Fugacity calculation with the Peng Robinson
Equation of State

This tutorial explains how to calculate the fugacity from the pressure with the Peng Robinson equation of state. With the files provided here, the fugacity can be calculated for both pure components and binary mixtures. The output file can be used as an input for a GCMC simulation with music.

Why use the fugacity instead of the pressure in a GCMC simulation?

The acceptance rules for the insertion and deletion moves of a GCMC simulation are a function of the chemical potential which is directly related to the fugacity. The fugacity and the pressure are only the same at very small pressure when the gas behaves like an ideal gas. However, for real gases the fugacity can deviate considerably from the pressur. For example, for methane at 298 K, the fugacity at 35 bar is 32.5 bar, that's a difference of 7 %. Unless you are running your simulations at really low pressure, I would always recommend that you go the extra step, calculate the fugacity and use this as input to your GCMC simulation.

Downloading and compiling the program

Although the fugacity program produces a file that can be used as an input file to music, it is not part of music itself but a separate program.

The code to calculate the excess amount adsorbed is available under the General Public Licence. Read the conditions of the license before proceeding with the download .

The files are available as a tar archive. To extract the files use the following commands

gunzip fugacity.tar.gz
tar -xvf fugacity.tar


After extracting the archive, you should end up with the following files

The program files
  • div_mod.f90
  • fluidproperties.f90
  • fuga_mod.f90
  • molecules_prop.f90
  • main_calc_fugacity.f90

A simple makefile that takes care of compiling the program
  • makefile

the input files
  • input.dat (for pure components)
  • input_bin.dat (for binary mixtures)

and the corresponding pressure files
  • pressure.dat (for pure components)
  • pressure_bin_const_P.dat (for binary mixtures with constant pressure)
  • pressure_bin_const_y.dat (for binary mixtures with constant mole fraction)

There are a few things you should be aware of before compiling the program:

  • The program can be compiled with the makefile provided. This makefile uses the intel ifort compiler. If you are using a different compiler, replace ifort with the name of your compiler.
  • Different compilers use different definitions for double precision variable. The intel compiler (and several other compilers) uses real(kind = 8). The most common other definiton is real(kind = 2) . The definition of the double precision variables can be changed in the module div_mod.f90.

To compile the program, simply type make and an executable called excess.exe will be created.

Running the program

The program is run with the input file. Input files for pure component and mixture simulations look very similar. For pure components use input.dat , for mixtures input_bin.dat . An example set up to calculate the fugacity for pure methane is given below.

! input file with pressure data
pressure.dat
! output file with fugacity data
fugacity.dat
! number of fluid species
1
! name of species (chemical formula not music name!)
CH4
! temperature of gcmc run in K
298.

So, to run the program you need
  • a file containing the pressure data (pressure.dat). This filec ontains in the first line the name of the fluid for which you want to do the GCMC simulation, in the second line the number of pressure point for which you want to calculate the fugacity, and in the third line the pressures in kPa separated by commas.
  • the name of the output file you want to create
  • the number of species.
  • the name of fluid / gas you calculated the isotherm for. This name has to be same as specified in the subroutine fluid_properties.f90 where you specify all the critical data necessary for the Peng Robonson EOS.
  • and the temperature at which you want to calculate the fugacity / run your GCMC simulation

To run the program use

fuga.exe < input.dat

and enjoy the output!

The program as it is provided here, can be used to calculate the fugacity of methane, ethane and their mixure. It is easy to extent the program to handle other fluids / gases.

Adding more fluid molecules

The subroutine fluid_properties.f90 contains a database for fluid molecules which contains the parameters necessary for the Peng Robinson equation of state.

  • the accentric factor
  • the critcial temperature in K
  • the critical pressure in Pa
  • and for the binary interaction paramter for binary mixtures

You can find these properties in thermodynamics text books such as Reid, Prausnitz, Poling "The properties of gases and liquids". Don't forget to recompile the program if you added something new!

Department of Chemical Engineering, University of Bath
Copyright (c) 2015 Tina Düren. All rights reserved. Design by FCT.