0
$\begingroup$

I want to solve the wave equation under polar coordinates.This is my code:

NDSolveValue[
  {
    (Derivative[0,2,0][ϕ][r,θ,t]/r
     + Derivative[1,0,0][ϕ][r,θ,t])/r
     + Derivative[2,0,0][ϕ][r,θ,t]
     == Derivative[0,0,2][ϕ][r,θ,t],
    ϕ[10,θ,t] == 0,
    Derivative[0,0,1][ϕ][r,θ,0] == 0,
    ϕ[r,θ,0] == Exp[-5*r^2]
  },
  ϕ[r,θ,t],
  {r,0,10},
  {θ,0,2*Pi},
  {t,0,50}
]

But this is returning error that infinite expression 1/0 encountered.What is the way out?

$\endgroup$
  • $\begingroup$ Actually the mathematica code got this form after copy pasting,i dont know how to change it to that form. $\endgroup$ – user157588 May 13 '18 at 9:37
  • $\begingroup$ What did you expect to happen at $r=0$? If you ask for a solution for $2\leq r\leq 10$, you get some more useful warning and solutions $\endgroup$ – Lukas Lang May 13 '18 at 9:43
  • $\begingroup$ And regarding the formatting of the code: In this case, InputForm[Hold[…]] gives you something that is more readable as plain text $\endgroup$ – Lukas Lang May 13 '18 at 9:46
  • $\begingroup$ I'm missing boundary conditions here. What's supposed to happen at r = 0? Where is the periodic boundary condition for theta? Also, strictly speaking your initial condition is in conflict with your BC at r==10. $\endgroup$ – Sjoerd Smit May 14 '18 at 13:04
1
$\begingroup$

Here is a work around. I am not sure why it fails in polar, but changing the PDE to use Cartesian coordinates works.

enter image description here

ClearAll[x, y, r, t];
region = Disk[{0, 0}, 10];
r = Sqrt[x^2 + y^2];
pde = D[u[x, y, t], {t, 2}] == Laplacian[u[x, y, t], {x, y}];
ic  = {u[x, y, 0] == Exp[-5*r^2], Derivative[0, 0, 1][u][x, y, 0] == 0};
bc  = DirichletCondition[u[x, y, t] == 0, r == 10];

solM2 = NDSolveValue[{pde, bc, ic}, u, {t, 0, 5}, Element[{x, y}, region]];

The animation code is

framesNDSolveM2 = Table[
   Grid[{{Row[{"time = ", t}]},
     {Plot3D[solM2[x, y, t],
       Element[{x, y}, solM2["ElementMesh"]],
       PlotRange -> {-0.5, 0.5},
       Boxed -> True, Axes -> True,
       Mesh -> 20,
       ImageSize -> 300,
       ViewPoint -> {2.17, -2.4, 1},
       BoxRatios -> {1, 1, 1}]
      }}
    ], {t, 0, 5, .01}];

Now

Manipulate[
 framesNDSolveM2[[i]],
 {{i, 1, "time"}, 1, Length[framesNDSolveM2], 1}
 ]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.