Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yongmayer committed Aug 6, 2021
1 parent a1525c6 commit 879e691
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 1,151 deletions.
5 changes: 4 additions & 1 deletion FWI/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# FWI
Python scripts to call Java programs for modeling, imaging, and inversion.
Python scripts to call Java programs for:
modeling ([mod](https://github.com/yongmayer/CompGeo/tree/main/FWI/SMFWI/mod))
imaging ([mig](https://github.com/yongmayer/CompGeo/tree/main/FWI/SMFWI/mig))
inversion ([inv](https://github.com/yongmayer/CompGeo/tree/main/FWI/SMFWI/fwi))
Binary file modified FWI/SMFWI/.DS_Store
Binary file not shown.
40 changes: 31 additions & 9 deletions FWI/SMFWI/fwi/inv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from utility import *

"""
2D acoustic full-waveform inversion
"""

freq = 12.0
cfile = wDir+"/./COORD/coords_ns11.txt"

Expand All @@ -16,11 +20,9 @@
groldfile = wDir+"/./grold.dat"
#############################################################################
def main(args):
ns = Coords.countShots(cfile)
sc = Coords.getSources(cfile, ns)
ng = Coords.countReceivers(cfile, ns)
gc = Coords.getReceivers(cfile, ns, ng)
##
# set up geometry
ns, sc, ng, gc = setGeom(cfile)
# prepare model and density
v = readImage(vinit,nz,nx)
v = ArraySegment.cutM(v,20,nz,0,nx)
vt= readImage(vtrue,nz,nx)
Expand All @@ -29,16 +31,17 @@ def main(args):
writeImage(vinput,v)
s = div(1.0,v)
d = add(sub(v,v),1.0)
##
# prepapre source wavelet
sou = FwiUtil.genRicker(nt, 150, freq, dt)
##
# inversion loop
for i in range(niter):
iter = i+1
iter = i+1 # iteration number
## forward modeling synthetic data and gradient calculation
if iter>1:
v = readImage(vinput,nz,nx)
Inv.partOne(sou, dt, ng, sc, gc, pml, dz, dx, v, d, wDir, iter)
##

## save gradient for CG
g = readImage(gfile,nz,nx)
g = ArraySegment.cutM(g,20,nz,0,nx)
writeImage(gbpfile, g)
Expand All @@ -48,10 +51,29 @@ def main(args):
gold = readImage(goldfile,nz,nx)
gold = ArraySegment.cutM(gold,20,nz,0,nx)
writeImage(groldfile, gold)

# line-search and update vel
Inv.partTwo(sou, dt, ng, sc, gc, pml, dz, dx, v, d, wDir, iter)
return

def setGeom(coord_file):
"""
setup geometry
Args:
coord_file (name): file name contains the acqusition geometry
Returns:
nsrc: number of shots
sloc: source locations
nrec: number of receivers
rloc: receiver locations
"""
nsrc = Coords.countShots(cfile)
sloc = Coords.getSources(cfile, nsrc)
nrec = Coords.countReceivers(cfile, nsrc)
rloc = Coords.getReceivers(cfile, nsrc, nrec)
return nsrc, sloc, nrec, rloc
#############################################################################
class RunMain(Runnable):
def run(self):
Expand Down
138 changes: 0 additions & 138 deletions FWI/SMFWI/fwi/plot.py

This file was deleted.

Binary file removed FWI/SMFWI/igfwi/.DS_Store
Binary file not shown.
Loading

0 comments on commit 879e691

Please sign in to comment.