2015-02-10 09:07:29 +00:00
|
|
|
{
|
|
|
|
"metadata": {
|
|
|
|
"name": "",
|
2015-02-20 09:34:05 +00:00
|
|
|
"signature": "sha256:c219b2e07da88eca6f031393997d37a4b29390fb7116605d50ca9f4c6d0512b5"
|
2015-02-10 09:07:29 +00:00
|
|
|
},
|
|
|
|
"nbformat": 3,
|
|
|
|
"nbformat_minor": 0,
|
|
|
|
"worksheets": [
|
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
|
|
|
"from timedomaineuler import *\n",
|
|
|
|
"#import timedomaineuler"
|
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
2015-02-20 09:34:05 +00:00
|
|
|
"outputs": []
|
2015-02-10 09:07:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
|
|
|
"#Globalconf accessable with cvar.gc\n",
|
|
|
|
"f=85.785\n",
|
|
|
|
"T=1/f\n",
|
|
|
|
"loglevel=20\n",
|
|
|
|
"L=1.0\n",
|
|
|
|
"gp=300\n",
|
|
|
|
"gc=cvar.gc #Reference!\n",
|
|
|
|
"dx=L/(gp-1); # One left and right gp, so\n",
|
2015-02-20 09:34:05 +00:00
|
|
|
"CFL=0.9;\n",
|
2015-02-10 09:07:29 +00:00
|
|
|
"gc.setfreq(f)\n",
|
|
|
|
"tube=Tube(L,gp)\n",
|
|
|
|
"dt=min(CFL*dx/gc.c0(),T/50)"
|
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
|
|
|
"sol=tube.getSol()"
|
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
2015-02-20 09:34:05 +00:00
|
|
|
"outputs": []
|
2015-02-10 09:07:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
2015-02-20 09:34:05 +00:00
|
|
|
"#sol.getrho()"
|
2015-02-10 09:07:29 +00:00
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
2015-02-20 09:34:05 +00:00
|
|
|
"outputs": []
|
2015-02-10 09:07:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
2015-02-20 09:34:05 +00:00
|
|
|
"dt*gc.getfreq()"
|
2015-02-10 09:07:29 +00:00
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
2015-02-20 09:34:05 +00:00
|
|
|
"outputs": []
|
2015-02-10 09:07:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"collapsed": false,
|
|
|
|
"input": [
|
2015-02-20 09:34:05 +00:00
|
|
|
"tube.DoIntegration(dt,10)\n",
|
|
|
|
"sol=tube.getSol()\n",
|
|
|
|
"rho=tube.getSol().getrho()\n",
|
|
|
|
"p=tube.getSol().getp()\n",
|
|
|
|
"figure(figsize=(12,4))\n",
|
|
|
|
"subplot(121)\n",
|
|
|
|
"plot(p)\n",
|
|
|
|
"subplot(122)\n",
|
|
|
|
"plot(rho)"
|
2015-02-10 09:07:29 +00:00
|
|
|
],
|
|
|
|
"language": "python",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|