Author Topic: Swimming physics and drag  (Read 4284 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Swimming physics and drag
« on: May 14, 2008, 04:25:26 PM »
I'm playing around with the equations for swimming physics and drag.  I think this is on the top of your todo list, too, Eric.  Anyway, I found this article helpful.  Check out pages 8 to 10.  It talks about this integral:

Drag Force = Int((n dot v) * n) dS over the surface (S) of the body, using the instantaneous velocity (v) of the point (dS) in question and the normal (n) to the surface.  For ties the normal is constant, the instaneous velocity is easily arrived at by lerping the velocities of either bot, and the length is simply bot2.pos - bo1.pos.  So I think we can build an equation that is physically accurate to allow for swimming motions in the present version.  I don't think it will properly take in to account the energy needed to move the tie to produce the motion in the first place, but it's a start.

I'll try to plug it in to Maple when I get home tonight to arrive at a closed form for a drag force from the tie on either bot.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Swimming physics and drag
« Reply #1 on: May 15, 2008, 02:22:00 AM »
Oooh, I'm exited!! Now all we need is collisions, and the ties will be totally realistic!
« Last Edit: May 15, 2008, 02:22:28 AM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Swimming physics and drag
« Reply #2 on: May 15, 2008, 04:00:35 AM »
The paper wasn't as much as I'd hoped.  It just ended up resolving down to the same dang problem I've been wrestling with for 3 years.  Good news, though, is that I know more now than I did before.  I think this is the answer: (looks right, too.  Something this simple from so much work fulfills some sort of cosmic edict)

Code: [Select]
let v = (v1 + v2)
 
 F1 = -b * L / 6 * (v + v1) dot n
 F2 = -b * L / 6 * (v + v2) dot n
 
 where b is the drag coefficient, L is the length of the tie, v1 and v2 are the velocities of either body (vectors), respectively, and n is the normal for the tie (vector), and F1 and F2 are the forces to apply to bot 1 and 2, respectively.

Doing some more tricks, you can combine the n and L term in to a single vector that is simply:

Code: [Select]
normal = (pos2 - pos1)
 normal = Vector(-normal.y, normal.x);

and just implicitly scale the b term by 1/6 (since it's arbitrarily chosen anyway)

and arrive at just:
Code: [Select]
F1 = -b * (v + v1) dot normal
 F2 = -b * (v + v2) dot normal

Also attached is the maple worksheet I used, if anyone is particularly interested.
« Last Edit: May 15, 2008, 04:02:41 AM by Numsgil »

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Swimming physics and drag
« Reply #3 on: May 15, 2008, 07:12:46 AM »
I'm not 100% certain I remeber everything from physics, so I haev to ask.

Does this acount for multiple shapes in DB? I had an idea if it doesnt. It seesm we have several options for defining a shape in DB, and it seems we should be able to make multiple types of shaped bots; oblong ones, and circular ones. Regardless of which method is implemented, we have 3choices for equations to define the normal surface of a shape usign conics.

Set A:

Code: [Select]
(X-H)^2+(Y-K)^2=R^2 (taken from a^2+b^2=c^20
where h = horizontal shift from center; k =  vertical shift, and r is radious of full circle - the square of the shifts.

Set B:

Code: [Select]
AX^2+AY^2+BX+CY+D=0
the break down of the polynomial:{ X(AX+B),(AY+C), D } = 0

Set C:

Code: [Select]
(X-H)^2)/A^2+(Y-K)^2/B^2=1
where h and y are horizontal and vertical point shifts for the center, and A is horizontal component of radius and B is vertical component of radius

I think those explinations are correct... Also I believe that mass adds to drag and should be used for inertia of drag, this would allow for you to calculate things like slipping force, which is the critical speed before a bot doesn't have enough drag force to steer. Not sure what you're calling the normal, is it the surface of the bot and tie? Or is it the normal angle of a tie?

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Swimming physics and drag
« Reply #4 on: May 15, 2008, 10:31:24 AM »
This topic is really useful.  Thanks guys.  Short on tiem at the moment, but I may dive into this next week.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Swimming physics and drag
« Reply #5 on: May 15, 2008, 01:53:53 PM »
Quote from: gymsum
Does this acount for multiple shapes in DB?

The equation I gave is just for something tie-shaped (ie: basically a rectangle, with the ends that attach to either bot not counting), and will work for the current version more so for DB3, if that's what you're getting at.  The current program should already understand the ideas of drag on the bots and added mass.

Or do you mean drag on shapes in DB (meaning those things you place in the world that animal minimalis tries to feed from like it's some over-bloated veggy)?

Quote
...to calculate things like slipping force, which is the critical speed before a bot doesn't have enough drag force to steer.

I'm not familiar with slipping force.  Do you have any links?  Unless you mean something like rolling resistance?  When I use the term "drag", I mean fluid resistance, not friction.

Quote
Not sure what you're calling the normal, is it the surface of the bot and tie? Or is it the normal angle of a tie?

Everything I've presented in this thread is just for ties.  In fact, it's just for ties moving in a viscous liquid.  It would not technically apply for something with turbulent flow, like bird flight or large fish swimming (or jet airplanes).  But I think it's probably close enough for our purposes to assume only laminar flow.

Bots are circular (or spherical as far as drag equations go), and have had drag implemented for quite a while.  Both laminar and turbulent flow are supported, IIRC.  AFAIK, bots and ties are the only thing that need drag (well, maybe shots too, but that's trivially easy).
« Last Edit: May 15, 2008, 06:12:29 PM by Numsgil »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Swimming physics and drag
« Reply #6 on: May 15, 2008, 07:16:21 PM »
Ack, forgot to mention, the F1 and F2 terms above reduce to a scalar (ie: float).  You'll need to point them.  Do F1Vector = F1 * unitize(normal) for F1 and F2 (that is, drag force acts along the normal).

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Swimming physics and drag
« Reply #7 on: May 20, 2008, 08:04:20 AM »
Sliding Friction (aka Slipping Force) is the minimum amount of kinetic energy required on two or one body(ies) of a system, ie tires on wet concrete. Realisiticly it requires calculous for 100% realism, but for DB it only has to be geometric since we're dealing with the really small, brownian motion or the Heisemer theory allows for much error in physical calulability. Any energy exerted below this 'floor' produces low amonts of inertia requiring more energy to push at lower forces than higher ones. There are in fact two slipping force ends, a minimum and maximum. If the maximum is exceeded, an object builds up to much inertia with relatively lower friction and thus turns wider and slower to respond to velocity vector changes.

http://www.ac.wwu.edu/~vawter/PhysicsNet/T...ionalForce.html  This should give you an idea of what every kind of friction there is based on geometric principles. Also I was going to ask you about DB 3, I know you were planning to add darkmatter and I had to ask why, because on a cellular level its almost inifinitely 0 in comparison to the weight of the entire mass of non-dark matter material. (I think you mentioned anti-matter also) Why not build the program assuming this is a preset feature, because if the value is to low, the bots will colapse in on themselves, if its too high, the bots will desintegrate. Anyways a bit off topic there...



Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Swimming physics and drag
« Reply #8 on: May 20, 2008, 01:38:33 PM »
Quote from: gymsum
Sliding Friction (aka Slipping Force) is the minimum amount of kinetic energy required on two or one body(ies) of a system, ie tires on wet concrete. Realisiticly it requires calculous for 100% realism, but for DB it only has to be geometric since we're dealing with the really small, brownian motion or the Heisemer theory allows for much error in physical calulability. Any energy exerted below this 'floor' produces low amonts of inertia requiring more energy to push at lower forces than higher ones. There are in fact two slipping force ends, a minimum and maximum. If the maximum is exceeded, an object builds up to much inertia with relatively lower friction and thus turns wider and slower to respond to velocity vector changes.

Ah, yes.  For the current 2.4X code, the only friction is along the z axis (pointing in to the screen) to slow bots down.  Implementing it to allow for something like a bot rolling along the top of a shape requires at the very least for the program to understand the idea of angular momentum and torque, which I think is either not implemented or implemented haphazardly at best.  For DB3, it should support things like a shape rolling down another one.

Quote
Also I was going to ask you about DB 3, I know you were planning to add darkmatter and I had to ask why,

I was?  Are you sure you didn't misunderstand me?  Because my understanding of dark matter is simply that it's matter that doesn't interact with light, which would indeed be a silly thing to add.  So I can't imagine that was ever on the plan.

Quote
(I think you mentioned anti-matter also)
This sounds vaguely familiar.  I think it was meant half in jest.

Either way, neither dark matter or anti matter are on my presently understood to-do list.