4.3.7 pde.pdes.laplace module

Solvers for Poisson’s and Laplace’s equation

solve_laplace_equation(grid, bc, label="Solution to Laplace's equation")[source]

Solve Laplace’s equation on a given grid.

This is implemented by calling solve_poisson_equation() with a vanishing right hand side.

Parameters:
  • grid (GridBase) – The grid on which the equation is solved

  • bc (BoundariesData) – The boundary conditions applied to the field. Boundary conditions are generally given as a list with one condition for each axis. For periodic axes, only periodic boundary conditions are allowed (indicated by ‘periodic’ and ‘anti-periodic’). For non- periodic axes, different boundary conditions can be specified for the lower and upper end (using a tuple of two conditions). For instance, Dirichlet conditions enforcing a value NUM (specified by {‘value’: NUM}) and Neumann conditions enforcing the value DERIV for the derivative in the normal direction (specified by {‘derivative’: DERIV}) are supported. Note that the special value ‘natural’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

  • label (str) – The label of the returned field.

Returns:

The field that solves the equation. This field will be defined on the given grid.

Return type:

ScalarField

solve_poisson_equation(rhs, bc, label="Solution to Poisson's equation", **kwargs)[source]

Solve Laplace’s equation on a given grid

Denoting the current field by \(u\), we thus solve for \(f\), defined by the equation

\[\nabla^2 u(\boldsymbol r) = -f(\boldsymbol r)\]

with boundary conditions specified by bc.

Note

In case of periodic or Neumann boundary conditions, the right hand side \(f(\boldsymbol r)\) needs to satisfy the following condition

\[\int f \, \mathrm{d}V = \oint g \, \mathrm{d}S \;,\]

where \(g\) denotes the function specifying the outwards derivative for Neumann conditions. Note that for periodic boundaries \(g\) vanishes, so that this condition implies that the integral over \(f\) must vanish for neutral Neumann or periodic conditions.

Parameters:
  • rhs (ScalarField) – The scalar field \(f\) describing the right hand side

  • bc (BoundariesData) – The boundary conditions applied to the field. Boundary conditions are generally given as a list with one condition for each axis. For periodic axes, only periodic boundary conditions are allowed (indicated by ‘periodic’ and ‘anti-periodic’). For non- periodic axes, different boundary conditions can be specified for the lower and upper end (using a tuple of two conditions). For instance, Dirichlet conditions enforcing a value NUM (specified by {‘value’: NUM}) and Neumann conditions enforcing the value DERIV for the derivative in the normal direction (specified by {‘derivative’: DERIV}) are supported. Note that the special value ‘natural’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

  • label (str) – The label of the returned field.

Returns:

The field \(u\) that solves the equation. This field will be defined on the same grid as rhs.

Return type:

ScalarField