← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4115: implement more accurate porosity calculation for clumps in TriaxialStressController; inserted upd...

 

------------------------------------------------------------
revno: 4115
committer: Christian Jakob <jakob@xxxxxxxxxxxxxxxxxxx>
timestamp: Thu 2014-07-24 16:00:28 +0200
message:
  implement more accurate porosity calculation for clumps in TriaxialStressController; inserted updateClumpProperties command in Triax tutorial
modified:
  examples/triax-tutorial/script-session1.py
  pkg/dem/TriaxialStressController.cpp
  pkg/dem/TriaxialStressController.hpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'examples/triax-tutorial/script-session1.py'
--- examples/triax-tutorial/script-session1.py	2014-01-03 20:43:21 +0000
+++ examples/triax-tutorial/script-session1.py	2014-07-24 14:00:28 +0000
@@ -68,6 +68,7 @@
  ## generate positions and input them in the simulation
  sp.makeClumpCloud(mn,mx,[c1],periodic=False)
  sp.toSimulation(material='spheres')
+ O.bodies.updateClumpProperties()#get more accurate clump masses/volumes/inertia
 else:
  sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.95,seed=1) #"seed" make the "random" generation always the same
  O.bodies.append([sphere(center,rad,material='spheres') for center,rad in sp])

=== modified file 'pkg/dem/TriaxialStressController.cpp'
--- pkg/dem/TriaxialStressController.cpp	2014-07-24 07:33:43 +0000
+++ pkg/dem/TriaxialStressController.cpp	2014-07-24 14:00:28 +0000
@@ -15,6 +15,7 @@
 #include<assert.h>
 #include<yade/core/Scene.hpp>
 #include<yade/pkg/dem/Shop.hpp>
+#include<yade/core/Clump.hpp>
 
 CREATE_LOGGER(TriaxialStressController);
 YADE_PLUGIN((TriaxialStressController));
@@ -101,13 +102,17 @@
 	if (first) {
 		BodyContainer::iterator bi = scene->bodies->begin();
 		BodyContainer::iterator biEnd = scene->bodies->end();
-		spheresVolume = 0;
+		particlesVolume = 0;
 		for ( ; bi!=biEnd; ++bi ) {
-			if((*bi)->isClump()) continue;
 			const shared_ptr<Body>& b = *bi;
-			if ( b->isDynamic() || b->isClumpMember() ) {
+			if (b->isClump()) {
+				const shared_ptr<Clump>& clump = YADE_PTR_CAST<Clump>(b->shape);
+				const shared_ptr<Body>& member = Body::byId(clump->members.begin()->first,scene);
+				particlesVolume += b->state->mass / member->material->density;
+			}
+			else if (b->isDynamic() && !b->isClumpMember()) {
 				const shared_ptr<Sphere>& sphere = YADE_PTR_CAST<Sphere> ( b->shape );
-				spheresVolume += 1.3333333*Mathr::PI*pow ( sphere->radius, 3 );
+				particlesVolume += 1.3333333*Mathr::PI*pow ( sphere->radius, 3 );
 			}
 		}
 		first = false;
@@ -116,7 +121,7 @@
 	max_vel2=3 * height /(height+width+depth)*max_vel;
 	max_vel3 =3 * depth /(height+width+depth)*max_vel;
 
-	porosity = ( boxVolume - spheresVolume ) /boxVolume;
+	porosity = ( boxVolume - particlesVolume ) /boxVolume;
 	position_top = p_top->se3.position.y();
 	position_bottom = p_bottom->se3.position.y();
 	position_right = p_right->se3.position.x();
@@ -219,7 +224,7 @@
 }
 
 void TriaxialStressController::controlInternalStress ( Real multiplier ) {
-	spheresVolume *= pow ( multiplier,3 );
+	particlesVolume *= pow ( multiplier,3 );
 	BodyContainer::iterator bi    = scene->bodies->begin();
 	BodyContainer::iterator biEnd = scene->bodies->end();
 	for ( ; bi!=biEnd ; ++bi ) {

=== modified file 'pkg/dem/TriaxialStressController.hpp'
--- pkg/dem/TriaxialStressController.hpp	2014-07-24 07:33:43 +0000
+++ pkg/dem/TriaxialStressController.hpp	2014-07-24 14:00:28 +0000
@@ -41,8 +41,8 @@
 		//! The values of stresses
 		Vector3r	stress [6];
 		Vector3r	force [6];
-		//! Value of spheres volume (solid volume)
-		Real spheresVolume;
+		//! Value of particles volume (solid volume of clumps and spheres)
+		Real particlesVolume;
 		//! Value of box volume
 		Real boxVolume;
 		//! Sample porosity
@@ -151,7 +151,8 @@
 		.def_readonly("strainRate",&TriaxialStressController::getStrainRate,"Current strain rate in a vector d/dt(exx,eyy,ezz).")
 		.def_readonly("porosity",&TriaxialStressController::porosity,"Porosity of the packing.")
 		.def_readonly("boxVolume",&TriaxialStressController::boxVolume,"Total packing volume.")
-		.def_readonly("spheresVolume",&TriaxialStressController::spheresVolume,"Total volume of spheres.")
+		.def_readonly("particlesVolume",&TriaxialStressController::particlesVolume,"Total volume of particles (clumps and spheres).")
+		.def_readonly("spheresVolume",&TriaxialStressController::particlesVolume,"Shorthand for :yref:`TriaxialStressController::particlesVolume`")
 		.def_readonly("max_vel1",&TriaxialStressController::max_vel1,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
 		.def_readonly("max_vel2",&TriaxialStressController::max_vel2,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
 		.def_readonly("max_vel3",&TriaxialStressController::max_vel3,"see :yref:`TriaxialStressController::max_vel` |ycomp|")