# Confusing periodic boundary condition with PeriodicInterpolation

When using NDSolve to solve a PDE with a periodic boundary condition, for example, $y(0,t)=y(L,t)$ using "DifferenceOrder"->"Pseudospectral" but without PeriodicInterpolation->True. After I obtained the solution, I plotted the grid and found that the grid used was uniform.

But according to the Mathematica tutorial: The pseudospectral derivative approximation is only applicable when the grid points are spaced corresponding to the Chebyshev–Gauss–Lobatto points or when the grid is uniform with PeriodicInterpolation->True,

This means that if one uses DifferenceOrder"->"Pseudospectral but doesn't add PeriodicInterpolation->True the grid should have consisted of the Chebyshev–Gauss–Lobatto points, that is, it should be nonuniform. Nevertheless, based on the fact that the grid used in the abovementioned computation was uniform by only using a periodic boundary condition but never applying PeriodicInterpolation->True, could we say that a periodic boundary condition implies PeriodicInterpolation->True.

Thank you for any suggestion.

This means that if one uses "DifferenceOrder"->"Pseudospectral" but doesn't add PeriodicInterpolation->True

But how will you add PeriodicInterpolation -> True?

Please notice PeriodicInterpolation is not an option for NDSolve and AFAIK there's no way to adjust it inside NDSolve. It's an option of NDSolveFiniteDifferenceDerivative, which is called internally by NDSolve when solving PDE with TensorProductGrid method. If one adds periodic b.c. to NDSolve, NDSolve will identify it and interprete it as setting PeriodicInterpolation -> True in NDSolveFiniteDifferenceDerivative. This can be verified with TraceInternal -> True:

eqn = With[{u = u[t, x]}, D[u, t] == D[u, x, x]];
ic = u[0, x] == Exp[-10 (x - 1)^2];
bc = u[t, 0] == u[t, 2];

Trace[NDSolveValue[{eqn, ic, bc}, u, {x, 0, 2}, {t, 0, 2},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid", "MaxPoints" -> 25,
"MinPoints" -> 25, "DifferenceOrder" -> "Pseudospectral"}}],
NDSolveFiniteDifferenceDerivative[__], TraceInternal -> True] // Flatten // Union
(*
{HoldForm@
NDSolveFiniteDifferenceDerivative[{2}, {{0., 0.0833333, 0.166667, 0.25, 0.333333,
0.416667, 0.5, 0.583333, 0.666667, 0.75, 0.833333, 0.916667, 1., 1.08333, 1.16667,
1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333, 1.91667, 2.}},
DifferenceOrder -> {"Pseudospectral"}, PeriodicInterpolation -> {True}]}
*)

• Thank you for the nice illustration @xzczd!! So the conclusion is: a periodic boundary condition in the NDSlove implies PeriodicInterpolation->True.
– jsxs
Mar 21, 2018 at 8:13
• @jsxs To be precise, when "TensorProductGrid" is chosen. If the new-added "FiniteElement" method is chosen, the interpretation is probably different, but I haven't explore it because I'm still in v9. (Update: a quick test shows the interpretation seems to be a PeriodicBoundaryCondition[…] when "FiniteElement" is chosen for "SpatialDiscretization") Mar 21, 2018 at 8:21