1
$\begingroup$

For my computing project, I am creating a projectile simulator but I cant seem to get my head round the air resistance. I tried by working out the horizontal and vertical velocity by solving it (vertically and horizontally giving me two equations):

  • $dv/dt = -cv^2$ (horizontal)
  • $dv/dt = -cv^2 - g $ (vertical)

where c is 1/2 (drag co x density x cross sectional area).

But after doing the integrals and finding the equation it doesn't seem to be working as I want them to...

Sorry for the bad formatting.. (Ill try to excuse myself by saying Im new) and thanks for any help

$\endgroup$
  • $\begingroup$ 2D quadratic drag was also considered in this Phys.SE post. $\endgroup$ – Qmechanic Feb 26 '15 at 23:04
1
$\begingroup$

So yeah, there are these things called vectors which represent arrows; they are made up of components. For example, we would not say "velocity (horizontal)" and "velocity (vertical)" but we would add labels $v_x, v_y$ where $x$ is usually a horizontal-label and $y$ is usually a vertical-label; then we would write the arrow as $\vec v = [v_x, v_y]$, packaging them together into this list-of-numbers that we call a "vector".

To get $\propto v^2$ drag in 2D, we form the vector:

$\vec F_{drag} = -k ~ |\vec v| ~ \vec v $

where we understand that multiplying the ordinary number $k$ over a vector $[a, b]$ produces the vector $[k~a, ~k~b]$, and the magnitude of $\vec v$, written as $|\vec v|$ or sometimes simply as $v$, is given by the Pythagorean theorem as

$v = |\vec v| = \sqrt{v_x^2 + v_y^2}.$

In other words, your equations should be:

$\frac{dv_x}{dt} = -k ~ v_x ~ \sqrt{v_x^2 + v_y^2}$
$\frac{dv_y}{dt} = -g - k ~ v_y ~ \sqrt{v_x^2 + v_y^2}$

This ensures that your drag force always points in the reverse direction from $\vec v$, and grows like $v^2$.

You can also include a wind $w$ in the $x$-direction by replacing (on the right hand side only!) $v_x$ with $(v_x - w)$. This is important because the drag force is relative to the air, not relative to the ground. With a little more effort you can draw a wind vector field $\vec w(x, y)$ and do modeling with "updrafts" and so forth.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ So if i wanted to work out a certain velocity at a certain time how would i go about this? Im not really sure what to do $\endgroup$ – ObnoxiousFrog Feb 26 '15 at 21:09
  • $\begingroup$ Well you said it was a "projectile simulator". The most naive projectile simulator splits the world into discrete time-steps of length $\delta t$, so that $t = n ~\delta t$ where n is the time counter. Then, at every time step, you update some variables $(x, y, v_x, v_y)$ based on the laws. The absolute easiest way is to use finite difference methods, where $x[n + 1] ~=~ x[n] ~+~ v_x[n] ~\delta t$ and similarly $v_x[n + 1] ~=~ v_x[n] ~+~ \frac{dv_x}{dt} ~ \delta t$. There are more sophisticated methods with better numerical stability, but that's a way to start. $\endgroup$ – CR Drost Feb 26 '15 at 22:43
0
$\begingroup$

You made a mistake in the direction of your drag force (vector). You calculated the magnitude of this force correctly, then applied that magnitude both along your horizontal and vertical basis vectors for a total of $\sqrt{2}$ of the desired drag force, and pointing in the wrong direction!

The missing direction is given by $-\vec{v}^0 = -\vec{v} / \left| \vec{v} \right|$. So multiply your drag force magnitude by $v_x / \left| \vec{v} \right|$ for the horizontal ($x$) direction, and analogously for the vertical direction.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ thanks for a fast reply! can you explain the notation? im still in school and never seen it before $\endgroup$ – ObnoxiousFrog Feb 26 '15 at 19:36
  • $\begingroup$ The equality constitutes a definition. The absolute value is a vector norm (here: square root of the sum of square of components). Arrows denote vectors. Subscripts ($x$ or, omitted, $y$) are the horizontal or, respectively, vertical components of vectors. As I write this I see there is another answer that actually gives more explicit definitions. $\endgroup$ – pyramids Feb 27 '15 at 8:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.