Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fedebenelli committed Sep 18, 2023
1 parent 2b8e8fb commit 881fa94
Showing 1 changed file with 85 additions and 23 deletions.
108 changes: 85 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
# envelopes
Simple program to calculate biphasic phase envolopes
# fenvelopes
Fortran program to calculate phase envelopes.

## Input files
The program assumes there is a `input.nml` file at it's path, which contains
all the relevant data for the system.
This is an ongoing project that intends te be a fully fledged generator of phase
equilibria diagrams using Equations of State.

## Capabilities
Right now `fenvelopes` calculates three kinds of phase-envelopes.

- [x] Two-phase PT envelopes
- [ ] Three-phase PT envelopes
- [x] Two-phase Px envelopes
- [ ] Three-phase Px envelopes
- [x] Px envelopes based on double saturation points.
- [ ] Isolated Px envelopes.
- [ ] Python wrappers to ease up scripting and plotting.

## Usage
This program is intended to be used as a `CLI` software. The command used to
calculate phase diagrams is:

```bash
fenvelopes --infile input_file.nml
```

This will generate an `fenvelopes_output` directory. Which contains all the
generated output files with the relevant data.

### Input files
The input files

```fortran
! input.nml
!
! Namelist based input file
! =========================
!
Expand All @@ -17,24 +43,26 @@ all the relevant data for the system.
&nml_setup
! General settings
nc=5, ! Number of components
model="PR78", ! SRK PR76 PR78
mixrule="ClassicVdW" ! only ClassicVdW
mixrule="ClassicVdW" ! only ClassicVdW for now
/
&nml_composition
names="PC1" "PC2" "PC3" "PC4" "H2O"
spec="critical", ! critical or parameters
spec="critical", ! critical or parameters specification
z=0.15 0.10 0.10 0.15 0.50
/
&nml_classicvdw
&nml_classicvdw ! Classic VdW mixing rule parameters
! kij matrix
kij(1, :)=0 0 0 0 0.7192
kij(2, :)=0 0 0 0 0.4598
kij(3, :)=0 0 0 0 0.2673
kij(4, :)=0 0 0 0 0.2417
kij(5, :)=0.7192 0.4598 0.2673 0.2417 0
kij(1, :)=0 0 0 0 0.7192
kij(2, :)=0 0 0 0 0.4598
kij(3, :)=0 0 0 0 0.2673
kij(4, :)=0 0 0 0 0.2417
kij(5, :)=0.7192 0.4598 0.2673 0.2417 0
! lij matrix
lij(:, :) = 0
/
Expand All @@ -51,18 +79,52 @@ all the relevant data for the system.
! Acentric Factor
w=0.098 0.535 0.891 1.085 0.344
/
&nml_px ! Px envelopes relevant info
! Temperature
T=350.0
! Initial composition, ussualy the same as the main fluid.
z_0=0.15 0.10 0.10 0.15 0.50
! Injection fluid composition
z_injection=1 0 0 0 0
! Which kind of injection to realize
injection_case="displace" ! [dilute|displace]
/
```

## Execution
This program is intended to work with `fpm`, to run it just use `fpm run`
### Output
All the output is directed to a generated folder `fenvelopes_output`. With the files

`env-<nphases>ph-<env_kind>_<envnumber>.dat`

Were all the envelope's calculated points are written in a `csv-like` format,
delimited by spaces.

## Installation
This program uses [`fpm`](https://fpm.fortran-lang.org) as a builder. `fpm`
handles all the needed dependencies and compiling procedures.
It is distributed in many ways, but we recommend the `pip` distribution.

## Output
Several output files are produced, `X_it*` files correspond to each iteration
point, `ENV2_OUT*` files correspond to the phase envelope structured to plot
with gnuplot, and there is also an `output.csv` file that contains the same
information but on another format.
```bash
# using pipx
pipx install fpm
```

To install this program is as simple as:

```
git clone https://www.github.com/fedebenelli/envelopes
cd envelopes
fpm install --profile release
```
This will make `fenvelopes` accessible from any directory of your computer

There is a simple `gnuplot` script to plot the phase envelope, just run
`gnuplot plot.gnu` to make the plot. It should look like this:
If you don't want to install the program and just run it you can also run it
with `fpm`

![](figs/example.png)
```bash
fpm run --profile release -- --infile <infile.nml PATH>
```

0 comments on commit 881fa94

Please sign in to comment.