[ODE] Approximate Hydrodynamic Forces

Ander Taylor ander_taylor at hotmail.com
Wed Apr 16 23:56:02 2003


Hi David,

I have been doing some experimenting, and the code below behaves more 
realisticaly.

I must say that I don't understand why!

What do you think?

Ander

void BoxGeom::ApplyHydrodynamicForces(dReal viscosity)
{
    const dReal *lvel = dBodyGetLinearVel(this->_body->Id);
    const dReal *R = dBodyGetRotation(this->_body->Id);
    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 DotProdX = (R[0]*lvel[0]);  //this I don't understand.
    dReal DotProdY = (R[5]*lvel[1]);  //if I include all the terms
    dReal DotProdZ = (R[10]*lvel[2]); //things can fly off!

    dReal nx = AreaX * DotProdX;
    dReal ny = AreaY * DotProdY;
    dReal nz = AreaZ * DotProdZ;

    dReal temp = -nx*viscosity;
    dBodyAddRelForce(this->_body->Id, temp, 0, 0); //This I do!
    temp = -ny*viscosity;
    dBodyAddRelForce(this->_body->Id, 0, temp, 0);
    temp = -nz*viscosity;
    dBodyAddRelForce(this->_body->Id, 0, 0, temp);

}

_________________________________________________________________
MSN Instant Messenger now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_messenger.asp