← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2120: - update of ThreeDTriaxialEngine with YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY \n - modified ThreeDTriax...

 

------------------------------------------------------------
revno: 2120
committer: Luc Sibille <luc@pc-calc-luc2>
branch nick: trunk
timestamp: Wed 2010-03-31 18:24:16 +0200
message:
  - update of ThreeDTriaxialEngine with YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY \n - modified ThreeDTriaxialEngine to be able to perform internal compaction (growing particles) \n - modified TriaxialStateRecorder to be able to use it with ThreeDTriaxialEngine
modified:
  pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.cpp
  pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.hpp
  pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.cpp
  pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.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/PartialEngine/ThreeDTriaxialEngine.cpp'
--- pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.cpp	2010-03-30 17:25:38 +0000
+++ pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.cpp	2010-03-31 16:24:16 +0000
@@ -25,33 +25,33 @@
 YADE_PLUGIN((ThreeDTriaxialEngine));
 
 
-ThreeDTriaxialEngine::ThreeDTriaxialEngine()
-{
-	translationAxisy=Vector3r(0,1,0);
-	translationAxisx=Vector3r(1,0,0);
-	translationAxisz=Vector3r(0,0,1);
-	strainRate1=0;
-	currentStrainRate1=0;
-	strainRate2=0;
-	currentStrainRate2=0;
-	strainRate2=0;
-	currentStrainRate2=0;
-	//StabilityCriterion=0.001;
-	UnbalancedForce = 1;
-	Key = "";
-	//Iteration = 0;
-	//testEquilibriumInterval = 20;
-	firstRun=true;
-	frictionAngleDegree = -1;
-	updateFrictionAngle=false;
-
-	stressControl_1=false;
-	stressControl_2=false;
-	stressControl_3=false;
-
- 	boxVolume=0;
-
-}
+// ThreeDTriaxialEngine::ThreeDTriaxialEngine()
+// {
+// 	translationAxisy=Vector3r(0,1,0);
+// 	translationAxisx=Vector3r(1,0,0);
+// 	translationAxisz=Vector3r(0,0,1);
+// 	strainRate1=0;
+// 	currentStrainRate1=0;
+// 	strainRate2=0;
+// 	currentStrainRate2=0;
+// 	strainRate2=0;
+// 	currentStrainRate2=0;
+// 	//StabilityCriterion=0.001;
+// 	UnbalancedForce = 1;
+// 	Key = "";
+// 	//Iteration = 0;
+// 	//testEquilibriumInterval = 20;
+// 	firstRun=true;
+// 	frictionAngleDegree = -1;
+// 	updateFrictionAngle=false;
+// 
+// 	stressControl_1=false;
+// 	stressControl_2=false;
+// 	stressControl_3=false;
+// 
+//  	boxVolume=0;
+// 
+// }
 
 ThreeDTriaxialEngine::~ThreeDTriaxialEngine()
 {	
@@ -87,9 +87,8 @@
 		wall_front_activated=false; wall_back_activated=false;
 		}
 
-		internalCompaction=false;  //is needed to avoid a control for internal compaction by the TriaxialStressController engine
+		//internalCompaction=false;  //is needed to avoid a control for internal compaction by the TriaxialStressController engine
 		
-		//isTriaxialCompression=false;
 		isAxisymetric=false; //is needed to avoid a stress control according the parameter sigma_iso (but according to sigma1, sigma2 and sigma3)
 	
 		firstRun=false;
@@ -97,18 +96,6 @@
 	}
 
 	
-	/*if ( Omega::instance().getCurrentIteration() % testEquilibriumInterval == 0 )
-	{
-	  //updateParameters ( ncb );
-		computeStressStrain ( ncb );
-
-		UnbalancedForce=ComputeUnbalancedForce ( ncb );
-
-		LOG_INFO("UnbalancedForce="<< UnbalancedForce);
-	
-	}*/
-	
-	
 	Real dt = Omega::instance().getTimeStep();
 
 	if(!stressControl_1)  // control in strain if wanted
@@ -159,7 +146,7 @@
 		max_vel3 = 0.5*currentStrainRate3*depth;
 	}
 	
-	TriaxialStressController::action(); // this function is called to perform the external stress control
+	TriaxialStressController::action(); // this function is called to perform the external stress control or the internal compaction
 
 }
 
@@ -171,18 +158,7 @@
 		if (b->isDynamic)
 		YADE_PTR_CAST<FrictMat> (b->material)->frictionAngle = frictionDegree * Mathr::PI/180.0;
 	}
-			
-// 	BodyContainer::iterator bi = bodies->begin();
-// 	BodyContainer::iterator biEnd = bodies->end();
-// 	
-// 	for ( ; bi!=biEnd; ++bi)	
-// 	{	
-// 		shared_ptr<Body> b = *bi;
-// 		if (b->isDynamic)
-// 
-// 		YADE_PTR_CAST<FrictMat> (b->material)->frictionAngle = frictionDegree * Mathr::PI/180.0;
-// 	}
-	
+				
 	FOREACH(const shared_ptr<Interaction>& ii, *scene->interactions){
 		if (!ii->isReal()) continue;
 		const shared_ptr<FrictMat>& sdec1 = YADE_PTR_CAST<FrictMat>((*bodies)[(body_id_t) ((ii)->getId1())]->material);
@@ -195,22 +171,6 @@
 		contactPhysics->tangensOfFrictionAngle		= std::tan(contactPhysics->frictionAngle);
 	}
   
-// 	InteractionContainer::iterator ii    = ncb->interactions->begin();
-// 	InteractionContainer::iterator iiEnd = ncb->interactions->end(); 
-// 	for(  ; ii!=iiEnd ; ++ii ) {
-// 		if (!(*ii)->isReal()) continue;
-// 		
-// 		const shared_ptr<FrictMat>& sdec1 = YADE_PTR_CAST<FrictMat>((*bodies)[(body_id_t) ((*ii)->getId1())]->material);
-// 		const shared_ptr<FrictMat>& sdec2 = YADE_PTR_CAST<FrictMat>((*bodies)[(body_id_t) ((*ii)->getId2())]->material);
-// 		
-// 		const shared_ptr<FrictPhys>& contactPhysics = static_pointer_cast<FrictPhys>((*ii)->interactionPhysics);
-// 
-// 		Real fa 	= sdec1->frictionAngle;
-// 		Real fb 	= sdec2->frictionAngle;
-// 
-// 		contactPhysics->frictionAngle			= std::min(fa,fb);
-// 		contactPhysics->tangensOfFrictionAngle		= std::tan(contactPhysics->frictionAngle); 
-//	}
 } 
 
 

=== modified file 'pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.hpp'
--- pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.hpp	2010-03-30 17:25:38 +0000
+++ pkg/dem/Engine/PartialEngine/ThreeDTriaxialEngine.hpp	2010-03-31 16:24:16 +0000
@@ -21,51 +21,23 @@
  * The engine perform a triaxial compression with a control in direction "i" in stress "if (stressControl_i)" else in strain.
  * For a stress control the imposed stress is specified by "sigma_i" with a "max_veli" depending on "strainRatei". To obtain the same strain rate in stress control than in strain control you need to set "wallDamping = 0.8".
  * For a strain control the imposed strain is specified by "strainRatei".
+ * With this engine you can perform internal compaction by growing the size of particles by using TriaxialStressController::controlInternalStress . For that, just switch on 'internalCompaction=1' and fix sigma_iso=value of mean pressure that you want at the end of the internal compaction.
  *
  */
 
 class ThreeDTriaxialEngine : public TriaxialStressController
 {
 	public :
-		ThreeDTriaxialEngine();
+// 		ThreeDTriaxialEngine();
 		virtual ~ThreeDTriaxialEngine();
 				
-		//! Strain velocity (./s)
-		Real strainRate1;
-		Real currentStrainRate1;
-		Real strainRate2;
-		Real currentStrainRate2;
-		Real strainRate3;
-		Real currentStrainRate3;
-		//! Max ratio of resultant forces on mean contact force
-		Real UnbalancedForce;
-		//! Value of UnbalancedForce for which the system is considered stable
-		//Real StabilityCriterion;
-		//! Value of axial deformation for which the simulation must stop
-		//Real epsilonMax;
-		//! Current value of axial deformation during confined loading (is reference to strain[1])
-		//Real& uniaxialEpsilonCurr;
-		//! Value of friction to use in the test "if (updateFrictionAngle)"
-		Real frictionAngleDegree;
-		//! Swith to activate if an update of the intergranular friction angle is required
-		bool updateFrictionAngle;
-
-		//! switches to choose a stress or a strain control in directions 1, 2 or 3
-		bool stressControl_1;
-		bool stressControl_2;
-		bool stressControl_3;
 		
-
 		Vector3r translationAxisy;
 		Vector3r translationAxisx;
 		Vector3r translationAxisz;
 
 		//! is this the beginning of the simulation, after reading the scene? -> it is the first time that Yade passes trought the engine ThreeDTriaxialEngine
 		bool firstRun;
-		//int FinalIterationPhase1, Iteration, testEquilibriumInterval;
-		//int Iteration, testEquilibriumInterval;
-		
-		std::string Key;//A code that is appended to file names to help distinguish between different simulations
 				
 		virtual void action();
 
@@ -73,13 +45,36 @@
 		///Change physical properties of interactions and/or bodies in the middle of a simulation (change only friction for the moment, complete this function to set cohesion and others before compression test)
 		void setContactProperties(Real frictionDegree);
 
-		
+		YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(
+		ThreeDTriaxialEngine,TriaxialStressController,
+		"The engine perform a triaxial compression with a control in direction 'i' in stress (if stressControl_i) else in strain.\n\n"
+		"For a stress control the imposed stress is specified by 'sigma_i' with a 'max_veli' depending on 'strainRatei'. To obtain the same strain rate in stress control than in strain control you need to set 'wallDamping = 0.8'.\n"
+		" For a strain control the imposed strain is specified by 'strainRatei'.\n"
+		"With this engine you can also perform internal compaction by growing the size of particles by using :yref:TriaxialStressController::controlInternalStress . For that, just switch on 'internalCompaction=1' and fix sigma_iso=value of mean pressure that you want at the end of the internal compaction.\n"
+		,
+		((Real, strainRate1,0,"target strain rate in direction 1 (./s)"))
+		((Real, currentStrainRate1,0,"current strain rate in direction 1 - converging to :yref:'ThreeDTriaxialEngine::strainRate1' (./s)"))
+		((Real, strainRate2,0,"target strain rate in direction 2 (./s)"))
+		((Real, currentStrainRate2,0,"current strain rate in direction 2 - converging to :yref:'ThreeDTriaxialEngine::strainRate2' (./s)"))
+		((Real, strainRate3,0,"target strain rate in direction 3 (./s)"))
+		((Real, currentStrainRate3,0,"current strain rate in direction 3 - converging to :yref:'ThreeDTriaxialEngine::strainRate3' (./s)"))
+		((Real, UnbalancedForce,1,"mean resultant forces divided by mean contact force"))
+		((Real, frictionAngleDegree,-1,"Value of friction used in the simulation if (updateFrictionAngle)"))
+		((bool, updateFrictionAngle,false,"Switch to activate the update of the intergranular frictionto the value :yref:'ThreeDTriaxialEngine::frictionAngleDegree")) 
+		((bool, stressControl_1,true,"Switch to choose a stress or a strain control in directions 1"))
+		((bool, stressControl_2,true,"Switch to choose a stress or a strain control in directions 2"))
+		((bool, stressControl_3,true,"Switch to choose a stress or a strain control in directions 3"))
+		((std::string,Key,"","A string appended at the end of all files, use it to name simulations."))
+		,
+		translationAxisy=Vector3r(0,1,0);
+		translationAxisx=Vector3r(1,0,0);
+		translationAxisz=Vector3r(0,0,1);
+		firstRun=true;
+		boxVolume=0;
+		,
+		.def("setContactProperties",&ThreeDTriaxialEngine::setContactProperties,"Assign a new friction angle (degrees) to dynamic bodies and relative interactions")
+		)
 
-	protected :
-		REGISTER_ATTRIBUTES(TriaxialStressController,(strainRate1)(currentStrainRate1)(strainRate2)(currentStrainRate2)(strainRate3)(currentStrainRate3)/*(Phase1)*/(UnbalancedForce)/*(StabilityCriterion)*//*(translationAxis)(compressionActivated)(autoCompressionActivation)(autoStopSimulation)*//*(testEquilibriumInterval)*//*(currentState)(previousState)(sigmaIsoCompaction)(previousSigmaIso)(sigmaLateralConfinement)*/(Key)(frictionAngleDegree)(updateFrictionAngle)	/*(epsilonMax)*/ /*(uniaxialEpsilonCurr)*//*(isotropicCompaction)*/(spheresVolume)/*(fixedPorosity)*/(stressControl_1)(stressControl_2)(stressControl_3)(sigma1)(sigma2)(sigma3));
-		
-	REGISTER_CLASS_NAME(ThreeDTriaxialEngine);
-	REGISTER_BASE_CLASS_NAME(TriaxialStressController);
 	DECLARE_LOGGER;
 };
 

=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.cpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.cpp	2010-03-29 15:48:00 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.cpp	2010-03-31 16:24:16 +0000
@@ -9,7 +9,8 @@
 *************************************************************************/
 
 #include "TriaxialStateRecorder.hpp"
-#include <yade/pkg-dem/TriaxialCompressionEngine.hpp>
+// #include <yade/pkg-dem/TriaxialCompressionEngine.hpp>
+#include <yade/pkg-dem/TriaxialStressController.hpp>
 #include<yade/pkg-common/Sphere.hpp>
 #include <yade/core/Omega.hpp>
 #include <yade/core/Scene.hpp>
@@ -26,28 +27,30 @@
 	if(out.tellp()==0){
 		out<<"iteration s11 s22 s33 e11 e22 e33 unb_force porosity kineticE"<<endl;
 	}
-	if ( !triaxialCompressionEngine )
+
+	if ( !triaxialStressController )
 	{
 		vector<shared_ptr<Engine> >::iterator itFirst = scene->engines.begin();
 		vector<shared_ptr<Engine> >::iterator itLast = scene->engines.end();
 		for ( ;itFirst!=itLast; ++itFirst )
 		{
-			if ( ( *itFirst )->getClassName() == "TriaxialCompressionEngine" ) //|| (*itFirst)->getBaseClassName() == "TriaxialCompressionEngine")
+
+			if ( ( *itFirst )->getClassName() == "TriaxialCompressionEngine" || ( *itFirst )->getClassName() == "ThreeDTriaxialEngine" )
 			{
 				LOG_DEBUG ( "stress controller engine found" );
-				triaxialCompressionEngine =  YADE_PTR_CAST<TriaxialCompressionEngine> ( *itFirst );
+				triaxialStressController =  YADE_PTR_CAST<TriaxialStressController> ( *itFirst );
 				//triaxialCompressionEngine = shared_ptr<TriaxialCompressionEngine> (static_cast<TriaxialCompressionEngine*> ( (*itFirst).get()));
 			}
 		}
-		if ( !triaxialCompressionEngine ) LOG_DEBUG ( "stress controller engine NOT found" );
+		if ( !triaxialStressController ) LOG_DEBUG ( "stress controller engine NOT found" );
 	}
-	if ( ! ( Omega::instance().getCurrentIteration() % triaxialCompressionEngine->computeStressStrainInterval == 0 ) )
-		triaxialCompressionEngine->computeStressStrain ();
+	if ( ! ( Omega::instance().getCurrentIteration() % triaxialStressController->computeStressStrainInterval == 0 ) )
+		triaxialStressController->computeStressStrain ();
 
 	/// Compute kinetic energy and porosity :
 
 	Real Vs=0, kinematicE = 0;
-	Real V = ( triaxialCompressionEngine->height ) * ( triaxialCompressionEngine->width ) * ( triaxialCompressionEngine->depth );
+	Real V = ( triaxialStressController->height ) * ( triaxialStressController->width ) * ( triaxialStressController->depth );
 
 	BodyContainer::iterator bi = scene->bodies->begin();
 	BodyContainer::iterator biEnd = scene->bodies->end();
@@ -65,13 +68,13 @@
 	porosity = ( V - Vs ) /V;
 	
 	out << lexical_cast<string> ( Omega::instance().getCurrentIteration() ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->stress[triaxialCompressionEngine->wall_right][0] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->stress[triaxialCompressionEngine->wall_top][1] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->stress[triaxialCompressionEngine->wall_front][2] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->strain[0] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->strain[1] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->strain[2] ) << " "
- 	<< lexical_cast<string> ( triaxialCompressionEngine->ComputeUnbalancedForce () ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_right][0] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_top][1] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_front][2] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->strain[0] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->strain[1] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->strain[2] ) << " "
+ 	<< lexical_cast<string> ( triaxialStressController->ComputeUnbalancedForce () ) << " "
  	<< lexical_cast<string> ( porosity ) << " "
  	<< lexical_cast<string> ( kinematicE )
  	<< endl;

=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.hpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.hpp	2010-03-30 04:55:22 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStateRecorder.hpp	2010-03-31 16:24:16 +0000
@@ -21,17 +21,18 @@
  */
 
 
-class TriaxialCompressionEngine;
+class TriaxialStressController;
 
 class TriaxialStateRecorder : public Recorder
 {
 	private :
-		shared_ptr<TriaxialCompressionEngine> triaxialCompressionEngine;
+		shared_ptr<TriaxialStressController> triaxialStressController; 
 		bool changed;
 	public :
 		virtual ~TriaxialStateRecorder ();
 		virtual void action();
-	YADE_CLASS_BASE_DOC_ATTRS_CTOR(TriaxialStateRecorder,Recorder,"Engine recording triaxial variables (needs :yref:TriaxialCompressionEngine present in the simulation).",
+
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR(TriaxialStateRecorder,Recorder,"Engine recording triaxial variables (needs :yref:TriaxialCompressionEngine or :yref:ThreeDTriaxialEngine present in the simulation).",
 		((Real,porosity,1,"porosity of the packing [-]")), //Is it really needed to have this value as a serializable?
 		initRun=true;
 		);


Follow ups