3
$\begingroup$

I am attempting to solve the wave equation with the boundary displacement oscillating in time, using mesh.

Here is a working program for the heat equation with the same boundary conditions:

<< NDSolve`FEM`;
mesh = ToElementMesh[Disk[], "MaxCellMeasure" -> {"Area" -> 0.1, "Length" -> 1}];
heatsol = NDSolveValue[
  {Derivative[0, 2, 0][u][t, x, y] + Derivative[0, 0, 2][u][t, x, y] -
   Derivative[1, 0, 0][u][t, x, y] == 0,
   DirichletCondition[u[t, x, y] == Sin[2 Pi t], True],
   u[0, x, y] == 0},
  u, {t, 0, 1}, {x, y} \[Element] mesh];

heatframes = Table[Plot3D[heatsol[t, x, y], {x, y} \[Element] mesh,
  PlotRange -> {-1, 1}],  {t, 0, 1, 0.1}];

Export[NotebookDirectory[] <> "heat.GIF", heatframes, "DisplayDurations" -> 0.1];

This works fine and produces the expected behaviour:

heat equation solution

However, if I change the first derivative in time to a second derivative in time to get the wave equation, I get an error:

NDSolveValue[
  {Derivative[0, 2, 0][u][t, x, y] + Derivative[0, 0, 2][u][t, x, y] -
   Derivative[2 (* changed from 1 *) , 0, 0][u][t, x, y] == 0,
   DirichletCondition[u[t, x, y] == Sin[2 Pi t], True],
   u[0, x, y] == 0},
  u, {t, 0, 1}, {x, y} \[Element] mesh]

"NDSolveValue::fememrc: The ranges {{0.,1.},<<1>>} cannot be combined to a region. Please specify a combined region. >>"

Why does changing the derivative from 1st order (heat) to 2nd order (wave) result in this error?

$\endgroup$
7
$\begingroup$

When you change from the heat equation to the wave equation you must add one more initial condition : not only the surface u[0,x,y] must be known but also one need a condition that specify the movement of the surface, for example the surface is still :

(Derivative[1, 0, 0][u][tt, x, y] /. tt-> 0) == 0

  heatsol=NDSolveValue[
      {Derivative[0, 2, 0][u][t, x, y] + Derivative[0, 0, 2][u][t, x, y] -
       Derivative[2 (* changed from 1 *) , 0, 0][u][t, x, y] == 0,
       DirichletCondition[u[t, x, y] == Sin[2 Pi t], True],
       u[0, x, y] == 0,
       (Derivative[1, 0, 0][u][tt, x, y] /. tt-> 0) == 0},
  u, {t, 0, 1},{x, y} \[Element] mesh]

heatframes = Table[Plot3D[heatsol[t, x, y], {x, y} \[Element] mesh,
  PlotRange -> {-3, 3}],  {t, 0, 1, 0.1}];

Export[ "heat.GIF", heatframes, "DisplayDurations" -> 0.1];  

enter image description here

$\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.