← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2149: - Register TriaxialTest (yes!!).

 

------------------------------------------------------------
revno: 2149
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Sun 2010-04-18 17:46:26 +0200
message:
  - Register TriaxialTest (yes!!).
modified:
  pkg/dem/PreProcessor/TriaxialTest.cpp
  pkg/dem/PreProcessor/TriaxialTest.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/PreProcessor/TriaxialTest.cpp'
--- pkg/dem/PreProcessor/TriaxialTest.cpp	2010-04-06 14:43:09 +0000
+++ pkg/dem/PreProcessor/TriaxialTest.cpp	2010-04-18 15:46:26 +0000
@@ -5,16 +5,16 @@
 *  This program is free software; it is licensed under the terms of the  *
 *  GNU General Public License v2 or later. See file LICENSE for details. *
 *************************************************************************/
-#include "TriaxialTest.hpp"
+
 
 #include<yade/pkg-dem/ElasticContactLaw.hpp>
 #include<yade/pkg-dem/Ip2_FrictMat_FrictMat_FrictPhys.hpp>
 #include<yade/pkg-dem/GlobalStiffnessTimeStepper.hpp>
-#include<yade/pkg-dem/PositionOrientationRecorder.hpp>
 #include<yade/pkg-common/ElastMat.hpp>
 #include<yade/pkg-dem/TriaxialStressController.hpp>
 #include<yade/pkg-dem/TriaxialCompressionEngine.hpp>
 #include <yade/pkg-dem/TriaxialStateRecorder.hpp>
+#include<yade/pkg-dem/PositionOrientationRecorder.hpp>
 #include<yade/pkg-common/Aabb.hpp>
 #include<yade/core/Scene.hpp>
 #include<yade/pkg-common/InsertionSortCollider.hpp>
@@ -47,83 +47,85 @@
 #include<yade/pkg-dem/SpherePack.hpp>
 //#include<yade/pkg-dem/MicroMacroAnalyser.hpp>
 
+#include "TriaxialTest.hpp"
 CREATE_LOGGER(TriaxialTest);
+YADE_PLUGIN((TriaxialTest));
 
 using namespace boost;
 using namespace std;
 
-TriaxialTest::TriaxialTest () : FileGenerator()
-{
-	lowerCorner 		= Vector3r(0,0,0);
-	upperCorner 		= Vector3r(1,1,1);
-	thickness 		= 0.001;
-	importFilename          = ""; // oh, PLEASE, keep this empty -- i.e., by default, generate spheres in the box, not load them.
-	Key			="";
-	outputFileName 		= "./TriaxialTest"+Key+".xml";
-	//nlayers = 1;
-	wall_top 		= true;
-	wall_bottom 		= true;
-	wall_1			= true;
-	wall_2			= true;
-	wall_3			= true;
-	wall_4			= true;
-	wall_top_wire 		= true;
-	wall_bottom_wire	= true;
-	wall_1_wire		= true;
-	wall_2_wire		= true;
-	wall_3_wire		= true;
-	wall_4_wire		= true;
-	spheresColor		= Vector3r(0.8,0.3,0.3);
-	spheresRandomColor	= false;
-	recordIntervalIter	= 20;
-	saveAnimationSnapshots = false;
-	AnimationSnapshotsBaseName = "./snapshots_"+Key+"/snap";
-	WallStressRecordFile = "./WallStresses"+Key;
-
-	rotationBlocked 	= false;
-	boxWalls 		= true;
-	internalCompaction	=false;
-	dampingForce 		= 0.2;
-	dampingMomentum 	= 0.2;
-	defaultDt 		= -1;
-	
-	timeStepUpdateInterval = 50;
-	timeStepOutputInterval = 50;
-	wallStiffnessUpdateInterval = 10;
-	radiusControlInterval 	= 10;
-	numberOfGrains 		= 400;
-	strainRate 		= 0.1;
-	maxWallVelocity		=10;
-	StabilityCriterion 	= 0.01;
-	autoCompressionActivation = true;
-	autoUnload 		= true;
-	autoStopSimulation 	= false;
-	maxMultiplier 		= 1.01;
-	finalMaxMultiplier 	= 1.001;	
-	sphereYoungModulus  	= 15000000.0;
-	sphereKsDivKn  	= 0.5;	
-	sphereFrictionDeg 	= 18.0;
-	compactionFrictionDeg   = sphereFrictionDeg;
-	density			= 2600;
-	
-	boxYoungModulus   	= 15000000.0;
-	boxKsDivKn  	= 0.2;
-	boxFrictionDeg   	= 0.f;
-	gravity 		= Vector3r(0,-9.81,0);
-	
-	sigmaIsoCompaction = 50000;
-	sigmaLateralConfinement=sigmaIsoCompaction;
-	wallOversizeFactor=1.3;
-	biaxial2dTest=false;
-	radiusStdDev=0.3;
-	radiusMean=-1; // no radius specified
-	fixedPoroCompaction=false;
-	fixedPorosity = 1;
-	fast=false;
-	noFiles=false;
-	facetWalls=false;
-	wallWalls=false;
-}
+// TriaxialTest::TriaxialTest () : FileGenerator()
+// {
+// 	lowerCorner 		= Vector3r(0,0,0);
+// 	upperCorner 		= Vector3r(1,1,1);
+// 	thickness 		= 0.001;
+// 	importFilename          = ""; // oh, PLEASE, keep this empty -- i.e., by default, generate spheres in the box, not load them.
+// 	Key			="";
+// 	outputFileName 		= "./TriaxialTest"+Key+".xml";
+// 	//nlayers = 1;
+// 	wall_top 		= true;
+// 	wall_bottom 		= true;
+// 	wall_1			= true;
+// 	wall_2			= true;
+// 	wall_3			= true;
+// 	wall_4			= true;
+// 	wall_top_wire 		= true;
+// 	wall_bottom_wire	= true;
+// 	wall_1_wire		= true;
+// 	wall_2_wire		= true;
+// 	wall_3_wire		= true;
+// 	wall_4_wire		= true;
+// 	spheresColor		= Vector3r(0.8,0.3,0.3);
+// 	spheresRandomColor	= false;
+// 	recordIntervalIter	= 20;
+// 	saveAnimationSnapshots = false;
+// 	AnimationSnapshotsBaseName = "./snapshots_"+Key+"/snap";
+// 	WallStressRecordFile = "./WallStresses"+Key;
+// 
+// 	rotationBlocked 	= false;
+// 	boxWalls 		= true;
+// 	internalCompaction	=false;
+// 	dampingForce 		= 0.2;
+// 	dampingMomentum 	= 0.2;
+// 	defaultDt 		= -1;
+// 	
+// 	timeStepUpdateInterval = 50;
+// 	timeStepOutputInterval = 50;
+// 	wallStiffnessUpdateInterval = 10;
+// 	radiusControlInterval 	= 10;
+// 	numberOfGrains 		= 400;
+// 	strainRate 		= 0.1;
+// 	maxWallVelocity		=10;
+// 	StabilityCriterion 	= 0.01;
+// 	autoCompressionActivation = true;
+// 	autoUnload 		= true;
+// 	autoStopSimulation 	= false;
+// 	maxMultiplier 		= 1.01;
+// 	finalMaxMultiplier 	= 1.001;	
+// 	sphereYoungModulus  	= 15000000.0;
+// 	sphereKsDivKn  	= 0.5;	
+// 	sphereFrictionDeg 	= 18.0;
+// 	compactionFrictionDeg   = sphereFrictionDeg;
+// 	density			= 2600;
+// 	
+// 	boxYoungModulus   	= 15000000.0;
+// 	boxKsDivKn  	= 0.2;
+// 	boxFrictionDeg   	= 0.f;
+// 	gravity 		= Vector3r(0,-9.81,0);
+// 	
+// 	sigmaIsoCompaction = 50000;
+// 	sigmaLateralConfinement=sigmaIsoCompaction;
+// 	wallOversizeFactor=1.3;
+// 	biaxial2dTest=false;
+// 	radiusStdDev=0.3;
+// 	radiusMean=-1; // no radius specified
+// 	fixedPoroCompaction=false;
+// 	fixedPorosity = 1;
+// 	fast=false;
+// 	noFiles=false;
+// 	facetWalls=false;
+// 	wallWalls=false;
+// }
 
 TriaxialTest::~TriaxialTest () {}
 
@@ -136,10 +138,6 @@
 		message="Biaxial test can be generated only if Z size is more than 8 times smaller than X size";
 		return false;
 	}
-	if((facetWalls||wallWalls) && !fast){
-		LOG_WARN("Turning TriaxialTest::fast on, since facetWalls or wallWalls were selected.");
-		fast=true;
-	}
 	if(facetWalls&&wallWalls){ LOG_WARN("Turning TriaxialTest::facetWalls off, since wallWalls were selected as well."); }
 	
 	shared_ptr<Body> body;
@@ -439,7 +437,7 @@
 	rootBody->engines.push_back(boundDispatcher);
 	shared_ptr<InsertionSortCollider> collider(new InsertionSortCollider);
 	rootBody->engines.push_back(collider);
-	if(fast){
+// 	if(fast){ // The old code was doing the same slower, still here in case we want to make comparisons again
 		collider->sweepLength=.05*radiusMean;
 		collider->nBins=5; collider->binCoeff=2; /* gives a 2^5=32× difference between the lower and higher bin sweep lengths */
 		shared_ptr<InteractionDispatchers> ids(new InteractionDispatchers);
@@ -453,14 +451,14 @@
 				ids->lawDispatcher->add(shared_ptr<Law2_Dem3DofGeom_FrictPhys_Basic>(new Law2_Dem3DofGeom_FrictPhys_Basic));
 			}
 		rootBody->engines.push_back(ids);
-	} else {
-		assert(!facetWalls);
-		rootBody->engines.push_back(interactionGeometryDispatcher);
-		rootBody->engines.push_back(interactionPhysicsDispatcher);
-		shared_ptr<ElasticContactLaw> elasticContactLaw(new ElasticContactLaw);
-		elasticContactLaw->sdecGroupMask = 2;
-		rootBody->engines.push_back(elasticContactLaw);
-	}
+// 	} else {
+// 		assert(!facetWalls);
+// 		rootBody->engines.push_back(interactionGeometryDispatcher);
+// 		rootBody->engines.push_back(interactionPhysicsDispatcher);
+// 		shared_ptr<ElasticContactLaw> elasticContactLaw(new ElasticContactLaw);
+// 		elasticContactLaw->sdecGroupMask = 2;
+// 		rootBody->engines.push_back(elasticContactLaw);
+// 	}
 	rootBody->engines.push_back(globalStiffnessTimeStepper);
 	rootBody->engines.push_back(triaxialcompressionEngine);
 	if(recordIntervalIter>0 && !noFiles) rootBody->engines.push_back(triaxialStateRecorder);
@@ -480,4 +478,3 @@
 void TriaxialTest::positionRootBody(shared_ptr<Scene>& rootBody)
 {
 }
-YADE_PLUGIN((TriaxialTest));

=== modified file 'pkg/dem/PreProcessor/TriaxialTest.hpp'
--- pkg/dem/PreProcessor/TriaxialTest.hpp	2010-03-18 18:44:02 +0000
+++ pkg/dem/PreProcessor/TriaxialTest.hpp	2010-04-18 15:46:26 +0000
@@ -43,37 +43,8 @@
 class TriaxialTest : public FileGenerator
 {
 	private	:
-		Vector3r	 gravity
-				,lowerCorner
-				,upperCorner;
-
+		Vector3r	 gravity;
 		Vector3r	 spheresColor;
-
-		Real		 thickness
-				,sphereYoungModulus
-				,sphereKsDivKn
-				,sphereFrictionDeg
-				//! If a different value of friction is to be used during the compaction phase
-				,compactionFrictionDeg
-				,boxYoungModulus
-				,boxKsDivKn
-				,boxFrictionDeg
-				,density
-				,dampingForce
-				,dampingMomentum
-				,defaultDt
-				
-				,sigmaIsoCompaction,
-				sigmaLateralConfinement,
-				strainRate,
-				maxWallVelocity,
-				StabilityCriterion,
-				maxMultiplier, ///max multiplier of diameters during internal compaction
-				finalMaxMultiplier,
-				wallOversizeFactor, // make walls bigger (/smaller) than necessary by this factor
-				radiusStdDev,
-				radiusMean,
-				fixedPorosity;
 		bool		 wall_top
 				,wall_bottom
 				,wall_1
@@ -86,50 +57,7 @@
 				,wall_2_wire
 				,wall_3_wire
 				,wall_4_wire
-				//! do we just want to generate a stable packing under isotropic pressure (false) or do we want the triaxial loading to start automatically right after compaction stage (true)?
-				,autoCompressionActivation
-				//! see docs for TriaxialCompressionEngine and TriaxialCompressionEngine::autoUnload
-				,autoUnload
-				//! stop the simulation or run it forever (i.e. until the user stops it)
-				,autoStopSimulation			
-				,rotationBlocked
-				,spheresRandomColor
-				,boxWalls
-				//! flag for choosing between moving boundaries or increasing particles sizes during the compaction stage.
-				,internalCompaction
-				,saveAnimationSnapshots
-				,biaxial2dTest
-				//!flag to choose an isotropic compaction until a fixed porosity choosing a same translation speed for the six walls
-				,fixedPoroCompaction
-				//! do not create any files during run (.xml, .spheres, wall stress records)
-				,noFiles
-				// use Facets instead of Boxes for the walls
-				,facetWalls
-				// use Walls instead of Boxes for the walls
-				,wallWalls
-				;
-				//! Generate faster simulation: use InsertionSortCollider and InteractionDispatchers
-				bool fast;
-
-		int		 recordIntervalIter
-				,timeStepUpdateInterval
-				,timeStepOutputInterval
-				,wallStiffnessUpdateInterval
-				,radiusControlInterval
-				,numberOfGrains;
-				/*,wall_top_id
-				,wall_bottom_id
-				,wall_left_id
-				,all_right_id
-				,wall_front_id
-				,wall_back_id;*/
-		
-		string		importFilename
-				,AnimationSnapshotsBaseName
-				,WallStressRecordFile
-				,Key //A code that is added to output filenames
-				//! string that contains some subset (max. 2) of {'x','y','z'} ; containes axes will have box dimension hardcoded, even if box is scaled as mean_radius is prescribed: scaling will be applied on the rest.
-				,fixedBoxDims;
+				,spheresRandomColor;
 	
 		shared_ptr<TriaxialCompressionEngine> triaxialcompressionEngine;
 		shared_ptr<TriaxialStressController> triaxialstressController;
@@ -144,68 +72,91 @@
 		typedef pair<Vector3r, Real> BasicSphere;
 	
 	public : 
-		TriaxialTest ();
+		//TriaxialTest ();
 		~TriaxialTest ();
 		bool generate();
-	
-	REGISTER_ATTRIBUTES(FileGenerator,
-		(lowerCorner)
-		(upperCorner)
-		(thickness)
-		(importFilename)
-		(outputFileName)
-		//(nlayers)
-		//(boxWalls)
-		(internalCompaction)
-		(biaxial2dTest)
-		(maxMultiplier)
-		(finalMaxMultiplier)
-		(radiusStdDev)
-		(radiusMean)
-		(sphereYoungModulus)
-		(sphereKsDivKn)
-		(sphereFrictionDeg)
-		(compactionFrictionDeg)
-		(boxYoungModulus)
-		(boxKsDivKn)
-		(boxFrictionDeg)
-		(density)
-		(defaultDt)
-		(dampingForce)
-		(dampingMomentum)
-		(rotationBlocked)
-		(timeStepUpdateInterval)
-		(timeStepOutputInterval)
-		(wallStiffnessUpdateInterval)
-		(radiusControlInterval)
-		(numberOfGrains)
-		(strainRate)
-		(maxWallVelocity)
-		(StabilityCriterion)
-		(autoCompressionActivation)
-		(autoUnload)
-		(autoStopSimulation)
-		(recordIntervalIter)
-		(saveAnimationSnapshots)
-		(AnimationSnapshotsBaseName)
-		(WallStressRecordFile)
-		(wallOversizeFactor)
-		(sigmaIsoCompaction)
-		(sigmaLateralConfinement)
-		(Key)
-		(fixedPoroCompaction)
-		(fixedPorosity)
-		(fixedBoxDims)
-		(fast)
-		(noFiles)
-		(facetWalls)
-		(wallWalls)
-	);
-	REGISTER_CLASS_NAME(TriaxialTest);
-	REGISTER_BASE_CLASS_NAME(FileGenerator);
+		
+		YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(
+		TriaxialTest,FileGenerator,"Prepare a scene for triaxial tests. See full documentation at http://yade-dem.org/index.php/TriaxialTest.";
+		,
+   		((Vector3r,lowerCorner,Vector3r(0,0,0),"Lower corner of the box."))
+		((Vector3r,upperCorner,Vector3r(1,1,1),"Upper corner of the box."))
+		((string,importFilename,"","File with positions and sizes of spheres."))
+		((string,Key,"","A code that is added to output filenames."))
+		((string,fixedBoxDims,"","string that contains some subset (max. 2) of {'x','y','z'} ; containes axes will have box dimension hardcoded, even if box is scaled as mean_radius is prescribed: scaling will be applied on the rest."))
+		((string,AnimationSnapshotsBaseName,"./snapshots_"+Key+"/snap",""))
+		((string,WallStressRecordFile,"./WallStresses"+Key,""))
+					
+		((bool,internalCompaction,false,"flag for choosing between moving boundaries or increasing particles sizes during the compaction stage."))
+		((bool,biaxial2dTest,false,"FIXME : what is that?"))
+		((bool,rotationBlocked,false,"FIXME : what is that?"))
+		((bool,fixedPoroCompaction,false,"flag to choose an isotropic compaction until a fixed porosity choosing a same translation speed for the six walls"))
+		((bool,autoCompressionActivation,true,"Do we just want to generate a stable packing under isotropic pressure (false) or do we want the triaxial loading to start automatically right after compaction stage (true)?"))
+		((bool,autoUnload,true,"auto adjust the isotropic stress state from :yref:'TriaxialTest::sigmaIsoCompaction' to :yref:'TriaxialTest::sigmaLateralConfinement' if they have different values. See docs for :yref:'TriaxialCompressionEngine::autoUnload'"))
+		((bool,autoStopSimulation,false,"freeze the simulation when conditions are reached (don't activate this if you want to be able to run/stop from Qt GUI)"))
+		((bool,saveAnimationSnapshots,false,""))
+		((bool,noFiles,false,"Do not create any files during run (.xml, .spheres, wall stress records)"))
+		((bool,facetWalls,false,"Use facets for boundaries (not tested)"))
+		((bool,wallWalls,false,"Use walls for boundaries (not tested)"))
+		((bool,boxWalls,true,"Use boxes for boundaries (recommended)."))
+		
+		((Real,fixedPorosity,1,"FIXME : what is that?"))
+		((Real,thickness,0.001,"thickness of boundaries. It is arbitrary and should have no effect"))
+		((Real,maxMultiplier,1.01,"max multiplier of diameters during internal compaction (initial fast increase)"))
+		((Real,finalMaxMultiplier,1.001,"max multiplier of diameters during internal compaction (secondary precise adjustment)"))
+		((Real,radiusStdDev,0.3,"Normalized standard deviation of generated sizes."))
+		((Real,radiusMean,-1,"Mean radius. If negative (default), autocomputed to as a function of box size and :yref:'TriaxialTest::numberOfGrains'"))
+		((Real,sphereYoungModulus,15000000.0,"Stiffness of spheres."))
+		((Real,sphereKsDivKn,0.5,"Ratio of shear vs. normal contact stiffness for spheres."))
+		((Real,sphereFrictionDeg,18.0,"Friction angle [°] of spheres assigned just before triaxial testing."))
+		((Real,compactionFrictionDeg,sphereFrictionDeg,"Friction angle [°] of spheres during compaction (different values result in different porosities)]. This value is overriden by :yref:'TriaxialTest::sphereFrictionDeg' before triaxial testing."))
+		((Real,boxYoungModulus,15000000.0,"Stiffness of boxes."))
+		((Real,maxWallVelocity,10,"max velocity of boundaries. Usually useless, but can help stabilizing the system in some cases."))
+		((Real,boxKsDivKn,0.5,"Ratio of shear vs. normal contact stiffness for boxes."))
+		((Real,boxFrictionDeg,0.0,"Friction angle [°] of boundaries contacts."))
+		((Real,density,2600,"density of spheres"))
+		((Real,strainRate,0.1,"Strain rate in triaxial testing."))
+		((Real,defaultDt,-1,"Max time-step. Used as initial value if defined. Latter adjusted by the time stepper."))
+		((Real,dampingForce,0.2,"Coefficient of Cundal-Non-Viscous damping (applied on on the 3 components of forces)"))
+		((Real,dampingMomentum,0.2,"Coefficient of Cundal-Non-Viscous damping (applied on on the 3 components of torques)"))
+		((Real,StabilityCriterion,0.01,"Value of unbalanced force for which the system is considered stable. Used in conditionals to switch between loading stages."))
+		((Real,wallOversizeFactor,1.3,"Make boundaries larger than the packing to make sure spheres don't go out during deformation."))
+		((Real,sigmaIsoCompaction,50000,"Confining stress during isotropic compaction."))
+		((Real,sigmaLateralConfinement,50000,"Lateral stress during triaxial loading. An isotropic unloading is performed if the value is not equal to :yref:'TriaxialTest::SigmaIsoCompaction'."))
+		
+		((int,timeStepUpdateInterval,50,"interval for :yref:'GlobalStiffnessTimeStepper'"))
+		((int,timeStepOutputInterval,50,"interval for outputing general informations on the simulation (stress,unbalanced force,...)"))
+		((int,wallStiffnessUpdateInterval,10,"interval for updating the stiffness of sample/boundaries contacts"))
+		((int,radiusControlInterval,10,"interval between size changes when growing spheres."))
+		((int,numberOfGrains,400,"Number of generated spheres."))
+		((int,recordIntervalIter,20,"interval between file outputs"))
+		,
+		/* init */
+		,
+		/* constructor */
+  		outputFileName = "./TriaxialTest"+Key+".xml";
+		wall_top 		= true;
+		wall_bottom 		= true;
+		wall_1			= true;
+		wall_2			= true;
+		wall_3			= true;
+		wall_4			= true;
+		wall_top_wire 		= true;
+		wall_bottom_wire	= true;
+		wall_1_wire		= true;
+		wall_2_wire		= true;
+		wall_3_wire		= true;
+		wall_4_wire		= true;
+		spheresColor		= Vector3r(0.8,0.3,0.3);
+		spheresRandomColor	= false;
+		AnimationSnapshotsBaseName = "./snapshots_"+Key+"/snap";
+		saveAnimationSnapshots = false;
+		WallStressRecordFile = "./WallStresses"+Key;	
+		gravity 		= Vector3r(0,-9.81,0);
+		,
+		//.def("setContactProperties",&TriaxialCompressionEngine::setContactProperties,"Assign a new friction angle (degrees) to dynamic bodies and relative interactions")
+		 );
 	DECLARE_LOGGER;
 };
 
 REGISTER_SERIALIZABLE(TriaxialTest);
-
-