-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathoutplace.jl
49 lines (43 loc) · 1.53 KB
/
outplace.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
kij_mix(f,p::ClapeyronParam,k::PairParam)::PairParam
kij_mix(f,p::ClapeyronParam)::PairParam
General combining rule for pair parameter with a `kᵢⱼ` interaction parameter. returns a pair parameter with non diagonal entries equal to:
```
pᵢⱼ = f(pᵢ,pⱼ,kᵢⱼ)
```
Where `f` is a 'combining' function that follows the rules:
```
f(pᵢ,pⱼ,0) = f(pⱼ,pᵢ,0)
f(pᵢ,pᵢ,0) = pᵢ
```
and `k` must follow:
```
kᵢᵢ = 0
```
Ignores non-diagonal entries already set.
If a Single Parameter is passed as input, it will be converted to a Pair Parameter with `pᵢᵢ = pᵢ`.
"""
function kij_mix(f::F,param::SingleOrPair,K = nothing) where F
return kij_mix!(f,PairParam(param),K)
end
"""
pair_mix(g,P::ClapeyronParam,Q::ClapeyronParam)::PairParam
pair_mix(g,P::ClapeyronParam,Q::ClapeyronParam)::PairParam
General combining rule for a pair and a single parameter. returns a pair parameter `P` with non diagonal entries equal to:
```
Pᵢⱼ = g(Pᵢ,Pⱼ,Qᵢ,Qⱼ,Qᵢⱼ)
```
Where `f` is a 'combining' function that follows the rules:
```
Pᵢⱼ = Pⱼᵢ = g(Pᵢ,Pⱼ,Qᵢ,Qⱼ,Qᵢⱼ) = g(Pⱼ,Pᵢ,Qⱼ,Qᵢ,Qᵢⱼ)
g(Pᵢ,Pᵢ,Qᵢ,Qᵢ,Qᵢ) = Pᵢ
```
it is a more general form of `kij_mix`, where `kij_mix(f,P,Q) == pair_mix(g,P,Q)` is correct if:
```
f(Pᵢ,Pⱼ,Qᵢⱼ) = g(Pᵢ,Pⱼ,_,_,Qᵢⱼ)
If you pass a `SingleParam` or a vector as input for `Q`, then `Qᵢⱼ` will be considered 0.
```
"""
function pair_mix(f::F,P::SingleOrPair,Q::SingleOrPair) where F
return pair_mix!(f,PairParam(P),Q)
end