So, I would like to integrate paths of particles on circular velocity on the surface of a sphere (due to some potential, i.e. gravity).
The problem is to fix the two angular velocities $\dot \theta $ and $\dot \phi $ (explained more later)
The situation at the start/beginning :
1) I have a set of x y z positions located on the surface of the sphere (see image)
2) From those locations, I can solve $\theta$ and $\phi$ angles (using some trigonometry, have not yet tried).
3) Then I would need to solve velocity components ($\dot \theta , \dot \phi$) so that the particle stays on circular velocity on the surface of the sphere (generated by potential, i.e. gravitational potential).
4) I am aware that there would be an infinite amount of different orientations for such orbit. Thus one could select a random value for one of the angular velocities, and based on that the other angular velocity would be fixed/known.
I think my method is kinda close, I just do not figure out some set of equations that I could use to fix the angles.
Some background equations:
Potential (in this example Newtonian for simplicity) $\phi(r) = -\frac{GMm}{r}$
Force $F(r)=-\frac{\partial \Phi(r)}{\partial(r)} = \frac{GMm}{r^2}$
and in vector form this would be $F(r)\frac{\bar r}{r}$
where $\bar r$ is position vector and $r = ||\bar r ||$ is the length of the vector. $G=1$ (grav. constant) , $M$ is the mass of potential, $m$ is the mass of the test particle (can be ignored).
Circular velocity is case $F_c = F_g$ (centrifugal force equals grav. force) and thus yields $ma = m \frac{v^2}{r} = \frac{GMm}{r^2}$ and solving for $v = v_{circle} = \sqrt{ \frac{GM}{r} }$
This can also be written in terms of potential function as $v_{circ} = \sqrt{\Phi(r)}$ or with force $v_{circ} = \sqrt{F(r)r}$
First, a 2D example of circular velocities, so here I'm creating a disk around the central point. For this, I am using polar coordinates (which later would be changed to Cartesian coordinates).
method 1
Cartesian coordinates
$$x = r \cos(\theta)$$
$$y = r \sin(\theta)$$
$$\dot x = \dot r \cos(\theta) - r \sin (\theta) \dot \theta$$
$$\dot y = \dot r \sin(\theta) - r \cos (\theta) \dot \theta$$
and note $\dot r = 0$ because we are staying in a circular orbit.
One can now link the $\dot \theta$ to circular velocity as follows :
$$\dot \theta = \frac{2\pi}{T} ; v = \frac{2\pi r}{T} $$
$$ \dot \theta = \frac{v}{r} $$
where now v = $v_{circ}$
Thus this now gives the velocity components as follows
$$v_x = -\sin (\theta) r \frac{v}{r} = -\sin (\theta) v_{circle}$$
$$v_y = -\sin (\theta) r \frac{v}{r} = \cos (\theta) v_{circle}$$
Method 2
Now this uses polar coordinates
First, define unit vectors as follows
$$\hat e_r = \cos (\theta) \hat i + \sin (\theta) \hat j $$
$$\hat e_{\theta} = -\sin (\theta) \hat i + \cos (\theta) \hat j $$
and so one can write the position vector $$\bar r = r \hat e_r = r [\cos(\theta)\hat i + \sin (\theta) \hat j ]$$
Lets now take the derivative with respect to time (so we get the velocity)
$$\bar v = \dot {\bar r} = \dot r \hat e_r + r \dot \theta \hat e_{\theta}$$
and again we have that $\dot r = 0$ and $\dot \theta = v/r$
giving solution $$\bar v = v \hat e_{\theta} = v_{circ} \Big(-\sin(\theta) \hat i + \cos(\theta)\hat j \Big) $$
which is identical to the method 1 .
And indeed, when integrated over time, the orbits are circular as they should be. Here in the image is some quick test for disk orbits.
Thus, I decided to try Spherical coordinates for solving the velocity components for given point $\theta$ and $\phi$ . This is how far I got:
Spherical coordinate system
Wikipedia link to spherical coordinate system
https://en.wikipedia.org/wiki/Spherical_coordinate_system
First, define unit vectors
$$\hat e_r = \sin (\theta) \cos (\phi) \hat i +\sin (\theta) \sin (\phi) \hat j + \cos(\theta) \hat k $$
$$\hat e_{\theta} = \cos (\theta) \cos (\phi) \hat i +\cos (\theta) \sin (\phi) \hat j - \sin(\theta) \hat k $$
$$\hat e_{\phi} = -\sin (\phi) \hat i + \cos (\theta) \hat j $$
and position vector $$\bar r = r \hat e_r = r \Big( \sin (\theta) \cos (\phi) \hat i +\sin (\theta) \sin (\phi) \hat j + \cos(\theta) \hat k \Big)$$
from where one can get the velocity vector
$$\dot {\bar r} = \bar v = \dot r \hat e_r + r \dot \theta \hat e_{\theta} + r \dot \phi \sin(\theta) \hat e_{\phi}$$
So now I have a problem that I have 2 unknown variables $\dot \theta$ and $\dot \phi$ so I need 2 independent equations to solve the set of these variables. Any idea what those two equations could be ?
I have tried to think one equation from the angular velocity perspective, such that $\sqrt{\dot \phi ^2 + \dot \theta ^2} = v/r$ (similarly as in the case of 2D , polar coordinate).
Another equation could have been from Angular momentum $\bar L = \bar r \times m\bar v $ (cross product)
and one need to remember that since we are in a circular orbit, $\bar r$ and $\bar v$ are orthogonal to each other, thus $\bar L = \bar r m \bar v $ and since we are interested on test particles, the mass $m$ can be neglected.
Or similarly maybe kinetic energy $E_{kin} = 1/2 m v ^2 = 0.5 \Big( (r\dot \theta)^2 + (r\dot \phi \sin(\theta))^2\Big)$ . Note, $v^2$ comes from above where velocity for spherical coordinate system has been solved.
However, I do not get anything sensible out for $\dot \theta$ or $\dot \phi$ .
I chose two of the above equations into Mathematica to be solved as pair of equations. The result was horrible, so I think I have made somewhere a stupid mistake. Here is an example of what the Mathematica gave
So in any case, I for some reason do not notice a mistake I have made in solving the velocity components for a specific point.