{ "cells": [ { "cell_type": "markdown", "id": "68630f03", "metadata": {}, "source": [ "# Problem set 6\n", "\n", "## Problem 6.1\n", "\n", "1. Salt ions disrupt the structure of the water molecules, and\n", " stimulate the nucleation process. For the formation of a new phase\n", " (here, a gas bubble) an energy barrier needs to be overcome. Small\n", " particles or a dirty pan can lower the barrier of the nucleation\n", " process locally. (this is actually a difficult question, and this\n", " answer is not the full story)\n", "\n", "2. To prevent the formation of many different crystalline domains,\n", " which gives an undesirable texture and look, and to make sure that\n", " one ends up with the ’desirable’ crystalline phase (which forms\n", " around 32$^\\mathrm{o}$C) which is the shiniest and makes the best\n", " sound when it is broken.\n", "\n", "3. Important is to use a clean bottle, to cool rapidly, and to cool\n", " deep enough, and not too long, to make sure that the nucleation\n", " process does not take over.\n", "\n", "4. The formation and growth of ice crystals cuts organic material into\n", " pieces at a microscopic scale. And if that is not harmful enough, it\n", " also changes the osmotic pressure in the remaining fluid phase, such\n", " that cells can dry out or burst.\n", "\n", "5. If one minimises $G$ one finds that\n", "\n", " $$\\frac{\\partial G}{\\partial R} = 0$$\n", "\n", " implies\n", "\n", " $$R_\\mathrm{crit} = \\frac{\\Delta G}{2 \\gamma}$$\n", "\n", " How the surface tension $\\gamma$ and change in free energy\n", " $\\Delta G$ are calculated is a story for another time.\n", "\n", "## Problem 6.2\n", "\n", "1. For an ideal gas\n", "\n", " $$p = k_\\mathrm{B}T \\rho$$\n", "\n", " and a Van der Waals fluid\n", "\n", " $$p = k_\\mathrm{B}T \\frac{\\rho}{1-b\\rho} - a \\rho^2$$\n", "\n", "2. See plot at the bottom of this page.\n", "\n", "3. See lecture (slides)\n", "\n", "4. Anywhere where there are multiple densities with the same pressure,\n", " one could expect a phase coexistence (draw a horizontal line in the\n", " $p$ vs. $\\rho$ curve). However, the regime where the pressure\n", " decreases with density should not be counted, because these\n", " densities unstable (see lecture)\n", "\n", "5. For an ideal gas\n", "\n", " $$\\mu = k_\\mathrm{B}T\\ln{\\rho}$$\n", "\n", " and for a Van der Waals fluid\n", "\n", " $$\\mu = k_\\mathrm{B}T\\ln\\frac{\\rho}{1-b\\rho} + \\frac{k_\\mathrm{B}T}{1-b\\rho} - 2a\\rho$$\n", "\n", "6. See plot at the bottom of this page.\n", "\n", "7. Yes, if there are multiple densities with the same $\\mu$ one can\n", " expect a phase coexistence. The regime where $\\mu$ decreases with\n", " density should not be counted (see part d and lecture slides)\n", "\n", "8. This follows quickly after substituting $\\frac{N}{V}$ by $\\rho$.\n", "\n", "9. For the pressure (use the sum rule and the chain rule):\n", "\n", " $$p = - \\frac{\\partial}{\\partial V} Vf = - f - V \\frac{\\partial f}{\\partial V} = -f - V \\frac{\\partial \\rho}{\\partial V}\\frac{\\partial f}{\\partial \\rho} = \\rho \\frac{\\partial f}{\\partial \\rho} - f$$\n", "\n", " and for $\\mu$ similarly:\n", "\n", " $$\\mu = \\frac{\\partial}{\\partial N} Vf = V \\frac{\\partial f}{\\partial N} = V \\frac{\\partial \\rho}{\\partial N}\\frac{\\partial f}{\\partial \\rho} = \\frac{\\partial f}{\\partial \\rho}$$\n", "\n", "10. It may be obvious that the chemical potentials are the same, because\n", " $\\mu = \\frac{\\partial f}{\\partial \\rho}$ is the slope of the curve,\n", " and the two points obviously have the same slope:\n", "\n", " $$\\mu_1 = f'(\\rho_1) = f'(\\rho_2) = \\mu_2$$\n", "\n", " For $p_1 = p_2$ another condition has to be met. If that is the\n", " case, then\n", "\n", " $$p_1 = \\rho_1 f'(\\rho_1) - f(\\rho_1) = \\rho_2 f'(\\rho_2) - f(\\rho_2) = p_2$$\n", "\n", " Swapping some terms, gives\n", "\n", " $$\\rho_1 f'(\\rho_1) - \\rho_2 f'(\\rho_2) = f(\\rho_1) - f(\\rho_2)$$\n", "\n", " but we know that $f'(\\rho_1)=f'(\\rho_2)$, so\n", "\n", " $$f'(\\rho_1) = f'(\\rho_2) = \\frac{f(\\rho_1) - f(\\rho_2)}{\\rho_1 - \\rho_2}$$\n", "\n", " This statement tells us that for the pressures to be the same, the\n", " points need to have the same slope, and in addition to that, that if\n", " the two points are connected with a straight line, that this line\n", " has to have the same slope as well. This can be done very easily by\n", " putting a ruler against the curve of $f(\\rho)$, as shown in\n", " {numref}`fig:free_energy_density`." ] }, { "cell_type": "code", "execution_count": 1, "id": "76ddf836", "metadata": { "tags": [ "remove-input" ] }, "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'numpy'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mplotly\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph_objects\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mgo\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mplotly\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msubplots\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmake_subplots\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mscipy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moptimize\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mfsolve\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'numpy'" ] } ], "source": [ "import numpy as np\n", "import plotly.graph_objects as go\n", "from plotly.subplots import make_subplots\n", "from scipy.optimize import fsolve\n", "\n", "kbt = 1\n", "\n", "def pressure(rho, a, b):\n", " p = rho*kbt/(1-b*rho) - a*rho**2\n", " return p\n", "\n", "def chempot(rho, a, b):\n", " kbt = 1\n", " mu = kbt*np.log(rho/(1-b*rho)) + kbt*b*rho/(1-b*rho) - 2*a*rho\n", " return mu\n", "\n", "## Define the range of densities to plot\n", "rho = np.linspace(0.01, 0.99, 200)\n", "range_a = np.arange(0, 10, 0.25)\n", "\n", "## Create plot\n", "fig = make_subplots(rows=1, cols=2, horizontal_spacing=0.18)\n", "\n", "# Add ideal gas traces\n", "fig.add_trace(go.Scatter(\n", " visible=True,\n", " x=rho,\n", " y=pressure(rho, 0, 0),\n", " line=dict(color=\"#000000\"),\n", " mode='lines',\n", " name='Ideal gas'), row=1, col=1)\n", "\n", "fig.add_trace(go.Scatter(\n", " visible=True,\n", " x=rho,\n", " y=chempot(rho, 0, 0),\n", " line=dict(color=\"#000000\"),\n", " mode='lines',\n", " name='Ideal gas',\n", " showlegend=False,), row=1, col=2)\n", "\n", "base_traces = 2 # Number of traces that are always visible\n", "\n", "# Add traces, one for each slider step\n", "for a in range_a:\n", " fig.add_trace( \n", " go.Scatter(\n", " visible=False,\n", " x=rho,\n", " y=pressure(rho, a, 1),\n", " line=dict(color=\"#ff5638\"),\n", " mode='lines',\n", " name='VdW fluid'), row=1, col=1)\n", "\n", " fig.add_trace( \n", " go.Scatter(\n", " visible=False,\n", " x=rho,\n", " y=chempot(rho, a, 1),\n", " line=dict(color=\"#ff5638\"),\n", " mode='lines',\n", " name='VdW fluid',\n", " showlegend=False), row=1, col=2)\n", "\n", "traces_per_step = 2 # Number of traces per value of a\n", "\n", "# Show the traces for one value of a when loading the plot (initial setup)\n", "active_a_index = 10\n", "fig.data[active_a_index + base_traces].visible = True\n", "fig.data[active_a_index + base_traces + 1].visible = True\n", "\n", "# Create and add slider\n", "steps = []\n", "for i in range(0, range_a.shape[0]):\n", " visarray = [False] * len(fig.data)\n", " visarray[0:base_traces] = [True] * base_traces\n", " curr_idx = int(base_traces + i * traces_per_step)\n", " next_idx = int(base_traces + (i+1) * traces_per_step)\n", " visarray[curr_idx:next_idx] = [True] * traces_per_step\n", " step = dict(\n", " method=\"update\",\n", " args=[{\"visible\": visarray}],\n", " label=range_a[i]\n", " )\n", " steps.append(step)\n", "\n", "sliders = [dict(\n", " active=active_a_index,\n", " currentvalue={\"prefix\": \"a: \"},\n", " steps=steps\n", ")]\n", "\n", "fig.update_layout(\n", " sliders=sliders,\n", " legend_title=\"Legend\",\n", " height=400\n", ")\n", "\n", "fig.update_xaxes(title_text=r'$\\mathrm{density} \\; \\rho$', row=1, col=1)\n", "fig.update_xaxes(title_text=r'$\\mathrm{density} \\; \\rho$', row=1, col=2)\n", "\n", "# Update yaxis properties\n", "fig.update_yaxes(title_text=r'$\\mathrm{pressure} \\; p$', range=[-3, 4], row=1, col=1)\n", "fig.update_yaxes(title_text=r'$\\mathrm{chemical \\; potential} \\; \\mu$', range=[-5.5, 0.25], row=1, col=2)\n", "\n", "fig" ] } ], "metadata": { "jupytext": { "text_representation": { "extension": ".md", "format_name": "myst", "format_version": 0.13, "jupytext_version": "1.10.3" } }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" }, "source_map": [ 12, 121 ] }, "nbformat": 4, "nbformat_minor": 5 }