Exemplo n.º 1
0
    smooth(initial_vp, solver.model.vp)
    dm = solver.model.vp - initial_vp

    info("Applying Adjoint")
    solver.adjoint(rec, autotune=autotune)
    info("Applying Born")
    solver.jacobian(dm, autotune=autotune)
    info("Applying Gradient")
    solver.jacobian_adjoint(rec, u, autotune=autotune)
    return summary.gflopss, summary.oi, summary.timings, [rec, u.data]


if __name__ == "__main__":
    description = (
        "Example script for a set of SSA isotropic-acoustic operators.")
    args = seismic_args(description)

    # 3D preset parameters
    ndim = args.ndim
    shape = args.shape[:args.ndim]
    spacing = tuple(ndim * [15.0])
    tn = 750. if ndim < 3 else 250.

    run(shape=shape,
        spacing=spacing,
        nbl=args.nbl,
        tn=tn,
        autotune=args.autotune,
        space_order=args.space_order,
        opt=args.opt,
        full_run=args.full)
Exemplo n.º 2
0
@pytest.mark.parametrize('shape', [(51, 51), (16, 16, 16)])
@pytest.mark.parametrize('kernel', ['centered', 'staggered'])
def test_tti_stability(shape, kernel):
    spacing = tuple([20] * len(shape))
    _, _, _, [rec, _, _] = run(shape=shape,
                               spacing=spacing,
                               kernel=kernel,
                               tn=16000.0,
                               nbl=0)
    assert np.isfinite(norm(rec))


if __name__ == "__main__":
    description = ("Example script to execute a TTI forward operator.")
    parser = seismic_args(description)
    parser.add_argument('--noazimuth',
                        dest='azi',
                        default=False,
                        action='store_true',
                        help="Whether or not to use an azimuth angle")
    parser.add_argument("-k",
                        dest="kernel",
                        default='centered',
                        choices=['centered', 'staggered'],
                        help="Choice of finite-difference kernel")
    args = parser.parse_args()

    # Switch to TTI kernel if input is acoustic kernel
    preset = 'layers-tti-noazimuth' if args.azi else 'layers-tti'
Exemplo n.º 3
0
    # Define receiver geometry (spread across x, just below surface)
    rec1, rec2, v, tau, summary = solver.forward(autotune=autotune)

    return (summary.gflopss, summary.oi, summary.timings, [rec1, rec2, v, tau])


def test_elastic():
    _, _, _, [rec1, rec2, v, tau] = run()
    norm = lambda x: np.linalg.norm(x.data.reshape(-1))
    assert np.isclose(norm(rec1), 20.59193, atol=1e-3, rtol=0)
    assert np.isclose(norm(rec2), 0.671578, atol=1e-3, rtol=0)


if __name__ == "__main__":
    description = ("Example script for a set of elastic operators.")
    args = seismic_args(description).parse_args()
    # Preset parameters
    ndim = args.ndim
    shape = args.shape[:args.ndim]
    spacing = tuple(ndim * [10.0])
    tn = args.tn if args.tn > 0 else (750. if ndim < 3 else 1250.)

    run(shape=shape,
        spacing=spacing,
        nbl=args.nbl,
        tn=tn,
        opt=args.opt,
        space_order=args.space_order,
        autotune=args.autotune,
        constant=args.constant)