Volume solver optimized for Cubic Equations of State.
@warn This routine intends to use the analyitical solution of the cubic equation, but due to errors in the solutions it is not used. And the general volume solver by Michelsen is used instead. @endwarn
Cubic equations can be analytically solved. Using an anallytical solution provides the best possible solution in terms of speed and precision. This subroutine uses the modified cardano method proposed by Rosendo.
use yaeos, only: CubicEoS, PengRobinson
type(CubicEoS) :: eos
eos = PengRobinson(tc, pc, w)
! Possible roots to solve
call eos%volume(n, P, T, V, "liquid")
call eos%volume(n, P, T, V, "vapor")
call eos%volume(n, P, T, V, "stable")
[1] “Thermodynamic Models: Fundamental and Computational Aspects”, Michael L. Michelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) doi
[2] “A Note on the Analytical Solution of Cubic Equations of State in Process Simulation”, Rosendo Monroy-Loperena doi
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(CubicEoS), | intent(in) | :: | eos | |||
real(kind=pr), | intent(in) | :: | n(:) | |||
real(kind=pr), | intent(in) | :: | P | |||
real(kind=pr), | intent(in) | :: | T | |||
real(kind=pr), | intent(out) | :: | V | |||
character(len=*), | intent(in) | :: | root_type |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=pr), | public | :: | AT_Liq | ||||
real(kind=pr), | public | :: | AT_Vap | ||||
real(kind=pr), | public | :: | Ar | ||||
real(kind=pr), | public | :: | Bmix | ||||
real(kind=pr), | public | :: | D | ||||
real(kind=pr), | public | :: | D1 | ||||
real(kind=pr), | public | :: | D2 | ||||
real(kind=pr), | public | :: | Tr(size(n)) | ||||
real(kind=pr), | public | :: | V_liq | ||||
real(kind=pr), | public | :: | V_vap | ||||
real(kind=pr), | public | :: | a(size(n)) | ||||
real(kind=pr), | public | :: | cp(4) | ||||
complex(kind=pr), | public | :: | cr(3) | ||||
real(kind=pr), | public | :: | dBi(size(n)) | ||||
real(kind=pr), | public | :: | dBij(size(n),size(n)) | ||||
real(kind=pr), | public | :: | dD1i(size(n)) | ||||
real(kind=pr), | public | :: | dD1ij(size(n),size(n)) | ||||
real(kind=pr), | public | :: | dDdT | ||||
real(kind=pr), | public | :: | dDdT2 | ||||
real(kind=pr), | public | :: | dDi(size(n)) | ||||
real(kind=pr), | public | :: | dDidT(size(n)) | ||||
real(kind=pr), | public | :: | dDij(size(n),size(n)) | ||||
real(kind=pr), | public | :: | dadt(size(n)) | ||||
real(kind=pr), | public | :: | dadt2(size(n)) | ||||
integer, | public | :: | flag | ||||
real(kind=pr), | public | :: | rr(3) | ||||
real(kind=pr), | public | :: | totn | ||||
real(kind=pr), | public | :: | z(size(n)) |