[ODE] Atmospheric drag

STenyaK stenyak at gmx.net
Thu Sep 1 07:16:32 MST 2005


I'm also interested in this... currently i use this code:
http://svn.motorsport-sim.org/svn/trunk/src/physics/bodyPhysics.cpp
Check void Body::stepPhysics (), right after the line:
	// apply simple air drag forces:

I'm not sure it's done correctly, i'm not specially good at physics or  
maths.

Thanks for any help or comments :)


On Thu, 01 Sep 2005 06:40:26 +0200, Oktay Ahiska <oktay at panix.com> wrote:

>
> Howdy folks,
>
> I am trying to simulate atmospheric drag with the following code:
> *pIter points to an internal structure with some info about the
> the current object, including its current velocity and surface
> area (these are all spheres) and its dBbody and dMass data.
>
> 	// initielze with negative of current normalized velocity vector
> 	dVector3 dragForce;
> 	dragForce[0] = -(*pIter)->velNorm[0];
> 	dragForce[1] = -(*pIter)->velNorm[1];
> 	dragForce[2] = -(*pIter)->velNorm[2];
>
>          double dragAmt;
>          double vm = (*pIter)->velMag;   // pre-computed velocity  
> magnitude
>
>          // surfaceArea: pre-computed surface area of the sphere
> 	// atmosphericDrag: drag constant, passed to us from caller
> 	
>          dragAmt = vm * vm * (*pIter)->surfaceArea * atmosphericDrag;
>
>          if (dragAmt > 0.) {
> 	      // clamp force if excessive
> 	      double dragMax = vm*(*pIter)->mass.mass;
>                if (dragAmt > dragMax) {
>                      dragAmt = dragMax;
>                }
>
>                dBodyAddForce( (*pIter)->body,
> 			      dragAmt * dragForce[0],
> 			      dragAmt * dragForce[1],
> 			      dragAmt * dragForce[2]);
>           }
>
> So... I know dragAmt is not really accurate, but I can tweak  
> atmosphericDrag
> till it looks "right" but is this otherwise ok?  Am I right to cap off my
> drag at  vm*(*pIter)->mass.mass?
>
> Any comments will be very much appreciated, including "you can already  
> do that
> by..." or some such.
>
> Thanks in advance,
> Oktay
>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



-- 
Saludos,
     STenyaK

_______________________________________________
Site:   http://1ksurvivor.homeip.net  <1kSurvivor>
         http://motorsport-sim.org     <Motorsport>
         http://kwh.iespana.es         <KuantikalWareHouse>
Mail:   stenyak AT gmx DOT net


More information about the ODE mailing list