{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Buckingham $\\pi$:  Dimensional Analysis\n",
    "**Mokbel Karam, and Prof. Tony Saad (<a href='www.tsaad.net'>www.tsaad.net</a>) <br/>Department of Chemical Engineering <br/>University of Utah**\n",
    "<hr/>\n",
    "This notebook represents the graphical user interface of `buckinghamPy` "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "6d2fa730b1cb406e96d3544b4be6c8cd",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(BoundedIntText(value=5, continuous_update=True, description='Number of Variables:', style=Descr…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "6fe704d5fbe44e359ba2d2da5ad94613",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(Box(children=(Textarea(value='', description='Name:', layout=Layout(height='32px', width='auto'…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "6e68fcf85241419d91650b00478fdf46",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#HIDDEN\n",
    "# please run this cell to get access the GUI app\n",
    "from buckinghampy import BuckinghamPiGui\n",
    "GUI=BuckinghamPiGui()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example 1: Pressure Drop in Pipe\n",
    "---"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\text{Set }1: \\quad\\pi_1 = \\frac{R}{d}\\quad\\pi_2 = \\frac{Q \\mu}{d^{3} {\\Delta}p}\\quad$$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "---"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\text{Set }2: \\quad\\pi_1 = \\frac{R \\sqrt[3]{{\\Delta}p}}{\\sqrt[3]{Q} \\sqrt[3]{\\mu}}\\quad\\pi_2 = \\frac{d \\sqrt[3]{{\\Delta}p}}{\\sqrt[3]{Q} \\sqrt[3]{\\mu}}\\quad$$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "---"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\text{Set }3: \\quad\\pi_1 = \\frac{d}{R}\\quad\\pi_2 = \\frac{Q \\mu}{R^{3} {\\Delta}p}\\quad$$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "---"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from buckinghampy import BuckinghamPi\n",
    "\n",
    "Pressure_Drop = BuckinghamPi()\n",
    "Pressure_Drop.add_variable(name='{\\\\Delta}p',units='M*L^(-1)*T^(-2)')     # pressure drop\n",
    "Pressure_Drop.add_variable(name='R',units='L')                            # length of the pipe\n",
    "Pressure_Drop.add_variable(name='d',units='L')                            # diameter of the pipe\n",
    "Pressure_Drop.add_variable(name='\\\\mu',units='M*L^(-1)*T^(-1)')           # viscosity\n",
    "Pressure_Drop.add_variable(name='Q',units='L^(3)*T^(-1)')                 # volumetic flow rate\n",
    "\n",
    "Pressure_Drop.generate_pi_terms()\n",
    "Pressure_Drop.print_all()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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"
  },
  "toc": {
   "colors": {
    "hover_highlight": "#DAA520",
    "navigate_num": "#000000",
    "navigate_text": "#333333",
    "running_highlight": "#FF0000",
    "selected_highlight": "#FFD700",
    "sidebar_border": "#EEEEEE",
    "wrapper_background": "#FFFFFF"
   },
   "moveMenuLeft": true,
   "nav_menu": {
    "height": "46px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": false,
   "sideBar": true,
   "threshold": 4,
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false,
   "widenNotebook": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}