simpeg.regularization.CrossGradient#

class simpeg.regularization.CrossGradient(mesh, wire_map, approx_hessian=True, **kwargs)[source]#

Bases: BaseSimilarityMeasure

Cross-gradient regularization for joint inversion.

CrossGradient regularization is used to ensure the location and orientation of non-zero gradients in the recovered model are consistent across two physical property distributions. For joint inversion involving three or more physical properties, a separate instance of CrossGradient must be created for each physical property pair and added to the total regularization as a weighted sum.

Parameters:
meshsimpeg.regularization.RegularizationMesh, discretize.base.BaseMesh

Mesh on which the regularization is discretized. This is not necessarily the same as the mesh on which the simulation is defined.

active_cellsNone, (n_cells, ) numpy.ndarray of bool

Boolean array defining the set of RegularizationMesh cells that are active in the inversion. If None, all cells are active.

wire_mapsimpeg.maps.Wires

Wire map connecting physical properties defined on active cells of the RegularizationMesh` to the entire model.

reference_modelNone, (n_param, ) numpy.ndarray

Reference model. If None, the reference model in the inversion is set to the starting model.

unitsNone, str

Units for the model parameters. Some regularization classes behave differently depending on the units; e.g. ‘radian’.

weightsNone, dict

Weight multipliers to customize the least-squares function. Each key points to a (n_cells, ) numpy.ndarray that is defined on the RegularizationMesh.

approx_hessianbool

Whether to use the semi-positive definate approximation for the Hessian.

Attributes

W

Weighting matrix.

active_cells

Active cells defined on the regularization mesh.

approx_hessian

Whether to use the semi-positive definate approximation for the Hessian.

cell_weights

Deprecated property for 'volume' and user defined weights.

indActive

active_cells.indActive has been deprecated.

mapping

Mapping from the inversion model parameters to the regularization mesh.

model

The model parameters.

mref

reference_model.mref has been deprecated.

nP

Number of model parameters.

parent

The parent objective function

reference_model

Reference model.

regmesh

regularization_mesh.regmesh has been deprecated.

regularization_mesh

Regularization mesh.

units

Units for the model parameters.

weights_keys

Return the keys for the existing cell weights

wire_map

Mapping from model to physical properties defined on the regularization mesh.

Methods

__call__(model)

Evaluate the cross-gradient regularization function for the model provided.

calculate_cross_gradient(model[, ...])

Calculates the magnitudes of the cross-gradient vectors at cell centers.

deriv(model)

Gradient of the regularization function evaluated for the model provided.

deriv2(model[, v])

Hessian of the regularization function evaluated for the model provided.

f_m(m)

Not implemented for BaseRegularization class.

f_m_deriv(m)

Not implemented for BaseRegularization class.

get_weights(key)

Cell weights for a given key.

map_class

alias of IdentityMap

remove_weights(key)

Removes the weights for the key provided.

set_weights(**weights)

Adds (or updates) the specified weights to the regularization.

test([x, num, random_seed])

Run a convergence test on both the first and second derivatives.

Notes

Consider the case where the model is comprised of two physical properties \(m_1\) and \(m_2\). Here, we define the regularization function (objective function) for cross-gradient as (Haber and Gazit, 2013):

\[\phi (m_1, m_2) = \int_\Omega \, w(r) \, \Big | \nabla m_1 \, \times \, \nabla m_2 \, \Big |^2 \, dv\]

where \(w(r)\) is a user-defined weighting function. Using the identity \(| \vec{a} \times \vec{b} |^2 = | \vec{a} |^2 | \vec{b} |^2 - (\vec{a} \cdot \vec{b})^2\), the regularization function can be re-expressed as:

\[\phi (m_1, m_2) = \int_\Omega \, w(r) \, \Big [ \, \big | \nabla m_1 \big |^2 \big | \nabla m_2 \big |^2 - \big ( \nabla m_1 \, \cdot \, \nabla m_2 \, \big )^2 \Big ] \, dv\]

For implementation within SimPEG, the regularization function and its variables must be discretized onto a mesh. The discretized approximation for the regularization function (objective function) is given by:

\[\phi (m_1, m_2) \approx \sum_i \tilde{w}_i \, \bigg [ \Big | (\nabla m_1)_i \Big |^2 \Big | (\nabla m_2)_i \Big |^2 - \Big [ (\nabla m_1)_i \, \cdot \, (\nabla m_2)_i \, \Big ]^2 \, \bigg ]\]

where \((\nabla m_1)_i\) are the gradients of property \(m_1\) defined on the mesh and \(\tilde{w}_i \in \mathbf{\tilde{w}}\) are amalgamated weighting constants that 1) account for cell dimensions in the discretization and 2) apply any user-defined weighting.

In practice, we define the model \(\mathbf{m}\) as a discrete vector of the form:

\[\begin{split}\mathbf{m} = \begin{bmatrix} \mathbf{m_1} \\ \mathbf{m_2} \end{bmatrix}\end{split}\]

where \(\mathbf{m_1}\) and \(\mathbf{m_2}\) are the discrete representations of the respective physical properties on the mesh. The discrete regularization function is therefore equivalent to an objective function of the form:

\[\phi (\mathbf{m}) = \Big [ \mathbf{W A} \big ( \mathbf{G \, m_1} \big )^2 \Big ]^T \Big [ \mathbf{W A} \big ( \mathbf{G \, m_2} \big )^2 \Big ] - \bigg \| \mathbf{W A} \Big [ \big ( \mathbf{G \, m_1} \big ) \odot \big ( \mathbf{G \, m_2} \big ) \Big ] \bigg \|^2\]

where exponents are computed elementwise,

  • \(\mathbf{G}\) is the cell gradient operator (cell centers to faces),

  • \(\mathbf{A}\) averages vectors from faces to cell centers, and

  • \(\mathbf{W}\) is the weighting matrix.

Custom weights and the weighting matrix:

Let \(\mathbf{w_1, \; w_2, \; w_3, \; ...}\) each represent an optional set of custom cell weights. The weighting applied within the objective function is given by:

\[\mathbf{\tilde{w}} = \mathbf{v} \odot \prod_j \mathbf{w_j}\]

where \(\mathbf{v}\) are the cell volumes. The weighting matrix used to apply weights within the regularization is given by:

\[\mathbf{W} = \textrm{diag} \Big ( \, \mathbf{\tilde{w}}^{1/2} \Big )\]

Each set of custom cell weights is stored within a dict as an (n_cells, ) numpy.ndarray. The weights can be set all at once during instantiation with the weights keyword argument as follows:

>>> reg = CrossGradient(mesh, wire_map, weights={'weights_1': array_1, 'weights_2': array_2})

or set after instantiation using the set_weights method:

>>> reg.set_weights(weights_1=array_1, weights_2=array_2})

The default weights that account for cell dimensions in the regularization are accessed via:

>>> reg.get_weights('volume')

Galleries and Tutorials using simpeg.regularization.CrossGradient#

Cross-gradient Joint Inversion of Gravity and Magnetic Anomaly Data

Cross-gradient Joint Inversion of Gravity and Magnetic Anomaly Data