Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a feeling the solution to my problem is very simple… but my knowledge of differential equations is pretty weak.

I am trying to solve a scalar diffusion equation (used in NMR spectroscopy, but from what I understand, modeled after heat and Fickian diffusion). I've tried following model equations, but whenever I ask Mathematica to evaluate, it returns the original equation. What am I missing here?

Here is my code:

With[{Dif = 2300, pde = D[u[t, r], t] == Dif/r*D[u[t, r]*r, r, r] - 
 1/(0.0945 E^(0.000212+0.4077r))*(u[t, r]+1.2004)}, 
 soln = NDSolve[{pde, u[0, r] == 0, Derivative[0, 1][u][t, 0] == 0, 
 Limit[u[t, r], r -> \[Infinity]] == 0}, u, {t, 0, 10}, {r, 0, 500}]]

Upon evaluation, it returns an error stating that the equation is "overdetermined". Removing a single one of the 3 boundary conditions results in an "underdetermined" error.

Is this possible to solve using NDSolve, or do I need to break down the equation?

Thanks for the help!

share|improve this question
2  
As it stands, you need to define Dif for a start. You also have a boundary condition that is outside the region that you are trying to integrate in. I believe you will have to define the large r part of u explicitly. ie. u[t,500]==1/500 or however you understand the function behaves in the large r limit. You will also have to set the boundary conditions away from r=0 as the equation looks to be singular there. –  Jonathan Shock May 14 '13 at 3:20
    
Sorry, I have defined Dif=2300 in an earlier cell… In all of my fooling about, I forgot to put it into the With statement. Fixed now. –  Dustin Wheeler May 14 '13 at 15:53
    
Expanding upon comment of @JonathanShock. The proper condition for $r=500$ is $u(t,500)=0$. I think the solution is tending to zero as $r\to \infty$ at least exponentially. Also one has to move a bit from the boundary $r=0$ since there is a singularity in the equation's coefficients and NDSolve gives messages > Power::infy: "Infinite expression 1/0. encountered." Here the condition for r=0 is changed on condition for r=10^-8. –  Andrew May 14 '13 at 16:42
    
With[{Dif = 2300}, pde = D[u[t, r], t] == Dif/r*D[u[t, r]*r, r, r] - 1/(0.0945 E^(0.000212 + 0.4077 r))*(u[t, r] + 1.2004); soln = NDSolve[{pde, u[0, r] == 0, Derivative[0, 1][u][t, 10^-8] == 0, u[t, 500] == 0}, u, {t, 0, 10}, {r, 10^-8, 500}]] –  Andrew May 14 '13 at 16:43
    
@Andrew, that works! Should've thought to change the limit off zero… Mathematica seems so smart sometimes, I am sometimes surprised by the things that can trip it up. Now, is there a way to mark the question as answered by one of the comments, or does it have to be a proper "answer" response? –  Dustin Wheeler May 15 '13 at 14:55
add comment

1 Answer

up vote 0 down vote accepted

As Andrew stated above, changing the lower limit to something non-zero takes care of the problem.

The following code gives a speedy answer:

With[{Dif = 2300}, pde = D[u[t, r], t] == Dif/r*D[u[t, r]*r, r, r] - 
 1/(0.0945 E^(0.000212 + 0.4077 r))*(u[t, r] + 1.2004); 
 soln = NDSolve[{pde, u[0, r] == 0, Derivative[0, 1][u][t, 10^-8] == 0, 
 u[t, 500] == 0}, u, {t, 0, 10}, {r, 10^-8, 500}]]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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