Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
moyner committed Jan 28, 2024
1 parent 163e2a6 commit ddb9981
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/src/examples/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ z = [0.4, 0.6] # 1 mole methane per 9 moles of decane
conditions = (p = p, T = T, z = z)
# Perform a flash to get the vapor fraction
V = flash_2ph(eos, conditions)
round(V, digits = 5)
# output
0.2660973082539688
0.2661
```

## K-values and fractions
Expand All @@ -84,31 +85,31 @@ We can also get more output by turning on the `extra_out` flag. We can use this

```jldoctest
V, K, report = flash_2ph(eos, conditions, extra_out = true);
K
round.(K, digits = 5)
# output
2-element Vector{Float64}:
4.1227246229737515
0.0004711582061535555
4.12272
0.00047
```

From the chosen overall mole fractions `z`, and the flashed `K`-values together with the vapor fraction `V` we can get the phase mole fractions in the liquid phase:

```jldoctest
julia> liquid_mole_fraction.(z, K, V)
2-element Vector{Float64}:
0.24247146623483945
0.7575285337651605
0.24247146623483776
0.7575285337651623
```

As expected, the liquid phase has more of the heavy component than in the overall mole fractions (0.75 relative to 0.6). If we compute the vapor fractions,

```jldoctest
julia> vapor_mole_fraction.(z, K, V)
2-element Vector{Float64}:
0.9996430842149212
0.0003569157850789261
0.9996430842149211
0.000356915785078925
```

we see that the vapor phase is almost entirely made up of the lighter methane at the chosen conditions.
Expand Down

0 comments on commit ddb9981

Please sign in to comment.