{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "(content:chap5:transient_one_dim_flow)=\n",
    "# Transient one-dimensional flow "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%config InlineBackend.rc = {'figure.dpi': 300}\n",
    "%config InlineBackend.figure_format = 'svg'\n",
    "import sys\n",
    "sys.path.append(\"../py_figures\")\n",
    "import diagrams\n",
    "from myst_nb import glue"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    " All solutions presented so far in this book were for steady flow: The head and flow were a function of $x$, but not of time. In nature, all flows are transient and they vary in response to forcings such as rainfall, evaporation, transpiration, atmospheric pressure changes, tidal fluctuations, and geological processes (e.g., loading, tectonic stress, and heating). In addition to these natural processes, there is groundwater pumping and injection, which are anthropogenic forcings. The degree to which the approximation of steady state is justified depends on the system under consideration and the objective of the investigation. For example, groundwater fluctuations may be small, or fluctuations may not be of interest when the objective is to study the longterm average situation. It is up to the modeler to assess whether or not temporal fluctuations are of importance. Transient analytic solutions can be very useful for that purpose because they can be used to quickly determine how long it takes before a steady state is reached.\n",
    "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This chapter deals with one-dimensional transient flow, which means that the head and flow are a function of both $x$ and time $t$. Transient solutions involving pumping are considered in {numref}`Chapter %s <content:chap9.0:transient_2d_intro>`. The focus here is on problems where heads vary as a result of changes in surface water levels or groundwater recharge.\n",
    "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;As a starting point, the differential equation for one-dimensional transient flow is derived. The transient groundwater mass balance states that"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "$$\n",
    "\\text{Mass in} - \\text{Mass out} = \\text{Increase in mass}\n",
    "$$(eq_continuitymass5.0)\n",
    "\n",
    "The groundwater mass balance reduces to a volume balance when the groundwater density is approximated as constant. The volume balance is\n",
    "\n",
    "$$\n",
    "\\text{Volume in} - \\text{Volume out} = \\text{Increase in volume}\n",
    "$$(eq_continuity5.0)\n",
    "\n",
    "The volume balance for one-dimensional flow in an aquifer is derived by considering a small section of aquifer that is $\\Delta x$ long and $\\Delta y=1$ wide in the direction normal to the plane of flow. Inflow consists of horizontal flow from the left, $Q_x(x, t)$ [L$^2$/T], and recharge at the top, $N$ [L/T]. Outflow consists of horizontal flow at the right, $Q_x(x+\\Delta x, t)$ ({numref}`Figure %s <fig_transient_waterbalance5.0>`). The increase in volume equals the increase in head multiplied by the storage coefficient $S$ and $\\Delta x \\Delta y$ (where $\\Delta y=1$). Recall\n",
    "from {ref}`Chapter 0.6 <content:chap0:storage_transient_flow>` that the storage coefficient is equal to the phreatic storage $S=S_p$ for unconfined flow and the product of the specific storage $S_s$ and the aquifer thickness $H$ ($S=S_sH$) for confined flow. Further, recall that the discharge vector $Q_x$ is the discharge per unit width of aquifer."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "fig = diagrams.continuity1dtr()\n",
    "glue(\"waterbalance5_0\", fig, display=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "```{glue:figure} waterbalance5_0\n",
    "---\n",
    "name: fig_transient_waterbalance5.0\n",
    "---\n",
    "Transient water balance for a section of aquifer that is $\\Delta x$ long and $\\Delta y=1$ wide normal to the plane of flow.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The volume balance is written for a period $\\Delta t$. Substitution of the appropriate volumes in Eq. ({eq}`eq_continuity5.0`) gives\n",
    "\n",
    "$$\n",
    "\\left.Q_x\\right|_{x,t}\\Delta t + N\\Delta x \\Delta t - \\left.Q_x\\right|_{x+\\Delta x,t}\\Delta t =\n",
    "S\\Delta x\\left(h|_{x, t + \\Delta t} - h|_{x, t}\\right)\n",
    "$$(eq_water_balance5.0)\n",
    "\n",
    "Division by $\\Delta x \\Delta t$ and rearrangement of terms gives\n",
    "\n",
    "$$\n",
    "\\frac{\\left.Q_x\\right|_{x+\\Delta x,t} - \\left.Q_x\\right|_{x,t}}{\\Delta x}\n",
    "= N - S \\frac{h|_{x, t + \\Delta t} - h|_{x, t}}{\\Delta t}\n",
    "$$(eq_division5.0)\n",
    "\n",
    "In the limit for $\\Delta x \\to 0$ and $\\Delta t \\to 0$, the volume balance turns into the differential equation for one-dimensional horizontal transient flow\n",
    "\n",
    "$$\n",
    "\\frac{\\partial Q_x}{\\partial x} = - S\\frac{\\partial h}{\\partial t} + N\n",
    "$$(eq_dif_horflow5.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "The discharge vector for transient flow is the same as for steady flow (Eq. {eq}`eq_Qx1.0`) \n",
    "\n",
    "$$\n",
    "Q_x = -T\\frac{\\partial h}{\\partial x}\n",
    "$$(eq_Qx_vec5.0)\n",
    "\n",
    "Recall that for confined flow, $T$ is the constant transmissivity of the aquifer. For unconfined\n",
    "flow, the head-dependent transmissivity is approximated by a constant effective transmissivity\n",
    "$T=kH$, where the saturated thickness $H$ is approximated as constant.\n",
    "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Substitution of Eq. ({eq}`eq_Qx_vec5.0`) for $Q_x$ in Eq. ({eq}`eq_dif_horflow5.0`) gives"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "$$\n",
    "\\frac{\\partial^2 h}{\\partial x^2} = \\frac{S}{T} \\frac{\\partial h}{\\partial t} - \\frac{N}{T}\n",
    "$$(eq_subsitution5.0)\n",
    "\n",
    "When the areal recharge equals zero, the governing differential equation reduces to\n",
    "\n",
    "$$\n",
    "\\frac{\\partial^2 h}{\\partial x^2} = \\frac{S}{T} \\frac{\\partial h}{\\partial t}\n",
    "$$(eq_rechargezero5.0)\n",
    "\n",
    "This equation is known as the diffusion equation; the term $T/S$ is also referred to as the aquifer diffusivity. The diffusion equation governs the transient behavior of many other physical processes.\n",
    "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Solutions for transient groundwater flow are, not surprisingly, more difficult to obtain than those for steady flow. Common mathematical approaches include similarity solutions, separation of variables, Fourier series, and Laplace transforms. An introduction into many of these mathematical solution techniques for hydrological applications may be found in, e.g., {cite:author}`bruggeman1999analytical` ({cite:year}`bruggeman1999analytical`). In this chapter, solutions are presented without derivation. Verification of the solutions is discussed and is part of the exercises. Solutions are presented for three problems: the response to a change in the surface water level in a semi-infinite aquifer ({numref}`content:chap5:step_changes_surface`), the tidal response in a semi-infinite aquifer ({numref}`content:chap5:periodic_changes_surface`), and the response to transient recharge between two parallel rivers ({numref}`content:chap5:recharge_two_rivers`). The problem of {numref}`content:chap5:step_changes_surface` is resolved using the Laplace transform approach in {numref}`content:chap5:laplace_transforms`, and a brief introduction into the (numerical) evaluation of Laplace transform solutions is presented. In the final section of this chapter, a solution to the Boussinesq equation for transient unconfined flow is presented."
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.5"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": 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": 4
}
