vector<double>distance_final(double x, double y, double z, double vx, double vy, double vz, double t)
///Final distances are calculated here in this function using all previous variable
vector<double> result = acceleration(t,vx,vy,vz,z); ///Result of the acceleration function, gets three values from the acceleration function and puts them into this vector
double a1x = result;
double a1y = result;
double a1z = result;
double k1x = dt*a1x;
double k1z = dt*a1z;
double k1y = dt*a1y;
Please put your code in code tags so that we can see its structure, and also so that we can run it in CPP shell without having to download it.
At the moment, for each timestep ... you are calling the Runge-Kutta update (routine distance_final) SIX times! You should just call it once per timestep.
Moreover, you are not updating your generalised coordinates (x,y,z,vx,vy,vz) at all - you are just putting them in an unused array bruhVector.
To be honest, it would be simpler just to pass x,y,z,vx,vy,vz as reference parameters; then they will be updated in the Runge-Kutta routine and returned to the calling procedure. You don't need to push_back and then return a 6-element vector.
For the long term, if you used a valarray to hold your dependent variables (positions and velocities), then your Runge-Kutta routine would be only one sixth of the size. Just saying.
Oh, and while we look at it, you do realise that pow(e, (-t/tau))
is more obviously coded as exp(-t/tau)
There are quite a few gems in that code when we delve into it! double az = adragz+aMagz-32.174;
I have this horrible feeling that you are working in imperial units!
Might be best if you started by setting the drag coefficient and Magnus-effect coefficient to zero, so that you can compare the results for basic projectile motion without the effects of friction or spin.