xugrid.UgridDataArrayAccessor.laplace_interpolate#

UgridDataArrayAccessor.laplace_interpolate(xy_weights: bool = True, direct_solve: bool = False, delta=0.0, relax=0.0, tol: float = 1e-05, maxiter: int = 500)[source]#

Fill gaps in data (np.nan values) using Laplace interpolation.

This solves Laplace’s equation where where there is no data, with data values functioning as fixed potential boundary conditions.

Note that an iterative solver method will be required for large grids. In this case, some experimentation with the solver settings may be required to find a converging solution of sufficient accuracy. Refer to the documentation of scipy.sparse.linalg.spilu() and scipy.sparse.linalg.cg().

Data can be interpolated from nodes or faces. Direct interpolation of edge associated data is not allowed. Instead, create node associated data first, then translate that data to the edges.

Parameters:
  • xy_weights (bool, default False.) – Wether to use the inverse of the centroid to centroid distance in the coefficient matrix. If False, defaults to uniform coefficients of 1 so that each face connection has equal weight.

  • direct_solve (bool, optional, default False) – Whether to use a direct or an iterative solver or a conjugate gradient solver. Direct method provides an exact answer, but are unsuitable for large problems.

  • delta (float, default 0.0.) – ILU0 preconditioner non-diagonally dominant correction.

  • relax (float, default 0.0.) – Modified ILU0 preconditioner relaxation factor.

  • tol (float, optional, default 1.0e-5.) – Convergence tolerance for scipy.sparse.linalg.cg.

  • maxiter (int, default 500.) – Maximum number of iterations for scipy.sparse.linalg.cg.

Returns:

filled

Return type:

UgridDataArray of floats