← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4128: reapply 9e512fd50083

 

------------------------------------------------------------
revno: 4128
author: Christian Jakob <jakob@xxxxxxxxxxxxxxxxxxx>
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Fri 2014-08-01 17:37:51 +0200
message:
  reapply 9e512fd50083
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-08-01 15:26:10 +0000
+++ examples/triax-tutorial/script-session1.py	2014-08-01 15:37:51 +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-08-01 15:27:46 +0000
+++ pkg/dem/TriaxialStressController.cpp	2014-08-01 15:37:51 +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));
@@ -105,14 +106,18 @@
 	if (first) {
 		BodyContainer::iterator bi = scene->bodies->begin();
 		BodyContainer::iterator biEnd = scene->bodies->end();
-		spheresVolume = 0;
-		for ( ; bi!=biEnd; ++bi )
-		{
-			if((*bi)->isClump()) continue;
+
+		particlesVolume = 0;
+		for ( ; bi!=biEnd; ++bi ) {
 			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;
@@ -121,7 +126,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();
@@ -227,9 +232,8 @@
 	meanStress/=6.;
 }
 
-void TriaxialStressController::controlInternalStress ( Real multiplier )
-{
-	spheresVolume *= pow ( multiplier,3 );
+void TriaxialStressController::controlInternalStress ( Real multiplier ) {
+	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-08-01 15:27:46 +0000
+++ pkg/dem/TriaxialStressController.hpp	2014-08-01 15:37:51 +0000
@@ -40,8 +40,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
@@ -142,7 +142,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 pf 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|")