Re: Numerical solution of the heat equation on a disk with Dirichlet
- To: mathgroup at smc.vnet.net
- Subject: [mg113628] Re: Numerical solution of the heat equation on a disk with Dirichlet
- From: Mark McClure <mcmcclur at unca.edu>
- Date: Fri, 5 Nov 2010 05:12:07 -0500 (EST)
On Thu, Nov 4, 2010 at 4:58 AM, Francois Fayard <FFayard at slb.com> wrote: > I would like to get a numerical simulation of the heat equation with > Dirichlet boundary conditions on a disk. With the problem I have, > the function does not depend on theta, so we get : > u_t = u_rr + (1/r) u_r > > It introduces a singularity as goes to 0 and Mathematica can not > solve the problem with NDSolve. Is there a way to go around this? Of course, there is no singularity, rather a removeable discontinuity. D[u,r]/r, for example, can be replaced with D[u,r,r] at r=0. We can define some auxilliarly functions so that the equation takes the proper form at zero. We also use the rotational symmetry of the solution to obtain the boundary condition at zero, nameley D[u,r]=0. Putting this all together, we get something like so: f1[r_ /; r > 0] := 1; f1[r_ /; r == 0] := 2; f2[r_ /; r > 0] := 1/r; f2[r_ /; r == 0] := 0; Clear[u]; {sol} = NDSolve[{Derivative[0, 1][u][r, t] == f2[r]*Derivative[1, 0][u][r, t] + f1[r]*Derivative[2, 0][u][r, t], u[r, 0] == 1 - r^2, Derivative[1, 0][u][0, t] == 0, u[1, t] == 0}, u[r, t], {t, 0, 2}, {r, 0, 1}]; u[r_, t_] = u[r, t] /. sol; pics = Table[ParametricPlot3D[{r*Cos[th], r*Sin[th], u[r, t]}, {r, 0, 1}, {th, 0, 2 Pi}, PlotRange -> {-1, 1}], {t, 0, 0.3, 0.01}]; ListAnimate[pics]