Wave Solvers (pysit.solvers
)¶
Introduction¶
The solvers
module of PySIT is where the actual numerical solvers of the PDEs
relevant to FWI are found. The PDE solvers in this module are, in a sense, the
lowest level of the FWI ‘stack’.
Solver objects are used directly by the modeling operators in pysit.modeling
.
That is, we denote that the modeling operation, acting upon a set of physical
parameters and producing a set of wavefields, \(\mathcal{F}(m) = u\) is
equivalent to solving the PDE
where \(x\) is a generalized spatial variable and \(\cdot\) is a placeholder for the dynamic variable (usually either \(t\) or \(\omega\)).
This module is for solving \(Lu=f\).
Getting Started¶
The most userfriendly way to instantiate a solver is through the solver factory interface:
from pysit import ConstantDensityAcousticWave
solver = ConstantDensityAcousticWave(mesh)
The above code will instantiate the most basic leapfrog based solver for the scalar constant density acoustic wave equation, secondorder accurate in both space and time. The correct solver class for that combination of physical dimension and boundary conditions will be selected.
A higher order solver can be obtained by adding an additional option:
solver = ConstantDensityAcoustic(mesh, spatial_accuracy_order=4)
A faster (implemented in C++) version of the same solver kernel is obtained by:
solver = ConstantDensityAcoustic(mesh, kernel_implementation='cpp')
There are a variety of options associated with each solver class that can be used to help select a specific class.
Using solvers
¶
Anatomy of a PySIT Solver¶
A solver in PySIT is a class that has a mechanism for taking a righthand side wavefield \(f\) and a set of physical parameters \(m\) and producing a wavefield \(u\) by solving \(L(m)u=f\).
All PySIT solvers must expose the following functionality:
ModelParameters
: A class attribute class describing the set of physical parameters that the solver operates on. The particular parameters, e.g., acoustic velocity, are induced by theequation_physics
.WavefieldVector
: A class attribute class describing the vector of wavefields produced by a given solver._SolverData
: A private class attribute class describing an internal representation of all data needed to perform a single timestep or solve with the solver._process_mp_reset()
: An optional private member function that can be used to process any internal change of state when the underlying model parameters are changed (e.g., after an FWI update). For example, a timedomain solver might require that the time step length change based on the CFL condition.compute_dWaveOp()
: A member function that applies the derivative of the wave operator (\(L\)), \(\frac{\delta}{\delta m}L\), to a wavefield, with all relevant data specified by the solver’sSolverData
member.supports
: A public class attribute dictionary whose keys are names of properties supported by the solver and the values are the supported ‘implementation’. For example, a solver that uses finite differences in the spatial discretization might have support key'spatial_discretization'
with value['fd', 'finitedifference']
. This information is used in the solver factory to dispatch a compatible solver, given the requested properties and can be used to ensure that solvers are compatible with other components of PySIT. See Factories for more details.mesh
: A public instance attribute describing the computational mesh upon which the solver operates.domain
: A public instance attribute describing the physical domain, derived from themesh
attribute.operator_components
: A public instance attribute of typeBunch
that provides a convenient storage location for items (e.g., matrices) that can be precomputed._rebuild_operators()
: An optional private member function for recomputing precomputed elements.
Additionally, timedynamic (timedomain) solvers must support:
time_step()
: A public member function that computes the wavefield \(u(t + \delta t)\) given the current and past wavefields, stored in aSolverData
object, and a righthand side.
Additionally, frequencydynamic (frequencydomain) solvers must support:
solvers
: A public instance attribute of typeConstructableDict
which stores callable functions (values) which solve the PDE at a given frequency (keys) for a provided righthand side.linear_operators
: A public instance attribute of typeConstructableDict
which stores precomputed linear operators or matrices (values) for the PDE at a given frequency (keys).
Extending solvers
¶
Reference/API¶
pysit.solvers Package¶
Classes¶
AcousticParameters (mesh[, inputs, …]) 

BulkModulus 

ConstantDensityAcousticParameters (mesh[, …]) 

Density 

ModelParameterBase (mesh[, inputs, …]) 
Container class for the model parameters for the wave and Helmholtz equations in question. 
ModelPerturbationBase (mesh[, padded, inputs]) 

WaveSpeed 