# MODELakefile for producing history files of velocity models and test of modeling programs
# set up the things

# Figures
MODELRESULTSER = 
MODELRESULTSCR = 
MODELRESULTSNR = 
MODELFIG_pdf = 

########################
## Ricker source wavelet
########################
sou.HH: 
	Wavelet n1=1000 d1=0.001 wavelet=ricker2 domain=time tdelay=0.08 fund=15 flow=0 fhigh=30 >temp.H
	Math file1=temp.H exp='file1*100.0' >$@
	echo "label1='time(s)' d1=0.001" >> $@
	Rm temp.H
sou.H: sou.HH
	Cp $< $@
souspectra.H: sou.H
	<$< Spectra >$@

########################
## Velocity model
########################
# constant velocity for testing wavefield extrapolation
vel-const.H: 
	Vel >$@ n1=151 n2=151 n3=1 d1=10 d2=10 d3=10 o1=0 o2=0 o3=0 vc=2000.
	echo label1="z(m)" label2="x(m)" >> $@

# vel0 model: one horizontal flat reflector
vel0.H: $D/vel0.HH
	Cp $< $@
vel0.mig.H: vel0.H
	<$< Vconvert invelopt=1 outvelopt=2 intype=1 outtype=1 inpar=2 outpar=2 >temp$*xxx.H
	<temp$*xxx.H Smooth rect1=10 rect2=10 >temp$*yyy.H
	<temp$*yyy.H Vconvert invelopt=2 outvelopt=1 intype=1 outtype=1 inpar=2 outpar=2 >$@
	Rm temp$*xxx.H temp$*yyy.H
vel0-mig.H: vel0.mig.H
	Cp $< $@

# vel1 model windowed from SEAM model
vel1.H: $D/seam2d1.HH
	Cp $< $@
vel1.mig.H: vel1.H
	<$< Vconvert invelopt=1 outvelopt=2 intype=1 outtype=1 inpar=2 outpar=2 >temp$*xxx.H
	<temp$*xxx.H Smooth rect1=10 rect2=10 >temp$*yyy.H
	<temp$*yyy.H Vconvert invelopt=2 outvelopt=1 intype=1 outtype=1 inpar=2 outpar=2 >$@
	Rm temp$*xxx.H temp$*yyy.H

########################
## wavefield modeling in constant velocity (vel-const)
########################
# with SRM (reflecting top boundary)
wvfld0.mult.H:  vel-const.H sou.H ${P}/shot0.P ${B}/model2d_program.x 
	<$< ${B}/model2d_program.x par=${P}/shot$*.P abstop=0 source=sou.H $
# without SRM (nonreflecting top boundary)
wvfld0.nomult.H:  vel-const.H sou.H ${P}/shot0.P ${B}/model2d_program.x 
	<$< ${B}/model2d_program.x par=${P}/shot$*.P abstop=1 source=sou.H $(dn) snap=$@



########################
## data for DRTM
########################

##########################
## copying the original synthetic data after muted
## By defualt data0 is likely to be the data from the whole shot in 2-D line
##########################
##### fullmuted data from vel1 model
# data with SRM
data%-vel0-mult.H: $(TestRTM)/data%.vel0.mult.fullmuted.H
	Cp $< $@
data%-vel0-mult: data%-vel0-mult.H
	<$< Transp plane=13 | Transp plane=34 | Grey title='data$* with SRM' $(Axis) label1="Time (s)" | Tube &
# data without SRM
data%-vel0-nomult.H: $(TestRTM)/data%.vel0.nomult.fullmuted.H
	Cp $< $@
data%-vel0-nomult: data%-vel0-nomult.H
	<$< Transp plane=13 | Transp plane=34 | Grey title='data$* without SRM' $(Axis) label1="Time (s)" | Tube &

##### fullmuted data from vel1 model
# data with SRM
data%-vel1-mult.H: $(TestRTM)/data%.vel1.mult.fullmuted.H
	Cp $< $@
data%-vel1-mult: data%-vel1-mult.H
	<$< Transp plane=13 | Transp plane=34 | Grey title='data$* with SRM' $(Axis) label1="Time (s)" | Tube &
# data without SRM
data%-vel1-nomult.H: $(TestRTM)/data%.vel1.nomult.fullmuted.H
	Cp $< $@
data%-vel1-nomult: data%.vel1.nomult.H
	<$< Transp plane=13 | Transp plane=34 | Grey title='data$* without SRM' $(Axis) label1="Time (s)" | Tube &






