diff --git a/book/1_modelling_intro_HBV/Exercise1.ipynb b/book/1_modelling_intro_HBV/Exercise1.ipynb index 0c4facb..abe684e 100644 --- a/book/1_modelling_intro_HBV/Exercise1.ipynb +++ b/book/1_modelling_intro_HBV/Exercise1.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "editable": true, "slideshow": { @@ -117,9 +117,11 @@ "\n", "At first we will consider the reservoir without the external drivers ```P``` and ```E``` and we assume that Q is equal to:\n", "\n", + "$$\n", "\\begin{equation}\n", "Q = k S ^\\alpha\n", "\\end{equation}\n", + "$$\n", "\n", "Next to this, we also assmume a linear reservoir, so $\\alpha$ is equal to 1.\n", "\n", @@ -133,26 +135,35 @@ "\n", "An simple example of a numerical solution is the explicit forward Euler method. This method calculates the state of a system at each time step considering the state of the system at the previous time step and rate of changes:\n", "\n", + "$$\n", "\\begin{equation}\n", "S(t + \\Delta t) = F(S(t))\n", "\\end{equation}\n", + "$$\n", "\n", "If we consider the linear reservoir problem without the external drivers, we obtain:\n", "\n", + "$$\n", "\\begin{equation}\n", "\\frac{dS(t)}{dt} = -k S(t) ^\\alpha\n", "\\end{equation}\n", + "$$\n", "\n", "The forward Euler method yields:\n", + "\n", + "$$\n", "\\begin{equation}\n", "\\frac{S(t + \\Delta t) - S(t)}{\\Delta t} = -kS(t)^\\alpha\n", "\\end{equation}\n", + "$$\n", "\n", "This results in the numerical solution:\n", "\n", + "$$\n", "\\begin{equation}\n", "S(t + \\Delta t) = S(t) + - k \\Delta t k S(t) ^\\alpha\n", "\\end{equation}\n", + "$$\n", "\n", "Hence, if $ S(t) $ is known, $ S(t + \\Delta t) $ can be calculated in one iteration. The big assumption in the forward Euler model is that $ S\\left(t\\right) $ is relatively constant during the timestep. This may not always be true. If $S\\left(t\\right)$ changes fast smaller timesteps need to be used to not make too big of an error. Other, more complicated methods to numerically solve differential equations exist such as Runga-Kutta. See the material of the MUDE course for more information on those. In hydrology it is always important to weigh if the error introduced by your numerical scheme is significant compared to the error introduced by the fact that the model is not perfect to begin with." ] @@ -187,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": { "editable": true, "slideshow": { @@ -207,8 +218,14 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, + "execution_count": 4, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "def analytical_solve():\n", @@ -219,8 +236,14 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, + "execution_count": 5, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "def numerical_solve():\n", @@ -232,7 +255,13 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Part 3\n", "\n", @@ -244,13 +273,25 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "## 2. Linear Reservoir with External Drivers\n", "\n", @@ -261,7 +302,13 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Part 4\n", "\n", @@ -273,13 +320,25 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Bonus Question\n", "\n", @@ -289,7 +348,13 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [] }