#from simParam import *
import math
from units import *

plot  = []
show_plot = False

height =  0.41
u_in_L = 0.05
u_in_phy = 0.3
nHeight = 50
dx = getdxFromnL(height,nHeight)
dt = getdt_acoustic(dx,u_in_L,u_in_phy)
pr_lp = getpress_p(dx,dt,1.0)
## xy plot
# pressure over the time
#plot.append(dict(kind = 'xy',data=['Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_probe_density_p00000.res'],
#          row=[1,-1],col=[1,2],
#          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k',label='before obstable', title='pressure over the time', 
#          xlabel='time', ylabel='pressure ($kgm/s^2$)',legend_loc=1))
#
#plot.append(dict(kind = 'xy',data=['Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_probe_density_p00000.res'],
#          row=[1,-1],col=[1,3],
#          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r',label='after obstable',newplot=False))

#Recirculation length
#plot.append(dict(kind = 'xy',data=[
#                                   'Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_line_p0000*'
#                                   ],
#           row=[1,-1],col=[1,5],
#           convertPhy = True, xfac = 1.0, yfac = dx/dt, xlabel = 'x', ylabel = '$u_x (m/s)$', label = 'extrapolation, l/h = 5, nH=50', 
#           title = 'How to compute recirculation length', legend_loc = 1))
#           
#nH50
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_line_p0000*'],
           row=[1,-1],col=[1,5], newplot = False, ls = 'b', label = 'u_x = 0',
           dx = dx, legend_loc = 1))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH50/tracking/2D_line_p0000*'],
           dx = dx, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH50/tracking/2D_line_p0000*'],
           dx = dx, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH50/tracking/2D_line_p0000*'],
           dx = dx, row=[1,-1],col=[1,5]))

#nH100
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH100/tracking/2D_line_p0000*'],
           dx = dx/2, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH100/tracking/2D_line_p0000*'],
           dx = dx/2, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH100/tracking/2D_line_p0000*'],
           dx = dx/2, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH100/tracking/2D_line_p0000*'],
           dx = dx/2, row=[1,-1],col=[1,5]))

#nH150
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH150/tracking/2D_line_p0000*'],
           dx = dx/3, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH150/tracking/2D_line_p0000*'],
           dx = dx/3, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH150/tracking/2D_line_p0000*'],
           dx = dx/3, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH150/tracking/2D_line_p0000*'],
           dx = dx/3, row=[1,-1],col=[1,5]))

#nH200
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH200/tracking/2D_line_p0000*300*'],
           dx = dx/4, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH200/tracking/2D_line_p0000*300*'],
           dx = dx/4, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH200/tracking/2D_line_p0000*300*'],
           dx = dx/4, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH200/tracking/2D_line_p0000*300*'],
           dx = dx/4, row=[1,-1],col=[1,5]))

##nH300
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH300/tracking/2D_line_p0000*500*'],
           dx = dx/6, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH300/tracking/2D_line_p0000*500*'],
           dx = dx/6, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH300/tracking/2D_line_p0000*500*'],
           dx = dx/6, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH300/tracking/2D_line_p0000*500*'],
           dx = dx/6, row=[1,-1],col=[1,5]))

##nH400
plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_expol/lh5/nH400/tracking/2D_line_p0000*500*'],
           dx = dx/8, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH400/tracking/2D_line_p0000*500*'],
           dx = dx/8, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_pab/lh5/nH400/tracking/2D_line_p0000*500*'],
           dx = dx/8, row=[1,-1],col=[1,5]))

plot.append(dict(kind = 'rLength',data=['Re20/inlet_ubb_outlet_eq/lh5/nH400/tracking/2D_line_p0000*500*'],
           dx = dx/8, row=[1,-1],col=[1,5]))

########################################
### deltaP                             #
########################################
##nH50
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH50/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH50/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH50/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH50/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH50/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH50/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH50/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))

#nH100
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH100/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH100/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH100/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH100/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH100/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH100/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH100/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH100/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))

#nH150
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH150/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH150/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH150/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH150/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH150/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH150/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH150/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH150/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))

##nH200
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH200/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH200/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH200/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH200/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH200/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH200/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH200/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH200/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))

##nH300
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH300/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH300/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH300/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH300/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH300/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH300/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH300/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH300/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))

##nH400
plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_expol/lh5/nH400/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_expol/lh5/nH400/tracking/2D_probe_density_p00000.res'],
          row=[-500,-1],col=[1,2,3],
          convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'k'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_dnt/lh5/nH400/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_dnt/lh5/nH400/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'r'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_pab/lh5/nH400/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_pab/lh5/nH400/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'g'))

plot.append(dict(kind = 'deltaP',data=['Re20/inlet_ubb_outlet_eq/lh5/nH400/tracking/2D_probe_density_p00000.res','Re20/inlet_ubb_outlet_eq/lh5/nH400/tracking/2D_probe_density_p00000.res'],
           row=[-500,-1],col=[1,2,3],
           convertPhy = True, xfac = 1., yfac = pr_lp, ls = 'y'))




#
#plot.append(dict(kind = 'FFT',data=['inlet_ubb_outlet_expol/lh3/level10/tracking/2D_probe_velocity_p00001.res'],
#           row=[4000,5000],col=[1,3],
#           convertPhy = True, xfac = dt, yfac = u_lp))
#
#
#plot.append(dict(kind = 'xy',data=['inlet_ubb_outlet_expol/lh5/level9/tracking/2D_line_p00000_t00000050.000E+03.res',
#                                   'inlet_ubb_outlet_expol/lh3/level9/tracking/2D_line_p00000_t00000050.000E+03.res'],
#           row=[1,-1],col=[1,6],
#           convertPhy = True, xfac = 1.0, yfac = u_lp))
