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[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,]+boffset 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 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  (8)

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.

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:

Set up plotting options and a helper function to create periodic plots:

Solve the PDE with a single periodic boundary condition on the left-hand side:

Visualize a periodic contour plot of the solution:

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

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:

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:

Visualize a periodic contour plot of the solution. As expected, the solution changes, since the implicit Neumann value is now eliminated:

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

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:

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:

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

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

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:

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).

CMS

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

BibTeX

@misc{reference.wolfram_2024_periodicboundarycondition, author="Wolfram Research", title="{PeriodicBoundaryCondition}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html}", note=[Accessed: 11-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_periodicboundarycondition, organization={Wolfram Research}, title={PeriodicBoundaryCondition}, year={2020}, url={https://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html}, note=[Accessed: 11-December-2024 ]}