{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Mass transfer\n",
    "\n",
    "* Combustion involves many chemical species.\n",
    "* A rigorous treatment of mass transfer is often important.\n",
    "\n",
    "## Velocity\n",
    "* If we could see a molecular view of a flow, we would not see a \"velocity,\" we would see many molecules, each with their own velocity. \n",
    "* If we consider the average velocity of a particular species, we can define average velocities\n",
    "    * Mass average\n",
    "    * Mole average\n",
    "    * Volume average\n",
    "\n",
    "### Mass and mole flux\n",
    "* Total mass flux for a mass average velocity\n",
    "$$\\dot{m}^{\\prime\\prime} = \\rho v$$\n",
    "* Species $A$\n",
    "$$\\dot{m}^{\\prime\\prime}_A = \\rho y_A v_A$$\n",
    "* Total molar flux for a molar average velocity\n",
    "$$\\dot{n}^{\\prime\\prime} = c v$$\n",
    "* Species $A$\n",
    "$$\\dot{n}^{\\prime\\prime}_A = c x_A v_A$$\n",
    "\n",
    "### Diffusion velocity\n",
    "$$v_A = v_A + v-v$$\n",
    "$$v_A = v + \\underbrace{(v_A - v)}_{v_A^{D}}$$\n",
    "* Mass flux\n",
    "$$\\dot{m}^{\\prime\\prime}_A = \\rho y_Av_A = \\rho y_Av + \\rho y_Av_A^{D}$$\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$\\dot{m}^{\\prime\\prime}_A = y_A\\dot{m}^{\\prime\\prime} + j_A$$\n",
    "</font>\n",
    "\n",
    "* This last expression is (Bulk flux of A) + (Diffusion flux of A)\n",
    "* $j_A$ is the diffusion flux.\n",
    "* Now, add all species:\n",
    "$$\\dot{m}^{\\prime\\prime} = \\sum_i\\dot{m}^{\\prime\\prime}_i = \\sum_iy_i\\dot{m}^{\\prime\\prime}+\\sum_ij_i = \\dot{m}^{\\prime\\prime}\\sum_iy_i + \\sum_ij_i = \\dot{m}^{\\prime\\prime} + \\sum_ij_i $$\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$\\rightarrow \\sum_ij_i = 0$$\n",
    "</font>\n",
    "\n",
    "* The diffusion flux is a difference from an average flux. So, the sum of all diffusion fluxes should be zero.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Multicomponent mass transfer\n",
    "\n",
    "* Model the $j_i$ as gradients of species. \n",
    "* Using a mole basis is more physical.\n",
    "* $J_i$ is the molar flux of species $i$\n",
    "* Fluxes depend on mole fraction gradients.\n",
    "\n",
    "#### Two species 1, 2\n",
    "$$J_1 = -cD\\nabla x_1,$$\n",
    "$$J_2 = -cD\\nabla x_2.$$\n",
    "\n",
    "#### Three species 1, 2, 3\n",
    "$$J_1 = -cD_{1,1}\\nabla x_1 - cD_{1,2}\\nabla x_2,$$\n",
    "$$J_2 = -cD_{2,1}\\nabla x_1 - cD_{2,2}\\nabla x_2.$$\n",
    "\n",
    "* The flux of one species depends on its own gradient **and** on the gradient of **other** species.\n",
    "    * Other species can *drag* on each other.\n",
    "    * Species can diffuse **up** their gradients!\n",
    "* **Question** why do we not include $\\nabla x_3$ in $J_1$ above?\n",
    "\n",
    "### Matrix form\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$\\mathbf{J} = -c[D]\\mathbf{\\nabla x},\\phantom{xxxxxx}\\text{size = }n_s-1$$\n",
    "</font>\n",
    "\n",
    "* $[D]$ is a diffusion matrix defined as follows\n",
    "\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$[D] = [B]^{-1}$$\n",
    "\n",
    "$$B_{i,j} = -x_i\\left(\\frac{1}{\\mathcal{D}_{i,j}} - \\frac{1}{\\mathcal{D}_{i,n_s}}\\right),\\phantom{xxx} i\\ne j$$\n",
    "\n",
    "$$B_{i,i} = \\frac{x_i}{\\mathcal{D}_{i,n}} + \\sum_{k=1,i\\ne k}^{n_s} \\frac{x_k}{\\mathcal{D}_{i,k}}$$\n",
    "</font>\n",
    "\n",
    "* $\\mathcal{D}_{i,j}$ are binary diffusion coefficients.\n",
    "    * Available in tables. See Turns Appendix D.\n",
    "    * Cantera can provide these also.\n",
    "    * <font color=\"blue\"> $\\mathcal{D}_{i,j} \\propto T^{3/2}/P$ </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fick's law\n",
    "\n",
    "* Beware, there are various forms of \"Fick's\" law.\n",
    "* We will use the \"best\" one\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$J_i = -cD_{i,e}\\nabla x_i$$\n",
    "</font>\n",
    "\n",
    "* $D_{i,e}$ is an *effective diffusivity*\n",
    "* To get mass flux, multiply by $M_i$\n",
    "\n",
    "$$j_i = M_iJ_i = -M_icD_{i,e}\\nabla x_i$$\n",
    "\n",
    "* Use $c=\\rho/M$, and $x_i = y_iM/M_i$\n",
    "\n",
    "$$ j_i = -\\frac{M_i\\rho}{M}D_{i,e}\\frac{M}{M_i}\\nabla y_i - \\frac{M_i\\rho}{M}D_{i,e}\\frac{y_i}{M_i}\\nabla M$$\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$j_i = -\\rho D_{i,e}\\nabla y_i - \\left(\\rho D_{i,e}y_i\\frac{\\nabla M}{M}\\right)$$\n",
    "</font>\n",
    "\n",
    "* The second term, in parentheses is often ignored. \n",
    "    * Not a great assumption for combustion.\n",
    "    * Often used in combustion models for turbulent flow.\n",
    "    \n",
    "**Note**: $J_i$ is relative to a *molar* average velocity. So, our conversion to $j_i$ and the use of a *mass* average velocity is not fully consistent.\n",
    "\n",
    "**Note**: In combustion, we often have lots of $N_2$ and using Fick's law instead of a full multicomponent treatment is not that bad.\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$D_{i,e} = \\left[\\frac{(1-x_i)}{\\sum_{j=1,j\\ne i}^n \\frac{x_j}{\\mathcal{D}_{i,j}}}\\right]$$\n",
    "</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The following illustrates the importance of using the \"full\" Fick's law form given above.\n",
    "This is from [Pitsch and Peters (1998)](https://www.sciencedirect.com/science/article/pii/S0010218097002782).\n",
    "\n",
    "<img src=\"http://ignite.byu.edu/che522/lectures/figs/pitsch_1998_diffusion.png\" width=800>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Heat, Mass, Momentum\n",
    "\n",
    "* Mass transfer: \n",
    "$$\\rho y_i \\rightarrow j_i = -\\rho D\\nabla y_i$$\n",
    "* Heat transfer: \n",
    "$$\\rho h \\rightarrow q = -\\lambda \\nabla T$$\n",
    "* Momentum transfer: \n",
    "$$\\rho u \\rightarrow \\tau = -\\mu \\nabla v$$\n",
    "\n",
    "Also,\n",
    "$$ y_i \\rightarrow -D\\nabla y_i$$\n",
    "$$ T   \\rightarrow -\\alpha\\nabla T$$\n",
    "$$ v   \\rightarrow -\\nu\\nabla v$$\n",
    "\n",
    "* $\\alpha = \\lambda/(\\rho c_p)$\n",
    "* $\\nu = \\mu/\\rho$\n",
    "* $D$, $\\alpha$, $\\nu$ all have units of $m/s^2$\n",
    "\n",
    "* For constant properties, the unsteady diffusion equation for some scalar $\\eta$, with diffusivity $\\Gamma$ is \n",
    "$$\\frac{\\partial \\eta}{\\partial t} = \\Gamma \\frac{\\partial^2\\eta}{\\partial x^2}$$\n",
    "\n",
    "### Dimensionless numbers\n",
    "\n",
    "* Lewis number\n",
    "<font color=\"blue\">\n",
    "$$ Le = \\frac{\\alpha}{D}$$\n",
    "</font>\n",
    "* Schmidt number\n",
    "<font color=\"blue\">\n",
    "$$ Sc = \\frac{\\nu}{D}$$\n",
    "</font>\n",
    "* Pr number\n",
    "<font color=\"blue\">\n",
    "$$ Pr = \\frac{\\nu}{\\alpha}$$\n",
    "</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## One-dimensional species transport equation\n",
    "\n",
    "$$\\frac{\\partial \\rho y_i}{\\partial t} + \\frac{\\partial}{\\partial x}(\\rho y_i v_i) = S_i$$\n",
    "\n",
    "$$v_i = v + v_i^D$$\n",
    "$$\\rho y_i v_i^D = j_i$$\n",
    "\n",
    "<font color=\"blue\">\n",
    "$$\\frac{\\partial \\rho y_i}{\\partial t} + \\frac{\\partial}{\\partial x}(\\rho y_i v) + \\frac{\\partial j_i}{\\partial x}  = S_i$$\n",
    "</font>\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "hide_input": false,
  "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.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
