# Using Runge-Kutta 4th order for a system of 5 ODE's

I'm an engineer and not quite familiar with solving systems of differential equations numerically, but I need to write a (fluid dynamics) program which contains a system of 4 implicit ODE's and an algebraic equation, which are:

$$C_m \, \dfrac{dC_m}{dr} - \dfrac{C_\theta^2}{r} + C_f \, \dfrac{C^2 \, cos(\beta)}{b \, sin(\phi)} + \frac{1}{\rho} \, \dfrac{dp}{dr} = 0$$ $$C_m \, \dfrac{dC_\theta}{dr} + \dfrac{C_m \, C_\theta}{r} + C_f \, \dfrac{C^2 \, sin(\beta)}{b \, sin(\phi)} = 0$$ $$\frac{1}{\rho} \, \dfrac{dp}{dr} + \frac{1}{C_m} \, \dfrac{dC_m}{dr} + \frac{1}{r} = 0$$ $$\dfrac{dh}{dr} + \frac{1}{C_m} \, \dfrac{dC_m}{dr} + \frac{1}{C_\theta} \, \dfrac{dC_\theta}{dr} = 0$$ and an algebraic function $$\rho = f(p, T) \;\;\; \text{(imported from real gas libraries)}$$ I would like to use an explicit Runge-Kutta-Solver with C++, but therefore the equations must be explicit. I don't see how I could transfer these equations to a possible format, without having something like $$y_1' = f(x,y_1,y_2')$$

I would be pleased if anybody could help me.

Regards Clemens

• Thanks for your response. It must be somehow possible to transfer these equations into explicit forms. This has been said in the relevant literature. But unfortunately they don't say how. – clemensf Dec 14 '15 at 15:22
• You have 4 ODEs, and 4 unknowns, so you should be able to solve them like a system of linear equations to get the derivatives separately. For example, you know $C_\theta'$ from (2), and you can work out $p'$ and $C_m'$ from (1) and (3), then (4) gives you $h'$. – David Dec 14 '15 at 22:23
• Man, that was a piece of cake. Thank you! I would have marked your answer as the one which helped me. – clemensf Dec 16 '15 at 7:44