{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Test line-sink ditch\n", "\n", "A string of line-sinks for which the total discharge is specified" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "import timflow.transient as tft" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ml = tft.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 = tft.DitchString(ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)])\n", "ml.solve()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "t = 2\n", "print(f\"Discharge at time t={t}:, {lsd.discharge(t)}\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for i, Q in enumerate(lsd.discharge_list(t=t)):\n", " print(f\"Discharge of segment {i}: {Q}\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ml = tft.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 = tft.DitchString(\n", " ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)], Astorage=100\n", ")\n", "ml.solve()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "t = 2\n", "print(f\"Discharge at time t={t}:, {lsd.discharge(t)}\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "np.sum(lsd.headinside(2, derivative=1) * lsd.Astorage)" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 4 }