I am slightly puzzled over the example "Solve PDEs over 3D Regions" provided by Wolfram. The example shows how to solve Laplace's equation over a space shuttle mesh. However, if I run the code in 11.0.1.0 the solution produced appears to be completely homogeneous:
mr = BoundaryDiscretizeGraphics[
ExampleData[{"Geometry3D", "SpaceShuttle"}]];
uif = NDSolveValue[{Inactive[Laplacian][u[x, y, z], {x, y, z}] == 0,
DirichletCondition[u[x, y, z] == 1, z <= -1.3]}, u, {x, y, z} ∈ mr];
Then
vals = uif["ValuesOnGrid"];
{Max[vals], Min[vals]}
produces the output {1.,1.}
, suggesting that the temperature field is homogeneous. Somehow, ElementMeshSurfacePlot3D[uif, Boxed -> False, ViewPoint -> {0, -4, 2}]
still produces the beautiful coloured plot of the documentation. This confuses me.
Here is a partially successful modified example with slightly altered Dirichlet boundary conditions:
uif = NDSolveValue[{Inactive[Laplacian][u[x, y, z], {x, y, z}] == 0,
DirichletCondition[u[x, y, z] == 1, -1 <= x <= 1],
DirichletCondition[u[x, y, z] == -1, -5 <= x <= 4]},
u, {x, y, z} ∈ mr];
The ElementMeshSurfacePlot3D
suggests that a plausible solution was computed:
With[{vals = uif["ValuesOnGrid"]},
Legended[ElementMeshSurfacePlot3D[uif, ViewPoint -> {0, -4, 2},
Axes -> True, AxesLabel -> {X, Y, Z}],
BarLegend[{ColorFunction /. Options[ElementMeshSurfacePlot3D] //
First, MinMax@vals}]]]
DensityPlot[uif[X, Y, 0.4], {X, -7, 7}, {Y, -4, 4}, PlotPoints -> 70,
PlotLegends -> Automatic, FrameLabel -> {X, Y, Z},
PlotLabel -> "Slice at Z=0.4"] // Quiet
However, a more careful look suggests that my Dirichlet condition is not exactly met at X=0:
Plot[uif[X, 0, 0.4], {X, -7, 7}, AxesLabel -> {X, u},
PlotLabel -> "Slice at Y=0, Z=0.4"] // Quiet
I would really appreciate your help fully understanding this example, as I also intend to solve FEM problems on BoundaryMeshRegion
s imported from STLs.
DirichletCondition[u[x, y, z] == 1, z <= -1.3]
is outsidemr
??? $\endgroup$