Message Boards Message Boards


[✓] Handle discontinuities at the boundary in DSolve and NDSolve?

Posted 7 months ago
1 Reply
0 Total Likes

I feel like there's an easy answer to this. Laminar flow in a cylinder:

DSolveValue[mu/r D[r u'[r], r] == dp, u[r], r]
c1 log(r)+c2+(dp r^2)/4/mu
(*log[0] is -infinity, but apply boundary conditions sets c1=0:*)
DSolveValue[{mu/r D[r u'[r], r] == dp,u'[0]==0,u[1]==0}, u[r], r]
dp/4/mu (r^2-1)

In DSolve it evaluates fine but with the error "For some branches of the general solution, unable to compute the limit at the given points. Some of the solutions may be lost"

NDSolve fails with a 1/0 error. What's the best way of handling this? I have a more difficult problem I need to resolve where one of the dependent variable goes to zero at the boundary and is in the denominator (the numerator goes to zero faster).

It looks like specifying the boundary conditions with NeumannValue and DirichletCondition fixes the problem

NDSolve[{Laplacian[u[r], {r, th, z}, "Cylindrical"] + dp == 
   NeumannValue[0, r == 0], 
  DirichletCondition[u[r] == 0, r == 1]}, u, {r, 0, 1}]

But Laplacian has to be used because this didn't work:

NDSolveValue[{1/r D[r u'[r]] + dp == NeumannValue[0, r == 0], 
   DirichletCondition[u[r] == 0, r == 1]}, u, {r, 0, 1}]

So, is there another way around this? My other equations are something like

1/r D[r U'[r]]/r - dP == 0
1/r D[r k'[r],r] + U'[r]^2 - e[r] == 0
1/r D[r e'[r],r] + e[r]/k[r] U'[r]^2 - c2 re e[r]^2/k[r] ==  0

Where k[r]=0 at r=0 but e[r] goes to zero faster

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract