← Back to team overview

yade-dev team mailing list archive

[Bug 923929] Re: OMP force container fails to reset forces on clump members

 

It is fixed with the code below, which introduces a loop in Newton just to apply 0-force on each clump.
This is how I made the bug disapear, but I would not really call this a fix... 
We can keep this in wishlist.


+#ifdef YADE_OPENMP
+void NewtonIntegrator::ensureSync()
+{
+	if (syncEnsured) return;	
+	YADE_PARALLEL_FOREACH_BODY_BEGIN(const shared_ptr<Body>& b, scene->bodies){
+		if(b->isClump()) continue;
+		scene->forces.addForce(b->getId(),Vector3r(0,0,0));
+	} YADE_PARALLEL_FOREACH_BODY_END();
+	syncEnsured=true;
+}
+#endif
+
 void NewtonIntegrator::action()
 {
+	#ifdef YADE_OPENMP
+	//prevent https://bugs.launchpad.net/yade/+bug/923929
+	ensureSync();
+	#endif

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/923929

Title:
  OMP force container fails to reset forces on clump members

Status in Yet Another Dynamic Engine:
  Incomplete

Bug description:
  When clumps are used and no gravity engine is present, force containers are not reseting the forces on clump members. Junk values are accumulated over time and the clump itself soon disappears.
  A workaround is to addForce(0,0,0) once at startup on all bodies, this is done in Newton::action() currently.
  This is most probably (still to check) because containers sizes are checked vs. body Id only in addForce, which is never applied on clump members before they are in contact with something. Not clear is why the same problem does not appear also on standalone bodies.
  The crashing example was obtained from a series of personal scripts from Klaus Thoeni, not disclosed here.

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/923929/+subscriptions


References