Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
by
Kyle Shalek and Jeff Daniels
The Ohio State University
Preface and Motivation
We needed a 3D seismic modeling package at OSU to compliment our 3D EM
modeling software. Madagascar is a freeware package that is readily available. The
first challenge was to make the package usable and accessible. Having done this, we
decided to post the instructions for others use. The following is a very terse outline
of a how to run Madagascar models.
Table of Contents
1.) Introduction
2.) Xwin
2.1) Installation
2.2) Basic Unix Commands
3.) Running Programs
4.) Programs
4.1) File Operations
4.2) Processing
4.3) Imaging
5.) Modeling
5.1) awefd2d: 2D Acoustic time-domain Finite Difference Modeling
5.1.1) Input
5.1.2) Output
5.1.3) Example
5.2) awefd3d: 3D Acoustic time-domain Finite Difference Modeling
5.2.1) Input
5.2.2) Output
5.2.3) Example
5.3) ewefd2d: 2D Elastic time-domain Finite Difference Modeling
5.3.1) Input
5.3.2) Output
5.3.3) Example
5.4) ewefd3d: 3D Elastic time-domain Finite Difference Modeling
5.4.1) Input
5.4.2) Output
5.4.3) Example
1.) Introduction
Open-source software package for data processing and numerical experiments
Large collection of programs (~300) written in C and C++
Command line environment. There is no GUI available for modeling. There is a GUI, OpendTect,
available for processing flows but needs a seismic survey data set to begin.
Links:
Madagascar Main Page: http://www.reproducibility.org/wiki/Main_Page
Madagascar Download: http://www.reproducibility.org/wiki/Download
List of Programs: http://www.reproducibility.org/RSF/
Currently, our version of Madagascar is stored on a private cluster that requires Linux or Xwin access.
Madagascar can be installed on a Windows box utilizing Cygwin.
The examples are best understood by looking at and executing the code yourself.
2.) Xwin (X-Win32 V9.4)
2.1) Installation
Ohio State Faculty/Students can download for free at: http://osusls.osu.edu/
Follow the on-screen instructions. The license is floating and located in a txt file in the
downloaded folder.
2.2) Basic Unix Commands
ls: lists all of the files in the current directory
cd directory_name: changes to the indicated directory
cd .. : goes up one directory
mkdir directory_name: creates the indicated directory
gedit: opens a file for editing
cp home2/shalek/test . : copies the directory test to the current directory
ln s home2/shalek/test . : creates a symbolic link to the test directory in the current directory
3.) Running Programs:
Programs can be executed from the command line or the program commands can be piped together
using SConstruct files (Python scripts). The SConstruct file is saved in the directory you want to use for output
files. The execution commands are listed below.
scons: executes the SConstruct from command line
scons view: shows the produced images
xtpen image_file: displays a single image of your choice
gedit SConstruct: opens the SConstruct file for editing
4.) Programs
A complete listing of available programs can be found at: http://www.reproducibility.org/RSF/ . Find the
program you want to use and the link will take you to a description of what the program does and what
arguments it accepts. Example SConstruct files and the source code are also available from that page. Useful
and important programs are listed below.
4.1) File Operations:
< input_file.rsf: command line format
< output_file.rsf: command line format
sfin < file.rsf: displays basic information about rsf files
sfattr < file.rsf: Display dataset attributes
sfdd < file.rsf col=1 format=data_type: converts the data file into any type
sfdisfil < file.rsf col=1: prints the file to the command window with indicated number of
columns
sfsegyread: Convert a SEG-Y or SU dataset to RSF
##########################################################
# Created by Kyle Shalek
#
# Last Modified: 9-4-09
#
# Creates a 2D model with velocity and density inputs. #
# Acoustic FD modeling with awefd2d (Psava)
#
# Single trace output
#
##########################################################
from rsfproj import *
import string
########################################################
#1) create velocity model
# Depth in km
xmax = 4.0
zmax = 2.0
layers = ((0.1,0.1,0.1,0.1,0.1),
(1.1,1.1,1.1,1.1,1.1),
(1.3,1.3,1.3,1.3,1.3))
layer1=0.1
layer2=1.1-0.1
layer3=1.3-1.1
layer4=2-1.3
# Velocity (Vp) in km/s
vp = (0.0,
6,
4.6657,
6)
#Velocity (Vs) in km/s
vs = (0.0,
2,
4,
2)
# Density in g/cc, converted to kg/ckm
densities = (0.1*1000000000000,
2.8*1000000000000,
2.5*1000000000000,
2.8*1000000000000)
def arr2str(array,sep=' '):
return string.join(map(str,array),sep)
n1 = len(layers[0])
n2 = len(layers)
Flow('layers',None,
'''
echo %s
n1=%d n2=%d o1=0 d1=%g
data_format=ascii_float in=$TARGET
''' % (string.join(map(arr2str,layers),' '),
n1,n2,xmax/(n1-1)))
d = 0.01 # sampling steps
Flow('mod1','layers',
'''
spline o1=0 d1=%g n1=%d |
unif2 d1=%g n1=%d v00=%s |
dd form=native
''' % (d,int(1.5+xmax/d),
d,int(1.5+zmax/d),
arr2str(vp,','),))
Flow('rho','layers',
'''
spline o1=0 d1=%g n1=%d |
unif2 d1=%g n1=%d v00=%s |
dd form=native
''' % (d,int(1.5+xmax/d),
d,int(1.5+zmax/d),
arr2str(densities,','),))
Result('mod1',
'''
grey color=j title="Velocity Model"
allpos=y titlesz=8 labelsz=6 screenratio=0.5
scalebar=y barlabel='velocity (km/s)' barlabelsz=6
label1="Depth (km)"
label2="Distance (km)"
''')
# Contour the layers
Plot('modline','mod1','contour title=" " label1='' label2='' wantaxis=n screenratio=0.5')
##############################################################
#2) 2D Acoustic wave FD Modeling
# Source location
sx = 2
sz = 0.1
Flow('source',None,
'spike n1=3 nsp=3 k1=1,2,3 mag=%g,%g,1 o1=0 o2=0' % (sx,sz))
# Receiver location
rx=2
rz=0.1
Flow ('receiver',None,
########################################################################
from rsfproj import *
import fdmod
# -----------------------------------------------------------par = {
'nx':151, 'ox':0, 'dx':0.002, 'lx':'x', 'ux':'km',
'ny':151, 'oy':0, 'dy':0.002, 'ly':'y', 'uy':'km',
'nz':151, 'oz':0, 'dz':0.002, 'lz':'z', 'uz':'km',
'nt':601, 'ot':0, 'dt':0.0002, 'lt':'t', 'ut':'s',
'kt':100,
'jsnap':100,
'height':10,
'nb':20,
'frq':45,
'nbell':5
}
fdmod.param(par)
par['nframe']=5
par['iframe']=4
par['dabc']='y'
# -----------------------------------------------------------# Thomsen parameters
par['vp']=2.0
par['vs']=1.0
par['ro']=2.0
# -----------------------------------------------------------par['kz']=2./3.*par['nz']
# -----------------------------------------------------------fdmod.wavelet('wav_',par['frq'],par)
# -----------------------------------------------------------# acoustic source
Flow( 'wava','wav_','transp')
Result('wava','transp |' + fdmod.waveplot('',par))
# -----------------------------------------------------------# source/receiver coordinates
# -----------------------------------------------------------xsou=par['ox']+(par['nx']/2*par['dx']);
ysou=par['oy']+(par['ny']/2*par['dy']);
zsou=par['oz']+(par['nz']/2*par['dz']);
center=fdmod.center3d(1.1*xsou,1.1*ysou,1.1*zsou,par)
fdmod.point3d('ss-3d',xsou,ysou,zsou,par)
fdmod.horizontal3d('rr-3d',0,par)
# -----------------------------------------------------------Flow('zero-3d',None,
'''
spike nsp=1 mag=0.0
n1=%(nz)d o1=%(oz)g d1=%(dz)g
n2=%(nx)d o2=%(ox)g d2=%(dx)g
n3=%(ny)d o3=%(oy)g d3=%(dy)g |
put label1=%(lz)s label2=%(lx)s label3=%(ly)s unit1=%(uz)s unit2=%(ux)s unit3=%(uy)s
''' % par)
# -----------------------------------------------------------Flow('vp-3d','zero-3d','math output="%(vp)g"' %par)
Flow('vs-3d','zero-3d','math output="%(vs)g"' %par)
Flow('ro-3d','zero-3d','math output="%(ro)g"' %par)
Result('vp-3d',fdmod.cgrey3d('allpos=y bias=2.0'+center,par))
Result('vs-3d',fdmod.cgrey3d('allpos=y bias=1.0'+center,par))
Result('ro-3d',fdmod.cgrey3d('allpos=y bias=2.0'+center,par))
# ------------------------------------------------------------# 3D acoustic modeling
fdmod.awefd3d('da-3d','wa-3d','wava','vp-3d','ro-3d','ss-3d','rr-3d','',par)
Result('wa-3d','window n4=1 f4=%(iframe)d |'%par
+ fdmod.cgrey3d('pclip=99.9'+center,par))
Result('da-3d',
'''
put
n1=%(nx)d o1=%(ox)g d1=%(dx)g
n2=%(ny)d o2=%(oy)g d2=%(dy)g
n3=%(nt)d o3=%(ot)g d3=%(dt)g |
transp plane=23 |
transp plane=12 |
''' % par
+ fdmod.dgrey3d('pclip=99.9'+center+' frame1=%d' % (0.65*par['nt']) ,par))
End()
Flow('layers',None,
'''
echo %s
n1=%g n2=%g o1=%g d1=%g
data_format=ascii_float in=$TARGET
''' % (layers1,n1,n2,par['ox'],par['dx'] ))
# -----------------------------------------------------------# Thomsen parameters
# Velocity (Vp) in km/s
vp =( 2,
2,
6,
2)
vp1= arr2str(vp,',')
#Velocity (Vs) in km/s
vs = (1,
1,
4,
1)
vs1=arr2str(vs,',')
# Density in g/cc, converted to kg/ckm
rho = (2*1000000000000,
2*1000000000000,
6*1000000000000,
2*1000000000000)
rho1=arr2str(rho,',')
#----------------------------------------------------------Flow('vp-2d','layers',
'''
spline o1=%g d1=%g n1=%d |
unif2 o1=%g d1=%g n1=%d v00=%s |
dd form=native |
put label1=%s label2=%s unit1=%s unit2=%s
''' % (par['ox'],par['dx'],par['nx'],
par['oz'],par['dz'],par['nz'],vp1,
par['lz'],par['lx'],par['uz'],par['ux']))
Flow('vs-2d','layers',
'''
spline o1=%g d1=%g n1=%d |
unif2 o1=%g d1=%g n1=%d v00=%s |
dd form=native |
put label1=%s label2=%s unit1=%s unit2=%s
''' % (par['ox'],par['dx'],par['nx'],
par['oz'],par['dz'],par['nz'],vs1,
par['lz'],par['lx'],par['uz'],par['ux']))
Flow('ro-2d','layers',
'''
spline o1=%g d1=%g n1=%d |
unif2 o1=%g d1=%g n1=%d v00=%s |
dd form=native |
put label1=%s label2=%s unit1=%s unit2=%s
''' % (par['ox'],par['dx'],par['nx'],
par['oz'],par['dz'],par['nz'],rho1,
par['lz'],par['lx'],par['uz'],par['ux']))
# -----------------------------------------------------------par['kz']=2./3.*par['nz']
# -----------------------------------------------------------fdmod.wavelet('wav_',par['frq'],par)
# -----------------------------------------------------------# elastic source
# -----------------------------------------------------------Flow('souz','wav_','math output=input*1')
Flow('soux','wav_','math output=input*0')
Flow('wave-2d',['souz','soux'],
'''
cat axis=2 space=n ${SOURCES[1:2]} |
transp plane=12 |
transp plane=23 |
transp plane=12
''')
fdmod.ewavelet('wave-2d','',par)
# -----------------------------------------------------------# source/receiver coordinates
# -----------------------------------------------------------xsou=par['ox']+(par['nx']/2*par['dx']);
#zsou=par['oz']+(par['nx']/8*par['dx']);
zsou=0.03
fdmod.point('ss-2d',xsou,zsou,par)
fdmod.horizontal('rr-2d',zsou,par)
#fdmod.point('rr-2d',xsou,zsou,par)
Plot('rr-2d',fdmod.rrplot('title="Receiver Line"',par))
Plot('ss-2d',fdmod.ssplot('title="Source"',par))
# -----------------------------------------------------------Plot('vp-2d',fdmod.cgrey('allpos=y bias=2.0 title="Vp"',par))
Plot('vs-2d',fdmod.cgrey('allpos=y bias=1.0 title="Vs"',par))
Plot('ro-2d',fdmod.cgrey('allpos=y bias=2.0 title="Rho"',par))
Result('vp-2d-s','vp-2d ss-2d','Overlay')
Result('vp-2d-r','vp-2d rr-2d','Overlay')
#Result('vs-2d','vs-2d ss-2d','Overlay')
#Result('ro-2d','ro-2d ss-2d','Overlay')
stiffness.iso2d('Ic-2d','vp-2d','vs-2d','ro-2d',par)
# -----------------------------------------------------------# 2D elastic modeling
stiffness.cplot2d('Ic-2d',1,1,par)
fdmod.ewefd2d('Id-2d','Iw-2d','wave-2d','Ic-2d','ro-2d','ss-2d','rr-2d','ssou=n opot=n',par)
fdmod.emovie( 'Iw-2d-movie','Iw-2d',par['nframe'],'pclip=99.9 color=j',2,par)
Result('Id-2d','window n2=1 | transp |' + fdmod.dgrey('title="Model Response" ',par))
"""
#-------------------------------------------------------------# Ewefd modeling
Flow('Id-2d Iw-2d','wave-2d Ic-2d ro-2d ss-2d rr-2d ',
'''
ewefd2d nbell=5 jsnap=10 dabc=y ssou=n opot=n nb=20 ompchunk=1 ompnth=0 verb=y free=n snap=y
ccc=${SOURCES[1]}
den=${SOURCES[2]}
sou=${SOURCES[3]}
rec=${SOURCES[4]}
wfl=${TARGETS[1]}
''')
"""
# Movie of wave
Plot('Iw-2d',
'''
window n3=1 |
grey gainpanel=all title=Wave label1=Depth unit1=km label2=Lateral unit2=km
''',view=1)
Result('Iw-2d-1','Iw-2d',
'''
window n3=1 |
grey color=j scalebar=y barlabel='Amplitude' barlabelsz=6
gainpanel=all title=Wave
label1=Depth unit1=km label2=Lateral unit2=km
''')
Result('Id-2d-1','Id-2d',
'''
window n2=1 |
transp |
grey color=j
gainpanel=all title=data
label1=time unit1=s label2=Lateral unit2=km
''')
"""
Wavelet
Velocity Model
Stiffness Diagram
A
1.50E-06
1.00E-06
5.00E-07
0.00E+00
0
200
400
600
800
1000
1200
1400
1600
1800
2000
2200
-5.00E-07
-1.00E-06
-1.50E-06
-2.00E-06
-2.50E-06
A
0
200
400
600
800
1000
1200
1400
1600
1800
2000
2200
-4.00E-08
-6.00E-08
-8.00E-08
-1.00E-07
A trace zoomed in
B
1.5E-10
1E-10
5E-11
B
0
0
200
400
600
800
1000
1200
1400
1600
1800
-5E-11
-1E-10
2000
2200
# -----------------------------------------------------------Flow('souz','wav_','math output=input*1')
Flow('soux','wav_','math output=input*0')
Flow('souy','wav_','math output=input*0')
Flow('wave-3d',['souz','soux','souy'],
'''
cat axis=2 space=n ${SOURCES[1:3]} |
transp plane=12 |
transp plane=23 |
transp plane=12
''')
fdmod.ewavelet3d('wave-3d','',par)
# -----------------------------------------------------------# source/receiver coordinates
# -----------------------------------------------------------xsou=par['ox']+(par['nx']/2*par['dx']);
ysou=par['oy']+(par['ny']/2*par['dy']);
#zsou=par['oz']+(par['nz']/2*par['dz']);
zsou= 0.03
center=fdmod.center3d(1.1*xsou,1.1*ysou,1.1*zsou,par)
fdmod.point3d('ss-3d',xsou,ysou,zsou,par)
fdmod.horizontal3d('rr-3d',0.03,par)
#fdmod.point3d('rr-3d',xsou,ysou,zsou,par)
"""
# -----------------------------------------------------------Flow('zero-3d',None,
'''
spike nsp=1 mag=0.0
n1=%(nz)d o1=%(oz)g d1=%(dz)g
n2=%(nx)d o2=%(ox)g d2=%(dx)g
n3=%(ny)d o3=%(oy)g d3=%(dy)g |
put label1=%(lz)s label2=%(lx)s label3=%(ly)s unit1=%(uz)s unit2=%(ux)s unit3=%(uy)s
''' % par)
# -----------------------------------------------------------Flow('vp-3d','zero-3d','math output="%(vp)g"' %par)
Flow('vs-3d','zero-3d','math output="%(vs)g"' %par)
Flow('ro-3d','zero-3d','math output="%(ro)g"' %par)
Result('vp-3d',fdmod.cgrey3d('allpos=y bias=2.0'+center,par))
Result('vs-3d',fdmod.cgrey3d('allpos=y bias=1.0'+center,par))
Result('ro-3d',fdmod.cgrey3d('allpos=y bias=2.0'+center,par))
"""
stiffness.iso3d('Ic-3d','vp-3d','vs-3d','ro-3d',par)
# ------------------------------------------------------------
# 3D elastic modeling
stiffness.cplot3d('Ic-3d',1,1,1,par)
fdmod.ewefd3d('Id-3d','Iw-3d','wave-3d','Ic-3d','ro-3d','ss-3d','rr-3d','ssou=n opot=n',par)
Result('Iw-3d','window n5=1 f5=%(iframe)d n4=1 |' %par
+ fdmod.cgrey3d('pclip=99.9 flat=n screenlg=5 color=j'+center,par))
Result('Id-3d',
'''
window n2=1 |
put
n1=%(nx)d o1=%(ox)g d1=%(dx)g label1=%(lx)s unit1=%(ux)s
n2=%(ny)d o2=%(oy)g d2=%(dy)g label2=%(ly)s unit1=%(uy)s
n3=%(nt)d o3=%(ot)g d3=%(dt)g label3=%(lt)s unit1=%(ut)s |
transp plane=23 |
transp plane=12 |
''' % par
+ fdmod.dgrey3d('pclip=99.9 flat=n color=j'+center+' frame1=%d' % (0.85*par['nt']) ,par))
for i in range(3):
tag = "%d"%i
Result('Iw-3d-'+tag,'Iw-3d',' window n5=1 f5=4 n4=1 f4=%d |'%i
+ fdmod.cgrey3d('pclip=99.9 flat=n color=j'+center+' movie=1 frame1=1',par))
End()
###########################################################################
Wavelet
Vp velocity model
Stiffness
Wave-field
3-ascii
1.00E-06
5.00E-07
0.00E+00
0
200
400
600
800
1000
-5.00E-07
-1.00E-06
-1.50E-06
-2.00E-06
3-ascii
1.00E-08
8.00E-09
6.00E-09
4.00E-09
2.00E-09
0.00E+00
-2.00E-09
100
200
300
400
500
600
700
-4.00E-09
-6.00E-09
-8.00E-09
-1.00E-08
800
900
1000
100
200
300
400
500
-0.000000001
-0.000000002
-0.000000003
Single Trace
600
700
800
900
1000
3E-13
2E-13
1E-13
0
0
100
200
300
400
500
-1E-13
-2E-13
-3E-13
Single Trace
600
700
800
900
1000