# Theory Question: The Gradient

**URL:** <https://gpusph.discourse.group/t/theory-question-the-gradient/107>\
**Category:** Uncategorized\
**Created:** [April 3, 2020, 5:33am UTC](https://gpusph.discourse.group/t/theory-question-the-gradient/107 "2020-04-03T05:33:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asalih3d](https://yyz2.discourse-cdn.com/free1/user_avatar/gpusph.discourse.group/asalih3d/32/32_2.png) [@Asalih3d](https://gpusph.discourse.group/u/Asalih3d)\
**Post date:** [April 3, 2020, 5:33am UTC](https://gpusph.discourse.group/t/theory-question-the-gradient/107/1 "2020-04-03T05:33:34Z")

</div>

Hello!

So I was reading through the Theory Guide for GPUSPH, and I stumbled across this bit;

 ![image](https://global.discourse-cdn.com/free1/uploads/gpusph/original/1X/9af6ccd0ec7b10ad09d033e35e1c0cb7c662275a.png)

And what I noticed is that the absolute value of the gradient is used. In theory the gradient of the kernel is anti-symmetric, so particles placed equally distanced on opposite sides, would contribute with opposite signs - of course this will not happen in equation 15, since it only focuses on the normalized distance, q.

I think my confusion might stem from the fact, that I have usually seen the gradient defined as this;

 ![image](https://global.discourse-cdn.com/free1/uploads/gpusph/original/1X/d59bae76b4afb72ba45277caa8c822129026722e.png)

Where the nominator would return a vector with three values, indicating xi - xj, yi - yj and zi - zj etc. In this case, two particles placed on opposite sides, would get a different sign, so the gradient values would be anti-symmetric.

I am probably misunderstanding something along the way, just thought I might ask here, since this is the first time I have seen that the absolute value of the gradient is used.

Hope someone can clear my confusion, kind regards

---

<div class="post-metadata">

**Author:** ![giuseppe.bilotta](https://yyz2.discourse-cdn.com/free1/user_avatar/gpusph.discourse.group/giuseppe.bilotta/32/72_2.png) [@giuseppe.bilotta](https://gpusph.discourse.group/u/giuseppe.bilotta)\
**Post date:** [April 3, 2020, 7:16am UTC](https://gpusph.discourse.group/t/theory-question-the-gradient/107/2 "2020-04-03T07:16:04Z")

</div>

It’s been a while since I’ve looked over the theory documentation, but isn’t that simply the _norm_ of the gradient? The direction is then given by the inter-particle versor, giving the anti-symmetry. Although I guess it could be explained better …

---

<div class="post-metadata">

**Author:** ![Asalih3d](https://yyz2.discourse-cdn.com/free1/user_avatar/gpusph.discourse.group/asalih3d/32/32_2.png) [@Asalih3d](https://gpusph.discourse.group/u/Asalih3d)\
**Post date:** [April 3, 2020, 7:27am UTC](https://gpusph.discourse.group/t/theory-question-the-gradient/107/3 "2020-04-03T07:27:23Z")

</div>

Actually, I just stumbled upon the following expression later down in the theory document;

 ![image](https://global.discourse-cdn.com/free1/uploads/gpusph/original/1X/e810e7b42734cdb59d9f00b15c36a64c944f96c6.png)

This gives me the interpretation that it has to be the absolute value of the gradient. I do not believe it to be a norm of the gradient, since the gradient as expressed here, will only always return a scalar value;

 ![image](https://global.discourse-cdn.com/free1/uploads/gpusph/original/1X/5dc62921acac8d74e44e1a233e0add34a07c89f9.png)

Of course |r\_ab| is then the norm, i.e. euclidean distance between particles, so the sign change can only come from “r\_ab = r\_a - r\_b”, but then I would not understand why it is important to use the absolute value of the gradient.

Kind regards

---

<div class="post-metadata">

**Author:** ![Asalih3d](https://yyz2.discourse-cdn.com/free1/user_avatar/gpusph.discourse.group/asalih3d/32/32_2.png) [@Asalih3d](https://gpusph.discourse.group/u/Asalih3d)\
**Post date:** [April 3, 2020, 7:36am UTC](https://gpusph.discourse.group/t/theory-question-the-gradient/107/4 "2020-04-03T07:36:58Z")

</div>

Actually think I just got it. If what I have sketched here is correct;

 ![image](https://global.discourse-cdn.com/free1/uploads/gpusph/original/1X/bc35fb7a789acc4542ef9e6eb06711c903754147.png)

Then one has to use the absolute value, since the particle on the right, will not be negative then. Still kind of weird for me, but I guess it is a consequence for saying r\_i - r\_j consistently. Atleast it explains the absolute value now.

EDIT: graph from [https://www.sciencedirect.com/science/article/pii/S0307904X13007920](https://www.sciencedirect.com/science/article/pii/S0307904X13007920)

Kind regards
