seisflows.workflow.inversion

A seismic inversion (a.k.a full waveform inversion, adjoint tomography, full waveform tomography) perturbs seismic velocity models by minimizing objective functions defining differences between observed and synthetic waveforms.

This seismic inversion workflow performs a linear set of tasks involving:

  1. Generating synthetic seismograms using an external numerical solver

  2. Calculating time-dependent misfit (adjoint sources) between data

    (or other synthetics) and synthetics

  3. Using adjoint sources to generate misfit kernels defining volumetric

    perturbations sensitive to data-synthetic misfit

  4. Smoothing and summing misfit kernels into a single gradient

  5. Perturbing the starting model with the gradient to reduce misfit defined by

    the objective function during a line search

The Inversion workflow runs the above tasks in a loop (iterations) while exporting updated models, kernels and/or gradients to disk.

Module Contents

Classes

Inversion

Inversion Workflow

class seisflows.workflow.inversion.Inversion(modules=None, start=1, end=1, thrifty=False, optimize='LBFGS', export_model=True, path_eval_func=None, **kwargs)

Bases: seisflows.workflow.migration.Migration

Inversion Workflow

Peforms iterative nonlinear inversion using the machinery of the Forward and Migration workflows, as well as a built-in optimization library.

Parameters

type start

int

param start

start inversion workflow at this iteration. 1 <= start <= inf

type end

int

param end

end inversion workflow at this iteration. start <= end <= inf

type iteration

int

param iteration

The current iteration of the workflow. If NoneType, takes the value of start (i.e., first iteration of the workflow). User can also set between start and end to resume a failed workflow.

type thrifty

bool

param thrifty

a thrifty inversion skips the costly intialization step (i.e., forward simulations and misfit quantification) if the final forward simulations from the previous iterations line search can be used in the current one. Requires L-BFGS optimization.

type export_model

bool

param export_model

export best-fitting model from the line search to disk. If False, new models can be discarded from scratch at any time.

Paths

type path_eval_func

str

param path_eval_func

scratch path to store files for line search objective function evaluations, including models, misfit and residuals

***

property task_list

USER-DEFINED TASK LIST. This property defines a list of class methods that take NO INPUT and have NO RETURN STATEMENTS. This defines your linear workflow, i.e., these tasks are to be run in order from start to finish to complete a workflow.

This excludes ‘check’ (which is run during ‘import_seisflows’) and ‘setup’ which should be run separately

Note

For workflows that require an iterative approach (e.g. inversion), this task list will be looped over, so ensure that any setup and teardown tasks (run once per workflow, not once per iteration) are not included.

Return type

list

Returns

list of methods to call in order during a workflow

__doc__
check()

Checks inversion-specific parameters

setup()

Assigns modules as attributes of the workflow. I.e., self.solver to access the solver module (or workflow.solver from outside class)

Lays groundwork for inversion by running setup() functions for the involved sub-modules, generating True model synthetic data if necessary, and generating the pre-requisite database files.

run()

Call the forward.run() function iteratively, from start to end

checkpoint()

Add an additional line in the state file to keep track of iteration,

evaluate_objective_function(save_residuals=False, **kwargs)

Overwrite evaluate objective function to include MORE input parameters specifying which evaluation in the inversion we are at. Also removes the check for a preprocessing module because it is assumed we have a preprocsesing module for an inversion workflow.

Note

Must be run by system.run() so that solvers are assigned individual task ids/ working directories.

evaluate_initial_misfit()

Overwrite workflow.forward to skip over initial misfit evaluation (using MODEL_INIT) if we are past iteration 1. Additionally, sum residuals output by preprocess module and save float to disk, to be discoverable by the optimization library

evaluate_gradient_from_kernels()

Overwrite workflow.migration to convert the current model and the gradient calculated by migration from their native SPECFEM model format into optimization vectors that can be used for model updates.

Computes search direction using the optimization library and sets up line search machinery to ‘perform line search’ by placing correct files on disk for each of the modules to find.

Optimization module perturbs the current model (m_new) by the search direction (p_new) to recover the trial model (m_try). This model is then exposed on disk to the solver.

Conducts line search in given search direction until the objective function is reduced acceptably, or the line search fails due to user-defined limit criteria.

Note

Starts on step_count == 1 because step_count == 0 will be the misfit of the starting model

Status codes:

status > 0 : finished status == 0 : not finished status < 0 : failed

_evaluate_line_search_misfit()

Convenience fuinction to wrap forward solver and misfit calc

finalize_iteration()

Cleans directories in which function and gradient evaluations were carried out. Contains some logic to consider whether or not to continue with a thrifty inversion.

_update_thrifty_status()

Determine if line search forward simulation can be carried over to the next iteration. Checks criteria related to the current iteration and its position relative to the start and end of the workflow.

Note

Resumed, failed workflows will not re-load _thrifty_status so initial misfit will always be evaluated in that case.