- #1
MrOmar
- 5
- 1
Hello all, I am currently trying to solve a differential equation numerically. The equation is as follows:
dv/dt = (u*q)/(m0-q*t) - g - (cd*ρ*A*0.5)*v2
If you haven't already guessed, it's the rocket equation with added gravity and drag. Now, I'm not even sure if that's what it's supposed to look like. Anyway, u is the speed of the exhaustion gasses of the rocket, q is the amount of gas spewed out every second in kg/s, m0 is the total mass of the rocket, t is time, g is gravity, cd is the drag coefficient, ρ is the density of air, A is the reference area of the rocket that is affected by the air, and finally v2 is, well, velocity squared.
Glad that's out of the way.
For a way to make this simpler for myself, I've assumed that the air density is constant. So now my equation would look like this:
dv/dt = (u*q)/(m0-q*t) - g - k*v2
Where k is a constant. I have all the data for the various constants, and now I can solve this numerically, right? Wrong.
To solve this numerically I need a difference quotient, and I have just that (with some help from my teacher):
(v(n+1)-v(n))/(t(n+1)-t(n))=k1/t(n)-k2-k3*v(n)2
where t(n+1)-t(n)=h is the stepsize.
Isolating v(n+1) I get v(n+1)=(k1/t(n)-k2-k3*v(n)2)*h+v(n)
Now, m0-q*t is the mass of the rocket as a function of time. My teacher calls it t(n) in the difference quotient, while I also have a t0, the time. I don't get it. But I tried solving it anyway, using Eulers method, and maybe eventually probably using RK4 at some point. I have never done this before, mind you, and I have just learned about this, by myself. My teacher is not answering the emails I've sent him, and he won't (read: He's not allowed to) help me anyway, as I am writing an assignment where I have to delve into the math and physics by myself without much help.
So I try to solve this using excel, and set some start values: y(10)=97 where t0 is 10 and v0 is 97. v(n) in my difference quotient, in the very first step, is 97, and I have to use that to find the next one hence the reason I isolated v(n+1).
But when I insert all the values into the difference quotient, and try to calculate my step, my velocity goes from 97 m/s to -3600. I tried using a stepsize of 1, and 0.5 but the end result was always the same; it would jump drastically down below 0
I really, really, don't know what I'm doing wrong, I don't know if my difference quotient is correct, and at this point, I'm not even sure if my rocket equation is correct. I've messaged my teacher but he's not answering.
Any help would be appreciated. Sorry for the long post, hope it was coherent enough to understand.
dv/dt = (u*q)/(m0-q*t) - g - (cd*ρ*A*0.5)*v2
If you haven't already guessed, it's the rocket equation with added gravity and drag. Now, I'm not even sure if that's what it's supposed to look like. Anyway, u is the speed of the exhaustion gasses of the rocket, q is the amount of gas spewed out every second in kg/s, m0 is the total mass of the rocket, t is time, g is gravity, cd is the drag coefficient, ρ is the density of air, A is the reference area of the rocket that is affected by the air, and finally v2 is, well, velocity squared.
Glad that's out of the way.
For a way to make this simpler for myself, I've assumed that the air density is constant. So now my equation would look like this:
dv/dt = (u*q)/(m0-q*t) - g - k*v2
Where k is a constant. I have all the data for the various constants, and now I can solve this numerically, right? Wrong.
To solve this numerically I need a difference quotient, and I have just that (with some help from my teacher):
(v(n+1)-v(n))/(t(n+1)-t(n))=k1/t(n)-k2-k3*v(n)2
where t(n+1)-t(n)=h is the stepsize.
Isolating v(n+1) I get v(n+1)=(k1/t(n)-k2-k3*v(n)2)*h+v(n)
Now, m0-q*t is the mass of the rocket as a function of time. My teacher calls it t(n) in the difference quotient, while I also have a t0, the time. I don't get it. But I tried solving it anyway, using Eulers method, and maybe eventually probably using RK4 at some point. I have never done this before, mind you, and I have just learned about this, by myself. My teacher is not answering the emails I've sent him, and he won't (read: He's not allowed to) help me anyway, as I am writing an assignment where I have to delve into the math and physics by myself without much help.
So I try to solve this using excel, and set some start values: y(10)=97 where t0 is 10 and v0 is 97. v(n) in my difference quotient, in the very first step, is 97, and I have to use that to find the next one hence the reason I isolated v(n+1).
But when I insert all the values into the difference quotient, and try to calculate my step, my velocity goes from 97 m/s to -3600. I tried using a stepsize of 1, and 0.5 but the end result was always the same; it would jump drastically down below 0
I really, really, don't know what I'm doing wrong, I don't know if my difference quotient is correct, and at this point, I'm not even sure if my rocket equation is correct. I've messaged my teacher but he's not answering.
Any help would be appreciated. Sorry for the long post, hope it was coherent enough to understand.