How to scale values for ColorFunction in SliceContourPlot3D?
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?
mesh = BoundaryDiscretizeRegion[Ball[{0, 0, 0}]];
alpha = 0.;
op = -Laplacian[u[x, y, z], {x, y, z}] - 2
Subscript[\[CapitalGamma],
D] = {DirichletCondition[u[x, y, z] == 0, True]};
uif = NDSolveValue[{op == 0, Subscript[\[CapitalGamma], D]},
u, {x, y, z} \[Element] mesh]
sol2 = Plot[uif[x, 0, 0], {x, -1, 1}]
SliceContourPlot3D[
uif[x, y, z], "CenterCutSphere", {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
AxesLabel -> Automatic, ColorFunction -> "BrightBands",
PlotLegends -> Automatic]