Skip to content

Commit 82caf93

Browse files
committed
Improve docs, add parametric type to ZJ
1 parent 2b5668e commit 82caf93

2 files changed

Lines changed: 33 additions & 18 deletions

File tree

src/eos_types.jl

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,52 +39,65 @@ abstract type AbstractGeneralizedCubic end
3939
abstract type AbstractPengRobinson <: AbstractGeneralizedCubic end
4040

4141
"""
42+
pr = PengRobinson()
43+
4244
Specializes the GenericCubicEOS to the Peng-Robinson cubic equation of state.
4345
"""
4446
struct PengRobinson <: AbstractPengRobinson end
4547

4648

4749
"""
50+
prc = PengRobinsonCorrected()
51+
4852
Specializes the GenericCubicEOS to Peng-Robinson modified for large acentric factors
4953
"""
5054

5155
struct PengRobinsonCorrected <: AbstractPengRobinson end
5256
"""
57+
zj = ZudkevitchJoffe(; F_a = (T, c_i) -> 1.0, F_b = (T, c_i) -> 1.0)
58+
5359
Specializes the GenericCubicEOS to the Zudkevitch-Joffe cubic equation of state.
5460
5561
The Zudkevitch-Joffe equations of state allows for per-component functions of
5662
temperature that modify the `weight_ai` and `weight_bi` functions. These additional
5763
fitting parameters allows for more flexibility when matching complex mixtures.
5864
"""
59-
struct ZudkevitchJoffe <: AbstractGeneralizedCubic
60-
F_a
61-
F_b
65+
struct ZudkevitchJoffe{A, B} <: AbstractGeneralizedCubic
66+
F_a::A
67+
F_b::B
6268
function ZudkevitchJoffe(; F_a = (T, c_i) -> 1.0, F_b = (T, c_i) -> 1.0)
63-
new(F_a, F_b)
69+
new{typeof(F_a), typeof(F_b)}(F_a, F_b)
6470
end
6571
end
6672

6773
"""
74+
srk = SoaveRedlichKwong()
75+
6876
Specializes the GenericCubicEOS to the Soave-Redlich-Kwong cubic equation of state.
6977
"""
7078
struct SoaveRedlichKwong <: AbstractGeneralizedCubic end
7179
"""
80+
rk = RedlichKwong()
81+
7282
Specializes the GenericCubicEOS to the Redlich-Kwong cubic equation of state.
7383
"""
7484
struct RedlichKwong <: AbstractGeneralizedCubic end
7585

7686
"""
77-
GenericCubicEOS(mixture, [type = PengRobinson()])
87+
GenericCubicEOS(mixture)
88+
GenericCubicEOS(mixture, PengRobinson())
89+
7890
79-
Instantiate a generic cubic equation-of-state for a `MultiComponentMixture` and
91+
Instantiate a generic cubic equation-of-state for a `MultiComponentMixture` and
8092
a specified EOS.
8193
82-
Currently supported choices for type:
94+
Currently supported choices for second argument:
8395
84-
1. `PengRobinson` (default)
85-
2. `ZudkevitchJoffe`
86-
3. `RedlichKwong`
87-
4. `SoaveRedlichKwong`
96+
1. `PengRobinson()` (default)
97+
2. `PengRobinsonCorrected()`
98+
3. `ZudkevitchJoffe()`
99+
4. `RedlichKwong()`
100+
5. `SoaveRedlichKwong()`
88101
"""
89102
function GenericCubicEOS(mixture, type = PengRobinson(); kwarg...)
90103
ω_a, ω_b, m_1, m_2 = static_coefficients(type)

src/flash_types.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ abstract type AbstractFlash end
44
abstract type AbstractNewtonFlash <: AbstractFlash end
55

66
"""
7-
Flash method that uses successive subtition.
7+
ssi = SSIFlash()
88
9-
Unconditionally convergent, does not require derivatives, but is very slow around critical regions.
9+
Flash method that uses successive subtition. Unconditionally convergent, does
10+
not require derivatives, but is very slow around critical regions.
1011
1112
See also: [`flash_2ph!`](@ref), [`NewtonFlash`](@ref) [`SSINewtonFlash`](@ref)
1213
"""
1314
struct SSIFlash <: AbstractFlash end
1415

1516
"""
16-
NewtonFlash([dMax = 0.2])
17+
newton = NewtonFlash()
18+
newton = NewtonFlash(dMax = 0.2)
1719
18-
Flash using Newton's method for zero solve.
19-
20-
Only conditionally convergent, but has better convergence rate than SSI.
20+
Flash using Newton's method for zero solve. Only conditionally convergent, but
21+
has better convergence rate than SSI.
2122
2223
# Arguments
2324
- `dMax`: dampening factor for the newton iteration
@@ -29,7 +30,8 @@ See also: [`flash_2ph!`](@ref), [`SSIFlash`](@ref) [`SSINewtonFlash`](@ref)
2930
end
3031

3132
"""
32-
SSINewtonFlash([swap_iter = 5,dMax = 0.2])
33+
ssi_newton = SSINewtonFlash(
34+
ssi_newton = SSINewtonFlash(swap_iter = 5, dMax = 0.2)
3335
3436
Perform a number of SSI iterations, followed by Newton until convergence.
3537

0 commit comments

Comments
 (0)