{ "cells": [ { "cell_type": "markdown", "id": "a22a5252", "metadata": {}, "source": [ "# Calculation of contact angles with cDFT" ] }, { "cell_type": "code", "execution_count": 1, "id": "7fcfe24b", "metadata": {}, "outputs": [], "source": [ "import feos\n", "import si_units as si\n", "import numpy as np\n", "\n", "# set up fluid model\n", "parameters = feos.Parameters.from_json([\"methanol\"], \"../../parameters/pcsaft/esper2023.json\")\n", "functional = feos.HelmholtzEnergyFunctional.pcsaft(parameters)\n", "\n", "# set up surface\n", "ext_pot = feos.ExternalPotential.LJ93(sigma_ss=3.0, epsilon_k_ss=120.0, rho_s=0.08)\n", "pore = feos.Pore1D(feos.Geometry.Cartesian, 50*si.ANGSTROM, ext_pot)" ] }, { "cell_type": "code", "execution_count": 2, "id": "70ee72e5", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$31.99°$" ], "text/plain": [ "31.990466526671963°" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# calculate the density profiles of the vapor and the liquid states\n", "vle = feos.PhaseEquilibrium.pure(functional, 350 * si.KELVIN)\n", "vapor_profile = pore.initialize(vle.vapor).solve()\n", "liquid_profile = pore.initialize(vle.liquid).solve()\n", "\n", "# calculate the solid/fluid interfacial tensions\n", "gamma_sl = liquid_profile.interfacial_tension / si.ANGSTROM**2\n", "gamma_sv = vapor_profile.interfacial_tension / si.ANGSTROM**2\n", "\n", "# calculate the vapor/liquid interfacial tension\n", "vle_profile = feos.PlanarInterface.from_pdgt(vle, 2048).solve()\n", "gamma_vl = vle_profile.surface_tension\n", "\n", "# calculate the contact angle from Young's equation\n", "np.acos((gamma_sv-gamma_sl)/gamma_vl)*si.RADIANS" ] } ], "metadata": { "kernelspec": { "display_name": "feos", "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.14.0" } }, "nbformat": 4, "nbformat_minor": 5 }