Trying to help out in the question, Finite Elements 3D, I came across this behavior of SliceContourPlot3D
:
op = -Laplacian[u[x, y, z], {x, y, z}] - 2;
uif = NDSolveValue[{op == 0, DirichletCondition[u[x, y, z] == 0, True},
u, {x, y, z} ∈ Ball[{0, 0, 0}]];
SliceContourPlot3D[
uif[x, y, z], "CenterPlanes", {x, y, z} ∈ MeshRegion@uif["ElementMesh"],
ColorFunction -> "Rainbow"]
The range of colors does not go all the way down to violet/indigo. I expected the range of colors to be something like this:
With[{sel = Positive[uif["Grid"].{0.3, -0.4, -1}]},
With[{pts = Pick[uif["Grid"], sel]},
Graphics3D[
GraphicsComplex[
pts,
{Point[Range@Length@pts,
VertexColors -> (ColorData["Rainbow"] /@ Rescale[Pick[uif["ValuesOnGrid"], sel]])
]}
]]
]]
Is this a bug in SliceContourPlot3D
? (Perhaps it's due to extrapolation from sampling outside the domain?) Is there a way to get it to rescale the colors the way I expected?
I'm using V10.3.0, Mac OSX.
Answer
It seems SliceContourPlot3D
makes an initial sample, that is not quite right - i.e. outside of the region. Using
op = -Laplacian[u[x, y, z], {x, y, z}] - 2;
uif = NDSolveValue[{op == 0,
DirichletCondition[u[x, y, z] == 0, True]},
u, {x, y, z} \[Element] Ball[{0, 0, 0}],
"ExtrapolationHandler" -> {(Indeterminate &),
"WarningMessage" -> False}];
SliceContourPlot3D[
uif[x, y, z], "CenterPlanes", {x, y, z} \[Element]
MeshRegion@uif["ElementMesh"], ColorFunction -> "Rainbow"]
On a related note, I am wondering if for FEM this ExtrapolationHandler
should be the default - what do you think?
Comments
Post a Comment