Message Boards Message Boards

0
|
11880 Views
|
13 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Solve 2D Wave equation with DSolve?

Posted 8 years ago

I`m trying to solve wave Equations with DSolve. First i startet with a 1 D Equation:

weq = D[\[Psi][x, t], {x, 2}] - D[\[Psi][x, t], {t, 2}] == 0;

with the initial conditions:

ic = {\[Psi][x, 0] == E^-x^2, Derivative[0, 1][\[Psi]][x, 0] == 0};

And it works out nice, giving me the expected Solution

{{\[Psi][x, t] -> 1/2 (E^-(-t + x)^2 + E^-(t + x)^2)}}

Now i want to solve it in 2D:

weq2D = 
  Laplacian[u[x, y, t], {x, y}] - D[u[x, y, t], {t, 2}] == 0;

with the "same" initial conditions:

ic2 = {u[x, y, 0] == E^-(x^2 + y^2), 
   Derivative[0, 0, 1][u][x, y, 0] == 0};

But when i try to solve it

DSolve[{weq2D, ic2}, u[x, y, t], x, y, t]

It gives me an error message:

DSolve::deqn: Equation or list of equations expected instead of False in the first argument {-(u^(0,0,2))[x,y,t]+(u^(0,2,0))[x,y,t]+(u^(2,0,0))[x,y,t]==0,{u[x,y,0]==E^(-x^2-y^2),False}}.

Did i do something wrong mathematically? Im still not quite familiar with PDEs (still a Student). I've tried adding some boundary conditions but it didn't work. Maybe i need more or different initial conditions? If so, how should they look?

POSTED BY: till johann
13 Replies
Posted 8 years ago

I want to visualize the solution for the 2D Equation with a Manipulate[Plot3D[...],{t,0,10}] and a running t. My expectation is that the solution is something like a moving Gaussian function:

Manipulate[
 Plot3D[E^-((x - t)^2 + (y - t)^2), {x, -4, 4}, {y, -4, 4}, 
  PlotRange -> 1], {t, 0, 5}]

But this function here doesn't fulfill the Wave equation. So maybe the solution is like a radially outward moving ring? (I know that for a real wave equation, the areas of constant phase (or lines of constant phase in 2D) are orthogonal to the direction of the wave). Or is there no solution for these initial conditions at all?

POSTED BY: till johann

Interesting.

I don't get an error message, but neither a solution.....

DSolve[{-
\!\(\*SuperscriptBox["u", 
TagBox[
RowBox[{"(", 
RowBox[{"0", ",", "0", ",", "2"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y, t] + 
\!\(\*SuperscriptBox["u", 
TagBox[
RowBox[{"(", 
RowBox[{"0", ",", "2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y, t] + 
\!\(\*SuperscriptBox["u", 
TagBox[
RowBox[{"(", 
RowBox[{"2", ",", "0", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y, t] == 0, 
  u[x, y, 0] == E^(-x^2 - y^2), 
\!\(\*SuperscriptBox["u", 
TagBox[
RowBox[{"(", 
RowBox[{"0", ",", "0", ",", "1"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y, 0] == 0, u[x, 0, 0] == 0, 
  u[0, y, 0] == 0}, u, {x, y, t}]
POSTED BY: Hans Dolhaine
Posted 8 years ago

I didn't have much luck with DSolve, but I did with NDSolve. Please have a look at the boundary and initial conditions. You should have 2 boundary conditions for x, 2 boundary conditions for y, and 2 initial condition equations for t. I made some up. These could be other things.

Clear[L, c, weq2, bc2, ic2, sol2, u, x, y, t, m, n]
weq2 = Laplacian[u[x, y, t], {x, y}] == D[u[x, y, t], {t, 2}]

bc2 = {u[x, Pi, t] == 0, u[x, 0, t] == 0, u[0, y, t] == 0, 
  u[Pi, y, t] == 0}
ic2 = {u[x, y, 0] == Sin[m x] Sin[n y], 
  Derivative[0, 0, 1][u][x, y, 0] == 0}

sol2 = DSolve[{weq2, bc2, ic2}, u[x, y, t], {x, y, t}, 
  Assumptions -> {Element[m | n , Integers]} ]

DSolve failed to find a solution. I had no trouble doing the same for 1D, but 2D it just isn't happy. Maybe someone can figure that out. So on with NDSolve

nsol2 = NDSolve[{weq2, bc2, ic2} /. {m -> 2, n -> 2}, 
  u, {x, 0, Pi}, {y, 0, Pi}, {t, 0, 5}]

ListAnimate[
 Table[Plot3D[u[x, y, t] /. nsol2, {x, 0, \[Pi]}, {y, 0, \[Pi]}, 
   AxesLabel -> Automatic, 
   PlotRange -> {{0, \[Pi]}, {0, \[Pi]}, {-1, 1}}], {t, 0, 5}]]

You should get an animation with time ....

enter image description here

POSTED BY: Eric Meyers
Posted 8 years ago

Thanks for the replys! NDSolve is really interesting and the animations are great, but i would also really like to take a look at the analytical solutions for these equations. I tried some ic's (plane waves,gaussians,..) in 2D, now with the 4 bc's, but everytime i just got my input as output, without an error message (as with your codes).I've found something in the DSolve documentation though, under Scope->Hyperbolic PDEs, quote:

Dirichlet problem for the wave equation in a rectangle:

weqn = D[u[x, y, t], {t, 2}] == Laplacian[u[x, y, t], {x, y}];
ic = {u[x, y, 0] == (1/10) (x - x^2) (2 y - y^2), 
   Derivative[0, 0, 1][u][x, y, 0] == 0};
bc = {u[x, 0, t] == 0,
    u[0, y, t] == 0, u[1, y, t] == 0, u[x, 2, t] == 0};

The solution is a doubly infinite trigonometric series:

(sol = FullSimplify[
    u[x, y, t] /. DSolve[{weqn, ic, bc}, u, {x, y, t}][[1]], 
    K[1] \[Element] Integers && 
     K[2] \[Element] Integers]) // TraditionalForm
\!\(\*
UnderoverscriptBox[
StyleBox["\[Sum]", "InactiveTraditional"], 
RowBox[{
TemplateArgBox[
RowBox[{"K", "[", "1", "]"}]], "=", 
TemplateArgBox["1"]}], 
TemplateArgBox["\[Infinity]"]]\(\*
UnderoverscriptBox[
StyleBox["\[Sum]", "InactiveTraditional"], 
RowBox[{
TemplateArgBox[
RowBox[{"K", "[", "2", "]"}]], "=", 
TemplateArgBox["1"]}], 
TemplateArgBox["\[Infinity]"]]\*
TemplateArgBox[
FractionBox[
RowBox[{"32", " ", 
RowBox[{"(", 
RowBox[{
SuperscriptBox[
RowBox[{"(", 
RowBox[{"-", "1"}], ")"}], 
RowBox[{"K", "[", "1", "]"}]], "-", "1"}], ")"}], " ", 
RowBox[{"(", 
RowBox[{
SuperscriptBox[
RowBox[{"(", 
RowBox[{"-", "1"}], ")"}], 
RowBox[{"K", "[", "2", "]"}]], "-", "1"}], ")"}], " ", 
RowBox[{"cos", "(", 
RowBox[{"\[Pi]", " ", "t", " ", 
SqrtBox[
RowBox[{
SuperscriptBox[
RowBox[{"K", "[", "1", "]"}], "2"], "+", 
FractionBox[
SuperscriptBox[
RowBox[{"K", "[", "2", "]"}], "2"], "4"]}]]}], ")"}], " ", 
RowBox[{"sin", "(", 
RowBox[{"\[Pi]", " ", "x", " ", 
RowBox[{"K", "[", "1", "]"}]}], ")"}], " ", 
RowBox[{"sin", "(", 
RowBox[{
FractionBox["1", "2"], " ", "\[Pi]", " ", "y", " ", 
RowBox[{"K", "[", "2", "]"}]}], ")"}]}], 
RowBox[{"5", " ", 
SuperscriptBox["\[Pi]", "6"], " ", 
SuperscriptBox[
RowBox[{"K", "[", "1", "]"}], "3"], " ", 
SuperscriptBox[
RowBox[{"K", "[", "2", "]"}], "3"]}]]]\)\)

End of quote. Why does this work and the others don't? The only difference i can see are the initial conditions?

POSTED BY: till johann

I tried it again with "appropriate" numbers of ic's and bc's, but without success.

Perhaps you should tackle your problem with the old fashioned method of a product Ansatz

u[ x, y, t ] =f1[ x ] f2 [y ] f3 [ t ]

POSTED BY: Hans Dolhaine
Posted 8 years ago

Sounds like progress. I'll play around a bit more when I get home from work.

POSTED BY: Eric Meyers

With

ww = w0 Exp[I A t]
uu = u0 Exp[I Sqrt[A^2 - B^2] x]
vv = v0 Exp[ I B y]

and

f = uu vv ww // FullSimplify

you have a solution to the wave equation (but not for the ic ).

Another solution is (you may take +t as well)

f = ff[(Cos[a] x + Sin[a] y - t)]
D[f, x, x] + D[f, y, y] - D[f, t, t] // Simplify

and then, to come somewhat "nearer" to your ic

f = Exp[(Cos[a] x + Sin[a] y - t)^2]
D[f, x, x] + D[f, y, y] - D[f, t, t] // Simplify
POSTED BY: Hans Dolhaine
Posted 8 years ago

So I played around. Yeah it seems DSolve recognized something with the ICs that it liked. So that isn't helping you much. However, this might help you with some tricks related to the infinite series. Also notice I used DSolveValue to avoid getting back a rule.

weqn = D[u[x, y, t], {t, 2}] == Laplacian[u[x, y, t], {x, y}];
ic = {u[x, y, 0] == (1/10) (x - x^2) (2 y - y^2), 
   Derivative[0, 0, 1][u][x, y, 0] == 0};
bc = {u[x, 0, t] == 0, u[0, y, t] == 0, u[1, y, t] == 0, 
   u[x, 2, t] == 0};
dsol = DSolveValue[{weqn, ic, bc}, u, {x, y, t}];
ListAnimate[
 Table[Plot3D[
   Activate[dsol[x, y, t] /. Infinity -> 5], {x, 0, 1}, {y, 0, 2}, 
   PlotRange -> {{0, 1}, {0, 2}, {-0.05, 0.05}}], {t, 0, 10, 0.25}]]

Note the Activate function and the replacement of infinity.

I realize you want a nice compact equation, but you might not get it.

enter image description here

POSTED BY: Eric Meyers
Posted 8 years ago

Thanks for your answers, this has helped me a lot! Im curious how you came up with the first solution Hans? Also, Is there a way to use the product ansatz to "transform" one complex DSolve computation into several simpler ones?(Sorry if this goes beyond the scope of this discussion)

POSTED BY: till johann

See

Partial Differential Equations With Mathematica (Physics Series) (Englisch) Gebundene Ausgabe – Januar 1993

von Dimitri Vvedensky (Autor)

https://www.amazon.de/Partial-Differential-Equations-Mathematica-Physics/dp/0201544091/ref=sr_1_1?ie=UTF8&qid=1481669125&sr=8-1&keywords=vvedensky+partial

and: is your problem confined to a certain region? your ic seems to show that you could look for solutions on a (perhaps inifinite) disk. then you should try polar coordinates. I think in this case the radial solutions are Bessel functions and sums of Bessel functions. Perhaps you can develop the Exp[ - r^2 ] in a series of Bessels and then you have a solution with your ic.

That would not be convenient due to the series, but......

POSTED BY: Hans Dolhaine

Solve 2D Wave equation with DSolve?

sorry. hit the wrong key. discard this

POSTED BY: Hans Dolhaine

Here is another attempt to come nearer to what you want.

Define the wave equation in polar coordinates

DGL[f_] :=  D[f, r, r] + 1/r D[f, r] + 1/r^2 D[f, phi, phi] - D[f, t, t]

A solution is given by

u[r_, phi_, t_, n_, m_] := 
BesselJ[n,BesselJZero[n, m] r] (\[Alpha] Cos[n phi] + \[Beta] Sin[n phi]) (a Cos[ BesselJZero[n, m] t] - b Sin[BesselJZero[n, m] t])

See

DGL[u[r, phi, t, n, m]] // FullSimplify`

Now we try to approximate the e-function by a series of u's. Taking into account that Exp[ - r^2 ] is not dependent on phi we chose n = 0 and calculate the coefficients in the series according to

c[n_] := \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1\)]\(r\ Exp[\(-r^2\)]\ \
BesselJ[0, r\ BesselJZero[0, n]] \[DifferentialD]r\)\)/\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1\)]\(r\ 
SuperscriptBox[\(BesselJ[0, 
     r\ BesselJZero[0, n]]\), \(2\)] \[DifferentialD]r\)\)

Unfortunately the integral in the numerator must be evaluated numerically. But having done this we get something that could be useful.....

Attachments:
POSTED BY: Hans Dolhaine
Posted 8 years ago

Actually i was just playing around with these equations, checking out how i can use mathematica to gain a deeper understanding, so my problem isn't really clearly defined. I didn't expect the solution would be so complicated though. Polar coordinates seem to be the way to go, i will try my hand on that.

POSTED BY: till johann
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract