← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2412: One more field added to PSD engine

 

------------------------------------------------------------
revno: 2412
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-08-25 11:28:04 +0200
message:
  One more field added to PSD engine
modified:
  pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp
  pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.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/ParticleSizeDistrbutionRPMRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp	2010-08-19 11:23:28 +0000
+++ pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp	2010-08-25 09:28:04 +0000
@@ -115,6 +115,7 @@
 	arrayIdentIds.clear();
 	Real totalMass = 0;
 	Real totalVol = 0;
+	Real totalPartNum = 0;
 	Real const constForVol = 4.0/3.0;
 	//Calculate specimen masses, create vector for storing it
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){
@@ -125,6 +126,7 @@
 			Real volTemp = constForVol*Mathr::PI*pow ( sphere->radius, 3 );
 			totalMass += massTemp;
 			totalVol += volTemp;
+			totalPartNum += 1;
 			int specimenNumberId = YADE_PTR_CAST<RpmState>(b->state)->specimenNumber;
 			
 			if (specimenNumberId != 0) {					//Check, whether particle already belongs to any specimen
@@ -133,6 +135,7 @@
 					if (arrayIdentIds[i].id1 == specimenNumberId) {
 						arrayIdentIds[i].mass+=massTemp;//If "bin" for particle with this specimenId found, put its mass there
 						arrayIdentIds[i].vol+=volTemp;//If "bin" for particle with this specimenId found, put its volume there
+						arrayIdentIds[i].particleNumber+=1; //Calculate the number of particles in on specimen
 						foundItemInArray = true;
 					}
 					if (foundItemInArray) break;
@@ -245,17 +248,18 @@
 	//=================================================================================================================
 	//Save data to a file
 	out<<"**********\n";
-	out<<"iter\ttotalMass\ttotalVol\tnumSpec\tmatNum\n";
-	out<<scene->iter<<"\t"<<totalMass<<"\t"<<totalVol<<"\t"<<arrayIdentIds.size()<<"\t"<<materialCount.size()<<"\n\n";
-	out<<"id\tmassSpec\tvolSpec \tmaxDiamSpec\t";
+	out<<"iter\ttotalMass\ttotalVol\ttotalPartNum\tnumSpec\tmatNum\n";
+	out<<scene->iter<<"\t"<<totalMass<<"\t"<<totalVol<<"\t"<<totalPartNum<<"\t"<<arrayIdentIds.size()<<"\t"<<materialCount.size()<<"\n\n";
+	out<<"id\tmassSpec\tvolSpec\tmaxDiamSpec\tpartNum\t";
 	
+
 	if (materialCount.size() > 1) {
 		for (unsigned int w=0; w<materialCount.size(); w++) { out<<"mat_"<<materialCount[w]<<"_Mass\tmat_"<<materialCount[w]<<"_Vol\tmat_"<<materialCount[w]<<"_PartNum\t";}
 	}
 	out<<"\n";
 	
 	for (unsigned int i=0; i<arrayIdentIds.size(); i++) {
-		out<<arrayIdentIds[i].id1<<"\t"<<arrayIdentIds[i].mass<<"\t"<<arrayIdentIds[i].vol<<"\t"<<arrayIdentIds[i].maxDistanceBetweenSpheres<<"\t";
+		out<<arrayIdentIds[i].id1<<"\t"<<arrayIdentIds[i].mass<<"\t"<<arrayIdentIds[i].vol<<"\t"<<arrayIdentIds[i].maxDistanceBetweenSpheres<<"\t"<<arrayIdentIds[i].particleNumber<<"\t";
 		if (materialCount.size() > 1) {
 			//Find Material Info
 			for (unsigned int w=0; w<materialCount.size(); w++) {

=== modified file 'pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp	2010-08-24 12:54:14 +0000
+++ pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp	2010-08-25 09:28:04 +0000
@@ -20,7 +20,7 @@
 };
 
 struct identicalIds{
-	int id1, id2;
+	int id1, id2,particleNumber;
 	Real mass, vol, maxDistanceBetweenSpheres;
 	identicalIds (int id1r, int id2r, Real massr, Real volr){
 		assert(id1r<id2r);
@@ -29,6 +29,7 @@
 		mass = massr;
 		vol = volr;
 		maxDistanceBetweenSpheres = 0;
+		particleNumber = 1;
 	}
 	static bool sortArrayIdentIds (identicalIds i, identicalIds d) {return i.mass>d.mass;}
 };