{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# File creation for REC A2 Digital Twin\n", "This notebook is used for creating input files for the Delft3D model of the REC A2 compound channel" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Trapezoidal channel\n", "The trapezoidal channel is located upstream from the compound channel cross-section" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [], "source": [ "href = 0.3 # height of reference point\n", "dx = 10\n", "sx = 70\n", "slope = 1e-3\n", "zbed_100 = 100-href-1.7 # minimum bed level at x=100\n", "zbed_0 = zbed_100 + 100*slope# minium bed level at x=0\n", "\n", "origin = (99.24, 0) # left-upper point\n", "\n", "trap_section = np.array([(0, -4, -7, -11), # x\n", " (2., 0., 0., 2.),\n", " (0, 0, 0, 0)])\n", "\n", "# Generate xyz of trap channel\n", "trap_xyz = []\n", "for i in range(int(sx/dx)+1):\n", " local_crs = trap_section.copy()\n", " local_crs[0] += 99.25\n", " local_crs[1] += -i*dx*slope+zbed_0\n", " local_crs[2] += i*dx\n", " trap_xyz.append(local_crs)\n", "\n", "trap_xyz = np.array(trap_xyz)\n", "\n", "with open('trapezoidal.xyz', 'w') as f:\n", " for crs in trap_xyz:\n", " for point in crs.T:\n", " f.write(f'{point[2]}\\t{point[0]}\\t{point[1]}\\n')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Compound channel section" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [], "source": [ "href = 0.3 # height of reference point\n", "dx = 10\n", "sx = 180\n", "slope = 1e-3\n", "zbed_100 = 100-href-1.7 # minimum bed level at x=100\n", "zbed_0 = zbed_100 + 100*slope# minium bed level at x=0\n", "zbed_80 = zbed_100 + 20*slope# minium bed level at x=0\n", "\n", "origin = (99.24, 0) # left-upper point\n", "\n", "cmp_section = np.array([(0, -1, -5.3, -6.7, -9.3, -11), # x\n", " (1.7, 0.7, 0.7, 0, 0, 1.7),\n", " (0, 0, 0, 0, 0, 0)])\n", "\n", "# Generate xyz of trap channel\n", "trap_xyz = []\n", "for i in range(int(sx/dx)+1):\n", " local_crs = cmp_section.copy()\n", " local_crs[0] += 99.25 # y\n", " local_crs[1] += -i*dx*slope+zbed_80 # z\n", " local_crs[2] += i*dx + 80 # x\n", " trap_xyz.append(local_crs)\n", "\n", "trap_xyz = np.array(trap_xyz)\n", "\n", "with open('compound_channel.xyz', 'w') as f:\n", " for crs in trap_xyz:\n", " for point in crs.T:\n", " f.write(f'{point[2]}\\t{point[0]}\\t{point[1]}\\n')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Observation points\n", "Place observation point at each section" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [], "source": [ "x_obs = list(range(80,240,10)) # Every 10 meters along the compound channel section\n", "y_obs = np.array([-2.4, -1.2, -0.5, -0.3, -0.2, -0.1, -0.05, 0.1, 0.2, 0.3, 0.5, 0.9, 1.1, 1.3, 1.9, 2.7])\n", "\n", "# Shift to REC-crs\n", "y_obs = y_obs + (100-5.5-0.75) # y reference point - half of channel width - distance ref to channel\n", "\n", "with open('REC_A2_obs.xyn', 'w') as f:\n", " for ix, x in enumerate(x_obs):\n", " for y in y_obs:\n", " f.write(f'{x}\\t{y}\\t\"No.{ix}_{y}\"\\n')" ] } ], "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }