From 5c25e81f375b6f4adb40115d22290b0fbaa9597b Mon Sep 17 00:00:00 2001 From: Brantegger Georg Date: Mon, 18 Jul 2022 08:15:11 +0200 Subject: [PATCH] updated to use outflux_vel instead of outflux --- Main_Programm.ipynb | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Main_Programm.ipynb b/Main_Programm.ipynb index a537c58..1570767 100644 --- a/Main_Programm.ipynb +++ b/Main_Programm.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 8, + "execution_count": 56, "metadata": {}, "outputs": [], "source": [ @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 57, "metadata": {}, "outputs": [], "source": [ @@ -32,14 +32,14 @@ "A_pipe = D**2/4*np.pi # pipeline area\n", "h_pipe = 200 # hydraulic head without reservoir [m] \n", "alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n", - "n = 10 # number of pipe segments in discretization\n", + "n = 50 # number of pipe segments in discretization\n", "# consider replacing Q0 with a vector be be more flexible in initial conditions\n", "Q0 = 2. # initial flow in whole pipe [m³/s]\n", "v0 = Q0/A_pipe # initial flow velocity [m/s]\n", - "f_D = 0.1 # Darcy friction factor\n", + "f_D = 0.01 # Darcy friction factor\n", "c = 400. # propagation velocity of the pressure wave [m/s]\n", "# consider prescribing a total simulation time and deducting the number of timesteps from that\n", - "nt = 100 # number of time steps after initial conditions\n", + "nt = 500 # number of time steps after initial conditions\n", "\n", "# derivatives of the pipeline constants\n", "dx = L/n # length of each pipe segment\n", @@ -60,7 +60,7 @@ "initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n", "initial_pipeline_pressure = p0 # Initial condition for the static pipeline pressure at the reservoir (= hydrostatic pressure - dynamic pressure) \n", "initial_pressure_unit = 'Pa' # DO NOT CHANGE! for pressure conversion in print statements and plot labels \n", - "conversion_pressure_unit = 'mWS' # for pressure conversion in print statements and plot labels\n", + "conversion_pressure_unit = 'bar' # for pressure conversion in print statements and plot labels\n", "area_base = 20. # total base are of the cuboid reservoir [m²] \n", "area_outflux = A_pipe # outlfux area of the reservoir, given by pipeline area [m²]\n", "critical_level_low = 0. # for yet-to-be-implemented warnings[m]\n", @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 58, "metadata": {}, "outputs": [], "source": [ @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 59, "metadata": {}, "outputs": [], "source": [ @@ -144,8 +144,8 @@ "v_boundary_tur[0] = v_old[-1] \n", "v_boundary_tur[1:] = 0 # instantaneous closing\n", "# v_boundary_tur[0:20] = np.linspace(v_old[-1],0,20) # overwrite for finite closing time - linear case\n", - "const = int(np.min([100,round(nt/1.1)]))\n", - "v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi/5)**2\n", + "# const = int(np.min([100,round(nt/1.1)]))\n", + "# v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi/5)**2\n", "p_boundary_res[0] = p_old[0]\n", "p_boundary_tur[0] = p_old[-1]\n", "\n" @@ -153,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 60, "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ @@ -195,8 +195,8 @@ "\n", "# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n", " # set initial conditions for the reservoir time evolution calculted with e-RK4\n", - " V.pressure = p_old[0]\n", - " V.outflux = v_old[0]\n", + " V.pressure = p_old[0]\n", + " V.outflux_vel = v_old[0]\n", " # calculate the time evolution of the reservoir level within each pipeline timestep to avoid runaway numerical error\n", " for it_res in range(nt_eRK4):\n", " V.e_RK_4() # call e-RK4 to update outflux\n", @@ -209,7 +209,7 @@ " level_vec[it_pipe] = V.level \n", "\n", " # set boundary conditions for the next timestep of the characteristic method\n", - " p_boundary_res[it_pipe] = rho*g*V.level-v_old[1]**2*rho/2\n", + " p_boundary_res[it_pipe] = rho*g*V.level-V.outflux_vel**2*rho/2\n", " v_boundary_res[it_pipe] = v_old[1]+1/(rho*c)*(p_boundary_res[it_pipe]-p_old[1])-f_D*dt/(2*D)*abs(v_old[1])*v_old[1] \\\n", " +dt*g*np.sin(alpha)\n", "\n", @@ -245,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 62, "metadata": {}, "outputs": [], "source": [ @@ -280,7 +280,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('DT_Slot_3')", + "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "language": "python", "name": "python3" }, @@ -299,7 +299,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" + "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" } } },