Skip to content

A FORTRAN 2008 implementation of PC-SAFT EoS used in Titan's lakes and seas numerical simulations

License

Notifications You must be signed in to change notification settings

dcordiercnrs/pcsaft-titan

Repository files navigation

A FORTRAN 2008 implementation of the PC-SAFT EoS

Logo du pole des surfaces planétaires

The Perturbed-Chain Statistical Associating Fluid Theory (hereafter PC-SAFT), equation of state (Gross and Sadowski, 2001) which is widely employed in the chemical engineering community. The PC-SAFT has been successfully introduced to the study of Titan by Tan et al. (2013, 2015) and Luspay-Kuti et al. (2015). The use of PC-SAFT is particularly relevant for the numerical simulation involving liquid-vapor equilibria and/or dissolution in the context of Titan (the main moon of the planet Saturn) "hydrology" (rain, rivers, lakes and seas of liquid hydrocarbons). This program has been entirely written in FORTRAN 2008 by Daniel Cordier and its future developments are open to collaboration. The proposed implementation comes as a FORTRAN module which makes easy the reuse of the program and/or its use in a more extended/complex program.

Two simple demo programs are provided (see below), the first one allows the user to compute the density of mixtures, the second simulates the isotherm binary diagram for a given mixture.

The PC-SAFT implementation available here has been already use in the following works:

  • Cordier, D., Cornet, T., Barnes, J. W., MacKenzie, S. M, Le Bahers, T., Nna Mvondo, D., Rannou, P., Ferreira, A. G., Structure of Titan's evaporites, 2016, Icarus, 270, 41-56. 10.1016/j.icarus.2015.12.034
  • Cordier, D., How speed of sound measurements could bring constraints on the composition of Titan's seas, 2016, Monthly Notices of the Royal Astronomical Society, 459, 2008-2013. 10.1093/mnras/stw732
  • Cordier, D., Garcia-Sanchez, F., Justo-Garcia, D. N., Liger-Belair, G., Bubble streams in Titan's seas as product of liquid N_2-CH_4-C_2H_6 cryogenic mixture, 2017, Nature Astronomy, 1, 102. 10.1038/s41550-017-0102
  • Singh, S., Combe, J.-P., Cordier, D., Chevrier, V.F., Wagner, A., McMahon, Z., Experimental Determination of Acetylene and Ethylene Solubility in liquid Methane and Ethane: Implications to Titan's Surface, 2017, Geochimica et Cosmochimica Acta, 208, 86-101. 10.1016/j.gca.2017.03.007
  • Cordier, D., Liger-Belair, G., Bubbles in Titan's seas: nucleation, growth and RADAR signature, 2018, The Astrophysical Journal, 859, 26. 10.3847/1538-4357/aabc10
  • Cordier, D., & Carrasco, N., The floatability of aerosols and waves damping on Titan's seas, 2019, Nature Geoscience, 12, 315-320. 10.1038/s41561-019-0344-4
  • Cordier, D., Bonhommeau, D., Vu, T., Choukroun, M., Garcia-Sanchez, F. Vertical compositional variations of liquid hydrocarbons in Titan's alkanofers, 2021, A&A, in press. Already available on Arxiv here: https://arxiv.org/abs/2107.06348.

How to cite this program


Quick start with Docker

For those who just want make a very quick test, the best solution is probably to run the programs in a tiny virtual Linux/Debian machine which can be set up using Docker (see also the Wikepedia page) which can be installed on your computer by downloading the appropriate version here dedicated to your OS.

  1. download the file called "Dockerfile" in your work directory.
  2. build the Linux virtual machine image: <<docker build -t dock-pcsaft .>> (<<dock-pcsaft>> is the name given to the image, <<.>> tells to docker it has to find the Dockerfile in the current directory).
  3. run the virtual machine: <<docker run --rm --name buster-pcsaft-titan -v $(pwd):/home -it dock-pcsaft:latest /bin/bash>>
  4. now you should be in the virtual environment, sharing the directory /home with the work directory from which you launch the virtual machine.
  5. dowload PCSAFT-TITAN: <<git clone https://github.com/dcordiercnrs/pcsaft-titan.git>>
  6. move to pcsaft-titan/ directory: <<cd pcsaft-titan>>
  7. compile the program: <<make>>
  8. now you can run an demo program: <<./pcsaft_demo>> or <<./binary_N2CH4_demo>>

How to get the files

There are two options:

  • Click on the Code green button (top right of this web page) and download the ZIP archive.
  • in a terminal type: git clone https://github.com/dcordiercnrs/pcsaft-titan.git

Alternative:

  • click on the big green button "Code" (top of this page) an choose "Download ZIP"

Requirements

A easy use of the programs available here requires:


Files description

  • Data files found in the directory 'DATABASE_PCSAFT/':

    • COMPOUNDS_DATA_PC-SAFT.data: decribes the properties of the molecules which can be used by the program. The user can add a species just by adding a new line, species can be removed just by deleting lines or by adding a # at the beginning of the line.
    • COMPOUNDS_DATA_PC-SAFT-PARAM_INTERAC.data: provides the intraction parameters between species.
    • COMPOUNDS_DATA_PC-SAFT_withASSO.data: parameters for PC-SAFT version including association terms, not functional for the moment, present just for furture development.
  • Data files found in the directory 'DATA_EXPERIMENTAL/': experimental measurement to make comparison plots with PC-SAFT outputs.

  • Main programs

    • pcsaft_demo.f08: provides some example of PC-SAFT use.
    • binary_N2CH4_demo.f08: demo program to simulate a liquid-vapor equilibrium for the binary mixture N2-CH4.
  • FORTRAN modules

    • utils_dc.f08: contains general parameters and utilities
    • foul.f90: (FOUL: The Fortran Output Library) FORTRAN module written by Philipp Emanuel Weidmann provides a lot of cool and useful stuff like text outputs colorization, timer, etc.
    • mod_pcsaft.f08: the module providing PC-SAFT.
  • Bonus

    • binaire_diag_N2CH4.ipynb: a Python Jupyter Notebook to plot binary diagram, uses data in DATA_EXPERIMENTAL/ and examples of simulation results stored in BINARY_SYSTEMS_RESULTS_EXAMPLES/. With this notebook the user can rebuild the binary diagram presented above in this webpage.
    • Dockerfile: Docker configuration file, allow to build a small virtual Linux machine with all the required tools to compile and run the programs available in this repository.

If you have a FORTRAN compiler on your machine, and you know how to modify a Makefile, you can proceed following the procedure detailled below.


Compilation

  • Edit the Makefile an specify your FORTRAN compiler and required options, the present code has been compiled with the GNU compiler gfortran version 8.3.0 using the Debian Buster OS Debian logo
  • in the terminal just type make and you should get two executable files respectively called pcsaft_demo and binary_N2CH4_demo
  • in the terminal type ./pcsaft_demo to run the demo program.
  • in the terminal type ./binary_N2CH4_demo to run the N2-CH4 liquid-vapor simulation program.

Examples

  • Computation of mixtures density with pcsaft_demo.f08:

    • compile the programs with make
    • run the program ./pcsaft_demo
    • read the results in the standard outputs.
    • parameter values can be changed in the source code itself.
  • Simulations of a liquid-vapor equilibrium for the binary system N2-CH4 under cryogenic conditions with binary_N2CH4_demo.f08:

    • compile the programs with make
    • run the program ./binary_N2CH4_demo
    • results are under the form of two ASCII text files binary_diag_N2CH4_L.dat (for the liquid phase) and binary_diag_N2CH4_v.dat (for the vapor phase)
    • Comments:
      • parameters, like temperature of the system, can be changed in the source code itself.
      • PC-SAFT parameters can be adjusted in data files contained in the directory DATABASE_PCSAFT/
      • results produced by this program can be compared to laboratory measurements available under the form of text files in the directory DATA_EXPERIMENTAL/

How to add new species or remove species

To add a new species is relatively simple, a 2 steps procedure has to be followed:

  1. add a new line in the file DATABASE_PCSAFT/COMPOUNDS_DATA_PC-SAFT.data
  2. add corresponding new lines (more than just one should be required if the user wants to consider the interactions of the added species with many other species, in the file DATABASE_PCSAFT/COMPOUNDS_DATA_PC-SAFT-PARAM_INTERAC.data

To remove a species (useful only if one wants to test a new set of parameters, the line of standard value is put in comment by writting a "#" at the beginning of the line) needs only to comment the line with a "#"

About

A FORTRAN 2008 implementation of PC-SAFT EoS used in Titan's lakes and seas numerical simulations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published