Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Boundary condition of diffusion equation in a sphere

  • To: mathgroup at
  • Subject: [mg126931] Re: Boundary condition of diffusion equation in a sphere
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Mon, 18 Jun 2012 05:45:29 -0400 (EDT)
  • Delivered-to:

Hi there!

I am solving a diffusion equation in sphere, can anybody tell me how to write this boundary condition in mathematica

c[x,0]=1, 0<x<1

I tried c[x,t]/.0<x<1 and c[x/;0<x<1,t] but they don't work out.

Thank you so much if you could shed some light on it

You may do it this way:

ss = NDSolve[{x*D[u[t, x], t] == x*D[u[t, x], x, x] + 2 D[u[t, x], x],
     u[0, x] == 1, u[t, 0.1] == Cos[t], u[t, 1] == 1},
   u, {t, 0, 2}, {x, 0.1, 1}, MaxStepSize -> 0.001][[1]]

Check this after:

Plot3D[Evaluate[u[t, x] /. ss], {t, 0, 10}, {x, 0.1, 5},
 PlotRange -> All,
 AxesLabel -> Map[Style[#, 16, Italic, Red] &, {x, t, u}]]

You need more boundary conditions here than you have specified above. Namely, at u[t,0] I fixed it for Cos[t] and at the outer boundary of the sphere x=1 I fixed u=1. The consistency requirements for the boundary conditions are here too rigid due to the specific initial condition that you have. I started from x=0.1 instead of x=0 in order to avoid the divergence. It might be chosen closer to zero though. You may try this for the beginning.

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at

  • Prev by Date: Re: Add scale bar to Image
  • Next by Date: Re: Structure of "identical" data not equal in size
  • Previous by thread: Boundary condition of diffusion equation in a sphere
  • Next by thread: modulo solving lacking domain?