4

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.

wgwz
  • 350
  • 2
  • 10

2 Answers2

5

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

user7257
  • 414
  • 2
  • 8
1

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.

Wolfgang Bangerth
  • 55,373
  • 59
  • 119