Dear Giovanni,
I think you are mixing the concept of solution value *on the boundary* with the solution on the (exterior) domain.
You are right that if you take the gradient of 1/2(x+y+z) you don’t get what you expect, but that is not the gradient of the analytical solution. That is the value of the solution *on the boundary*. The analytical solution in R^3 for a sphere moving with velocity 1 in the x direction has the expression (in spherical coordinates):
phi(r,theta) = -1/2 U a^3/r^2 cos(theta)
outside the sphere, and zero inside the sphere.
On the boundary (i.e., r=a), such a function happens to be exactly x/2 = 1/2 a cos(theta).
The principle is that you add two more solutions of the same type, along y, and z, (i.e., the wind is not 1,0,0, but 1,1,1), and then the exact solution, *on the boundary only* happens to be (x+y+z)/2.
The exact solution, however, is not constant along the radial direction, so the gradient of the function (x+y+z)/2 is not the gradient of the exact solution. You are still missing what the component of the gradient along the normal direction is.
You need to take the gradient of the analytical solution in the direction of the normal, and this is what you need to match to your boundary conditions.
Indeed, there is a mistake in the writing of the analytical solution (it is as I wrote it above, not as in the tutorial). I’m going to open a PR to fix this. But the fact that phi = 1/2 (x+y+z) on the boundary does *not* mean that its normal gradient is (1/2, 1/2, 1/2).
I will expand a bit in the documentation of the tutorial to better clarify this point.
Best,
Luca.
> --
> The deal.II project is located at
http://www.dealii.org/
> For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
dealii+un...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/dealii/2c963891-aea4-4caa-b7a1-4f8b50898b49n%40googlegroups.com.