I'm trying to solve the spherically symmetric wave equation $$0 = (\partial_t^2 - \partial_r^2 + 1)\phi(t,r)\,,$$ where $\phi(t,0) = 0$. Without doing anything fancy, we can solve this equation "in a vacuum" by simply putting it in a large enough box. For example
rmax = 40;
ti = 0;
tf = 40;
ω = 1/2;
θfn =
NDSolveValue[{
Derivative[0, 2][θ][r, t] -
Derivative[2, 0][θ][r, t] + θ[r, t] ==
0, θ[0, t] == 0,
Derivative[1, 0][θ][rmax, t] == 0, θ[rmax, t] ==
0, θ[r, ti] == 0,
Derivative[0, 1][θ][r, ti] ==
r A Sech[r ω]}, θ, {r, 0, rmax}, {t, ti, tf},
MaxStepSize -> 1/10];
Manipulate[
Plot[θfn[r, t]/r, {r, 0, rmax}, PlotRange -> {-10, 10}], {t,
0, tf}]
However, if I want to run this code for a very long time, then the size of the grid grows like $t_f^2$. It would be desirable if I could put absorbing boundary conditions in this box, however, I run into trouble with the grid refinement. For example, the following code runs into trouble
A = 8;
rmax = 20;
ti = 0;
tf = 80;
ω = 1/2;
θfn =
NDSolveValue[{Derivative[0, 2][θ][r, t] -
Derivative[2, 0][θ][r, t] + θ[r, t] +
NeumannValue[Derivative[0, 1][θ][r, t], r == rmax] ==
0, θ[0, t] == 0, θ[r, ti] == 0,
Derivative[0, 1][θ][r, ti] ==
r A Sech[r ω] (1 - Erf[r/6])}, θ, {r, 0,
rmax}, {t, ti, tf}, MaxStepSize -> 1/100];
Manipulate[
Plot[θfn[r, t]/r, {r, 0, rmax}, PlotRange -> {-1, 1}], {t, 0,
tf}]
As you can see, standing waves form, which should not exist. I suspected that this might be a problem with the absorbing boundary conditions I implemented using the NeumannValue function. However, even as we take the size of the box large enough for the reflection at the boundary to never happen, the standing waves still form. This is clearly a result of a grid that is too-coarse. However, the maximum step size is even smaller than in the simple example I gave above which does have the correct behavior. Therefore, I suspect that including the NeumannValue function is somehow causing the grid to be unrefined, leading to large errors.
Any suggestions to circumvent this would be appreciated!!!
Laplacian[f[r], {r, th, phi}, "Spherical"]
$\endgroup$Laplacian[g[r]/r, {r, th, phi}, "Spherical"] // Simplify
givesg''[r]/r
. $\endgroup$Derivative[1, 0][θ][rmax, t] == 0, θ[rmax, t] == 0, θ[r, ti] == 0
is droped the rest works fine for me and fullfills this boundary condition too. With Your input I get warnings for inconsistency, should be scalar function of the spatial variables (twice), boundary and initial condition inconsistent. $\endgroup$