2
$\begingroup$

I am attempting to solve a PDE as prescribed in a paper I am reading; however, Mathematica doesn't seem to be happy with the way I am posing the problem.

Im my case, r(t,100) is an approximation of r(t,inf).

d = 27;
k = 10;
s = 1;

sol = NDSolve[
  {D[u[t, r], t] == d*(1/r^2) D[r^2*D[u[t, r], r], r], 
   u[0, r] == 1, 
   Derivative[0, 1][u][t, s] == (k/d)*u[t, s], u[t, 100] == 1}, 

  u, {t, 0, 10}, {r, 0, 100}]

I am receiving an error stating that my boundary condition u(t,100)==1 is not specified on a single edge of the boundary of the computational domain. The answer is probably very simple, however I am just not seeing it.

$\endgroup$
3
$\begingroup$

That means the boundary conditions defined should fit the the range of t and r in NDSolve command. You have 4 values: {t,0,10} and {r,0,100}, so you have to define the conditions at these 4 values. Here you define at r = s = 1 but you run r from 0 to 100. You need to define the boundary condition at r = 0 and at r = 100. But I don't know which boundary condition you need for r = 0, so I just run the NDSolve from s to 100 where at theses limits, the boundary conditions are well defined.

So this is the correct way to define the boundary conditions:

d = 27;
k = 10;
s = 1;

sol = NDSolve[{D[u[t, r], t] == d*(1/r^2) D[r^2*D[u[t, r], r], r],
   u[0, r] == 1,
   Derivative[0, 1][u][t, s] == (k/d)*u[t, s],
   u[t, 100] == 1},
  u,
  {t, 0, 10}, {r, s, 100}]


Plot[u[10, r] /. sol, {r, s, 100}]

enter image description here

| improve this answer | |
$\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.