2
$\begingroup$

I am trying to solve the 2D heat equation (or diffusion equation) in a disk:

NDSolve[{\!\(
    \*SubscriptBox[\(\[PartialD]\), \(t\)]\(f[x, y, t]\)\) == \!\(
    \*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(f[x, y, t]\)\), 
      f[x, y, 0] == E^(-x^2 - y^2)}, {t, 0, 1}, {x, y} \[Element] Disk[]]

but I get this error

NDSolve::underdet: There are more dependent variables, {f[x,y,0],f[x,y,t],(f^(0,0,1))[x,y,t]}, than equations, so the system is underdetermined.

I want to include the Neumann boundary condition such that the normal derivative is zero. How can I include that?

edit: user21 fixed my mistake, here is a density plot from the code

DensityPlot3D[f[x, y, t] /. sol, {x, -1, 1}, {y, -1, 1}, {t, 0, 1}, 
 PlotRange -> All, AxesLabel -> Automatic]

with sol the solution as found below.

enter image description here

$\endgroup$
2
  • $\begingroup$ Please, post the code of the 3D plot $\endgroup$ Commented Jun 30, 2017 at 17:43
  • $\begingroup$ done, see edit. $\endgroup$
    – Ruud3.1415
    Commented Jul 2, 2017 at 13:19

1 Answer 1

3
$\begingroup$

You need to add the dependent variable f like so:

NDSolve[{Derivative[0, 0, 1][f][x, y, t] == 
   Derivative[0, 2, 0][f][x, y, t] + Derivative[2, 0, 0][f][x, y, t], 
  f[x, y, 0] == E^(-x^2 - y^2)}, f, {t, 0, 1}, 
 Element[{x, y}, Disk[{0, 0}]]]

Concerning the Neumann zero boundary condition: Neumann zero boundary conditions are the default so nothing needs to be done.

$\endgroup$
2
  • $\begingroup$ yes... I should have done that.. Thanks user21! Also thanks for the info andre! $\endgroup$
    – Ruud3.1415
    Commented Jun 30, 2017 at 17:30
  • $\begingroup$ @andre, thanks added your comment to the post. $\endgroup$
    – user21
    Commented Jun 30, 2017 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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