yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #00814
Re: YADE crash when spheres generated during simulation
One idea comes to mind...
Perhaps the vector containing forces is not resized immediatly to
(NumberOfOldSphere + NumberOfNewSpheres). So you are accessing component
(n+...) of a vector of size n.
Perhaps try to run at least one timestep before computing the unbalanced
force. It can be done by just reordering engines in the loop : place the
"addSpheres" engine _after_ the "computeForce" engine.
If it doesn't help. Try to decompose this line :
f= (static_cast<Force*> ( ncb->physicalActions->find( (*bi)->getId() , ForceClassIndex).get() )->force).Length();
as
int i = (*bi)->getId();
shared_ptr <physicalActions> pa = ncb->physicalActions->find(
(*bi)->getId() , ForceClassIndex);
etc...
and see precisely where the problem is.
Also, are you sure that ForceClassIndex is defined correctly? Does it
work before you generate new spheres?
Bruno
Kien Dang, Mr a écrit :
> Hi all,
>
> I am trying to generate spheres during the simulation, when the old group of shpere is stable, a new group of spheres is generated and the stability check is perfrom similarly to the function computeunbalancedforce in TRIAXIAL TEST. YADE however crash whenever the physicalAction class accessed through a pointer. The thread is begin at the operator get() in the share_ptr in boost library. I tried to figured it out in several days but all the attempts failed.
>
> The code is attached hereunder:
>
>
> Real MeanUnbalanced=0;
> long nBodies = 0;
> BodyContainer::iterator bi = bodies->begin();
> BodyContainer::iterator biEnd = bodies->end();
> Real f;
> for( ; bi!=biEnd ; ++bi )
> {
> if ((*bi)->isDynamic)
> {
> CRASH HERE --------->f= (static_cast<Force*> ( ncb->physicalActions->find( (*bi)->getId() , ForceClassIndex).get() )->force).Length();
> MeanUnbalanced += f;
> if (f!=0) ++nBodies;
> }
> }
> if (nBodies != 0 && MeanForce != 0)
> {
> MeanUnbalanced = MeanUnbalanced/nBodies/MeanForce;
> }
> return MeanUnbalanced;
>
>
>
> Could anyone give me some hints about the problems? If you need a whole class please let me know.
>
> Thanks in advance,
>
> Kien Dang
> _______________________________________________
> Yade-users mailing list
> Yade-users@xxxxxxxxxxxxxxxx
> https://lists.berlios.de/mailman/listinfo/yade-users
>
>
--
_______________
Chareyre Bruno
Maitre de conference
Institut National Polytechnique de Grenoble
Laboratoire 3S (Soils Solids Structures) - bureau E145
BP 53 - 38041, Grenoble cedex 9 - France
Tél : 33 4 56 52 86 21
Fax : 33 4 76 82 70 43
________________
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users
Follow ups
References