Bug introduced in 10.3
I recently installed Mathematica v10.3 and checked a project I was working on few months ago under Mathematica v10.1.
In this project I solve a PDE with NDSolve
and Finite Element Method over a 2D anulus region and I and ContourPlot
that solution.
Under v10.1 (and v10.2) the solution appear like this:
Under v10.3 the solution appear like this:
The source code is exactly the same.
At the beginning I was convinced the problem was with NDSolve (and this question reflected that, I later edited). After more investigation I discovered the solution in the two releases is nearly the same.
You can reproduce the problem running:
Import["http://bit.ly/cp103issue"]
I searched on the documentation, news section, but I didn't find anything that could explain this or restore the previous behavior.
Any chance to understand the reason of the changed behavior and eventually restore the old?
UPDATE
The problem is not related to ContourPlot but to the InterpolatingFunction
returned by NDSolve (thanks to JasonB). Probably the InterpolatingFunction is built under the cover by a call to ElementMeshInterpolation
. Indeed the following code in Mathematica 10.3 returns result completely different from the results in Mathematica 10.2.
<<NDSolve`FEM`
{Ri,Ro}={3000000.,6371000.};
rgn=RegionDifference[Disk[{0.,0.},Ro],Disk[{0.,0.},Ri]];
mesh=ToElementMesh[rgn];
grid=mesh["Coordinates"];
vog=(Exp[-Norm[#]^2/Ri^2])&/@grid;
ListContourPlot[MapThread[Append,{grid,vog}],Epilog->{Point[grid]},PlotLegends->Automatic]
if=ElementMeshInterpolation[{mesh},vog];
ContourPlot[if[x,y],{x,y}\[Element]mesh,PlotLegends->Automatic,Epilog->{Point[grid]}]
TakeLargest[(if@@@grid-vog),20]
In 10.3:
In 10.2 (after som InterpolatingFunction::dmval message):
As you can see, in 10.2, the largest differences in "interpolation errors" are negligible, while in 10.3 they are even greather than the actual expected value.
The problem appear more specifically related with the "scale" of the mesh. Indeed if you change the sizes:
{Ri,Ro}={3000000.,6371000.}/10^6;
all apear fine: