Suppose I have a triangulated mesh and I have solved a differential equation problem and have a solution phi. From phi I can construct a vector field, how would I go about computing the gradient of this vector field?

The mesh looks something like this. phi is solved for at the center of all of the cells in the picture.

enter image description here

I'm not sure how to handle the spatial discretization for a triangulated lattice. Any references would be appreciated.


You can use a least squares method to calculate the gradient on unstructured meshes. Here's a presentation on the method. least squares gradient

  • $\begingroup$ Does this method by itself work for computing the gradient of a vector? $\endgroup$ – wgwz Dec 24 '14 at 14:45
  • $\begingroup$ The url doesn't exist anymore. $\endgroup$ – johnbaltis Jun 18 '18 at 16:55

The gradient of a vector field is simply a matrix where each row is the gradient of one of the (scalar) components of your vector field. In other words, if you know how to compute the gradient of a scalar solution, you also know how to compute the gradient of a vector field.

Of course, on a triangular mesh with piecewise linear elements, the gradient is then simply a constant on every cell.

  • $\begingroup$ What are piecewise linear elements? $\endgroup$ – wgwz Dec 29 '14 at 16:53
  • $\begingroup$ Err, the most elementary elements, with the usual hat functions as shape functions. $\endgroup$ – Wolfgang Bangerth Dec 29 '14 at 23:32
  • $\begingroup$ Here's some stuff on shape functions for those like myself who have never heard of these before. Basic explanation of shape functions.. @WolfgangBangerth I plan to check out Lecture 4 of yours. Thanks for the pointers. $\endgroup$ – wgwz Dec 30 '14 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.