Example #1
0
 def critical_dt(self):
     """Critical computational time step value from the CFL condition."""
     # For a fixed time order this number goes down as the space order increases.
     #
     # The CFL condtion is then given by
     # dt < h / (sqrt(2) * max(vp)))
     return self.dtype(.5*mmin(self.spacing) / (np.sqrt(2)*mmax(self.vp)))
Example #2
0
 def _max_vp(self):
     """
     Maximum velocity
     """
     try:
         return np.sqrt(1. / mmin(self.m))
     except ValueError:
         return np.sqrt(1. / np.min(self.m))
Example #3
0
 def critical_dt(self):
     """Critical computational time step value from the CFL condition."""
     # For a fixed time order this number goes down as the space order increases.
     #
     # The CFL condtion is then given by
     # dt <= coeff * h / (max(velocity))
     coeff = 0.38 if len(self.shape) == 3 else 0.42
     dt = self.dtype(coeff * mmin(self.spacing) / (self.scale*mmax(self.vp)))
     return .001 * int(1000 * dt)
Example #4
0
 def critical_dt(self):
     """
     Critical computational time step value from the CFL condition.
     """
     # For a fixed time order this number goes down as the space order increases.
     #
     # The CFL condtion is then given by
     # dt < h / (sqrt(2) * max(vp)))
     return self.dtype(.5 * mmin(self.spacing) /
                       (np.sqrt(2) * mmax(self.vp)))
Example #5
0
 def critical_dt(self):
     """
     Critical computational time step value from the CFL condition.
     """
     # For a fixed time order this number decreases as the space order increases.
     # See Blanch, J. O., 1995, "A study of viscous effects in seismic modelling,
     # imaging, and inversion: methodology, computational aspects and sensitivity"
     # for further details:
     # FIXME: Fix 'Constant' so that that mmax(self.vp) returns the data value
     return self.dtype(6. * mmin(self.spacing) /
                       (7. * np.sqrt(self.grid.dim) * mmax(self.vp.data)))
Example #6
0
 def critical_dt(self):
     """
     Critical computational time step value from the CFL condition.
     """
     # For a fixed time order this number goes down as the space order increases.
     #
     # The CFL condtion is then given by
     # dt <= coeff * h / (max(velocity))
     coeff = 0.38 if len(self.shape) == 3 else 0.42
     dt = self.dtype(coeff * mmin(self.spacing) /
                     (self.scale * mmax(self.vp)))
     return .001 * int(1000 * dt)
Example #7
0
        # Compute smooth data and full forward wavefield u0
        _, u0, _ = solver.forward(vp=vp_in, save=True, rec=d_syn)

        # Compute gradient from data residual and update objective function
        residual = compute_residual(residual, d_obs, d_syn)

        objective += .5 * norm(residual)**2
        solver.gradient(rec=residual, u=u0, vp=vp_in, grad=grad)

    return objective, grad


# Compute gradient of initial model
ff, update = fwi_gradient(model0.vp)
print(ff, mmin(update), mmax(update))
assert np.isclose(ff, 57010, atol=1e1, rtol=0)
assert np.isclose(mmin(update), -1198, atol=1e1, rtol=0)
assert np.isclose(mmax(update), 3558, atol=1e1, rtol=0)

# Run FWI with gradient descent
history = np.zeros((fwi_iterations, 1))
for i in range(0, fwi_iterations):
    # Compute the functional value and gradient for the current
    # model estimate
    phi, direction = fwi_gradient(model0.vp)

    # Store the history of the functional values
    history[i] = phi

    # Artificial Step length for gradient descent