PeriodicBoundaryCondition

PeriodicBoundaryCondition[u[x1,],pred,f]

represents a periodic boundary condition for all xtarget on the boundary of the region given to NDSolve where pred is True.

PeriodicBoundaryCondition[a+b u[x1,],pred,f]

represents a generalized periodic boundary condition .

Details

  • PeriodicBoundaryCondition is used together with differential equations to describe boundary conditions in functions such as NDSolve.
  • In NDSolve[eqns,{u1,u2,},{x1,x2,}Ω], xi are the independent variables, uj are the dependent variables, and Ω is the region with boundary Ω.
  • Locations where periodic boundary conditions might be specified are shown in blue. They appear on the boundary Ω of the region Ω and specify the relation of the solution at those locations to the locations shown in green. The function f maps from the blue locations to the green locations.
  • In the special case of rectangular region Ω, a boundary equation u[,xi,min,]u[,xi,max,] is taken to be equivalent to PeriodicBoundaryCondition[u[,xi,],xixi,max,f] with f=TranslationTransform[{,0,xi,min-xi,max,0,}]. »
  • Any logical combination of equalities and inequalities in the independent variables x1, may be used for the predicate pred.
  • In PeriodicBoundaryCondition[a+b u[x1,],pred,f], for any point xtarget in the part of Ω where pred is True, then xsource=f[xtarget] should be a point in Ω where pred is not True.
  • With PeriodicBoundaryCondition[a+b u[x1,],pred,f], in NDSolve the system matrices are modified so that the solution values u[xtarget] approximately satisfy u[xtarget]==a+b u[xsource] for all xtarget on the boundary of Ω where pred is True.
  • Boundary conditions for , including implicit Neumann 0 conditions, will also be mapped to .
  • In PeriodicBoundaryCondition[a+b u[x1,],pred,f], both a and b are scalar values that may depend on any of the independent variables xi, including time.
  • Antiperiodic boundaries may be specified using PeriodicBoundaryCondition[-u[x1,],pred,f].
  • Common values for a and b include:
  • u[x1,]periodic boundary condition
    -u[x1,]anti-periodic boundary condition
    a u[x1,]scaled periodic boundary condition
    u[x1,]+boffset periodic boundary condition

Examples

open allclose all

Basic Examples  (2)

Find 5 eigenvalues and eigenvectors of a Laplacian with periodic boundary conditions:

Compare the eigenvalues with the expected analytical eigenvalues:

Visualize the eigenfunctions:

Inspect to see that the bounds are periodic:

Solve a Poisson equation with periodic boundary conditions on curved boundaries:

Visualize the solution:

Visualize the periodic solution:

Scope  (15)

1D Eigenvalue Problems  (7)

Find 5 eigenvalues and eigenvectors of a Mathieu equation:

Visualize the eigenfunctions:

Inspect to see that the bounds are periodic:

This is equivalent:

Find 5 eigenvalues and eigenvectors of a Laplacian with antiperiodic bounds:

Inspect the eigenvalues:

Visualize the eigenfunctions:

Inspect to see that the eigenvectors add up at the endpoints:

Find 9 eigenvalues and eigenvectors of the Meissner equation on a refined mesh:

Compare the eigenvalues with the expected analytical eigenvalues:

Visualize the eigenfunctions:

Find 5 eigenvalues and eigenvectors of a SturmLiouville operator with a symmetric potential:

Inspect the eigenvalues:

Recompute the eigenvalues with higher resolution:

Visualize the eigenfunctions:

Find 5 periodic eigenvalues and eigenvectors of a SturmLiouville operator with an unsymmetrical potential:

Inspect the eigenvalues:

Visualize the eigenfunctions:

Find 5 antiperiodic eigenvalues and eigenvectors of a SturmLiouville operator with an unsymmetrical potential:

Inspect the eigenvalues:

Visualize the eigenfunctions:

Inspect to see that the eigenvectors add up at the endpoints:

Find 5 relational antiperiodic eigenvalues and eigenvectors of a SturmLiouville operator with an unsymmetrical potential:

Inspect the eigenvalues:

Visualize the eigenfunctions:

Inspect to see that the eigenvectors match the relation at the endpoints:

1D+Time PDE Problems  (2)

Solve a 1D Schrödinger equation with periodic boundary conditions:

Visualize the wavefunction:

Solve a 1D wave equation with periodic boundary conditions:

Visualize the periodic wavefunction:

The previous example used as a target. In this case, the target is placed where the flux is entering the periodic domain.

If instead is the target, the wave pulse inverts when reaching and then moves backward. At an implicit Neumann 0 boundary condition imposes a hard boundary condition and the pulse is reflecting off that hard boundary:

Compare the two periodic wavefunctions:

2D PDE Problems  (4)

Set up a rectangular region to solve a PDE with a DirichletCondition on the top and bottom:

To implement a periodic boundary condition, specify a mapping f from the target (x==0) to the source (x==2):

Visualize the region Ω and the source of the periodic boundary condition in green and the target in blue:

Specify the periodic boundary condition using the mapping function f:

Solve and visualize the equation:

Find the solution to a Laplace-type equation over a rectangle with a DirichletCondition at the lower-left corner and periodic boundary conditions linking the opposite sides:

Visualize the result:

Inspect the difference of the solution at the boundaries:

Note that the DirichletCondition in the lower-left corner has been propagated to the remaining corners:

Specify a region:

Show the region and the boundaries:

Find a mapping f that maps from the target (blue) to the source (green):

Solve a Poisson equation with internal heat generation and a fixed temperature set on the orange boundaries, and a periodic boundary condition linking the green source and the blue target boundary:

Inspect to see that the periodic boundaries have the same values:

Visualize the solution:

Compare to an antiperiodic solution:

Specify a region:

The lower and upper parts are subject to a DirichletCondition:

The left-hand edge is the target of the relational boundary condition of the right-hand edge (the source):

Solve and visualize the equation:

Inspect to see that the periodic boundaries have the correct relation:

2D+Time PDE Problems  (1)

Solve a 2D time-dependent Schrödinger equation with a potential fitting the box and with periodic boundary conditions:

Visualize the wavefunction:

3D Problems  (1)

Solve a Poisson equation in a cuboid with periodic boundary conditions:

Visualize the solution:

Applications  (1)

Compute eigenvalues of a Laplacian in polar coordinates over a Disk:

Analytically compute the eigenvalues of a Laplacian in Cartesian coordinates over a Disk:

Compare the eigenvalues computed:

Numerically compute the eigenvalues of a Laplacian in Cartesian coordinates over a Disk:

Compare the numerically computed eigenvalues computed in Cartesian coordinates with the analytical solution:

Compare the numerically computed eigenvalues:

Possible Issues  (6)

Exclusively specifying periodic boundary condition for stationary PDEs may result in a non-unique solution. In some cases, the system may not be solvable at all:

Specify a DirichletCondition on the source boundary:

The source for the mapping f of the PeriodicBoundaryCondition need not necessarily be on the boundary of a domain:

Visualize the result:

Note that :

Compare to the solution where the source is on the boundary:

Visualize the result:

DirichletCondition cannot be present on the target boundary:

Moving the DirichletCondition to the source boundary works:

Periodic boundary conditions propagate the solution of a PDE from the source to the target boundary. The choice of which boundary is considered source and which is target has an influence on the solution of the PDE.

Consider a rectangular domain and an asymmetric Poisson equation:

The lower and upper parts are subject to a DirichletCondition:

First, the left-hand edge is the target boundary to the right-hand edge (the source):

Solve and visualize the equation:

Inspect the values at the periodic boundaries:

In the second example, the right-hand edge is a target boundary to the left-hand edge (the source):

Solve and visualize the equation:

Inspect the values at the periodic boundaries:

Periodic boundary conditions propagate the solution of a PDE from a source region to the target region. The direction of the mapping has an influence on the solution of the PDE.

Consider a rectangular domain and an asymmetric Poisson equation:

The lower and upper parts are subject to a DirichletCondition:

Map the lower right to the higher left-hand side and the higher right to the lower left-hand side:

The left-hand side is a target boundary to the right-hand side:

Solve and visualize the equation:

Compare to mapping in the same direction but with flipped edges; the lower right to the lower left-hand side and the higher right to the higher left-hand side:

The left-hand side is a target boundary to the right-hand side:

Solve and visualize the equation:

Periodic boundary conditions relate the solution of a PDE from the source to the target boundary. Boundary conditions present, also implicit ones, at the source will affect the solution at the target.

To exemplify the behavior, consider a time-dependent equation discretized with the finite element method. An initial condition u, implicit Neumann zero boundary conditions on both sides and no PeriodicBoundaryCondition are specified:

Visualize the solution at various times:

Note that at both spatial boundaries the implicit Neumann 0 boundary conditions are satisfied.

When a PeriodicBoundaryCondition is used on a source boundary that has an implicit Neumann 0 boundary condition, then that condition will be mapped to the target boundary.

Following is the solution of the same equation and initial condition as previously and an additional periodic boundary condition that has its source on the left and its target on the right:

Visualize the solution at various times:

Note how the solution value at the implicit Neumann 0 boundary condition on the left is mapped to the right.

This is the expected behavior for the finite element method. The tensor product grid method behaves differently, as that method does not have implicit boundary conditions:

Visualize the tensor product grid solution at various times:

A similar behavior can be achieved with the finite element method by specifying a DirichletCondition on the left and a PeriodicBoundaryCondition:

Visualize the difference between the finite element and tensor product grid solutions at various times:

Alternatively, a DirichletCondition could be specified at each side.

Neat Examples  (1)

Specify a region to solve a wave equation over a box:

Set up the mapping functions so that the colored edges match. The dashed lines are the respective targets:

Solve the wave equation on a fine mesh:

Visualize the wave propagating on the box:

Introduced in 2016
 (11.0)