up [pdf]
from rsf.proj import *


dt = 0.001
nt = 500
dx = 10.0
nx = 256
dk = 1.0/nx/dx
nk = nx
fdsize = 8

par = {
    'dt': dt,
    'nt': nt,
    'dx': dx,
    'nx': nx,
    'dk': dk,
    'nk': nk,
    'fdsize' : fdsize,
    'size'  : 16,
    'twopi' : 6.28318530718,
    'ok' :  -0.5*nk*dk,
    'vel' : 3000,

}

##################################
# size 


Flow('vel', None, 'spike n1=%(nx)d d1=%(dx)g | math output=%(vel)g' %par)

Flow('G1 Mlr1 Mfd1','vel',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=4
     ''')
Flow('G2 Mlr2 Mfd2','vel',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=6
     ''')
Flow('G3 Mlr3 Mfd3','vel',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=8
     ''')
Flow('G4 Mlr4 Mfd4','vel',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')


Flow(['G','sx'],'vel1',
         '''
         sfsglfdc1 dt=%(dt)g eps=0.00001 npk=70 seed=2010
                   sx=${TARGETS[1]} size=%(size)d wavnumcut=0.6
         ''' %par)

Flow('one','Mlr1','math output=0.0')

Result('Mlr','one Mlr1 Mlr2 Mlr3 Mlr4',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_LFD\^/v-1" title="SGLFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
       max2=0.1 min2=-0.25
       ''')

Result('Mfd','one Mfd1 Mfd2 Mfd3 Mfd4',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_FD\^/v-1" title="Conventional SGFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
       max2=0.1  min2=-0.25
       ''')

#####################################
# dt

Flow('Gt1 Mlr1t Mfd1t','vel',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('Gt2 Mlr2t Mfd2t','vel',
     '''sglfdcp1 dt=0.0015 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('Gt3 Mlr3t Mfd3t','vel',
     '''sglfdcp1 dt=0.002 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('Gt4 Mlr4t Mfd4t','vel',
     '''sglfdcp1 dt=0.0025 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')

Flow('onet','Mlr1t','math output=0.0')

Result('Mlrt','onet Mlr1t Mlr2t Mlr3t Mlr4t',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_LFD\^/v-1" title="SGLFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
       max2=0.2  min2=-0.15
       ''')

Result('Mfdt','onet Mfd1t Mfd2t Mfd3t Mfd4t',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_FD\^/v-1" title="Conventional SGFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
       max2=0.2 min2=-0.15
       ''')

##################################
# velocity


Flow('vel1v', None, 'spike n1=%(nx)d d1=%(dx)g | math output=2500 '%par)
Flow('vel2v', None, 'spike n1=%(nx)d d1=%(dx)g | math output=3500 '%par)
Flow('vel3v', None, 'spike n1=%(nx)d d1=%(dx)g | math output=4000 '%par)
Flow('vel4v', None, 'spike n1=%(nx)d d1=%(dx)g | math output=4500 '%par)


Flow('G1v Mlr1v Mfd1v','vel1v',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('G2v Mlr2v Mfd2v','vel2v',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('G3v Mlr3v Mfd3v','vel3v',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')
Flow('G4v Mlr4v Mfd4v','vel4v',
     '''sglfdcp1 dt=0.001 eps=0.00001 npk=70 seed=2010
     Mlr=${TARGETS[1]} Mfd=${TARGETS[2]} size=16
     ''')

Flow('onev','Mlr1v','math output=0.0')

Result('Mlrv','onev Mlr1v Mlr2v Mlr3v Mlr4v',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_LFD\^/v-1" title="SGLFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
        max2=0.1 
       ''')

Result('Mfdv','onev Mfd1v Mfd2v Mfd3v Mfd4v',
       '''
       cat ${SOURCES[1]} ${SOURCES[2]} ${SOURCES[3]} ${SOURCES[4]} axis=2 |
       window n1=128 |
       put o1=0 d1=0.7874 n1=128 |
       graph dash=0,0,0,0,0 unit2= label2="v\_FD\^/v-1" title="Conventional SGFD" plotfat=7
       label1="Frequency (% of the Nyquist)" unit1=" "
       max2=0.1  
       ''')


End()

sfspike
sfmath
sfsglfdcp1
sfsglfdc1
sfcat
sfwindow
sfput
sfgraph