|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "a22a5252", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Calculation of contact angles with cDFT" |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "code", |
| 13 | + "execution_count": 1, |
| 14 | + "id": "7fcfe24b", |
| 15 | + "metadata": {}, |
| 16 | + "outputs": [], |
| 17 | + "source": [ |
| 18 | + "import feos\n", |
| 19 | + "import si_units as si\n", |
| 20 | + "import numpy as np\n", |
| 21 | + "\n", |
| 22 | + "# set up fluid model\n", |
| 23 | + "parameters = feos.Parameters.from_json([\"methanol\"], \"../../parameters/pcsaft/esper2023.json\")\n", |
| 24 | + "functional = feos.HelmholtzEnergyFunctional.pcsaft(parameters)\n", |
| 25 | + "\n", |
| 26 | + "# set up surface\n", |
| 27 | + "ext_pot = feos.ExternalPotential.LJ93(sigma_ss=3.0, epsilon_k_ss=120.0, rho_s=0.08)\n", |
| 28 | + "pore = feos.Pore1D(feos.Geometry.Cartesian, 50*si.ANGSTROM, ext_pot)" |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "cell_type": "code", |
| 33 | + "execution_count": 2, |
| 34 | + "id": "70ee72e5", |
| 35 | + "metadata": {}, |
| 36 | + "outputs": [ |
| 37 | + { |
| 38 | + "data": { |
| 39 | + "text/latex": [ |
| 40 | + "$31.99°$" |
| 41 | + ], |
| 42 | + "text/plain": [ |
| 43 | + "31.990466526671963°" |
| 44 | + ] |
| 45 | + }, |
| 46 | + "execution_count": 2, |
| 47 | + "metadata": {}, |
| 48 | + "output_type": "execute_result" |
| 49 | + } |
| 50 | + ], |
| 51 | + "source": [ |
| 52 | + "# calculate the density profiles of the vapor and the liquid states\n", |
| 53 | + "vle = feos.PhaseEquilibrium.pure(functional, 350 * si.KELVIN)\n", |
| 54 | + "vapor_profile = pore.initialize(vle.vapor).solve()\n", |
| 55 | + "liquid_profile = pore.initialize(vle.liquid).solve()\n", |
| 56 | + "\n", |
| 57 | + "# calculate the solid/fluid interfacial tensions\n", |
| 58 | + "gamma_sl = liquid_profile.interfacial_tension / si.ANGSTROM**2\n", |
| 59 | + "gamma_sv = vapor_profile.interfacial_tension / si.ANGSTROM**2\n", |
| 60 | + "\n", |
| 61 | + "# calculate the vapor/liquid interfacial tension\n", |
| 62 | + "vle_profile = feos.PlanarInterface.from_pdgt(vle, 2048).solve()\n", |
| 63 | + "gamma_vl = vle_profile.surface_tension\n", |
| 64 | + "\n", |
| 65 | + "# calculate the contact angle from Young's equation\n", |
| 66 | + "np.acos((gamma_sv-gamma_sl)/gamma_vl)*si.RADIANS" |
| 67 | + ] |
| 68 | + } |
| 69 | + ], |
| 70 | + "metadata": { |
| 71 | + "kernelspec": { |
| 72 | + "display_name": "feos", |
| 73 | + "language": "python", |
| 74 | + "name": "python3" |
| 75 | + }, |
| 76 | + "language_info": { |
| 77 | + "codemirror_mode": { |
| 78 | + "name": "ipython", |
| 79 | + "version": 3 |
| 80 | + }, |
| 81 | + "file_extension": ".py", |
| 82 | + "mimetype": "text/x-python", |
| 83 | + "name": "python", |
| 84 | + "nbconvert_exporter": "python", |
| 85 | + "pygments_lexer": "ipython3", |
| 86 | + "version": "3.14.0" |
| 87 | + } |
| 88 | + }, |
| 89 | + "nbformat": 4, |
| 90 | + "nbformat_minor": 5 |
| 91 | +} |
0 commit comments