/* extrap.java Wavefield extrapolation program for monochromatic waves. Computes a number of x-z timeslices, displayed as a movie. Adapted from Jon Claerbout's Imaging the Earth's Interior (1985), p. 105, by John N. Louie, 28 November 1998. */ /* Include the usual classes */ import java.util.*; import java.io.*; import java.lang.Math; /* Declare a class with a main() method to contain the finite-difference code. */ /* When you change the code in this file, make a copy to a new file with a new name like "ex1extrap.java", and be sure to make the same change to the class name below - e.g. "class ex1extrap" */ class extrap { /* The main() method compiles into a file named "extrap.class" that you run in the Java virtual machine as a stand-alone application with a command such as "java extrap"; or however you have renamed it. */ public static void main(String args[]) /* No runtime arguments needed */ { System.out.println("Starting extrap..."); /* Declare variables */ int ix, nx, iz, nz, iw, nw, it, nt; float phase, pi2, dx, dz, v; float z0, x0, dt, dw, lambda, w, wov, x; Complex aa = new Complex(); Complex a = new Complex(); Complex b = new Complex(); Complex c = new Complex(); Complex cshift = new Complex(); Complex num = new Complex(); Complex den = new Complex(); Complex num2 = new Complex(); Complex bl = new Complex(); Complex br = new Complex(); Complex qm1 = new Complex(); Complex qnx = new Complex(); Complex star[][]; /* We let star[][] be a simple 2-d array of class Complex objects, but it is easier to let p be a class FltVol object from the JRG package, and cd, ce, cf, and q to be class ComplexVec. */ FltVol p; ComplexVec cd, ce, cf, q; /* Set dimensions */ nt = 12; nx = 48; nz = 96; dx = 2; dz = 1; /* Dimension arrays */ p = new FltVol(nt, nx, nz); cd = new ComplexVec(nx); ce = new ComplexVec(nx); cf = new ComplexVec(nx); q = new ComplexVec(nx); star = new Complex[2][3]; /* Still have to actually create the class Complex objects referenced by the star 2-d array. */ /* 2 frequencies */ nw = 2; /* Initialize constants */ pi2 = (float)(2.0*Math.PI); v = 1; lambda = nz*dz/4F; dw = v*pi2/lambda; dt = pi2/(nt*dw); /* Boundary Conditions */ /* Zero-slope boundary */ bl.re = 1.0F; bl.im = 0.0F; br.re = 1.0F; br.im = 0.0F; /* Superimpose nw frequencies */ for (iw=0; iw=0; i--) { num.mul(e.vec[i],q.vec[i+1]); num.add(num,f.vec[i]); q.vec[i].re = num.re; q.vec[i].im = num.im; } /* End of ctris static method of class extrap */ } /* End of methods in class extrap */ }