134 lines
15 KiB
Plaintext
134 lines
15 KiB
Plaintext
|
{
|
||
|
"metadata": {
|
||
|
"name": "",
|
||
|
"signature": "sha256:665d4d927eafbb088c892eb5950f2a0975c691bdbb983ca96c13a6336ba30584"
|
||
|
},
|
||
|
"nbformat": 3,
|
||
|
"nbformat_minor": 0,
|
||
|
"worksheets": [
|
||
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"from timedomaineuler import *"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"prompt_number": 1
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"f=85.785 #Frequency of oscillation\n",
|
||
|
"L=1. #Length of tube\n",
|
||
|
"gp=300 #Number of gridpoints\n",
|
||
|
"\n",
|
||
|
"nr_p_period=50 #Number of save per oscillation period\n",
|
||
|
"CFL=0.5; # CFL number\n",
|
||
|
"periods=100 #Number of periods to compute\n",
|
||
|
"\n",
|
||
|
"T=1/f\n",
|
||
|
"gc=cvar.gc #Reference!\n",
|
||
|
"dx=L/(gp-1); # One left and right gp, so\n",
|
||
|
"\n",
|
||
|
"gc.setfreq(f)\n",
|
||
|
"tube=TubeLF(L,gp)\n",
|
||
|
"dt=min(CFL*dx/gc.c0(),T/nr_p_period)\n",
|
||
|
"intsteps=int(floor(1./(gc.getfreq()*dt)/nr_p_period))\n",
|
||
|
"x=linspace(0,L,gp)\n",
|
||
|
"# Create tube instance\n",
|
||
|
"tube=TubeLF(L,gp)\n",
|
||
|
"# To create a ni"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"prompt_number": 5
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"dt"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"metadata": {},
|
||
|
"output_type": "pyout",
|
||
|
"prompt_number": 6,
|
||
|
"text": [
|
||
|
"4.873360558484559e-06"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"prompt_number": 6
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"tube.DoIntegration(dt,1000)"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"prompt_number": 7
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"sol=tube.getSol()"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"prompt_number": 8
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [
|
||
|
"plot(sol.u())"
|
||
|
],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"metadata": {},
|
||
|
"output_type": "pyout",
|
||
|
"prompt_number": 9,
|
||
|
"text": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7f3d19ffaa90>]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data",
|
||
|
"png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEACAYAAABCl1qQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X2c1XP+//HHa6ZLLCORIgohF1/y3e2CMGgzRSUiudys\nZG2urcR+v8J32V1fi1jXoVzUhspIF4pm10UbUgmV5peodOFr2VW5qOb9++P9iTE7c86ZmXPmfT7n\nPO+327nNOZ/z+ZzzevtkXvO+NuccIiIiiRSEDkBERLKfkoWIiCSlZCEiIkkpWYiISFJKFiIikpSS\nhYiIJJU0WZh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KzUObe40jm9gf2ccx3MrAtwP9A1ybWLgP7Ag9V8bblzrlM1x7POqlV+CYcLL4Th\n1aZRkdrZe2+/L0aPHn6wxC236A8QyQ7Jahad8b+8VzjnNgPjgarL3/UFxgA45+YCRWa2e6JrnXNL\nnHMfprEcDW7lSiguhqFDlSgkvdq08QljyhS/+GDMVraRHJUsWewBrKz0elV0LJVz2qRwbXXaR01Q\nZWbWPYXzG9zHH/tE8etfwzXXhI5GctGuu/o+jNdfh0su8asBiISUrIM71b9p0lVR/hRo65z7IurL\nmGxmBzvnvqp64siRI79/XlxcTHFxcZpCSGzFCt/0dMUV6oSUzNp5Z7+k/cknw+DBMHq0RtlJ7ZSV\nlVGWph24Eq46a2ZdgZHOuZLo9Qigwjn3h0rnPACUOefGR6+XAMcC7VO4djZwtXPunRq+v9r3Q606\nu3y536Pgmmv8mk8iDWHTJr9P
|
||
|
"text": [
|
||
|
"<matplotlib.figure.Figure at 0x7f3d1b8e7d30>"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"prompt_number": 9
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"collapsed": false,
|
||
|
"input": [],
|
||
|
"language": "python",
|
||
|
"metadata": {},
|
||
|
"outputs": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {}
|
||
|
}
|
||
|
]
|
||
|
}
|