This appears to be inconsistent with the gravity model documentation (models/environment/gravity/docs/gravity.pdf), wherein equation 3.18 says
$$q = \frac{\vec r\cdot(\vec r - 2\vec \rho)}{\rho^2}$$
Note the plus sign in line 361 versus the minus sign in the documentation. This turns out to be not a bug. The documentation uses $\vec \rho, \vec r, \text{and}\ \vec d$ to be consistent with Battin while the code uses grav_source_frame.pos in lieu of $\vec \rho$. The two vectors grav_source_frame.pos and $\vec \rho$ are additive inverses, thereby making the code consistent with the documentation. A comment to that effect would be useful.
Line 361 of models/environment/gravity/src/gravity_controls.cc reads
This appears to be inconsistent with the gravity model documentation (models/environment/gravity/docs/gravity.pdf), wherein equation 3.18 says $$q = \frac{\vec r\cdot(\vec r - 2\vec \rho)}{\rho^2}$$ Note the plus sign in line 361 versus the minus sign in the documentation. This turns out to be not a bug. The documentation uses $\vec \rho, \vec r, \text{and}\ \vec d$ to be consistent with Battin while the code uses
grav_source_frame.pos
in lieu of $\vec \rho$. The two vectorsgrav_source_frame.pos
and $\vec \rho$ are additive inverses, thereby making the code consistent with the documentation. A comment to that effect would be useful.