Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road to v1.0.0 #84

Merged
merged 189 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
5d81f7e
Starting python interface drafts
fedebenelli Feb 5, 2024
a9ce22b
Merge pull request #10 from fedebenelli/main
fedebenelli Feb 5, 2024
0ab5113
Merge pull request #14 from fedebenelli/main
fedebenelli Feb 5, 2024
d988376
Merge pull request #20 from ipqa-research/main
fedebenelli Feb 7, 2024
dc104d7
Merge branch 'main' into 5-python-api
fedebenelli Feb 26, 2024
0c685ab
makefile to generate compiled library
fedebenelli Feb 26, 2024
7c48489
cubic_eos
fedebenelli Feb 26, 2024
a10f57b
simplifying dirs for now
fedebenelli Feb 26, 2024
cab37e5
going straight to C makes much more sense
fedebenelli Feb 26, 2024
3437e7d
giving this a more pythonic structure
fedebenelli Feb 26, 2024
3a31c89
moved
fedebenelli Feb 26, 2024
3a5be13
Merge branch 'main' into 5-python-api
fedebenelli Feb 26, 2024
b8ed6f9
tpd procedure
fedebenelli Mar 3, 2024
5da10c4
Merge branch '5-python-api' into 16-phase-equilibria-procedures
fedebenelli Mar 3, 2024
c7121d3
using bobyqa for tpd
fedebenelli Mar 6, 2024
a81400e
Merge branch 'dev' of github.com:fedebenelli/yaeos into 5-python-api
fedebenelli Mar 24, 2024
3489d23
python extension generator
fedebenelli Mar 24, 2024
04b5aef
Python API toy code
fedebenelli Mar 24, 2024
02804a8
format
fedebenelli Mar 25, 2024
d888c57
ignore
fedebenelli Mar 25, 2024
1f471f8
Merge branch 'dev' into 5-python-api
fedebenelli Jun 27, 2024
601d427
updated C API behaviour
fedebenelli Jun 27, 2024
85c252b
comment
fedebenelli Jun 27, 2024
db80f8f
names
fedebenelli Jun 27, 2024
0cc2b00
_del_
fedebenelli Jun 27, 2024
9f56422
modular mixing
fedebenelli Jun 27, 2024
6cb96e9
installable package. practically done with the api (????
SalvadorBrandolin Jun 28, 2024
2a92fe8
use pathlib for portability (it even gives you glob too) and absolute…
fedebenelli Jun 28, 2024
95262d1
wf?
fedebenelli Jun 28, 2024
57d9505
force meson
fedebenelli Jun 28, 2024
d39a67b
blacked
fedebenelli Jun 28, 2024
e63cbe7
blacked
fedebenelli Jun 28, 2024
74ac795
can now be installed normally and editable. I still don't know if it …
SalvadorBrandolin Jun 28, 2024
ed75ee7
.gitignore modificado
SalvadorBrandolin Jun 28, 2024
d3755a1
tapenade needs fPIC
fedebenelli Jun 30, 2024
aad31c5
NRTL model and MHV mixrule
fedebenelli Jun 30, 2024
caa71d0
ci?
fedebenelli Jun 30, 2024
4f732b5
ci?
fedebenelli Jun 30, 2024
10a1e85
ci
fedebenelli Jun 30, 2024
1917157
cleaning
fedebenelli Jun 30, 2024
f5be76a
det
fedebenelli Jun 30, 2024
c4de098
ifort
fedebenelli Jun 30, 2024
5e9468c
fortran-setup
fedebenelli Jun 30, 2024
0f7aefb
syntx
fedebenelli Jun 30, 2024
6e20aa9
syntx
fedebenelli Jun 30, 2024
17c477e
ci
fedebenelli Jun 30, 2024
6ce0903
intel?
fedebenelli Jun 30, 2024
19049a9
ci
fedebenelli Jun 30, 2024
1c73591
iostat
fedebenelli Jun 30, 2024
c1073ad
coverage only with gfortran
fedebenelli Jun 30, 2024
52225db
iostat
fedebenelli Jun 30, 2024
847ed3d
cov only on gfo
fedebenelli Jul 1, 2024
4418b72
cov only on gfo
fedebenelli Jul 1, 2024
69a1b2e
cov only on gfo
fedebenelli Jul 1, 2024
682ba91
cov only on gfo
fedebenelli Jul 1, 2024
23e0c24
shorter name for ifort
fedebenelli Jul 1, 2024
7b62df1
_pr
fedebenelli Jul 1, 2024
64e5f11
Write beta too
fedebenelli Jul 1, 2024
355538f
Added kind of Equilibirum
fedebenelli Jul 1, 2024
fd0dc29
typo
fedebenelli Jul 1, 2024
0589d69
format/names
fedebenelli Jul 1, 2024
78edf2d
doc
fedebenelli Jul 1, 2024
c8d1664
We are not compatible with the intel-classic compiler yet
fedebenelli Jul 1, 2024
d1827cc
Merge pull request #81 from ipqa-research/dev_ci
fedebenelli Jul 1, 2024
5ad9c6f
ign
fedebenelli Jul 1, 2024
8222c56
merge dev
fedebenelli Jul 1, 2024
95d3b57
phase stability. Using general optimizer
fedebenelli Jul 1, 2024
fc20316
tpd
fedebenelli Jul 1, 2024
84b1b8e
consistency module doc to the yaeos standard
SalvadorBrandolin Jul 1, 2024
2e0c498
tmp
fedebenelli Jul 1, 2024
3e15569
nvdia
fedebenelli Jul 1, 2024
fab4e9f
references of UNIFAC
SalvadorBrandolin Jul 1, 2024
a678371
structure to user documentation
SalvadorBrandolin Jul 1, 2024
f1ef0fb
Merge branch 'dev' into dev_ci
fedebenelli Jul 2, 2024
1f5df90
Merge branch '16-phase-equilibria-procedures' into dev_ci
fedebenelli Jul 2, 2024
c1039ee
ci
fedebenelli Jul 2, 2024
3da2177
not nvidia
fedebenelli Jul 2, 2024
3364009
UNIFAC user documentation
SalvadorBrandolin Jul 2, 2024
ee8fb4b
Merge pull request #82 from ipqa-research/doc_salva
fedebenelli Jul 3, 2024
7042daa
tpd minimzation using michelsens tm
fedebenelli Jul 3, 2024
ebdd506
test
fedebenelli Jul 3, 2024
b27c7c0
simple program for tpd calculation
fedebenelli Jul 3, 2024
44a6ffc
using pures
fedebenelli Jul 3, 2024
6ae4f9f
test
fedebenelli Jul 3, 2024
ae5e4b5
Merge pull request #83 from ipqa-research/dev_ci
fedebenelli Jul 3, 2024
2787a37
prettier?
fedebenelli Jul 4, 2024
26d9977
envelope doc
fedebenelli Jul 4, 2024
0d524ce
envdoc
fedebenelli Jul 4, 2024
156c8f3
docs
fedebenelli Jul 4, 2024
958a5f7
docs and crit
fedebenelli Jul 4, 2024
a1c3fb1
ign
fedebenelli Jul 4, 2024
976b7e5
merge dev
fedebenelli Jul 4, 2024
8a530a4
working on python
fedebenelli Jul 4, 2024
7491f1c
more exposure from the fortran-side
fedebenelli Jul 5, 2024
94fb9be
insall meson
fedebenelli Jul 5, 2024
5e80ac9
ci
fedebenelli Jul 5, 2024
e7d6aff
ci
fedebenelli Jul 5, 2024
f79c33d
ci
fedebenelli Jul 5, 2024
938cd42
ci
fedebenelli Jul 5, 2024
010a861
meson
fedebenelli Jul 5, 2024
861c6e6
python
fedebenelli Jul 5, 2024
8200ca1
python
fedebenelli Jul 5, 2024
3101bd6
trying to make editable install
SalvadorBrandolin Jul 8, 2024
24ad12c
Update README.md
fedebenelli Jul 8, 2024
07dca53
Merge branch 'dev' of github.com:fedebenelli/yaeos into dev
fedebenelli Jul 8, 2024
e8aa28b
failed spec
fedebenelli Jul 8, 2024
77300e1
migration to always using the ProblemFitting model
fedebenelli Jul 8, 2024
0e4bf87
fixing example adiffPR76
fedebenelli Jul 8, 2024
1e6044c
Implementation of a hard-spheres mixing rule
fedebenelli Jul 8, 2024
6f34fd9
example demo
fedebenelli Jul 8, 2024
015a145
editable install works, thinking where compile on build
SalvadorBrandolin Jul 8, 2024
815f1bc
getting better, a little more work to do
SalvadorBrandolin Jul 8, 2024
0e214a0
still needs some work. build working. elucidate how to include licenc…
SalvadorBrandolin Jul 9, 2024
f47b4a0
dirty signal to skip_compilation, need to think better about it, but …
SalvadorBrandolin Jul 9, 2024
2c856f8
little mistake fixed
SalvadorBrandolin Jul 10, 2024
b3f6496
little mistake 2 fixed
SalvadorBrandolin Jul 10, 2024
5a5b663
keep working with tox at home
SalvadorBrandolin Jul 10, 2024
7cd3469
idk how to fix all the install really... keep working tomorrow
SalvadorBrandolin Jul 11, 2024
386e5c2
keep working with tox at home
SalvadorBrandolin Jul 11, 2024
a7d25f9
fixed fit_kij_lij interface
fedebenelli Jul 11, 2024
ebec536
it workksss (only on linux)
SalvadorBrandolin Jul 12, 2024
95b1eaa
Merge branch 'dev_fitting' into 5-python-api
fedebenelli Jul 12, 2024
f14e629
fix coverage and check-manifest
fedebenelli Jul 12, 2024
7d867c9
coverage collect needs an __init__ file
fedebenelli Jul 12, 2024
03ececa
wrappers for some phase equilibria procedures
fedebenelli Jul 12, 2024
106de13
more implementation and some more examples
fedebenelli Jul 12, 2024
c5912f0
tapenade: added interfaces so now it is possible to disable implicit …
fedebenelli Jul 14, 2024
a774b2a
test nrtlmhv fit
fedebenelli Jul 14, 2024
e84895b
added conditionals
fedebenelli Jul 14, 2024
9dd6b34
possiblity to not initialize step
fedebenelli Jul 14, 2024
846e854
test
fedebenelli Jul 14, 2024
b31ae16
scripts
fedebenelli Jul 14, 2024
5cda95f
fit
fedebenelli Jul 14, 2024
52c5d76
better now?
SalvadorBrandolin Jul 14, 2024
850d07a
verb
fedebenelli Jul 14, 2024
2a8e603
Merge pull request #88 from ipqa-research/dev_fitting
fedebenelli Jul 14, 2024
18ed7a0
tapenanade_interface
fedebenelli Jul 14, 2024
1302ae1
added models
fedebenelli Jul 14, 2024
2aded77
slider
fedebenelli Jul 14, 2024
aa1fe14
refactored pt envelopes
fedebenelli Jul 15, 2024
e3c4727
some docs
fedebenelli Jul 15, 2024
564b601
docs
fedebenelli Jul 15, 2024
73daaf6
docs
fedebenelli Jul 15, 2024
d1229cb
generic volume solver for ArModel
fedebenelli Jul 15, 2024
c1b8be2
moved thermoprops as methods
fedebenelli Jul 15, 2024
53bb236
moved thermoprops as ArModel methods
fedebenelli Jul 15, 2024
57aaa8e
Adding specialized solvers module, now including Michelsen volume sol…
fedebenelli Jul 15, 2024
dd56df7
Simple newton solver
fedebenelli Jul 15, 2024
739d8f5
Moved thermoprops to methods
fedebenelli Jul 15, 2024
e49859c
moved thermoprops to methods
fedebenelli Jul 15, 2024
4cad4b5
cardano method
fedebenelli Jul 16, 2024
0f01166
added cardano method test
fedebenelli Jul 16, 2024
71f744a
FIXTHIS: Saturation temperatures are hard to converge
fedebenelli Jul 16, 2024
73bb6eb
Analitical solutions for cubic EoS
fedebenelli Jul 16, 2024
1d3c502
mindoc
fedebenelli Jul 16, 2024
f318fd0
isotherm
fedebenelli Jul 16, 2024
a449b62
not using polyroots
fedebenelli Jul 16, 2024
8c5b5b3
jupyter notebook sympy playground
fedebenelli Jul 16, 2024
901871c
ign
fedebenelli Jul 16, 2024
734541a
roots rosendo
SalvadorBrandolin Jul 17, 2024
4d4ce45
changed init which was too far away.
fedebenelli Jul 17, 2024
0d1a48e
changed init which was too far away.
fedebenelli Jul 17, 2024
7bd603c
newton test
fedebenelli Jul 17, 2024
0852112
documentation for cubics
fedebenelli Jul 17, 2024
3e2cacf
docs
fedebenelli Jul 17, 2024
ef98dd9
Merge pull request #90 from ipqa-research/volume_solvers
fedebenelli Jul 17, 2024
9613363
version number
fedebenelli Jul 17, 2024
ce26549
merge dev
fedebenelli Jul 17, 2024
74c46a3
thermoprops
fedebenelli Jul 17, 2024
3e97987
include NRTL in init
fedebenelli Jul 17, 2024
75018d8
tox?
fedebenelli Jul 17, 2024
13ac976
tox
fedebenelli Jul 17, 2024
869f6a3
Going to a standard naming convention
fedebenelli Jul 17, 2024
ee645f7
naming
fedebenelli Jul 17, 2024
0ef87bf
Now we truly calcualte lnPhi
fedebenelli Jul 17, 2024
6952ff5
starting to test more
fedebenelli Jul 17, 2024
e642bb0
styleguide
fedebenelli Jul 17, 2024
78a9be3
test for exact root solvers
SalvadorBrandolin Jul 17, 2024
77fa993
Merge pull request #91 from ipqa-research/test_volume_solvers
fedebenelli Jul 18, 2024
fb7227a
PT spec
fedebenelli Jul 18, 2024
8ab34e1
Merge pull request #92 from ipqa-research/std_api
fedebenelli Jul 18, 2024
bf4d3dd
example of calculating saturation points of pure components
fedebenelli Jul 18, 2024
7e6dfe1
added size function to ArModel
fedebenelli Jul 18, 2024
ee8c2ed
touched a bit MHV example
fedebenelli Jul 18, 2024
bbbed79
do test python
fedebenelli Jul 18, 2024
a8c727c
ensable cubic eos tutorail
fedebenelli Jul 18, 2024
6de06c3
test newton volume
fedebenelli Jul 18, 2024
e0541a7
read
fedebenelli Jul 18, 2024
e59f1ed
read
fedebenelli Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 65 additions & 25 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
name: CI
on: [push]


jobs:
Build:
tests_and_coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
gcc_v: [10] # Version of GFortran we want to use.
python-version: [3.9]
env:
FC: gfortran-${{ matrix.gcc_v }}
GCC_V: ${{ matrix.gcc_v }}

toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}
- {compiler: intel, version: '2024.1'}
- {compiler: intel, version: '2023.2'}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false

- name: Setup Fortran Compiler
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Install Python
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
Expand All @@ -33,39 +43,69 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Python dependencies
if: contains( matrix.os, 'ubuntu')
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ford numpy matplotlib gcovr numpy scipy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install GFortran Linux
if: contains( matrix.os, 'ubuntu')
run: |
sudo apt-get install lcov
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }}

- name: Install NLopt
run:
sudo apt-get install libnlopt-dev

- name: Compile
run: fpm build --profile release
- name: Run tests without coverage
if: ${{ env.FC != 'gfortran' }}
run: |
fpm test --profile debug --compiler ${{ env.FC }} --c-compiler gcc

- name: Run tests
- name: Run tests with coverage
if: ${{ env.FC == 'gfortran' }}
run: |
fpm test --profile debug --flag -coverage
fpm test --profile debug --flag -coverage --compiler ${{ env.FC }} --c-compiler gcc
bash ci/ci.sh

- name: Coverage
run: bash ci/ci.sh coverage
if: ${{ env.FC == 'gfortran' }}

- name: Upload coverage reports to Codecov
if: ${{ env.FC == 'gfortran' }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ipqa-research/yaeos

Python-API:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
gcc_v: [10] # Version of GFortran we want to use.
python-version: [3.9]
env:
FC: gfortran-${{ matrix.gcc_v }}
GCC_V: ${{ matrix.gcc_v }}

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false

- name: Install Python
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
working-directory: ./python
run: |
sudo apt-get install libnlopt-dev meson
pip install meson tox

- name: Install yaeos
working-directory: ./python
run:
pip install .

# - name: tox
# working-directory: ./python
# run: tox -r
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ doc/ford_site
*.smod
*mypy*
*.so
*.egg-info
tools/uml
tools/uml.png
tools/uml.svg
python/yaeos/script.py
__pycache__
iso
log
coverage.xml
Expand Down Expand Up @@ -44,3 +46,23 @@ log_srk-hv
srk
srk_hv
fort.2
*.egg-info
*ipynb_checkpoints
chulia
flang.rsp
flash
flash_log_para
flash_log_sequ
fort.4
log2
para.py
tools/plotting/pt_envel_2ph.gnu
tools/notebooks/other.ipynb
dist
.tox
.coverage
tmp_editable
hsprpxy
iters
n2c8data
prpxy
129 changes: 62 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

[![Fortran](https://img.shields.io/badge/Fortran-734f96?logo=fortran&style=flat)](https://fortran-lang.org)
[![fpm](https://img.shields.io/badge/fpm-Fortran_package_manager-734f96)](https://fpm.fortran-lang.org)
[![Documentation](https://img.shields.io/badge/ford-Documentation%20-blueviolet.svg)](https://ipqa-research.github.io/yaeos/)
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](https://github.com/ipqa-research/yaeos/blob/main/LICENSE)
[![CI](https://github.com/fedebenelli/yaeos/actions/workflows/CI.yml/badge.svg)](https://github.com/ipqa-research/yaeos/actions/workflows/CI.yml)
[![codecov](https://codecov.io/gh/ipqa-research/yaeos/graph/badge.svg?token=IDJYKV8XK6)](https://codecov.io/gh/ipqa-research/yaeos)


<p align="center">
<img src="media/logo.png" width="50%"/>
</p>
Expand Down Expand Up @@ -36,15 +34,39 @@ derivatives so both options are easily available.
We focus mainly on that the addition of a new thermodynamic model as easily as
possible. Also providing our models too!

For now, we only include residual Helmholtz model (like Cubic or Saft Equations
of State). But we'll be adding other models like $G^E$ (UNIFAC for example).
For now, we only include residual Helmholtz model (like Cubic or SAFT Equations
of State).

## Available models
- CubicEoS
- SoaveRedlichKwong
- PengRobinson76
- PengRobinson78
- ExcessGibbs models
- NRTL
- UNIFAC VLE

## Available properties
- Bulk Properties
- Volume(n, P, T)
- Pressure(n, V, T)
- Residual Properties
- H^R(n, V, T)
- S^R(n, V, T)
- G^R(n, V, T)
- Cv^R(n, V, T)
- Cp^R(n, V, T)
- Phase-Equilibria
- FlashPT, FlashVT
- Saturation points (bubble, dew and liquid-liquid)
- Phase Envelope PT (isopleths)

# A little taste of `yaeos`
A lot of users get the bad picture of Fortran being old and archaic since most
of the codes they've seen are written in ancient `F77`.

```fortran
use yaeos, only: PengRobinson76, pressure, ArModel
use yaeos, only: PengRobinson76, ArModel

integer, parameter :: n=2 ! Number of components
real(8) :: V, T, P, dPdN(n) ! variables to calculate
Expand All @@ -64,7 +86,7 @@ model = PengRobinson76(tc, pc, w, kij, lij)
V = 1
T = 150

call pressure(model, z, V, T, P)
call model%pressure(z, V, T, P)
print *, P

! Obtain derivatives adding them as optional arguments!
Expand All @@ -83,30 +105,42 @@ with:
Not providing any example will show all the possible examples that can be run.

# How to install/run it
`yaeos` is intended to use as a [`fpm`](fpm.fortran-lang.org)

You can either:

- Generate a new project that uses `yaeos` as a dependency
## Dependencies
`yaeos` needs to have both `lapack` and `nlopt` libraries on your system.

### Debian/Ubuntu-like
```bash
fpm new my_project
sudo apt install libnlopt-dev libblas-dev liblapack-dev
```

In the `fpm.toml` file add:
## Installing `yaeos`
`yaeos` is intended to use as a [`fpm`](fpm.fortran-lang.org) package. `fpm`
is the Fortran Package Manager, which automates the compilation and running
process of Fortran libraries/programs.

```toml
[dependencies]
yaeos = {git="https://github.com/ipqa-research/yaeos"}
```
You can either:

- Generate a new project that uses `yaeos` as a dependency with:

> ```bash
> fpm new my_project
> ```
>
> In the `fpm.toml` file add:
>
> ```toml
> [dependencies]
> yaeos = {git="https://github.com/ipqa-research/yaeos"}
> ```

- Clone this repository and just modify the executables in the `app` directory

```bash
git clone https://github.com/ipqa-research/yaeos
cd yaeos
fpm run
```
> ```bash
> git clone https://github.com/ipqa-research/yaeos
> cd yaeos
> fpm run
> ```

## Developing with vscode
If your intention is either to develop for `yaeos` or to explore in more detail
Expand All @@ -131,63 +165,24 @@ fpm run --example <example_name_here>
```

# Including new models with Automatic Differentiation.

## Hyperdual Numbers autodiff
We are using the `hyperdual` module developed by
[Philipp Rehner](https://github.com/prehner)
and [Gernot Bauer](https://github.com/g-bauer)

> The automatic differentiation API isn't fully optimized yet so performance is
> much slower than it should be.

```fortran
type, extends(ArModelAdiff) :: YourNewModel
type(Substances) :: composition
real(8), allocatable :: parameters(:) ! A vector of parameters
contains
procedure :: Ar => arfun
procedure :: get_v0 => v0
end type
```

```fortran
subroutine arfun(self, n, v, t, Ar)
class(YourNewModel), intent(in) :: self
type(hyperdual), intent(in) :: n(:) ! Number of moles
type(hyperdual), intent(in) :: v ! Volume [L]
type(hyperdual), intent(in) :: t ! Temperature [K]
type(hyperdual), intent(out) :: ar_value ! Residual Helmholtz Energy

! A very complicated residual helmholtz function of a mixture
Ar = sum(n) * v * t / self%parameters(1)
end subroutine

function v0(self, n, p, t)
class(YourNewModel), intent(in) :: self
real(pr), intent(in) :: n(:) ! Number of moles
real(pr), intent(in) :: p ! Pressure [bar]
real(pr), intent(in) :: t ! Temperature [K]
real(pr) :: v0

v0 = self%parameters(3)
end function
```

A complete implementation of the PR76 Equation of State can me found in
`example/adiff/adiff_pr76.f90`.

All the thermodynamic properties can be found in `yaeos_thermoprops` and called
like:
`example/adiff/adiff_pr76.f90`. Or in the documentation pages.

```fortran
use yaeos_thermoprops, only: fugacity_vt
use my_new_model, only: YourNewModel
...
type(YourNewModel) :: eos
eos%parameters = [1, 2, 3]
call fugacity_vt(eos, n, v, t, lnfug=lnfug, dlnphidn=dlnphidn)
```
## Tapenade-based autodiff
It is also possible to differentiate with `tapenade`. Examples can be seen
in the documentation pages or in [The tools directory](tools/tapenade_diff/)

# Documentation
The latest API documentation for the `main` branch can be found
[here](https://ipqa-research.github.io/yaeos). This was generated from the source
code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford). We're
working in extending it more.
working in extending it more.
Loading
Loading