Skip to content

Prediction of binary diffusivities in supercritical carbon dioxide, polar, and nonpolar systems

License

Notifications You must be signed in to change notification settings

EgiChem/ml-D12-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Machine Learning models for D12 prediction

Prediction of binary diffusivities of solutes in:

  • supercritical carbon dioxide
  • polar solvents (except water)
  • nonpolar solvents (except supercritical carbon dioxide)

The machine learning models were trained with a database of 4000 experimental data points from over 170 systems. For more information check the following papers:

Index

Quickstart

Select the program and provide the properties using their flags.

Solvent Program Required properties (unit) [-flag]
SC-CO2 ml_scco2.py Temperature (K) [-t]
Density (g/cm3) [-d]
Solute Molar Mass (g/mol) [-mm]
Solute Critical Pressure (bar) [-cp]
Solute Acentric Factor (-) [-af]
Polar ml_polar.py Temperature (K) [-t]
Viscosity (cP) [-v]
Solute Molar Mass (g/mol) [-m2]
Solute Critical Pressure (bar) [-cp2]
Solvent Molar Mass (g/mol) [-m1]
Solvent Lennard-Jones Energy (K) -[e1]
Nonpolar ml_nonpolar.py Temperature (K) [-t]
Viscosity (cP) [-v]
Solute Molar Mass (g/mol) [-m2]
Solute Critical Pressure (bar) [-cp2]
Solvent Molar Mass (g/mol) [-m1]

Example:

python ml_scco2.py -t 313.15 -d 0.830000647 -mm 430.71 -cp 8.45543 -af 0.8071

# Output:
# Predicted diffusivities:
# D12(1) = 5.81821846E-05 cm2/s

You can also calculate multiple points by providing the properties as a CSV file. See below.

Requirements

Python 3 and the following Python libraries are required:

  • numpy
  • pandas
  • scikit-learn
  • joblib

Program is fully tested on:

  • Python 3.7
  • numpy 1.18.5
  • pandas 1.0.5
  • scikit-learn 0.23.1

Installation

  1. Install Python from python.org.
  2. Download the software by clickig Code >> Download ZIP.
  3. Unpack the zip file.
  4. Open the command line and run pip install -r requirements.txt to install the required libraries.
  5. You can now cd to the program folder and use it as described below.

Alternativelly, using Anaconda:

  1. Download and install Anaconda from anaconda.com.
  2. Lunch the Anaconda Prompt.
  3. Create a new environment by running: conda create --name <env_name>
  4. Activate the environment with conda activate <env_name>
  5. Install the required packages by running the following commands:
conda install scikit-learn=0.23.1
conda install pandas=1.0.5
conda install joblib=0.15.1

Usage

Option 1) By providing the properties in order:

Call the program you desire and provide the properties in order. For istance, for the SC-CO2 program:

  1. Temperature (K)
  2. Density (g/cm3)
  3. Solute molecular mass (g/mol)
  4. Solute critical pressure (bar)
  5. Solute acentric factor (-)
python ml_scco2.py --properties YOUR_TEMPERATURE YOUR_DENSITY YOUR_MOLECULAR_MASS YOUR_CRITICAL_PRESSURE YOUR_ACENTRIC_FACTOR

Example:

python ml_scco2.py --properties 313.15 0.830000647 430.71 8.45543 0.8071

# Output:
# Predicted diffusivities:
# D12(1) = 5.81821846E-05 cm2/s

Option 2) By specifying each property:

In this case the order is irrelevant.

python ml_scco2.py --temperature YOUR_TEMPERATURE --density YOUR_DENSITY --molecularmass YOUR_MOLECULAR_MASS --criticalpressure YOUR_CRITICAL_PRESSURE --acentricfactor YOUR_ACENTRIC_FACTOR

# OR using 

python ml_scco2.py -t YOUR_TEMPERATURE -d YOUR_DENSITY -mm YOUR_MOLECULAR_MASS -cp YOUR_CRITICAL_PRESSURE -af YOUR_ACENTRIC_FACTOR

Example:

python ml_scco2.py -t 313.15 -d 0.830000647 -mm 430.71 -cp 8.45543 -af 0.8071

# Output:
# Predicted diffusivities:
# D12(1) = 5.81821846E-05 cm2/s

Option 3) By specifying a CSV file with the input data:

The CSV file must include at least five columns with the following headers:

Case SC-CO2 Polar Nonpolar
Properties/Headers T
density
solute.M2
solute.Pc
solute.w
T
viscosity
solute.M2
solute.Pc
solvent.M1
solvent.elj
T
viscosity
solute.M2
solute.Pc
solvent.M1

You can provide any number of points as rows. See the examples folder.

python ml_scco2.py --csvfile YOUR_CSVFILE_PATH

Example:

# Using a file in the same directory with 3 points (rows)
python ml_scco2.py --csvfile sample-scco2-data.csv

# Output:
# Predicted diffusivities:
# D12(1) = 5.03732712E-05 cm2/s
# D12(2) = 1.05026748E-04 cm2/s
# D12(3) = 9.14913157E-05 cm2/s

Save results

Optionally you can use the --save or -s flag to save the results in an csv file.

python ml_scco2.py --csvfile YOUR_CSVFILE_PATH --save

Help

python ml_scco2.py -h

Citing

If you use the SC-CO2 model/program for a scientific publication, please cite:

If you use the polar or nonpolar models/programs for a scientific publication, please cite: