Solving for the radius of a sphere as a function of time I have tried to realistically model the famous game Agar.io, which can described as the following: A sphere of initial mass $m_0$ expels part of its mass at a given rate ($\frac{dm_l}{dt}$) for thrust with a velocity $v_e$ in the frame of the sphere. At the same time it moves, it is passing through a medium of density $\rho_M$, and absorbs the mass in the volume it has swept/covered, thereby increasing its mass and volume and decreasing its velocity. From this description I want to derive the radius of the sphere as a function of time.
The first thing I noticed is that
$$\frac{dm_G}{dt}=\rho_M \pi r^2v$$
where $m_G$ is the mass gained by absorption. Its rate of change is the volume it has swept per unit of time, multiplied by the medium density.
Also,
$$m=m_0+m_G-m_l$$
$$\frac{dm}{dt}=\frac{dm_G}{dt}-\frac{dm_l}{dt}$$
But since $m=V \rho_s  =\frac{4}{3}\pi r^3 \rho_s$, where $\rho_s$ is the density of the sphere,
$$4 \pi r^2 \rho_s \frac{dr}{dt}=\rho_M \pi r^2v-\frac{dm_l}{dt}$$
Another equation to consider, due to conservation of momentum, is
$$mv=(m+dm_G-dm_l)(v+dv)+dm_l(v-v_e)$$
which simplifies to
$$0=(dm_G-dm_l)v+m\cdot dv+dm_l(v-v_e)$$
$$0=v\cdot dm+m\cdot dv+dm_l(v-v_e)$$
$$0=v\frac{dm}{dt}+m\frac{dv}{dt}+\frac{dm_l}{dt}(v-v_e)$$
$$0=4 \pi r^2 \rho_s \frac{dr}{dt}v+\frac{4}{3}\pi r^3 \rho_s\frac{dv}{dt}+\frac{dm_l}{dt}(v-v_e)$$
However, I don't know exactly how to combine these equations into a useful one without the unknown $v$ or $\frac{dv}{dt}$, or higher order derivatives of $r$, since I don't see a way to, for example, get $\frac{d^2r}{dt^2}$ for $t=0$, which doesn't allow me to do a numerical solution.
 A: I have yet to get clear on your momentum equation, but as for initial conditions: you have $m_o$ at t = 0.  Assuming you know a constant density for the sphere, that lets you calculate the initial radius. You will need to know (or assume) an initial velocity through the medium (perhaps zero) in order to get the initial acceleration.  I'm thinking I would work with a force equation rather than momentum. The mass, acceleration, velocity, and radius will each be a function of time, which does lend itself to a numeric simulation.
A: From the changing mass equation we have
$$dm =  dm_G - dm_l$$
and from the mass gain equation
$$dm_G = (\rho_M\pi r^2 v)dt$$
Then naturally we should be able to define an infinitesimal change in lost mass. Assuming the mass maintains the thrust velocity, we have
$$m_0v_0 = (m_0-m_l)v_e $$
$$m_l =\frac{m_0v_e -m_0v_0}{v_e}$$
so
$$\frac{dm_l}{dt} =m_0\frac{d}{dt}(\frac{v_e-v_0}{v_e})$$
$$=\frac{m_0v_0}{v_e^2}\frac{dv_e}{dt}$$
$$dm_l =(\frac{m_0v_0}{v_e^2})dv_e $$
Reassembling our change in mass equation
$$dm = (\rho_M\pi r^2 v)dt - (\frac{m_0v_0}{v_e^2})dv_e$$
As you cleverly noted
$$\frac{dm}{dt} = 4\pi r^2\rho \frac{dr}{dt}$$
$$dm = 4\pi r^2\rho_s dr$$
Thus we get our grand equation
$$4\pi r^2\rho_s dr = (\rho_M\pi r^2 v)dt - (\frac{m_0v_0}{v_e^2})dv_e$$
Solving this for r, given the initial conditions of $v_e$ and $v$ and that they are functions of time, should land you in the right place.
