small formatations

This commit is contained in:
Brantegger Georg
2022-06-28 15:37:54 +02:00
parent fe6b7c0e6b
commit a109b8d8d1

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -14,7 +14,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -30,13 +30,12 @@
"n = 10 # number of pipe segments in discretization\n", "n = 10 # number of pipe segments in discretization\n",
"nt = 1500 # number of time steps after initial conditions\n", "nt = 1500 # number of time steps after initial conditions\n",
"f_D = 0.05 # Darcy friction factor\n", "f_D = 0.05 # Darcy friction factor\n",
"c = 400 # propagation velocity of the pressure wave [m/s]\n", "c = 400 # propagation velocity of the pressure wave [m/s]"
"\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -64,14 +63,14 @@
"v_1 = np.zeros_like(t_vec)\n", "v_1 = np.zeros_like(t_vec)\n",
"\n", "\n",
"# storage vector for time evolution of parameters at node N+1 (at valve)\n", "# storage vector for time evolution of parameters at node N+1 (at valve)\n",
"p_np1 = np.zeros_like(t_vec)\n", "p_np1 = np.full_like(t_vec,p_old)\n",
"v_np1 = np.zeros_like(t_vec)\n", "v_np1 = np.full_like(t_vec,v_old)\n",
"\n" "\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -92,7 +91,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -123,14 +122,13 @@
" p_old = p_new.copy()\n", " p_old = p_new.copy()\n",
" v_old = v_new.copy()\n", " v_old = v_new.copy()\n",
"\n", "\n",
"\n",
" lo_00.set_ydata(p_new)\n", " lo_00.set_ydata(p_new)\n",
" lo_01.set_ydata(v_new)\n", " lo_01.set_ydata(v_new)\n",
" \n", " \n",
" fig1.suptitle(str(it))\n", " fig1.suptitle(str(it))\n",
" fig1.canvas.draw()\n", " fig1.canvas.draw()\n",
" fig1.tight_layout()\n", " fig1.tight_layout()\n",
" plt.pause(0.1)\n", " plt.pause(0.01)\n",
"\n", "\n",
" # store parameters of node 1 (at reservoir)\n", " # store parameters of node 1 (at reservoir)\n",
" p_1[it] = p_new[0]\n", " p_1[it] = p_new[0]\n",
@@ -139,6 +137,20 @@
" p_np1[it] = p_new[-1]\n", " p_np1[it] = p_new[-1]\n",
" v_np1[it] = v_new[-1]" " v_np1[it] = v_new[-1]"
] ]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"fig2,axs2 = plt.subplots(2,2)\n",
"axs2[0,0].plot(t_vec,p_1)\n",
"axs2[0,1].plot(t_vec,v_1)\n",
"axs2[1,0].plot(t_vec,p_np1)\n",
"axs2[1,1].plot(t_vec,v_np1)\n",
"plt.show()"
]
} }
], ],
"metadata": { "metadata": {