PeriodicBoundaryCondition
✖
PeriodicBoundaryCondition
represents a periodic boundary condition for all xtarget on the boundary of the region given to NDSolve where pred is True.
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[xsource]==a+b u[xtarget] 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,…]+b offset periodic boundary condition - For finite element approximations, PeriodicBoundaryCondition operates on nodes in 1D, on edges in 2D and on faces in 3D.

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Find 5 eigenvalues and eigenvectors of a Laplacian with periodic boundary conditions:

https://wolfram.com/xid/0bswu24h9fy656tmxe-27yd3c
Compare the eigenvalues with the expected analytical eigenvalues:

https://wolfram.com/xid/0bswu24h9fy656tmxe-j364ca


https://wolfram.com/xid/0bswu24h9fy656tmxe-t36qjx

Inspect to see that the bounds are periodic:

https://wolfram.com/xid/0bswu24h9fy656tmxe-djrn9f

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-jn7cv9

https://wolfram.com/xid/0bswu24h9fy656tmxe-crc3eq

https://wolfram.com/xid/0bswu24h9fy656tmxe-tygyjc

Visualize the periodic solution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-pt7hmg

Scope (15)Survey of the scope of standard use cases
1D Eigenvalue Problems (7)
Find 5 eigenvalues and eigenvectors of a Mathieu equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-2ramyz

https://wolfram.com/xid/0bswu24h9fy656tmxe-wx9lkb

Inspect to see that the bounds are periodic:

https://wolfram.com/xid/0bswu24h9fy656tmxe-jbtl5h


https://wolfram.com/xid/0bswu24h9fy656tmxe-t0qhnz

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-et5uks

https://wolfram.com/xid/0bswu24h9fy656tmxe-8h2lrn


https://wolfram.com/xid/0bswu24h9fy656tmxe-9gyjs5

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-sj3nq0

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-b8pcvn
Compare the eigenvalues with the expected analytical eigenvalues:

https://wolfram.com/xid/0bswu24h9fy656tmxe-6a633q


https://wolfram.com/xid/0bswu24h9fy656tmxe-xevngu

Find 5 eigenvalues and eigenvectors of a Sturm–Liouville operator with a symmetric potential:

https://wolfram.com/xid/0bswu24h9fy656tmxe-m6ftp4

https://wolfram.com/xid/0bswu24h9fy656tmxe-r3zkj5

Recompute the eigenvalues with higher resolution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-4ygtps

https://wolfram.com/xid/0bswu24h9fy656tmxe-i0yxy9


https://wolfram.com/xid/0bswu24h9fy656tmxe-j21bde

Find 5 periodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:

https://wolfram.com/xid/0bswu24h9fy656tmxe-u2im4u

https://wolfram.com/xid/0bswu24h9fy656tmxe-kll0nx


https://wolfram.com/xid/0bswu24h9fy656tmxe-4b19yl

Find 5 antiperiodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:

https://wolfram.com/xid/0bswu24h9fy656tmxe-g119rn

https://wolfram.com/xid/0bswu24h9fy656tmxe-8s38mv


https://wolfram.com/xid/0bswu24h9fy656tmxe-b7ndxs

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-8bmxdk

Find 5 relational antiperiodic eigenvalues and eigenvectors of a Sturm–Liouville operator with an unsymmetrical potential:

https://wolfram.com/xid/0bswu24h9fy656tmxe-lmw637

https://wolfram.com/xid/0bswu24h9fy656tmxe-p0ljo6


https://wolfram.com/xid/0bswu24h9fy656tmxe-ojd5sw

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-nj7y96

1D+Time PDE Problems (2)
Solve a 1D Schrödinger equation with periodic boundary conditions:

https://wolfram.com/xid/0bswu24h9fy656tmxe-lupdse


https://wolfram.com/xid/0bswu24h9fy656tmxe-gkx4zv

Solve a 1D wave equation with periodic boundary conditions:

https://wolfram.com/xid/0bswu24h9fy656tmxe-4dpfrt
Visualize the periodic wavefunction:

https://wolfram.com/xid/0bswu24h9fy656tmxe-c4yyvr

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-jzw5x6
Compare the two periodic wavefunctions:

https://wolfram.com/xid/0bswu24h9fy656tmxe-t12r6i

2D PDE Problems (4)
Set up a rectangular region to solve a PDE with a DirichletCondition on the top and bottom:

https://wolfram.com/xid/0bswu24h9fy656tmxe-y8v838
To implement a periodic boundary condition, specify a mapping f from the target (x==0) to the source (x==2):

https://wolfram.com/xid/0bswu24h9fy656tmxe-iyd402
Visualize the region Ω and the source of the periodic boundary condition in green and the target in blue:

https://wolfram.com/xid/0bswu24h9fy656tmxe-u28bys

Specify the periodic boundary condition using the mapping function f:

https://wolfram.com/xid/0bswu24h9fy656tmxe-oe6ik8
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-0lvvrv

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-npnizb

https://wolfram.com/xid/0bswu24h9fy656tmxe-rr1r0d

Inspect the difference of the solution at the boundaries:

https://wolfram.com/xid/0bswu24h9fy656tmxe-1ymij7

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-ggk4vp


https://wolfram.com/xid/0bswu24h9fy656tmxe-8ki66z
Show the region and the boundaries:

https://wolfram.com/xid/0bswu24h9fy656tmxe-680h8a

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-qqr0tr
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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-4119wo
Inspect to see that the periodic boundaries have the same values:

https://wolfram.com/xid/0bswu24h9fy656tmxe-6w76kp


https://wolfram.com/xid/0bswu24h9fy656tmxe-h1w6t0

Compare to an antiperiodic solution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-b44gwp


https://wolfram.com/xid/0bswu24h9fy656tmxe-jnf5k3
The lower and upper parts are subject to a DirichletCondition:

https://wolfram.com/xid/0bswu24h9fy656tmxe-c2ukdy
The left-hand edge is the target of the relational boundary condition of the right-hand edge (the source):

https://wolfram.com/xid/0bswu24h9fy656tmxe-3xcxsk
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-zhlbw0

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-nmvvl5

2D+Time PDE Problems (1)
3D Problems (1)
Applications (1)Sample problems that can be solved with this function
Compute eigenvalues of a Laplacian in polar coordinates over a Disk:

https://wolfram.com/xid/0bswu24h9fy656tmxe-tk7m0j

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-ukyzsi

Compare the eigenvalues computed:

https://wolfram.com/xid/0bswu24h9fy656tmxe-78cvmd

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-604zx5

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-tdwuvz

Compare the numerically computed eigenvalues:

https://wolfram.com/xid/0bswu24h9fy656tmxe-c44u3m

Possible Issues (8)Common pitfalls and unexpected behavior
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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-5ksdm5



https://wolfram.com/xid/0bswu24h9fy656tmxe-k4869g

Specify a DirichletCondition on the source boundary:

https://wolfram.com/xid/0bswu24h9fy656tmxe-0vtfq7


https://wolfram.com/xid/0bswu24h9fy656tmxe-tya5sb

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-monwn8

https://wolfram.com/xid/0bswu24h9fy656tmxe-1y3tvl


https://wolfram.com/xid/0bswu24h9fy656tmxe-41yufl


https://wolfram.com/xid/0bswu24h9fy656tmxe-05qkf

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-zhwq5c

https://wolfram.com/xid/0bswu24h9fy656tmxe-k2w192


https://wolfram.com/xid/0bswu24h9fy656tmxe-m6qb8o

DirichletCondition cannot be present on the target boundary:

https://wolfram.com/xid/0bswu24h9fy656tmxe-1lnu32



Moving the DirichletCondition to the source boundary works:

https://wolfram.com/xid/0bswu24h9fy656tmxe-0y1wsk

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-pl7h6f
The lower and upper parts are subject to a DirichletCondition:

https://wolfram.com/xid/0bswu24h9fy656tmxe-k9vboc
First, the left-hand edge is the target boundary to the right-hand edge (the source):

https://wolfram.com/xid/0bswu24h9fy656tmxe-lp450z
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-rr9cpz

Inspect the values at the periodic boundaries:

https://wolfram.com/xid/0bswu24h9fy656tmxe-4ixamx

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-fs7lw
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-wg53k3

Inspect the values at the periodic boundaries:

https://wolfram.com/xid/0bswu24h9fy656tmxe-3kazvj

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-do3kxc
The lower and upper parts are subject to a DirichletCondition:

https://wolfram.com/xid/0bswu24h9fy656tmxe-nowjzg
Map the lower right to the higher left-hand side and the higher right to the lower left-hand side:

https://wolfram.com/xid/0bswu24h9fy656tmxe-qlsqto
The left-hand side is a target boundary to the right-hand side:

https://wolfram.com/xid/0bswu24h9fy656tmxe-ei7lfx
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-h7lo2x

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-2bwnrk
The left-hand side is a target boundary to the right-hand side:

https://wolfram.com/xid/0bswu24h9fy656tmxe-pk4zy
Solve and visualize the equation:

https://wolfram.com/xid/0bswu24h9fy656tmxe-1vj0od

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-zp7vy6

Visualize the solution at various times:

https://wolfram.com/xid/0bswu24h9fy656tmxe-du9xil

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-5ir21a

Visualize the solution at various times:

https://wolfram.com/xid/0bswu24h9fy656tmxe-k3bcpi

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:

https://wolfram.com/xid/0bswu24h9fy656tmxe-pu2wqu

Visualize the tensor product grid solution at various times:

https://wolfram.com/xid/0bswu24h9fy656tmxe-kf1nse

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-5p0or6

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-8vzuez

Alternatively, a DirichletCondition could be specified at each side.
Periodic boundary conditions relate the solution of a PDE from the source to the target boundary. Boundary conditions present, including implicit ones, at the source will affect the solution at the target. Multiple periodic boundary conditions can be used to enforce continuous derivatives.
Set up a region and a helper function that takes periodic boundary conditions as arguments:

https://wolfram.com/xid/0bswu24h9fy656tmxe-y5va20
Set up plotting options and a helper function to create periodic plots:

https://wolfram.com/xid/0bswu24h9fy656tmxe-imv7n9
Solve the PDE with a single periodic boundary condition on the left-hand side:

https://wolfram.com/xid/0bswu24h9fy656tmxe-vim8b
Visualize a periodic contour plot of the solution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-0ev6l0

Visualize a periodic stream density plot of the gradient of the solution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-vfllob

Note that the gradient is not continuous. This because of the implicit Neumann value that is present at the source location.
Similarly, visualize a periodic density plot of the norm of the gradient of the solution:

https://wolfram.com/xid/0bswu24h9fy656tmxe-h2vi64

Specifying a second periodic boundary condition enforces a continuous derivative. Solve the PDE with periodic boundary conditions on both the left- and right-hand sides:

https://wolfram.com/xid/0bswu24h9fy656tmxe-11vk39
Visualize a periodic contour plot of the solution. As expected, the solution changes, since the implicit Neumann value is now eliminated:

https://wolfram.com/xid/0bswu24h9fy656tmxe-84k9os

Visualize a periodic stream density plot of the gradient of the solution. Note that now the gradient is continuous:

https://wolfram.com/xid/0bswu24h9fy656tmxe-068bvh

Similarly, visualize a periodic density plot of the norm of the gradient of the solution and find that the norm of the gradient is also continuous:

https://wolfram.com/xid/0bswu24h9fy656tmxe-wyvoic

This approach works on unstructured meshes.
Periodic boundary conditions, like Neumann values, operate on edges in 2D and surfaces in 3D. This means that sufficient nodes need to be present in a finite element mesh to make periodic boundary conditions work.
Generate a finite element mesh and visualize the mesh nodes:

https://wolfram.com/xid/0bswu24h9fy656tmxe-e32zcv

Solve a PDE with a periodic boundary condition that maps a single point:

https://wolfram.com/xid/0bswu24h9fy656tmxe-hxrjnf




To fix this, specify a predicate for the periodic boundary condition that covers an edge:

https://wolfram.com/xid/0bswu24h9fy656tmxe-9p7iwk

Neat Examples (1)Surprising or curious use cases
Specify a region to solve a wave equation over a box:

https://wolfram.com/xid/0bswu24h9fy656tmxe-v233nu

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

https://wolfram.com/xid/0bswu24h9fy656tmxe-lz7xel
Solve the wave equation on a fine mesh:

https://wolfram.com/xid/0bswu24h9fy656tmxe-21gfsz

Visualize the wave propagating on the box:

https://wolfram.com/xid/0bswu24h9fy656tmxe-e8fxty

https://wolfram.com/xid/0bswu24h9fy656tmxe-c85lnz

Wolfram Research (2016), PeriodicBoundaryCondition, Wolfram Language function, https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html (updated 2020).
Text
Wolfram Research (2016), PeriodicBoundaryCondition, Wolfram Language function, https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html (updated 2020).
Wolfram Research (2016), PeriodicBoundaryCondition, Wolfram Language function, https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html (updated 2020).
CMS
Wolfram Language. 2016. "PeriodicBoundaryCondition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html.
Wolfram Language. 2016. "PeriodicBoundaryCondition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html.
APA
Wolfram Language. (2016). PeriodicBoundaryCondition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html
Wolfram Language. (2016). PeriodicBoundaryCondition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html
BibTeX
@misc{reference.wolfram_2025_periodicboundarycondition, author="Wolfram Research", title="{PeriodicBoundaryCondition}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html}", note=[Accessed: 05-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_periodicboundarycondition, organization={Wolfram Research}, title={PeriodicBoundaryCondition}, year={2020}, url={https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html}, note=[Accessed: 05-May-2025
]}