Cristiano Posted August 25, 2017 Posted August 25, 2017 I have 3 variables: v, b and h. I know how to calculate v’, b’ and h’. Starting the simulation from an initial condition, I need to calculate v, b and h after a given time using a numerical integrator (say RK4). If I use the simple Euler method, I write; v= v + dt * v’ b= b + dt * b’ h= h + dt * h’ but when I switch to RK4, I don’t know what to write. The simulation is explained here:https://mintoc.de/index.php?title=Gravity_Turn_Maneuver For example, h’= v * cos(b) doesn’t seem a differential equation; does it mean that h= h + dt * h’ is correct and that there is no reason to use RK4? Also, the second RK4 step is: k2 = f(x + dx / 2, y + k1 / 2) and we have that m’ = constant, v’= f(v, m). When I write the above k2 f(x, y) function, I suppose that I need to consider also m at time x + dx / 2, not only v, in other words f(x, y) is: m = m_initial – m’ * x v’ = f(m, v) and not only v’ = f(v).
Country Boy Posted August 26, 2017 Posted August 26, 2017 To do a "Runge- Kutta" solver with more than function, do simultaneous R-K solvers on each function, at each step using all the function values that you have determined at h/2 and h. 1
Cristiano Posted August 26, 2017 Author Posted August 26, 2017 Ah! Ok. The same that I do for the n-body simulation. Now it's clear. Thank you very much.
Cristiano Posted August 28, 2017 Author Posted August 28, 2017 On 26/8/2017 at 2:27 PM, HallsofIvy said: To do a "Runge- Kutta" solver with more than function, do simultaneous R-K solvers on each function, at each step using all the function values that you have determined at h/2 and h. I still have a little doubt. We have: v0 = v v' = f(t, v), v= RK(v') b' = f(v, b) When I wrote RK for b', should I first calculate the new v and use this new v as the input for b' or should I use v0, the v before the update v= RK(v')?
Country Boy Posted September 10, 2017 Posted September 10, 2017 Depending on the functions, one way might converge faster than the other but, assuming they converge, they will converge to the same result.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now