{ "cells": [ { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# 128.0x: Tidal fluctuation of open water." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "This notebook shows comparisons of tidal wave propagation in a 'Timflow' ModelXsection against known formulas from literature (Bruggeman, 1999: `Analytical solutions of geohydrological problems`).\n", "\n", "Three situations are shown:\n", "1. Bruggeman 128.01: tidal fluctation of open water, in a confined aquifer with open boundary at x=0\n", "2. Bruggeman 128.03: tidal fluctation of open water, in a leaky aquifer with open boundary at x=0\n", "3. Bruggeman 128.04: tidal fluctation of open water, in a leaky aquifer with entry resistance at x=0" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import timflow.transient as tft\n", "\n", "from bruggeman.flow1d import bruggeman_128_01, bruggeman_128_03, bruggeman_128_04" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "View the functions. Since the latter equation is the most generic one (with the others being more specific), we will show that one:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bruggeman_128_04" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "View the docstring to get a description of the input parameters" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "help(bruggeman_128_04)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Set up the comparison in `timflow`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The analytic solution is for a river with varying head that has been varying for ever. \n", "In `timflow`, head is simulated for several days to get the model to spin-up. \n", "\n", "By using a `sine` function, the head starts at zero (as should be the case in Timflow)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def head_river(h, t, tau, tp=0):\n", " return h * np.sin(2 * np.pi * (t - tp) / tau)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Below the `sine` (water level on river) is split into steps as shown in the example [How to model a fluctuating head boundary](https://timflow.readthedocs.io/en/latest/transient/00userguide/howtos/howto_fluctuating_head_boundary.html) from the `timflow` documentation. We use a small timestep ($\\Delta t$)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Parameters of tidal wave\n", "tau = 0.5 # tidal period, d\n", "h_tidal = 1 # amplitude of tidal fluctuation, m" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tmax = 5 # day\n", "delt = 0.01 # day\n", "t = np.arange(0, tmax, delt)\n", "hexact = head_river(h_tidal, t, tau)\n", "hmid = 0.5 * (\n", " head_river(h_tidal, t - delt / 2, tau) + head_river(h_tidal, t + delt / 2, tau)\n", ")\n", "tmid = np.hstack((0, 0.5 * (t[:-1] + t[1:])))\n", "# plot\n", "plt.figure(figsize=(10, 3))\n", "plt.plot(t, hexact, \"k\", label=\"observed\")\n", "plt.step(tmid, hmid, where=\"post\", label=\"mid\")\n", "plt.xlim(0, 1)\n", "plt.xlabel(\"time (d)\")\n", "plt.ylabel(\"head (m)\")\n", "plt.legend()\n", "plt.grid()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Bruggeman 128.01 - Confined, no entry resistance\n", "\n", "Create the Timflow model for comparison with Bruggeman 128.01 (confined, no entry resistance).\n", "\n", "In this example, we use the 1D inhomogeneities because of the nice plotting. The same result could be reached with a 'normal' Timflow model.\n", "In all the Timflow models, the left-hand inhomogeneity (`river`) is shown for illustration purposes. That inhomogeneity is only created to satisfy the requirement of ModelXsection to have inhoms for $-\\infty