# Heat transportation equation 2

I would like to thank you for all the suggestions for the problem with the heat transportation equation I have posted time ago! I rewrited the code along with the implementation of the Neumann boundary condition, changed the discretisation and eliminated questionable boundary-condition that could violate the conservation of energy in the following way:

T = NDSolveValue[{-Laplacian[t[r, \[Theta], z], {r, \[Theta], z},
"Cylindrical"]*(10^-5) +
0.001*(1 - (r^2))*D[t[r, \[Theta], z], z] ==
NeumannValue[0, r == 10^-7], DirichletCondition[t[r, \[Theta], z] == 10,
z == 10^-7 && 10^-7 <= r <= 1 && 0 <= \[Theta] <= 2*\[Pi]], DirichletCondition[t[r, \[Theta], z] == 0,
10^-7 <= z <= 10 && r == 1 && 0 <= \[Theta] <= 2*\[Pi]]}, t, {r, 10^-7, 1}, {\[Theta], 10^-7, 2*\[Pi]}, {z, 10^-7, 10}, MaxStepSize -> 0.0001]


and used the command:

Plot3D[T[r, \[Theta], z] /. \[Theta] -> \[Pi], {r, 0, 1}, {z, 0, 1}, PlotRange -> All]


or

ContourPlot[T[r, \[Theta], z] /. \[Theta] -> \[Pi]/2, {r, 0, 1}, {z, 0, 1},MaxRecursion -> 2]


to plot the solution

Now is almost the solution it needs to be, but as you can see from the 3D representation, I keep getting that small bump at the beginning and also a fluctuation at the edge that brings the temperature below 0 which is obviously wrong.I don' t know any other command that could be implemented in the code to make it work better, because it seems that the change in discretization and the implementation of the NeumallValue are not enoug to ensure the right solution in all points.

The solution displayed is correct. What happens is that your DirichletCondition overlap. They overlap that r==1 and z == 10^-7, the corner case, so to speak. You can see that, for example, when you swap your DirichletCondition, then the other one 'wins' in the solution process.

T = NDSolveValue[{-Laplacian[t[r, \[Theta], z], {r, \[Theta], z},
"Cylindrical"]*(10^-5) +
0.001*(1 - (r^2))*D[t[r, \[Theta], z], z] == 0
, DirichletCondition[t[r, \[Theta], z] == 0,
10^-7 <= z <= 10 && r == 1 && 0 <= \[Theta] <= 2*\[Pi]]
, DirichletCondition[t[r, \[Theta], z] == 10,
z == 10^-7 && 10^-7 <= r <= 1 && 0 <= \[Theta] <= 2*\[Pi]]},
t, {r, 10^-7, 1}, {\[Theta], 10^-7, 2*\[Pi]}, {z, 10^-7, 10}];
Plot3D[T[r, \[Theta], z] /. \[Theta] -> \[Pi], {r, 0, 1}, {z, 0, 1},
PlotRange -> All]


To fix this you need to resolve the ambiguity, which can not be done without further information.

• Thank you for the suggestion, but the solution is better when I do not swap the DiricletCondition. The exact boundary condition which have to be considered are: Apr 6 '16 at 10:10
• This was not a suggestion to swap the boundary conditions. It was to point out that there is an overlap that should be fixed in order to get a good solution. Apr 6 '16 at 10:12
• T must be 10 at z=0 and 0<=r<=1 (at the beginning of the pipe through the whole intersection); T must be 0 at r=1 and z>=0 (the pipe is cooled from outside). So the solution at the corner r=1, z=0 is good, the problem is the solution between r=0.6 and r=0.8 when z is between 0 and 0.3. A small bump arises there instead of a flat solution, which means that there is a non conservation in energy. The same problem is at r=1, 0.1<z<0.2 when goes below 0. Apr 6 '16 at 10:37
• Maybe I miss something, but to me this sounds like a contradiction: "T must be 10 at z=0 and 0<=r<=1 [....] T must be 0 at r=1 and z>=0" At z==0 and r==1 T is 0 and 10 at the same time, that does not sound right. Apr 6 '16 at 11:00
• And even if you fix that there can not be an infinitesimal small strip when T jumps from 10 to 0, there needs to be a smooth transition. Apr 6 '16 at 11:03