{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Benchmark: Line-sink ditch\n", "A string of line-sinks for which the total discharge is specified" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "import ttim" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "self.neq 20\n", "solution complete\n" ] } ], "source": [ "ml = ttim.ModelMaq(kaq=10, z=[10, 0], Saq=1e-4, tmin=0.01, tmax=10)\n", "x = np.linspace(-100, 100, 21)\n", "y = np.zeros(len(x))\n", "lsd = ttim.LineSinkDitchString(ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)])\n", "ml.solve()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Discharge at time t=2:, [[99.99999972]]\n" ] } ], "source": [ "t = 2\n", "print(f\"Discharge at time t={t}:, {lsd.discharge(t)}\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Discharge of segment 0: [[13.72066952]]\n", "Discharge of segment 1: [[6.04460443]]\n", "Discharge of segment 2: [[4.97677729]]\n", "Discharge of segment 3: [[4.30323129]]\n", "Discharge of segment 4: [[3.90805018]]\n", "Discharge of segment 5: [[3.65055705]]\n", "Discharge of segment 6: [[3.47803788]]\n", "Discharge of segment 7: [[3.36384238]]\n", "Discharge of segment 8: [[3.29380413]]\n", "Discharge of segment 9: [[3.2604252]]\n", "Discharge of segment 10: [[3.26042517]]\n", "Discharge of segment 11: [[3.29380416]]\n", "Discharge of segment 12: [[3.36384242]]\n", "Discharge of segment 13: [[3.478038]]\n", "Discharge of segment 14: [[3.65055708]]\n", "Discharge of segment 15: [[3.90805017]]\n", "Discharge of segment 16: [[4.30323113]]\n", "Discharge of segment 17: [[4.9767767]]\n", "Discharge of segment 18: [[6.04460434]]\n", "Discharge of segment 19: [[13.72067031]]\n" ] } ], "source": [ "for i, Q in enumerate(lsd.discharge_list(t=t)):\n", " print(f\"Discharge of segment {i}: {Q}\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "self.neq 20\n", "solution complete\n" ] } ], "source": [ "ml = ttim.ModelMaq(kaq=10, z=[10, 0], Saq=1e-4, tmin=0.01, tmax=10)\n", "x = np.linspace(-100, 100, 21)\n", "y = np.zeros(len(x))\n", "lsd = ttim.LineSinkDitchString(\n", " ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)], Astorage=100\n", ")\n", "ml.solve()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Discharge at time t=2:, [[94.47093728]]\n" ] } ], "source": [ "t = 2\n", "print(f\"Discharge at time t={t}:, {lsd.discharge(t)}\")" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-110.5812863933381" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sum(lsd.headinside(2, derivative=1) * lsd.Astorage)" ] }, { "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.7.4" }, "widgets": { "state": {}, "version": "1.1.2" } }, "nbformat": 4, "nbformat_minor": 4 }