4.4.8 pde.pdes.laplace module

Solvers for Poisson’s and Laplace’s equation.

solve_poisson_equation

Solve Poisson's equation on a given grid.

solve_laplace_equation

Solve Laplace's equation on a given grid.

helmholtz_decomposition

Return Helmholtz decomposition of a vector field.

helmholtz_decomposition(field, bc)[source]

Return Helmholtz decomposition of a vector field.

For a vector field \(\boldsymbol u\), we return a scalar potential \(\phi\) and a solenoidal (divergence-free) vector field \(\boldsymbol v\), which obey

\[\boldsymbol u = \nabla \phi + \boldsymbol v\]
Parameters:
  • field (VectorField) – The vector field \(u\) that needs to be decomposed.

  • bc (BoundariesData) – The boundary conditions applied to the field. Note that the same boundary conditions are also applied to when solving the Poisson equation to determine the potential. Boundary conditions are generally given as a dictionary with one condition for each axis side. 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 specific identifiers, like x- and y+). 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 ‘auto_periodic_neumann’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

Returns:

The two fields of the Helmholtz decomposition

Return type:

ScalarField, VectorField

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

Solve Laplace’s equation on a given grid.

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 dictionary with one condition for each axis side. 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 specific identifiers, like x- and y+). 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 ‘auto_periodic_neumann’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

  • backend (str) – The name of the backend to use to implement this operator.

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

Returns:

The field that solves the equation.

Return type:

ScalarField

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

Solve Poisson’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 dictionary with one condition for each axis side. 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 specific identifiers, like x- and y+). 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 ‘auto_periodic_neumann’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

  • backend (str) – The name of the backend to use to implement this operator.

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

  • **kwargs – Additional parameters influence how the Laplace operator is constructed.

Returns:

Field \(u\) solving the equation.

Return type:

ScalarField