ipqa-research / yaeos

Thermodynamic Equations of State, Fortran library with both automatic and anallytical derivation capabilities
https://ipqa-research.github.io/yaeos/
Mozilla Public License 2.0
26 stars 4 forks source link

IMP: Implement an `enum` for different root types and saturation points #97

Open fedebenelli opened 1 month ago

fedebenelli commented 1 month ago

Right now the kind of saturation points or volume roots are defined with characters "liquid", "dew", etc. A more solid approach would be the implementation of some enum type that holds those values.

This improvement would need two steps:

module yaeos__saturation_kinds

    implicit none

    type, private :: EquilibriaEnum
        integer, parameter :: bubble = 1
        integer, parameter :: dew = 2
        ...
    end type

    type, private :: VolumeRootEnum
        integer, parameter :: liquid = 1
        integer, parameter :: vapor = 2
         integer, parameter :: stable = 3
        ...
    end type

    type(SaturationEnum), public :: saturation_kind
    type(VolumeRootEnum), public :: roots
end module

program main
    use yaeos
    use yaeos__saturation_kinds

    ... ! model definition somewhere

    call model%volume(n, P, T, root=roots%volume, V=V)

    sat_point = saturation_pressure(model, n, T, kind=saturation_kind%bubble)
end program