On 07/15/2015 05:55 PM, Robert Cimrman wrote:
Hi Jozef,
Hi,
thanks for quick answer,
Where do you need the gradient? If you need it in the quadrature points, you can use the ev_grad term in 'qp' mode. I need it at arbitrary point, unrelated to mesh, much like evaluate_at().
Your gradient is linear over each element and not continuous over element boundaries - you get different values in a vertex for each element it is in, right? So some averaging is needed, but you could bypass .set_data_from_qp(), take a simple arithmetic average, have the values in the right order (using the field DOF connectivity) and use Variable.set_data() directly.
I see that it is difficult to treat gradient discontinuity at element boundaries. Therefore I am not really looking into generating new field representing the gradient (which would need averaging at vertices).
I suppose the proposed method using projection does just that, but more in a more clever way than simple average.
Rather than that I would like to only evaluate the gradient of my field at given point. Something along the lines:
To evaluate the the variable at given point you first evaluate basis functions at given point and then take their linear combination depending on the values on vertices (quarature points) of given element. Isn't it possible to evaluate gradients of basis functions at given point weight them by vertex values of original field and get the result?
Arbitrary point has little chance being exactly on the vertex (or facet) where gradient would be discontinuous.
J.