> I have a gradient vector formed by integrating the control, the
> derivative of the state solution, the derivative of the adjoint, and a
> shape function. In the attached picture, it is the bottom right. This
> is a 1D problem, and the boundary nodes are off by 1/2. I can't figure
> out why. Is there something obvious in deal II that I've left out?
While you plot the vector as if it is function (by connecting dots with
straight lines), the thing you compute is in fact an element of the dual
space. To wit:
- A vector in primal space is a vector of nodal values so that
sum_i U_i phi_i(x)
is a reasonable function. Solution vectors are examples of elements
of primal space.
- A vector in dual space is a vector W formed from the integration of
an object in primal space against the shape functions, e.g.
W_i = int f(x) phi_i(x)
Examples of dual vectors are right hand sides. Your vector is another
some such.
For vectors in dual space, it doesn't make sense to plot them as
functions of the form
sum_i W_i phi_i(x)
The reason is that the values of the coefficients W_i are not of
*amplitude* kind. Rather, the W_i are of kind amplitude (e.g. f(x))
times integration volume (the integral * dx over the support of shape
functions phi_i). In other words, the sizes of cells comes into play for
W_i, as does whether a shape function lies in the interior or at the
boundary. In your case, the area of the integral when you integrate
against shape functions at the boundary happens to be half the size of
the integration area for shape functions in the interior.
Best
W.
PS: I've made this mistake myself a number of times over the years, so
I've put a variant of this answer on the (new google code) wiki as well.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@math.tamu.edu
www:
http://www.math.tamu.edu/~bangerth/