{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Drag Coefficient of a Smooth Sphere\n", "\n", "This notebook plots the drag coefficient of a smooth sphere as a function of the Reynold's number for two different empirical correlations." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "from pytrebuchet.drag_coefficient import clift_grace_weber, morrison\n", "\n", "# Calculate drag coefficient for a range of Reynold's numbers\n", "reynolds_morrison = np.logspace(-1, 6, 1000) # morrison valid from 0.1 to 1e6\n", "reynolds_clift = np.logspace(-2, 8, 1200)\n", "drag_coeff_morrison = morrison(reynolds_morrison)\n", "drag_coeff_clift = clift_grace_weber(reynolds_clift)\n", "\n", "# Plotting, both axes logarithmic\n", "fig, ax = plt.subplots()\n", "ax.loglog(reynolds_morrison, drag_coeff_morrison, label=\"Morrison\")\n", "ax.loglog(reynolds_clift, drag_coeff_clift, label=\"Clift, Grace, Weber\")\n", "ax.set_xlabel(\"Reynolds Number\")\n", "ax.set_ylabel(\"Drag Coefficient (Cd)\")\n", "ax.set_title(\"Drag Coefficient vs Reynolds Number\")\n", "ax.grid(True, which=\"both\", ls=\"--\")\n", "ax.legend()\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": ".venv (3.13.9)", "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.13.9" } }, "nbformat": 4, "nbformat_minor": 5 }