timedomainresonace/timedomain.ipynb

209 lines
24 KiB
Plaintext
Raw Normal View History

{
"metadata": {
"name": "",
2015-02-22 08:54:36 +00:00
"signature": "sha256:2aa6562ce56a22699d07327912ff516ed48493f67bbddc1babb0722b0ee1a0ff"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from timedomaineuler import *\n",
"#import timedomaineuler"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Globalconf accessable with cvar.gc\n",
"f=85.785\n",
"T=1/f\n",
"loglevel=20\n",
2015-02-22 08:54:36 +00:00
"L=1e-2\n",
"gp=10\n",
"gc=cvar.gc #Reference!\n",
"dx=L/(gp-1); # One left and right gp, so\n",
2015-02-22 08:54:36 +00:00
"CFL=0.1;\n",
"gc.setfreq(f)\n",
"tube=TubeLF(L,gp)\n",
"dt=min(CFL*dx/gc.c0(),T/50)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
2015-02-22 08:54:36 +00:00
"nr_p_period=1\n",
"intsteps=int(floor(1./(gc.getfreq()*dt)/nr_p_period))"
],
"language": "python",
"metadata": {},
2015-02-22 08:54:36 +00:00
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
2015-02-22 08:54:36 +00:00
"intsteps=1000"
],
"language": "python",
"metadata": {},
2015-02-22 08:54:36 +00:00
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
2015-02-22 08:54:36 +00:00
"print(\"DoIntegration relative time step of one period: %0.2e\" %(dt*gc.getfreq()))"
],
"language": "python",
"metadata": {},
2015-02-22 08:54:36 +00:00
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"DoIntegration relative time step of one period: 2.78e-05\n"
]
}
],
2015-02-22 08:54:36 +00:00
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
2015-02-22 08:54:36 +00:00
"tube.gp"
],
"language": "python",
"metadata": {},
"outputs": [
{
2015-02-22 08:54:36 +00:00
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
2015-02-22 08:54:36 +00:00
"10"
]
}
],
2015-02-22 08:54:36 +00:00
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
2015-02-22 08:54:36 +00:00
"tube.DoIntegration(dt,1)\n",
2015-02-20 09:34:05 +00:00
"sol=tube.getSol()\n",
"u=sol.u()\n",
"p=sol.p()\n",
2015-02-22 08:54:36 +00:00
"#rho=sol.rho()\n",
"figure(figsize=(9,6))\n",
"subplot(221)\n",
2015-02-20 09:34:05 +00:00
"plot(p)\n",
"subplot(222)\n",
"plot(u)\n",
"subplot(223)\n",
2015-02-22 08:54:36 +00:00
"#plot(rho)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
2015-02-22 08:54:36 +00:00
"prompt_number": 9,
"text": [
2015-02-22 08:54:36 +00:00
"<matplotlib.axes._subplots.AxesSubplot at 0x7f8a6779fac8>"
]
},
{
"metadata": {},
"output_type": "display_data",
2015-02-22 08:54:36 +00:00
"png": "iVBORw0KGgoAAAANSUhEUgAAAkcAAAF2CAYAAABkjTxiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYXVWZ7/Hvj4QwKBACGsjAcCEiUYYikEEbLRSwiN2E\nBhWiCAq3zdMhircflcTbTULbymB7GR4gRiahVYICbccmBqJQLW1DwpxgEkiE0EkFAjKpSGuG9/6x\nV8Wdw6mqU3XGOvX7PM95cvbea6/11klq5z1rrb22IgIzMzMzy+xQ7wDMzMzMGomTIzMzM7McJ0dm\nZmZmOU6OzMzMzHKcHJmZmZnlODkyMzMzy3FyZGZWZZJulLRR0vIK1HWcpMdyrzclnVyJOM0sI69z\nZGZWXZKOBX4P3BIRh1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OjsysXF4p26zxOTnqBSdHZlauww6Ddevgtdfq\nHYmZdcXJUS8ccQT86leweXO9IzGz/mrwYBg3zotBmjUyJ0e9sNtuMHIkPPVUvSMxs/5s4kRPyjZr\nZE6OeslDa2ZWLs87MmtsTo56ycmR2cAh6UZJG3OPHSpW5ipJqyU9IamllHonTsyG1bZurVysZlY5\nTo566cgjnRyZDSA3AW1dHZQ0GTg4IsYAnwPmllLp8OGw554eojdrVE6OeqnzAbR+JJ1Z84uI+4FX\nuylyMnBzKrsEGCppeCl1e2jNrHE5Oeql4cNh553huefqHYmZNYCRwLrc9npgVCknelK2WeMaXO8A\n+qPOeUcHHFDvSMysARQ+3btov/KcOXO2vW9tbWXSpFa+850qRmVmALS3t9Pe3t6rcxQeH+qWpCj8\njP7+72GHHeAf/7FOQZkNUJKI
"text": [
2015-02-22 08:54:36 +00:00
"<matplotlib.figure.Figure at 0x7f8a721c74e0>"
]
}
],
2015-02-22 08:54:36 +00:00
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
2015-02-22 08:54:36 +00:00
"input": [
"rho"
],
"language": "python",
"metadata": {},
2015-02-22 08:54:36 +00:00
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"text": [
"<timedomaineuler.vd; proxy of <Swig Object of type 'vd *' at 0x7f8a724e5e10> >"
]
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
2015-02-22 08:54:36 +00:00
"input": [
"p"
],
"language": "python",
"metadata": {},
2015-02-22 08:54:36 +00:00
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 9,
"text": [
"array([ -4.29085417e-16, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00])"
]
}
],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}