07 · Real benzene solubility and a solid/liquid flash¶
The main course uses actual ThermoWeave models and real chemical components. See the course index.
At 275 K, compute benzene's solubility in water using actual SAFT activities
and measured fusion properties. The pure-solid condition is
\(\ln(x_B\gamma_B)=-\Delta h_{fus}/R(1/T-1/T_m)\) with ΔCp=0.
Then independently flash the feed with ReducedHELD and check the saturated
liquid. No synthetic fusion values or regular-solution liquid are used.
In [1]:
Copied!
import numpy as np
import matplotlib.pyplot as plt
from thermoweave import SAFTgammaMie,FusionProperties
from thermoweave.equilibrium.sle import solubility
from thermoweave.equilibrium.reduced_held import ReducedChart,ReducedHELD,Solid
from _support import COMPONENTS,solid_gibbs,held_settings,check_flash,phase_table
names=['benzene','water'];T=275.
d=COMPONENTS['benzene'];print('Fusion source:',d['fusion_reference'],d['source_url'])
model=SAFTgammaMie.from_smiles({n:COMPONENTS[n]['smiles'] for n in names},pressure_Pa=101325.,report_assignment=False)
fusion=FusionProperties(d['melting_temperature_K'],d['enthalpy_of_fusion_J_mol'])
root=solubility(model,0,T,fusion)
print('Saturated liquid composition:',root.composition)
print('Solubility [benzene mole fraction]:',root.solubility,'; root residual:',root.residual)
chart=ReducedChart.build([0,0],[COMPONENTS[n]['molar_mass_g_mol'] for n in names])
solid=Solid('benzene(s)',[1.,0.],solid_gibbs(T))
result=ReducedHELD(model,T,chart,held_settings(),solids=[solid]).flash([.5,.5])
print(phase_table(result,names));print(check_flash(model,T,[.5,.5],result))
liquid=result.mole_fractions[result.phase_kinds.index('liquid')]
np.testing.assert_allclose(liquid,root.composition,atol=1e-8)
import numpy as np
import matplotlib.pyplot as plt
from thermoweave import SAFTgammaMie,FusionProperties
from thermoweave.equilibrium.sle import solubility
from thermoweave.equilibrium.reduced_held import ReducedChart,ReducedHELD,Solid
from _support import COMPONENTS,solid_gibbs,held_settings,check_flash,phase_table
names=['benzene','water'];T=275.
d=COMPONENTS['benzene'];print('Fusion source:',d['fusion_reference'],d['source_url'])
model=SAFTgammaMie.from_smiles({n:COMPONENTS[n]['smiles'] for n in names},pressure_Pa=101325.,report_assignment=False)
fusion=FusionProperties(d['melting_temperature_K'],d['enthalpy_of_fusion_J_mol'])
root=solubility(model,0,T,fusion)
print('Saturated liquid composition:',root.composition)
print('Solubility [benzene mole fraction]:',root.solubility,'; root residual:',root.residual)
chart=ReducedChart.build([0,0],[COMPONENTS[n]['molar_mass_g_mol'] for n in names])
solid=Solid('benzene(s)',[1.,0.],solid_gibbs(T))
result=ReducedHELD(model,T,chart,held_settings(),solids=[solid]).flash([.5,.5])
print(phase_table(result,names));print(check_flash(model,T,[.5,.5],result))
liquid=result.mole_fractions[result.phase_kinds.index('liquid')]
np.testing.assert_allclose(liquid,root.composition,atol=1e-8)
Fusion source: Oliver, Eaton and Huffman (1948), selected row in NIST Chemistry WebBook https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=4
Saturated liquid composition: [2.23810507e-04 9.99776189e-01] Solubility [benzene mole fraction]: 0.00022381050730463565 ; root residual: 1.5704701920860042e-08
[{'phase': 'liquid', 'mole_fraction_of_total': 0.5001119303030563, 'mass_fraction_of_total': 0.1875929878957369, 'x_benzene': 0.00022381050375732507, 'x_water': 0.9997761894962426}, {'phase': 'benzene(s)', 'mole_fraction_of_total': 0.49988806969694377, 'mass_fraction_of_total': 0.8124070121042631, 'x_benzene': 1.0, 'x_water': 0.0}]
In [2]:
Copied!
Ts=np.linspace(274.,278.,12)
x=[solubility(model,0,float(t),fusion).solubility for t in Ts]
fig,ax=plt.subplots(figsize=(6,3.8));ax.plot(Ts,x,'o-')
ax.set(xlabel='Temperature [K]',ylabel='Benzene mole fraction in saturated aqueous liquid',
title='Actual SAFT-γ Mie SLE prediction: benzene + water')
ax.grid(alpha=.2);fig.tight_layout();plt.show()
Ts=np.linspace(274.,278.,12)
x=[solubility(model,0,float(t),fusion).solubility for t in Ts]
fig,ax=plt.subplots(figsize=(6,3.8));ax.plot(Ts,x,'o-')
ax.set(xlabel='Temperature [K]',ylabel='Benzene mole fraction in saturated aqueous liquid',
title='Actual SAFT-γ Mie SLE prediction: benzene + water')
ax.grid(alpha=.2);fig.tight_layout();plt.show()
This temperature range stays below the binary three-phase transition computed in notebook 10 and above water's melting point. A solubility root by itself does not select all competing phases; notebook 10 shows where a second liquid becomes stable and notebook 11 computes actual ternary SLLE.
<style>
['pre { line-height: 125%; }\ntd.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\nspan.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\ntd.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\nspan.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n.highlight-ipynb .hll { background-color: var(--jp-cell-editor-active-background) }\n.highlight-ipynb { background: var(--jp-cell-editor-background); color: var(--jp-mirror-editor-variable-color) }\n.highlight-ipynb .c { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment */\n.highlight-ipynb .err { color: var(--jp-mirror-editor-error-color) } /* Error */\n.highlight-ipynb .k { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword */\n.highlight-ipynb .o { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator */\n.highlight-ipynb .p { color: var(--jp-mirror-editor-punctuation-color) } /* Punctuation */\n.highlight-ipynb .ch { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Hashbang */\n.highlight-ipynb .cm { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Multiline */\n.highlight-ipynb .cp { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Preproc */\n.highlight-ipynb .cpf { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.PreprocFile */\n.highlight-ipynb .c1 { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Single */\n.highlight-ipynb .cs { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Special */\n.highlight-ipynb .kc { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Constant */\n.highlight-ipynb .kd { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Declaration */\n.highlight-ipynb .kn { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Namespace */\n.highlight-ipynb .kp { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Pseudo */\n.highlight-ipynb .kr { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Reserved */\n.highlight-ipynb .kt { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Type */\n.highlight-ipynb .m { color: var(--jp-mirror-editor-number-color) } /* Literal.Number */\n.highlight-ipynb .s { color: var(--jp-mirror-editor-string-color) } /* Literal.String */\n.highlight-ipynb .ow { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator.Word */\n.highlight-ipynb .pm { color: var(--jp-mirror-editor-punctuation-color) } /* Punctuation.Marker */\n.highlight-ipynb .w { color: var(--jp-mirror-editor-variable-color) } /* Text.Whitespace */\n.highlight-ipynb .mb { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Bin */\n.highlight-ipynb .mf { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Float */\n.highlight-ipynb .mh { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Hex */\n.highlight-ipynb .mi { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer */\n.highlight-ipynb .mo { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Oct */\n.highlight-ipynb .sa { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Affix */\n.highlight-ipynb .sb { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Backtick */\n.highlight-ipynb .sc { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Char */\n.highlight-ipynb .dl { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Delimiter */\n.highlight-ipynb .sd { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Doc */\n.highlight-ipynb .s2 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Double */\n.highlight-ipynb .se { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Escape */\n.highlight-ipynb .sh { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Heredoc */\n.highlight-ipynb .si { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Interpol */\n.highlight-ipynb .sx { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Other */\n.highlight-ipynb .sr { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Regex */\n.highlight-ipynb .s1 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Single */\n.highlight-ipynb .ss { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Symbol */\n.highlight-ipynb .il { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer.Long */']
</style>