4

I want to study the time evolution of a small perturbation around the static solution of the following Wave Equation

$$ -\partial_t^2 v(t,r) + \partial_r^2v(t,r) + \frac{2}{r}\partial_r v(t,r) = \frac{\partial V(v)}{\partial v}(t,r) $$

for some expression of the potential $V(v)$ that is written in the code below. The coordinates $t,r$ run over $[0,+\infty]$.

By definition, the static solution $\hat{v}(r)$ is time-independent and I require the following initial/boundary conditions

$$ \partial_r \hat{v}(r)|_{r=0} =0\,,\qquad \hat{v}(r \rightarrow +\infty) = 0. $$

Obviously, to perform numerical computations the limit $r\rightarrow+\infty$ is replaced by $r=M$ where $M\gg \ell$ where $\ell$ is the characteristic length of the problem; it turns out to be $\ell \sim 2$ for the static solution.

I want to perturb this solution at $t=0$ and see how it evolves with time. So, now I am interested in the time-dependent solution which satisfies

$$ v(t=0,r) = \hat{v}(r)\,\qquad \partial_t v(r,t)|_{t=0}=\delta \cdot 10^{-2}\,,\\ \partial_r v(t,r)|_{r=0}=0\,, \qquad v(r=M) = 0. $$

where $\delta\ll 1$.

  • While the numerical static solution satisfies $\hat{v}'(r=0)=0$, the time-dependent solution I got does not. I don't understand why. For a specific example with $\delta = 0.001$, I get $\partial_r v(t,r) \sim -0.000701892$ irrespectively of the value of the time variable t. In particular, it looks the initial condition $v(t=0,r) = \hat{v}(r)$ is not satisfied. Is this normal?
  • Moreover, I get the error enter image description here, why? Are my boundary conditions really inconsistent?

This is my code.

V[v_] = (-1 + (1/8 (-9 + Sqrt[145]) - v)^2)^2 + 3 (1/8 (-9 + Sqrt[145]) - v)^3;

sol[rmax_, \[Delta]_] := Last@Last@ Last@NDSolve[{+D[v[r], {r, 2}] + 2/r D[v[r], {r, 1}] - (D[V[v], v] /. v -> v[r]) == 0, (D[v[r], r] /. r -> SetPrecision[10^-10, 100]) == 0, v[SetPrecision[10^-10, 100]] == SetPrecision[\[Delta], 100]}, v, {r, 10^-10, rmax}, WorkingPrecision -> 50, Method -> "Extrapolation"]

iTf = sol[30, 1.506400187591933106770472351];
Plot[{iTf[r]}, {r, 0, 30}, PlotRange -> All, Frame -> True]

iTfTime = v /. ParametricNDSolve[{-D[v[t, r], {t, 2}] + D[v[t, r], {r, 2}] + 2/r D[v[t, r], {r, 1}] - (D[V[v], v] /. v -> v[t, r]) == 0, v[0, r] == iTf[r], ((D[v[t, r], t]) /. t -> 0) == +\[Delta] 10^-2, (D[v[t, r], r] /. r -> 10^-10) == 0,v[t,30]==0}, v, {t, 0, 40}, {r, 10^-10, 30}, {\[Delta]}, WorkingPrecision -> MachinePrecision, Method -> {"MethodOfLines", "TemporalVariable" -> t, "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 200}}, PrecisionGoal -> 15]

iTfTimeToPlot0 = iTfTime[0.001];

(*Checking boundary conditions in generic points*)
((D[iTfTimeToPlot0[t, r], t] /. t -> 0) /. r -> RandomReal[]) == +0.001 10^-2
(*Output: True*)

((D[iTfTimeToPlot0[t, r], r] /. r -> 10^-10) /. t -> RandomReal[]) == 0
(*Output: False*)

Update

I have tried adding the following method

Method -> {"MethodOfLines", 
"DifferentiateBoundaryConditions" -> {True, "ScaleFactor" -> 1}}

but still the two solutions ($v(t=0,r)$ and $\hat{v}(r)$ differs for small values of $r$, instead they should coincide given the boundary condition)

iTfTime = v /. ParametricNDSolve[{-D[v[t, r], {t, 2}] + D[v[t, r], {r, 2}] + 2/r D[v[t, r], {r, 1}] - (D[V[v], v] /. v -> v[t, r]) == 0, v[0, r] == iTf[r], ((D[v[t, r], t]) /. t -> 0) == +\[Delta] 10^-2, (D[v[t, r], r] /. r -> 10^-10) == 0, v[t, 30] == 0}, v, {t, 0, 40}, {r, 10^-10, 30}, {\[Delta]},  WorkingPrecision -> MachinePrecision, Method -> {"MethodOfLines", "DifferentiateBoundaryConditions" -> {True, "ScaleFactor" -> 1}}]

iTfTimeToPlot = iTfTime[0.001]
Plot[{iTfTimeToPlot[0, r], iTf[r]}, {r, 10^-10, 0.003}, PlotRange -> All]

(*Output: enter image description here *)

apt45
  • 1,648
  • 9
  • 14
  • The b.c. at $r=M$ isn't included in the code. Though NDSolve doesn't spit out bcart, please notice this will still cause severe problem: https://mathematica.stackexchange.com/questions/141364/pde-with-ndsolve-gives-solution-despite-not-enough-boundary-conditions#comment382152_141364 2. Have you read this post?: https://mathematica.stackexchange.com/a/127411/1871
  • – xzczd Apr 19 '19 at 12:24
  • Isn't included because I think it is redundant given the dynamics of the equation. The static solution already satisfies it and I expect this to hold. However, I have tried adding this boundary condition and nothing changes. – apt45 Apr 19 '19 at 12:27
  • @xzczd I have seen the problem is solved by adding AccuracyGoal -> 6 when solving the time-dependent solution. Now, it gives me the solution but it returns the message Warning: scaled local spatial error estimate is too large. However, the solution looks nice, but its merely an accident – apt45 Apr 19 '19 at 12:28
  • @xzczd How could I have understood the value of AccuracyGoal in order to catch the solution?? This is a mystery..... – apt45 Apr 19 '19 at 12:51
  • The missing of b.c. at $r=M$ doesn't seem to cause problem in this case, but it's no more than an accident, please add all the necessary b.c. to the code. 2. Please read the post linked above about ibcinc warning. 3. AFAIK, struggling with AccuracyGoal and PrecisionGoal is almost always the wrong way to go when dealing with PDE, for more info please read this post: https://mathematica.stackexchange.com/q/118249/1871
  • – xzczd Apr 19 '19 at 12:55
  • @xzczd Thanks for the suggestion. I have added the boundary condition at $r=M$. I have also read the links, I am going to try to solve the issue. – apt45 Apr 19 '19 at 15:01
  • @xzczd I had a look to the links, however I didn't find any useful informations to understand why NDSolve does not give a solution that satisfies the b.c. at r=0. Do you have more hints? – apt45 Apr 23 '19 at 16:20
  • …Have you tried adding the option mentioned there and recheck? – xzczd Apr 23 '19 at 16:36
  • @xzczd Sure. I have tried adding Method -> {"MethodOfLines", "DifferentiateBoundaryConditions" -> {True, "ScaleFactor" -> 1}} but still the spatial initial condition (that is the derivative wrt r evaluated at r=10^-10) is not satisfied. – apt45 Apr 23 '19 at 16:42
  • But they're much closer. Well, it's midnight here, if you still have difficulty in understanding, I can try finding some time to elaborate with an answer tomorrow, perhaps. – xzczd Apr 23 '19 at 16:49
  • @xzczd Sure, don't worry. I have edited the question with the updates. My actual problem is much more difficult, this is just a toy model which I should be able to solve. – apt45 Apr 23 '19 at 16:51
  • ……Why is there a v[t,rmax]==0} in definition of sol? – xzczd Apr 24 '19 at 06:45
  • @xzczd ops... It's just a typo in the code here in SE. I have added this condition on my code after your comment, but then I didn't copy all the code here. Just modified it in the wrong place. I edit the question. – apt45 Apr 24 '19 at 06:47
  • @xzczd Now, it is v[t,30]==0 in the definition of iTfTime – apt45 Apr 24 '19 at 06:50