← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2440: 1. correct somemisprints anddo some actualization in user's manual.

 

Hi,

Have a look at the commented code, in PeriTriaxController::strainStressStiffUpdate (now I see current code is an approximation : it uses ref. distance... I did not remember that).
The commented code is exact but needs wrapped coordinates(no big deal*).
This code gives the 3x3 stress tensor. It is shorter, and probably faster than any code using length because length needs a sqrt. It works at the genericSphereContact level. Another solution is to compute branch like this, but it would apply only for ScGeom :
branch= scg->normal* ( scg->refR1+scg->refR2 - penetrationDepth);

Anyway, this code shows how to get positions in C++.

//branch vector, FIXME : the first definition generalizes to non-spherical bodies but needs wrapped coords. // Vector3r branch=(Body::byId(I->getId1())->state->pos-Body::byId(I->getId2())->state->pos);
        Vector3r branch= gsc->normal* ( gsc->refR1+gsc->refR2 );
        stressTensor+=f*branch.transpose();


(*) An example of such wrapping in C++ is in ScGeom::getIncidentVel : scene->cell->Hsize*c->cellDist.cast<Real>() is the translation you have to apply on one sphere to get it in the position where it touch the other one. So, the solution should look like this (not tested) : Vector3r branch=(Body::byId(I->getId1())->state->pos - Body::byId(I->getId2())->state->pos - scene->cell->Hsize*c->cellDist.cast<Real>());

Cheers.

Bruno


On 19/09/10 22:58, Honza Stránský wrote:
Hello,

how can I rewrite in C++ this Python statement?

for i in O.interactions:
     length = (O.bodies[i.id2].state.pos - O.bodies[i.id1].state.pos).norm()

Or is there any other possibility to compute length of interaction in ScGeom (or in GenericSpheresContact in general)? I would like to use function Shop::stressTensorOfPeriodicCell() in new version of peri3dController when it is tested, but currently this function is written only for Dem3DofGeom..

thanks for advices

Jan

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp



--
_______________
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
Lab. 3SR
BP 53 - 38041, Grenoble cedex 9 - France
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43
________________




References