pylops_mpi.basicoperators.MPIFirstDerivative#

class pylops_mpi.basicoperators.MPIFirstDerivative(dims, sampling=1.0, kind='centered', edge=False, order=3, base_comm=<mpi4py.MPI.Intracomm object>, dtype=<class 'numpy.float64'>)[source]#

MPI First Derivative

Apply a first derivative using a multiple-point stencil finite-difference approximation with pylops_mpi.DistributedArray. The First-Derivative is calculated along axis=0.

Parameters:
dimsint or tuple

Number of samples for each dimension.

samplingfloat, optional

Sampling step \(\Delta x\).

kindstr, optional

Derivative kind (forward, centered, or backward).

edgebool, optional

Use reduced order derivative at edges (True) or ignore them (False). This is currently only available for centered derivative.

orderint, optional

Derivative order (3 or 5). This is currently only available for centered derivative.

base_commmpi4py.MPI.Comm, optional

MPI Base Communicator. Defaults to mpi4py.MPI.COMM_WORLD.

dtypestr, optional

Type of elements in the input array.

Attributes:
shapetuple

Operator shape

Notes

The MPIFirstDerivative operator applies a first derivative to a pylops_mpi.DistributedArray using either a first-order backward and forward stencil or a second or third ordered centered stencil.

When computing the first derivative using a pylops_mpi.DistributedArray, a technique named ghosting is employed, often in conjunction with MPI for communication between different processes. Ghosting involves creating additional “ghost cells” around the boundary of each process’s local data domain. These ghost cells are replicated copies of the border cells from neighboring processes, these cells allow each process to perform local computations without the need for explicit communication with other processes.

Now, for a one-dimensional DistributedArray, the first order forward stencil is:

\[y[i] = (x[i+1] - x[i]) / \Delta x\]

while the first order backward stencil is:

\[y[i] = (x[i] - x[i-1]) / \Delta x\]

and the second-order centered stencil is:

\[y[i] = 0.5 * (x[i+1] - x[i-1]) / \Delta x\]

where \(y\) is a DistributedArray and \(x\) is a Ghosted array created by adding border cells of neighboring processes to the local array at each rank.

Formulas for the third-order centered stencil can be found at this link.

Methods

__init__(dims[, sampling, kind, edge, ...])

adjoint()

Adjoint MPI LinearOperator

conj()

Complex conjugate operator

dot(x)

Matrix Vector Multiplication

matvec(x)

Matrix-vector multiplication.

rmatvec(x)

Adjoint Matrix-vector multiplication.

transpose()

Transposition of MPI LinearOperator