from rsf.proj import *
from math import pi
pgrid = {'nx':300, 'ox':1., 'dx':1.}
Flow('fgrd',None,'spike nsp=1 mag=1 n1=%(nx)d d1=%(dx)g o1=%(ox)g | put label1=f unit1=Hz' % pgrid)
Flow('lfgrd','fgrd','math output="log(x1)/log(10.)"')
pgrids = {'M025':{'hu':-0.25, 'cu':1.311, 'shu':'\F15 8\F2 0.25'},
'025':{'hu':0.25, 'cu':0.5991, 'shu':'0.25'},
'05':{'hu':0.5, 'cu':1.0, 'shu':'0.5'},
'075':{'hu':0.75, 'cu':1.3317, 'shu':'0.75'},
'1':{'hu':1.0, 'cu':1.57, 'shu':'1.0'}
}
bvalues = {'b25':2.5, 'b05':5.0, 'b10':10.0}
bvalstr = {'b25':'2.5', 'b05':'5', 'b10':'10'}
parq = {
'sp':0.3,
'ss':0.3,
'cp':2700.,
'cs':1230.
}
parq['vrs2'] = parq['ss']*parq['ss']
parq['vrp2'] = parq['sp']*parq['sp']
for lb in bvalues.keys():
parq['b'] = bvalues[lb]
bstring = bvalstr[lb]
ksb = 'ksb' + lb
ksb2 = 'ksb2' + lb
kpb = 'kpb' + lb
kpb2 = 'kpb2' + lb
Flow(ksb,'fgrd','math output="(%g)*x1/(%g)"' % (2.*pi*parq['b'],parq['cs']))
Flow(ksb2,ksb,'math output="input*input"')
Flow(kpb,'fgrd','math output="(%g)*x1/(%g)"' % (2.*pi*parq['b'],parq['cp']))
Flow(kpb2,kpb,'math output="input*input"')
dvse = 'dvse' + lb
qse = 'qse' + lb
depthse = 'depthse' + lb
Flow(dvse,ksb2,'math k2=${SOURCES[0]} output="1./(1.+(%g)*(0.5+4.*k2)/(1.+4.*k2))"' % (parq['vrs2']))
Flow(qse,[ksb2, ksb],'math k2=${SOURCES[0]} k=${SOURCES[1]} output="(%g)*(k2*k)/(1.+4.*k2)"' % (8.*parq['vrs2']))
Flow(depthse,ksb2,'math k2=${SOURCES[0]} output="(%g)/(%g)*(1.+4.*k2)/(k2*k2)"' % (parq['b'],4.*parq['vrs2']))
dvpe = 'dvpe' + lb
qpe = 'qpe' + lb
depthpe = 'depthpe' + lb
Flow(dvpe,kpb2,'math k2=${SOURCES[0]} output="1./(1.+(%g)*(0.5+4.*k2)/(1.+4.*k2))"' % (parq['vrp2']))
Flow(qpe,[kpb2, kpb],'math k2=${SOURCES[0]} k=${SOURCES[1]} output="(%g)*(k2*k)/(1.+4.*k2)"' % (8.*parq['vrp2']))
Flow(depthpe,kpb2,'math k2=${SOURCES[0]} output="(%g)/(%g)*(1.+4.*k2)/(k2*k2)"' % (parq['b'],4.*parq['vrp2']))
lfdvse = 'lfdvse' + lb
lfdvpe = 'lfdvpe' + lb
lqse = 'lqse' + lb
lqpe = 'lqpe' + lb
lfqse = 'lfqse' + lb
lfqpe = 'lfqpe' + lb
lldve = 'lldve' + lb
llqe = 'llqe' + lb
depthle = 'depthle' + lb
Flow(lfdvse,['lfgrd', dvse],'cmplx ${SOURCES[0:2]}',stdin=0)
Flow(lfdvpe,['lfgrd', dvpe],'cmplx ${SOURCES[0:2]}',stdin=0)
Flow(lqse,qse,'math output="log(input)/log(10.)"')
Flow(lqpe,qpe,'math output="log(input)/log(10.)"')
Flow(lfqse,['lfgrd', lqse],'cmplx ${SOURCES[0:2]}',stdin=0)
Flow(lfqpe,['lfgrd', lqpe],'cmplx ${SOURCES[0:2]}',stdin=0)
Result(lldve,[lfdvpe, lfdvse],
'''
cat ${SOURCES[0:2]} axis=2 |
put label1='log[f]' unit1='Hz' label2='c/c\_0\^' unit2= |
graph dash=0,3 title="Dispersion velocity - H=0.5" min1=0. max1=2.5 min2=0.9 max2=1.
''',stdin=0)
Result(llqe,[lfqpe, lfqse],
'''
cat ${SOURCES[0:2]} axis=2 |
put label1='log[f]' unit1='Hz' label2='log[1/Q]' unit2= |
graph dash=0,3 title="Attenuation - H=0.5" min1=0. max1=2.5 max2=0. min2=-6.
''',stdin=0)
Result(depthle,[depthpe, depthse],
'''
cat ${SOURCES[0:2]} axis=2 |
put label2='d' unit2='m' |
graph dash=0,3 title="Penetration depth - H=0.5" min1=0. max1=100. min2=0. max2=2500.
''',stdin=0)
for fexp in ('M025','025','075'):
parq.update(pgrids[fexp])
hksb4 = 'hksb4' + lb + fexp
qsf = 'qsf' + lb + fexp
depthsf = 'depthsf' + lb + fexp
Flow(hksb4,[ksb2, ksb],'math k2=${SOURCES[0]} k=${SOURCES[1]} output="k-k/(1.+4.*k2)^(%g)"' % (0.5+parq['hu']))
Flow(qsf,hksb4,'math hk4=${SOURCES[0]} output="2.*(%g)*hk4"' % (parq['vrs2']*parq['cu']))
Flow(depthsf,[hksb4, ksb],'math hk4=${SOURCES[0]} k=${SOURCES[1]} output="(%g)/(%g)/(k*hk4)"' % (parq['b'],parq['vrs2']*parq['cu']))
hkpb4 = 'hkpb4' + lb + fexp
qpf = 'qpf' + lb + fexp
depthpf = 'depthpf' + lb + fexp
Flow(hkpb4,[kpb2, kpb],'math k2=${SOURCES[0]} k=${SOURCES[1]} output="k-k/(1.+4.*k2)^(%g)"' % (0.5+parq['hu']))
Flow(qpf,hkpb4,'math hk4=${SOURCES[0]} output="2.*(%g)*hk4"' % (parq['vrp2']*parq['cu']))
Flow(depthpf,[hkpb4, kpb],'math hk4=${SOURCES[0]} k=${SOURCES[1]} output="(%g)/(%g)/(k*hk4)"' % (parq['b'],parq['vrp2']*parq['cu']))
lqsf = 'lqsf' + lb + fexp
lqpf = 'lqpf' + lb + fexp
lfqsf = 'lfqsf' + lb + fexp
lfqpf = 'lfqpf' + lb + fexp
llqf = 'llqf' + lb + fexp
depthlf = 'depthlf' + lb + fexp
Flow(lqsf,qsf,'math output="log(input)/log(10.)"')
Flow(lqpf,qpf,'math output="log(input)/log(10.)"')
Flow(lfqsf,['lfgrd', lqsf],'cmplx ${SOURCES[0:2]}',stdin=0)
Flow(lfqpf,['lfgrd', lqpf],'cmplx ${SOURCES[0:2]}',stdin=0)
titleatt = 'title="Attenuation \k100 \k100 \F5 b\F2 \k70 =\k70 ' + bstring + '\k10 m\g \G \F5 H\F2 \k60 =\k60 ' + parq['shu'] + '"'
Result(llqf,[lfqpf, lfqsf],
'''
cat ${SOURCES[0:2]} axis=2 |
put label1='log[f]' unit1='Hz' label2='log[1/Q]' unit2= |
graph dash=0,3 min1=0. max1=2.5 max2=0. min2=-6. font=2
parallel2=n plotfat=4,4 n2tic=7 o2num=-6.0 d2num=1.0 %s
''' % (titleatt),stdin=0)
titledep = 'title="Penetration depth \k100 \k100 \F5 b\F2 \k70 =\k70 ' + bstring + '\k10 m\g \G \F5 H\F2 \k60 =\k60 ' + parq['shu'] + '"'
Result(depthlf,[depthpf, depthsf],
'''
cat ${SOURCES[0:2]} axis=2 |
put label2='d' unit2='m' |
graph dash=0,3 min1=0. max1=100. min2=0. max2=2500. font=2
parallel2=n plotfat=4,4 n2tic=6 o2num=0.0 d2num=500.0 %s
''' % (titledep),stdin=0)
End() |