/yaeos

Thermodynamic Equations of State, Fortran library with both automatic and anallytical derivation capabilities

Primary LanguageFortran

GitHub Fortran fpm Documentation License CI

YA_EoS

There are multiple equation of state libraries, like:

Here we are presenting yet another (still in development) one, that tackles the same problem just, in another way. Mostly exploiting readability and extensiblity of Modern Fortran for scientists to have an easy way to implement new thermodynamic models without dealing with lower level languages but still getting decent performance. And also having the possiblility of using analitically obtained derivatives so both options are available with just a switch.

This is an experimental work in progress and we recommend the before mentioned libraries if you are intending to use some of this in real work.

We focus mainly in that the addition of a new thermodynamic model is as easy as possible. Also providing our own 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).

subroutine Ar(z, v, t, ar)
   use yaeos_adiff
   type(hyperdual), intent(in) :: z(:)
   type(hyperdual), intent(in) :: v
   type(hyperdual), intent(in) :: t
   type(hyperdual), intent(out) :: ar

   ! A very complicated residual helmholtz function of a mixture
   ar = sum(z) * v * t
end subroutine

After defining your own model you must just setup the Ar function and you're done, the available routines are using your model:

use yaeos_ar_models, only: set_ar_function
use yaeos_thermoprops, only: pressure
...

call set_ar_function(Ar) ! Set the before defined subroutine
call pressure(z, v, t, p, dp, dp2) ! Get the pressure and it's derivatives 
                                   ! at some thermodynamic state

Documentation

The latest API documentation for the main branch can be found here. This was generated from the source code using FORD.