started with some poor code on pressure propagation
This commit is contained in:
92
functions/pressure_propagation.ipynb
Normal file
92
functions/pressure_propagation.ipynb
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 12,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np \n",
|
||||||
|
"from pressure_propagation import pressure_update"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# Ausbreitungsgeschwindigkeit\n",
|
||||||
|
"u = 1 # m/s\n",
|
||||||
|
"# Rohrlänge\n",
|
||||||
|
"l = 100 # m\n",
|
||||||
|
"# maximal simulierte Zeitspanne\n",
|
||||||
|
"t_max = 60 # s\n",
|
||||||
|
"\n",
|
||||||
|
"# Zeitschritt\n",
|
||||||
|
"delta_t = 0.1 # s\n",
|
||||||
|
"# Diskretisierungslänge = Ausbreitungsgeschwindigkeit*Zeitschritt\n",
|
||||||
|
"delta_x = u*delta_t\n",
|
||||||
|
"\n",
|
||||||
|
"# Anzahl der örtlichen Diskretisierungsintervalle\n",
|
||||||
|
"n_x = int(np.floor(l/delta_x))\n",
|
||||||
|
"# Anzahl der zeitlichen Diskretisierungsintervalle\n",
|
||||||
|
"n_t = int(np.floor(t_max/delta_t))\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#initiale Druckverteilung (excl hydrostatischer Drucks)\n",
|
||||||
|
"p_0 = np.ones([n_x,1])\n",
|
||||||
|
"# np.array das den Verlauf der Druckverteilungen speichert\n",
|
||||||
|
"pressure_profiles = np.tile(p_0,[1,n_t])\n",
|
||||||
|
"\n",
|
||||||
|
"pressure_profiles[-1,0] = 2 # for testing\n",
|
||||||
|
"# loop\n",
|
||||||
|
"for i in range(1,n_t): # start at 1 because i reference i-1 in the loop over the control-volumina\n",
|
||||||
|
" #get boundary pressure from outflux-change and hydrostatic pressure in the pool\n",
|
||||||
|
" pressure_profiles[-1,i] = 2 # for testing\n",
|
||||||
|
" \n",
|
||||||
|
" for j in range(n_x-2,1,-1): # leave out the first and last control-volume because their pressure\n",
|
||||||
|
" # is set by the boundary conditions\n",
|
||||||
|
" p = pressure_profiles[j,i-1]\n",
|
||||||
|
" p1 = pressure_profiles[j+1,i-1]\n",
|
||||||
|
" p2 = pressure_profiles[j-1,i-1]\n",
|
||||||
|
" pressure_profiles[j,i] = pressure_update(p,p1,p2)\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"interpreter": {
|
||||||
|
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
|
||||||
|
},
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
|
||||||
|
"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.8.13"
|
||||||
|
},
|
||||||
|
"orig_nbformat": 4
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
||||||
2
functions/pressure_propagation.py
Normal file
2
functions/pressure_propagation.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
def pressure_update(p,p1=-1,p2=-1):
|
||||||
|
return 1/4*(2*p+p1+p2)
|
||||||
Reference in New Issue
Block a user