I am trying to use NDSolveValue for a fairly simple setup (used for testing that I understand NDSolveValue which apparently I don’t). I have a wave equation (for a vector potential) where I use a plane wave propagating in the -x direction as initial conditions. It works fine in Cartesian coordinates where I only need to solve for 1 function. But if I switch to spherical coordinates where I have two functions (the r and phi components of the vector potential) then the solution is no longer correct. I wonder if it is because I am not extracting the results from NDSolveValue correctly; if I compare the initial conditions that are used by NDSolveValue then these do not correspond to the “solution” I get out at the initial time. So I am wondering if anyone might have an idea as to what is going wrong - am I for instance extracting the output from NDSolveValue incorrectly? The notebook code is shown below.
In[1]:= Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"]
eqr = -r r D[Ar[t, r, phi], t, t] +
r r D[Ar[t, r, phi], r, r] + D[Ar[t, r, phi], phi, phi] +
2 r D[Ar[t, r, phi], r] - 2 r D[Aphi[t, r, phi], phi] -
2 Ar[t, r, phi] == 0
eqphi = -r r r D[Aphi[t, r, phi], t, t] +
r r r D[Aphi[t, r, phi], r, r] + D[Aphi[t, r, phi], phi, phi] r +
4 r r D[Aphi[t, r, phi], r] + r Aphi[t, r, phi] +
2 D[Ar[t, r, phi], phi] == 0
a[r_, phi_] := 1
omega := 0.2
Aric =
Ar[t, r, phi] == a[r, phi] Sin[phi] Cos[omega (r Cos[phi] + t)]
Aphiic =
Aphi[t, r, phi] == a[r, phi] Cos[phi] Cos[omega (r Cos[phi] + t)]/r
{Arsol, Aphisol} =
NDSolveValue[{eqr, eqphi,
DirichletCondition[{Aric, Aphiic}, t == 0]}, {Ar, Aphi}, {t, 0,
100}, {r, 0.001, Sqrt[2] 100}, {phi, 0, 2 Pi}, AccuracyGoal -> 24,
PrecisionGoal -> 10]
For any rvalue and phivalue in the intervals [0.001,Sqrt[2] 100] and [0, 2 Pi] I would expect that Arsol[0,rvalue,phivalue] and Aphisol[0,rvalue,phivalue] should be equal to the expressions indicated in Aric and Aphiic evaluated at those same rvalue, phivalue. But they are not. Why?