[ODE] ODE regarding drag and lift

Ander Taylor ander_taylor at hotmail.com
Thu Nov 6 03:08:36 MST 2003


Hi Jon,

The function below is from a Managed C++ Wrapper so you will have to play 
around with it.

It is ages since I worked on it, so I will not try to explain what I think 
it is doing! If you have any questions, just ask and I will try to help.

I really should use comments!!!!

void BoxGeom::ApplyHydrodynamicForces(dReal linear_viscosity, dReal 
angular_viscosity, dReal density,Vector3 flow)
    {
        const dReal *lvel = dBodyGetLinearVel(this->_body->Id);
        const dReal *avel = dBodyGetAngularVel(this->_body->Id);
        const dReal *R = dBodyGetRotation(this->_body->Id);

        dVector3 compFlow;
        compFlow[0] = lvel[0] - flow.x;
        compFlow[1] = lvel[1] - flow.y;
        compFlow[2] = lvel[2] - flow.z;

        dReal ss[3];
        dGeomBoxGetLengths(this->_id, ss);

        dReal AreaX = ss[1] * ss[2];
        dReal AreaY = ss[0] * ss[2];
        dReal AreaZ = ss[0] * ss[1];

        dReal nx = (R[0] * compFlow[0] + R[4] * compFlow[1] + R[8] * 
compFlow[2]) * AreaX;
        dReal ny = (R[1] * compFlow[0] + R[5] * compFlow[1] + R[9] * 
compFlow[2]) * AreaY;
        dReal nz = (R[2] * compFlow[0] + R[6] * compFlow[1] + R[10] * 
compFlow[2]) * AreaZ;

        dReal temp = -nx*linear_viscosity;
        dBodyAddForce(this->_body->Id, temp*R[0], temp*R[4], temp*R[8]);

        temp = -ny*linear_viscosity;
        dBodyAddForce(this->_body->Id, temp*R[1], temp*R[5], temp*R[9]);

        temp = -nz*linear_viscosity;
        dBodyAddForce(this->_body->Id, temp*R[2], temp*R[6], temp*R[10]);

        nx = (R[0] * avel[0] + R[4] * avel[1] + R[8] * avel[2]) * (AreaY + 
AreaZ);
        ny = (R[1] * avel[0] + R[5] * avel[1] + R[9] * avel[2]) * (AreaX + 
AreaZ);
        nz = (R[2] * avel[0] + R[6] * avel[1] + R[10] * avel[2]) * (AreaX + 
AreaY);

        temp = -nx * angular_viscosity;
        dBodyAddTorque(this->_body->Id, temp * R[0], temp * R[4], temp * 
R[8]);

        temp = -ny * angular_viscosity;
        dBodyAddTorque(this->_body->Id, temp * R[1], temp * R[5], temp * 
R[9]);

        temp = -nz * angular_viscosity;
        dBodyAddTorque(this->_body->Id, temp * R[2], temp * R[6], temp * 
R[10]);

        dReal gravity[3];
        dWorldGetGravity(this->_body->get_WorldId(), gravity);

        temp = -density * ss[0] * ss[1] * ss[2];
        dBodyAddForce(this->_body->Id, temp*gravity[0], temp*gravity[1], 
temp*gravity[2]);

        //which, unless you have a non-axis-aligned gravity, is probably 
just:
        //dBodyAddForce(body, 0, temp*gravity[1], 0);

    }

I have a small demo if you want.


Cheers,

Ander




----Original Message Follows----
Hi all,

I'm considering using ODE to simulate flying objects and I need a bit of 
background information.  Has anyone come across any examples of this or has 
anyone attempted to modify ODE to consider, drag, lift and thrust etc?

Any help you guys could offer would be greatly appreciated.

Best regards,

Jon
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode

_________________________________________________________________
Hot chart ringtones and polyphonics. Go to  
http://ninemsn.com.au/mobilemania/default.asp



More information about the ODE mailing list