Page 1 of 1

Scalar Field > Gradient Formula?

Posted: Tue Nov 14, 2023 5:30 pm
by mnotarian
I was wondering if you could explain how scalar field gradients are calculated. I understand that they are a ratio of the change in the scalar field across a certain distance, but can you provide any more detailed information? Is it an average of change between the point and its nearest neighbors? Do you have the exact equation that is used?

Thanks very much in advance!

Re: Scalar Field > Gradient Formula?

Posted: Fri Nov 17, 2023 1:41 pm
by daniel
If you can read French you can refer to my PhD manuscript (https://theses.hal.science/pastel-00001745/)

Here is the formula:
gradient.JPG
gradient.JPG (10.07 KiB) Viewed 13927 times
P is the center point on which we compute the gradient, Pi is the ith neighbor. And f(P) is the scalar field value associated to the point P.

Re: Scalar Field > Gradient Formula?

Posted: Wed Nov 29, 2023 2:50 am
by mnotarian
Thank you very much Daniel for your response and the formula. I can read French well enough, but unfortunately it is my lack of formal training in mathematical notation that is the problem. Would you mind explaining in layman's terms what the gradient formula is doing here? I really appreciate your help!

Re: Scalar Field > Gradient Formula?

Posted: Sat Dec 02, 2023 7:13 am
by daniel
The gradient represents how much the scalar field changes, and the 'main' direction of change.

So we sum all the unit vectors that point from the central point to each of its neighbors. Each unit vector is multiplied by the difference of the scalar values (between the central point and its neighbor). And finally we divide the result by the number of neighbors.

In CC we just keep the amplitude/norm of the resulting vector (not the vector itself).