Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ypaul21/OpenSAFT.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Aug 1, 2021
2 parents 832d51b + a7028f9 commit 5c8a075
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

Welcome to Clapeyron! This module provides both a large library of equations of state and a framework for one to easily implement their own equations of state.

We have recently presented at the JuliaCon 2021 conference! Feel free to take a look at our talk:

[![Clapeyron.jl: An Extensible Implementation of Equations of State | Paul Yew et al | JuliaCon2021](https://img.youtube.com/vi/Re5qI-9zyIM/0.jpg)](https://www.youtube.com/watch?v=Re5qI-9zyIM "Clapeyron.jl: An Extensible Implementation of Equations of State | Paul Yew et al | JuliaCon2021")

SAFT equations of state currently available:

| EoS | Seg./Mono.? | Chain? | Assoc.? | Parameters? |
Expand Down Expand Up @@ -109,9 +113,7 @@ Note that at its current stage, Clapeyron is still in the very early stages of d

# Installing Clapeyron

Clapeyron is not yet in the JuliaHub (but it will be soon!).

To load Clapeyron, launch Julia with
To install Clapeyron, launch Julia with

```julia
> julia
Expand All @@ -124,7 +126,7 @@ Pkg> add Clapeyron
```
Or to add the development version:
```julia
Pkg> add https://github.com/ypaul21/Clapeyron.jl
Pkg> add https://github.com/ypaul21/Clapeyron.jl#development
```
Exit Pkg mode by hitting backspace.

Expand All @@ -134,8 +136,7 @@ Now you may begin using functions from the Clapeyron library by entering the com
using Clapeyron
```

To remove the package (for when we finally get it on JuliaHub and you want to use the official version),
hit the ```]``` key to enter Pkg mode, then type
To remove the package, hit the ```]``` key to enter Pkg mode, then type

```julia
Pkg> rm Clapeyron
Expand Down
15 changes: 15 additions & 0 deletions docs/src/user_guide/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ Multi-parameter equations:

We also support the SPUNG method (`SPUNG`)

### Specifying an ideal term

By default, Clapeyron uses what we refer to as the `BasicIdeal` model to account for the ideal contribution. For properties which only have derivatives with respect to volume or composition (_e.g._ pressure, isothermal compressibility, critical points, saturation points), or monoatomic species (_e.g._ noble gases), this is perfectly fine. However, for any other properties or species, the results obtained will most likely be quite poor. This is because this model does not account for the rotational and vibrational modes of the species. To amend this, we provide two additional ideal models to be used instead (more soon to come):

- Walker and Haslam's ideal correlation (`WalkerIdeal`)
- Reid's polynomial correlation (`ReidIdeal`)

These can be specified for any of the cubic or SAFT-type equations of state using:

```julia
model4 = PCSAFT(["carbon dioxide"]; idealmodel = WalkerIdeal)
```

Everything else will work as normal.

### Available properties

Once we have our model object, we will be able to call the respective thermodynamic methods to obtain the properties that we are looking for. For example, to find the isobaric heat capacity of a 0.5 mol methanol and 0.5 mol ethanol mixture using PC-SAFT at a pressure of 10 bar and a temperature of 300 K, we just call the `isobaric_heat_capacity(model, p, T, z)` function with the desired model and conditions as parameters.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/user_guide/custom_dtb.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Note that it is extremely important that the cell A2 has the word 'Like', 'Unlik

## Using your own parameters

If you have CSV files formatted as above with your own parameters, and you want to implement these into one of the existing equations of state in Clapeyron, all that is needed is to provide the path to those files in the definition of your model:
If you have CSV files formatted as above with your own parameters, and you want to implement these into one of the existing equations of state in Clapeyron, all that is needed is to provide the path to those files in the definition of your model (note that ideal term related parameters are specified separately):

```julia
model1 = PR(["your_species_1","your_species_2"];userlocations=["path/to/your/database/"])
model2 = PCSAFT(["your_species_1","your_species_2"];userlocations=["dtb_like","dtb_unlike","dtb_assoc"])
model1 = PR(["your_species_1","your_species_2"];userlocations=["path/to/your/database/"], ideal_userlocations=["path/to/your/ideal_database"])
model2 = PCSAFT(["your_species_1","your_species_2"];userlocations=["dtb_like","dtb_unlike","dtb_assoc"],ideal_userlocations=["dtb_ideal"])
```

The rest works exactly as it normally would! We recommend reading the background documentation for the various models to ensure the units of the parameters you provide are correct.
2 changes: 1 addition & 1 deletion src/methods/methods.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
molecular_weight(model::EoSModel,z = @SVector [1.]) = 0.001*mapreduce(+,*,mw(model),z)
molecular_weight(model::EoSModel,z = @SVector [1.]) = 0.001*mapreduce(*,+,mw(model),z)
mw(model::EoSModel) = paramvals(model.params.Mw)

include("initial_guess.jl")
Expand Down

0 comments on commit 5c8a075

Please sign in to comment.