Interpolation

As the numeric solver does not accept non-grid domains, the package ships with a function that can interpolate between two coordinate sets.

Usage of bicubic_interpolate function is as follows:

from fast_poisson_solver import Solver, numeric_solve, bicubic_interpolate

solver = Solver()
solver.precompute(x_pde, y_pde, x_bc, y_bc)
u_ml, u_ml_pde, u_ml_bc, f_ml, t_ml = solver.solve(f, u_bc)

u_num_grid = numeric_solve(f_grid, x_pde_grid, y_pde_grid, u_bc_grid, x_bc_grid, y_bc_grid)

u_num = bicubic_interpolate(x_pde_grid, y_pde_grid, x_bc_grid, y_bc_grid, u_num_grid, x_pde, y_pde, x_bc, y_bc)

This performs a bicubic interpolation from the grid coordinates that the numeric solver needed to the coordinates the Solver takes.#

The function can also interpolate the source function. In this case domain=True hast to be specified, to do the interpolation only inside the domain.

bicubic_interpolate(x_pde_grid, y_pde_grid, x_bc_grid, y_bc_grid, f_grid, x_pde, y_pde, x_bc, y_bc, domain=True)

Note: In its current version this function needs the coordinates of the boundary even if domain=True.

fast_poisson_solver.bicubic_interpolate(x_pde_base, y_pde_base, x_bc_base, y_bc_base, v_base, x_pde_new, y_pde_new, x_bc_new, y_bc_new, domain=False)

Performs bicubic interpolation of a two-dimensional field.

The function performs bicubic interpolation of a field, which is defined by its values v_base at points (x_pde_base, y_pde_base) for the domain and (x_bc_base, y_bc_base) for the boundary. Interpolation is done at new points (x_pde_new, y_pde_new) for the domain and (x_bc_new, y_bc_new) for the boundary. Interpolation can be done only inside the domain, excluding the boundary, depending on the domain parameter.

Parameters:
x_pde_basetensor/array/list

x-coordinates of the PDE base points.

y_pde_basetensor/array/list

y-coordinates of the PDE base points.

x_bc_basetensor/array/list

x-coordinates of the boundary base points.

y_bc_basetensor/array/list

y-coordinates of the boundary base points.

v_basetensor/array/list

Values of the field at the base points.

x_pde_newtensor/array/list

x-coordinates of the new PDE points for interpolation.

y_pde_newtensor/array/list

y-coordinates of the new PDE points for interpolation.

x_bc_newtensor/array/list

x-coordinates of the new boundary points for interpolation.

y_bc_newtensor/array/list

y-coordinates of the new boundary points for interpolation.

domainbool, optional

If True, the interpolation is done only inside the domain, not on the boundary. Defaults to False.

Returns:
tensor/array/list

The interpolated field values at the new points.