from rsf.proj import *
from rsf.recipes.beg import server as private
from math import pi
pcb = {}
pgrid = {'nz':609, 'oz':4., 'dz':2., 'nx':521, 'ox':272., 'dx':17.}
dfile = 'coronation_xl590_vs.HH'
Fetch(dfile,'apache',private)
Flow('dfile',dfile,'dd form=native | math output="input" | put label1=z label2=x unit1=m unit2=m')
Result('dfile','grey color=a title="VS velocity variations" parallel2=n')
pgrid.update({'ozw':200., 'nzw':351, 'oxw':272., 'nxw':521})
pcb['bvv'] = 0.0
Flow('wdfile','dfile','window min1=%(ozw)g n1=%(nzw)d min2=%(oxw)g n2=%(nxw)d' % pgrid)
Flow('mscale','wdfile','stack axis=2 norm=n | stack axis=1 norm=n | math output="input*%g"' % (1./(pgrid['nzw']*pgrid['nxw'])))
Flow('mdfile','mscale',
'''
window | spray axis=1 n=%(nzw)d o=%(ozw)g d=%(dz)g |
spray axis=2 n=%(nxw)d o=%(oxw)g d=%(dx)g | put label1=z
''' % pgrid)
Flow('signal',['wdfile','mdfile'],'math r=${SOURCES[0]} m=${SOURCES[1]} output="r/m-1."')
Result('signal',
'''
grey color=b bias=%(bvv)g
title="\F5 V\_\s70 \F2 S\s100 \^ velocity variations" font=2
parallel2=n n2tic=8 o2num=200 d2num=100
label1="\F2 z" label2="\F2 x"
unit1="\F2 m" unit2="\F2 m"
''' % pcb)
pcb.update({'fzc':0.0025})
fft2 = 'fft1 sym=y | fft3 sym=y'
Flow('fdfile','signal',fft2)
Flow('f2dfile','fdfile','math output="input*conj(input)" | real | window min1=%(fzc)g' % pcb)
Result('f2dfile',
'''
put label1=fz label2=fx unit1=1/m unit2=1/m |
grey color=H allpos=y
parallel2=n n2tic=5 o2num=0.05 d2num=0.05 format2=%3.2f
title="\F2 Energy density spectrum" font=2
label1="\F2 fz" label2="\F2 fx"
unit1="\F2 m\^\s50 -1\s100 \_" unit2="\F2 m\^\s50 -1\s100 \_"
''')
pgrids = {'nz':701, 'oz':200., 'dz':1.,'nx':8841, 'ox':272., 'dx':1.}
Flow('spacegrid',None,'spike mag=1 n1=%(nz)d n2=%(nx)d d1=%(dz)g d2=%(dx)g o1=%(oz)g o2=%(ox)g label1="z" label2="x" unit1="m" unit2="m"' % pgrids)
pmd = {
'bx':2500.,
'bz':10.,
'nu':-0.5,
'wst':0.1
}
pwhite = {
'wmu':0.,
'wvr':pmd['wst']*pmd['wst'],
'wrn':30.,
'wsd':7
}
Flow('wgauss','spacegrid','noise mean=%(wmu)g range=%(wrn)g seed=%(wsd)g var=%(wvr)g rep=y type=y' % pwhite)
fcb = {
'fzc':0.0025,
'fzm':0.25,
'fxc':-0.0294,
'fxm':0.0294,
'bcg':0.0
}
Result('wgauss','window j2=4 | grey color=j parallel2=n bias=%g title="White noise"' % (fcb['bcg']))
Flow('fwgauss','wgauss',fft2)
specm = pmd['nu']*4.*pi*pmd['bx']*pmd['bz']
Flow('specsde','fwgauss','math output="(1.+(x1*2.*(%g))^2+(x2*2.*(%g))^2)^(%g)"' % (pi*pmd['bz'],pi*pmd['bx'],-pmd['nu']-1.))
Flow('fcgaussb',['specsde','fwgauss'],'math r=${SOURCES[0]} p=${SOURCES[1]} type=complex output="sqrt(abs(%g)*r)*p"'% (specm))
ifft2 = 'sffft3 sym=y inv=y | sffft1 sym=y inv=y'
Flow('cgaussb','fcgaussb',ifft2)
Flow('fcgaussbp','fcgaussb',
'''
math output="input*conj(input)" | real | window min1=%(fzc)g max1=%(fzm)g min2=%(fxc)g max2=%(fxm)g |
put label1=fz label2=fx unit1=1/m unit2=1/m
''' % fcb)
Result('fcgaussbp',
'''
grey color=H allpos=y
title="\F2 Energy density spectrum" font=2
parallel2=n n2tic=5 o2num=0.05 d2num=0.05
label1="\F2 fz" label2="\F2 fx" format2=%3.2f
unit1="\F2 m\^\s50 -1\s100 \_" unit2="\F2 m\^\s50 -1\s100 \_"
''')
Result('cgaussb',
'''
window j2=4 |
grey color=b bias=%g
parallel2=n n2tic=8 o2num=200 d2num=100
title="\F5 b\_x\^\F2 \k70 =\k70 2500\k10 m\g \G \F5 b\_z\^\F2 \k60 =\k60 10\k10 m\g \G \F5 H\F2 \k60 =\k60 \F15 8\F2 0.5" font=2
label1="\F2 z" label2="\F2 x"
unit1="\F2 m" unit2="\F2 m"
''' % (fcb['bcg']))
End() |