PeriodicBoundaryCondition
PeriodicBoundaryCondition[u[x_{1},…],pred,f]
represents a periodic boundary condition for all x_{target} on the boundary of the region given to NDSolve where pred is True.
PeriodicBoundaryCondition[a+b u[x_{1},…],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,{u_{1},u_{2},…},{x_{1},x_{2},…}∈Ω], x_{i} are the independent variables, u_{j} 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[…,x_{i,min},…]u[…,x_{i,max},…] is taken to be equivalent to PeriodicBoundaryCondition[u[…,x_{i},…],x_{i}x_{i,max},f] with f=TranslationTransform[{…,0,x_{i,min}x_{i,max},0,…}]. »
 Any logical combination of equalities and inequalities in the independent variables x_{1},… may be used for the predicate pred.
 In PeriodicBoundaryCondition[a+b u[x_{1},…],pred,f], for any point x_{target} in the part of ∂Ω where pred is True, then x_{source}=f[x_{target]} should be a point in ∂Ω where pred is not True.
 With PeriodicBoundaryCondition[a+b u[x_{1},…],pred,f], in NDSolve the system matrices are modified so that the solution values u[x_{target}] approximately satisfy u[x_{target}]==a+b u[x_{source}] for all x_{target} 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[x_{1},…],pred,f], both a and b are scalar values that may depend on any of the independent variables x_{i}, including time.
 Antiperiodic boundaries may be specified using PeriodicBoundaryCondition[u[x_{1},…],pred,f].
 Common values for a and b include:

u[x_{1},…] periodic boundary condition u[x_{1},…] antiperiodic boundary condition a u[x_{1},…] scaled periodic boundary condition u[x_{1},…]+b offset periodic boundary condition
Examples
open allclose allBasic Examples (2)
Scope (15)
1D Eigenvalue Problems (7)
Find 5 eigenvalues and eigenvectors of a Mathieu equation:
Inspect to see that the bounds are periodic:
Find 5 eigenvalues and eigenvectors of a Laplacian with antiperiodic bounds:
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:
Find 5 eigenvalues and eigenvectors of a Sturm–Liouville operator with a symmetric potential:
Recompute the eigenvalues with higher resolution:
Find 5 periodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:
Find 5 antiperiodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:
Inspect to see that the eigenvectors add up at the endpoints:
Find 5 relational antiperiodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:
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:
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:
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 Laplacetype equation over a rectangle with a DirichletCondition at the lowerleft corner and periodic boundary conditions linking the opposite sides:
Inspect the difference of the solution at the boundaries:
Note that the DirichletCondition in the lowerleft corner has been propagated to the remaining corners:
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:
Compare to an antiperiodic solution:
The lower and upper parts are subject to a DirichletCondition:
The lefthand edge is the target of the relational boundary condition of the righthand edge (the source):
Solve and visualize the equation:
Inspect to see that the periodic boundaries have the correct relation:
2D+Time PDE Problems (1)
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:
Possible Issues (6)
Exclusively specifying periodic boundary condition for stationary PDEs may result in a nonunique 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:
Compare to the solution where the source is on the boundary:
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 lefthand edge is the target boundary to the righthand edge (the source):
Solve and visualize the equation:
Inspect the values at the periodic boundaries:
In the second example, the righthand edge is a target boundary to the lefthand 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 lefthand side and the higher right to the lower lefthand side:
The lefthand side is a target boundary to the righthand side:
Solve and visualize the equation:
Compare to mapping in the same direction but with flipped edges; the lower right to the lower lefthand side and the higher right to the higher lefthand side:
The lefthand side is a target boundary to the righthand 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 timedependent 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.