PLUTO
stellar_wind.py
Go to the documentation of this file.
1 import os
2 import sys
3 from numpy import *
4 from matplotlib.pyplot import *
5 import pyPLUTO as pp
6 
7 #To run this example it is suggested to get data in 2D using pluto_01.ini and set the data in flt datatype instead of dbl.h5
8 
9 plutodir = os.environ['PLUTO_DIR']
10 wdir = plutodir+'/Test_Problems/HD/Stellar_Wind/'
11 nlinf = pp.nlast_info(w_dir=wdir,datatype='float')
12 
13 D = pp.pload(nlinf['nlast'],w_dir=wdir,datatype='float') # Loading the data into a pload object D.
14 
15 I = pp.Image()
16 I.pldisplay(D, log10(D.rho),x1=D.x1,x2=D.x2,label1='x',label2='y',
17  title=r'Log Density $\rho$ [Stellar Wind]',cbar=(True,'vertical'),figsize=[8,12])
18 
19 # Code to plot arrows. --> Spacing between the arrow can be adjusted by modifying the newdims tuple of conrid function.
20 T = pp.Tools()
21 newdims = 2*(20,)
22 Xmesh, Ymesh = meshgrid(D.x1.T,D.x2.T)
23 xcong = T.congrid(Xmesh,newdims,method='linear')
24 ycong = T.congrid(Ymesh,newdims,method='linear')
25 velxcong = T.congrid(D.vx1.T,newdims,method='linear')
26 velycong = T.congrid(D.vx2.T,newdims,method='linear')
27 gca().quiver(xcong, ycong, velxcong, velycong,color='w')
28 
29 savefig('stellar_wind_1.png')
30 show()