← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2234: Force calculation mechanism is changed in VTKRecorder (Thanks to Vaclav). Experimental.

 

------------------------------------------------------------
revno: 2234
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-05-18 11:25:24 +0200
message:
  Force calculation mechanism is changed in VTKRecorder (Thanks to Vaclav). Experimental.
modified:
  pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-05-17 15:08:57 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-05-18 09:25:24 +0000
@@ -176,7 +176,24 @@
 		}
 	}
 
-
+	//Additional Vector for storing forces
+	vector<bodyForce> bodyForces;
+	if(recActive[REC_FORCE]){
+		bodyForces.resize(scene->bodies->size());
+		FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
+			if(!I->isReal()) continue;
+			const NormShearPhys* phys = YADE_CAST<NormShearPhys*>(I->interactionPhysics.get());
+			if(!phys) continue;
+			const body_id_t id1=I->getId1(), id2=I->getId2();
+			
+			bodyForces[id1].norm+=phys->normalForce;
+			bodyForces[id2].norm-=phys->normalForce;
+			
+			bodyForces[id1].shear+=phys->shearForce;
+			bodyForces[id2].shear-=phys->shearForce;
+		}
+	}
+	
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){
 		if (!b) continue;
 		if(mask!=0 && (b->groupMask & mask)==0) continue;
@@ -208,7 +225,7 @@
 					spheresAngVelLen->InsertNextValue(angVel.norm());
 				}
 				if(recActive[REC_FORCE]){
-					const Vector3r& force = scene->forces.getForce(b->getId());
+					const Vector3r& force = bodyForces[b->getId()].norm+bodyForces[b->getId()].shear;
 					float f[3] = { force[0],force[1],force[2] };
 					spheresForceVec->InsertNextTupleValue(f);
 					spheresForceLen->InsertNextValue(force.norm());
@@ -248,7 +265,7 @@
 					facetsColors->InsertNextTupleValue(c);
 				}
 				if(recActive[REC_FORCE]){
-					const Vector3r& force = scene->forces.getForce(b->getId());
+					const Vector3r& force = bodyForces[b->getId()].norm+bodyForces[b->getId()].shear;
 					float f[3] = { force[0],force[1],force[2] };
 					facetsForceVec->InsertNextTupleValue(f);
 					facetsForceLen->InsertNextValue(force.norm());
@@ -338,4 +355,3 @@
 	//writer->SetInput(multiblockDataset);
 	//writer->Write();	
 }
-

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2010-05-17 15:08:57 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2010-05-18 09:25:24 +0000
@@ -19,5 +19,14 @@
 	);
 	DECLARE_LOGGER;
 };
+
+//Class for storing forces, affected on bodies, obtained from Interactions
+class bodyForce{
+	public:
+		Vector3r norm, shear;
+		bodyForce (){
+			norm = Vector3r(0.0,0.0,0.0);
+			shear = Vector3r(0.0,0.0,0.0);
+		}
+};
 REGISTER_SERIALIZABLE(VTKRecorder);
-


Follow ups