Solving the following PDE, defined in the same domain of a previous question:
p = 0.2;
Pe = 20;
<< NDSolve`FEM`
boundaries = {-r +
1/2 (Sqrt[2] Sqrt[Cos[2 \[Theta]] (1 - p)^2 + 2 p + 1 - p^2] +
2 Cos[\[Theta]] (1 - p)),
r - 8, -\[Theta] + Pi/2, \[Theta] - Pi, -\[Phi], \[Phi] - Pi};
\[CapitalOmega] =
ToElementMesh[
ImplicitRegion[
And @@ (# <= 0 & /@ boundaries), {r, \[Theta], \[Phi]}],
"MaxBoundaryCellMeasure" -> 0.04];
Show[\[CapitalOmega][
"Wireframe"["MeshElement" -> "MeshElements", Boxed -> True]],
AxesLabel -> {"r", "\[Theta]", "\[Phi]"},
PlotRange -> {{0.15, 1}, {1.5, 3.16}, {0, 3.16}}]
and
sol = NDSolveValue[{Sin[\[Theta]] Cos[\[Phi]] D[
T[r, \[Theta], \[Phi]], r] + (Cos[\[Theta]] Cos[\[Phi]])/
r D[T[r, \[Theta], \[Phi]], \[Theta]] -
1/r D[T[r, \[Theta], \[Phi]], \[Phi]] ==
1/Pe (1/r^2 D[r^2 D[T[r, \[Theta], \[Phi]], r], r] +
1/(r^2 Sin[\[Theta]])
D[Sin[\[Theta]] D[
T[r, \[Theta], \[Phi]], \[Theta]], \[Theta]] +
1/(r^2 (Sin[\[Theta]])^2)
D[T[r, \[Theta], \[Phi]], {\[Phi], 2}]), {DirichletCondition[
T[r, \[Theta], \[Phi]] == 1., boundaries[[1]] == 0.],
DirichletCondition[T[r, \[Theta], \[Phi]] == 0.,
boundaries[[2]] == 0.]}},
T, {r, \[Theta], \[Phi]} \[Element] \[CapitalOmega]]
I noticed a strange behavior of the solution. For example:
\[Theta]1 = 0.6 Pi;
sol[1/2 (Sqrt[2] Sqrt[Cos[2 \[Theta]1] (1 - p)^2 + 2 p + 1 - p^2] +
2 Cos[\[Theta]1] (1 - p)), \[Theta]1, 0 Pi]
or
sol[0.5, 0.5 Pi, 0 Pi]
give: InterpolatingFunction::dmval: Input value {.....} lies outside the range of data in the interpolating function. Extrapolation will be used
, though the input values are inside the domain of the solution. Furthermore, the plot of the solution for small values of \[Phi]]
looks fine:
Plot[sol[r, 0.6 Pi, 0.0 Pi], {r, 0.4025, 8}, Frame -> True,
PlotRange -> {{0.15, 8}, {-0.1, 1.2}}]
but
Plot[sol[r, 0.6 Pi, 0.8 Pi], {r, 0.4025, 8}, Frame -> True,
PlotRange -> {{0.15, 8}, {-0.1, 1.2}}]
gives:
Things are even worse with the derivative of the solution, that I need to find the gradient of T
on the curved portion of the domain, the final aim being to calculate the flow of the grad of T
through the spherical cap. E.g.,
Dr[r_, \[Theta]_, \[Phi]_] = D[sol[r, \[Theta], \[Phi]], r]
Plot[Dr[r, 0.6 Pi, 0.0 Pi], {r, 0.403, 8}, Frame -> True,
PlotRange -> {{0.15, 6}, {-1.6, 0.1}}]
gives:
Things seem to improve if the MaxBoundaryCellMeasure
is decreased, at the cost of the computational time however, but the problems on the derivative still remain. I am grateful for any help.