← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2060: Re-write of CinemKNCEngine according to new macros. Anecdotic changes in CinemCNCEngine

 

------------------------------------------------------------
revno: 2060
committer: jduriez <jduriez@c1solimara-l>
branch nick: trunk
timestamp: Wed 2010-03-03 17:03:23 +0100
message:
  Re-write of CinemKNCEngine according to new macros. Anecdotic changes in CinemCNCEngine
modified:
  pkg/common/Engine/PartialEngine/CinemCNCEngine.hpp
  pkg/common/Engine/PartialEngine/CinemKNCEngine.cpp
  pkg/common/Engine/PartialEngine/CinemKNCEngine.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/common/Engine/PartialEngine/CinemCNCEngine.hpp'
--- pkg/common/Engine/PartialEngine/CinemCNCEngine.hpp	2010-02-26 23:29:53 +0000
+++ pkg/common/Engine/PartialEngine/CinemCNCEngine.hpp	2010-03-03 16:03:23 +0000
@@ -49,9 +49,9 @@
 		void computeStiffness(Scene* ncb);
 	
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(CinemCNCEngine,PartialEngine,
-				 "To apply a constant normal stress shear for a parallelogram box (simple shear)\n\nThis engine, used in simulations issued from :yref:`DirectShearCis` Preprocessor, allows to translate horizontally the upper plate while the lateral ones rotate so that they always keep contact with the lower and upper walls.\n\nIn fact the upper plate can move not only horizontally but also vertically, so that the normal stress acting on it remains constant (this constant value is not choosen by the user but is the one that exists at the beginning of the simulation)\n\nThe right vertical displacements which will be allowed are computed from the rigidity Kn of the sample over the wall (so to cancel a deltaSigma, a normal dplt deltaSigma*S/(Kn) is set)\n\nThe movement is moreover controlled by the user via a *shearSpeed* which will be the speed of the upper wall, and by a maximum value of horizontal displacement *gammalim*, after which the shear stops.\n\n.. note::\n\tNot only the positions of walls are updated but also their speeds, which is all but useless considering the fact that in the contact laws these velocities of bodies are used to compute values of tangential relative displacements.\n\n.. warning::\n\tBecause of this last point, if you want to use later saves of simulations executed with this Engine, but without that stopMovement was executed, your boxes will keep their speeds => you will have to cancel them 'by hand' in the .xml.\n",
-				 ((Real,shearSpeed,0.0,"the speed at wich the shearing is performed [m/s]"))
-				 ((Real,gammalim,0.0,"the value of tangential displacement at wich the shearing is stopped [m]"))
+				 "To apply a constant normal stress shear for a parallelogram box (simple shear)\n\nThis engine, used in simulations issued from :yref:`SimpleShear` Preprocessor, allows to translate horizontally the upper plate while the lateral ones rotate so that they always keep contact with the lower and upper walls.\n\nIn fact the upper plate can move not only horizontally but also vertically, so that the normal stress acting on it remains constant (this constant value is not choosen by the user but is the one that exists at the beginning of the simulation)\n\nThe right vertical displacements which will be allowed are computed from the rigidity Kn of the sample over the wall (so to cancel a deltaSigma, a normal dplt deltaSigma*S/(Kn) is set)\n\nThe movement is moreover controlled by the user via a *shearSpeed* which will be the speed of the upper wall, and by a maximum value of horizontal displacement *gammalim*, after which the shear stops.\n\n.. note::\n\tNot only the positions of walls are updated but also their speeds, which is all but useless considering the fact that in the contact laws these velocities of bodies are used to compute values of tangential relative displacements.\n\n.. warning::\n\tBecause of this last point, if you want to use later saves of simulations executed with this Engine, but without that stopMovement was executed, your boxes will keep their speeds => you will have to cancel them 'by hand' in the .xml.\n",
+				 ((Real,shearSpeed,0.0,"the speed at wich the shearing is performed : speed of the upper plate [m/s]"))
+				 ((Real,gammalim,0.0,"the value of tangential displacement (of upper plate) at wich the shearing is stopped [m]"))
 				 ((Real,gamma,0.0,"current value of tangential displacement [m]"))
 				 ((std::vector<Real>,gamma_save,,"vector with the values of gamma at which a save of the simulation is performed [m]"))
 				 ((std::vector<Real>,temoin_save,,"vector (same length as 'gamma_save'), with 0 or 1 depending whether the save for the corresponding value of gamma has been done (1) or not (0)"))

=== modified file 'pkg/common/Engine/PartialEngine/CinemKNCEngine.cpp'
--- pkg/common/Engine/PartialEngine/CinemKNCEngine.cpp	2010-02-09 20:22:04 +0000
+++ pkg/common/Engine/PartialEngine/CinemKNCEngine.cpp	2010-03-03 16:03:23 +0000
@@ -15,26 +15,25 @@
 #include<yade/core/Scene.hpp>
 #include<yade/lib-base/Math.hpp>
 
-
-CinemKNCEngine::CinemKNCEngine() : leftbox(new Body), rightbox(new Body), frontbox(new Body), backbox(new Body), topbox(new Body), boxbas(new Body)
-{
-	prevF_sup=Vector3r(0,0,0);
-	firstRun=true;
-	shearSpeed=0;
-	alpha=Mathr::PI/2.0;;
-	gamma=0;
-	gammalim=0;
-	id_boxhaut=3;
-	id_boxbas=1;
-	id_boxleft=0;
-	id_boxright=2;
-	id_boxfront=5;
-	id_boxback=4;
-	Y0=0;
-	F_0=0;
-	KnC=10.0e6;
-	Key="";
-}
+YADE_PLUGIN((CinemKNCEngine));
+
+
+// CinemKNCEngine::CinemKNCEngine() : leftbox(new Body), rightbox(new Body), frontbox(new Body), backbox(new Body), topbox(new Body), boxbas(new Body)
+// {
+// 	firstRun=true;
+// 	shearSpeed=0;
+// 	alpha=Mathr::PI/2.0;;
+// 	gamma=0;
+// 	gammalim=0;
+// 	id_topbox=3;
+// 	id_boxbas=1;
+// 	id_boxleft=0;
+// 	id_boxright=2;
+// 	id_boxfront=5;
+// 	id_boxback=4;
+// 	F_0=0;
+// 	Key="";
+// }
 
 
 void CinemKNCEngine::applyCondition(Scene * ncb)
@@ -44,7 +43,7 @@
 	rightbox = Body::byId(id_boxright);
 	frontbox = Body::byId(id_boxfront);
 	backbox = Body::byId(id_boxback);
-	topbox = Body::byId(id_boxhaut);
+	topbox = Body::byId(id_topbox);
 	boxbas = Body::byId(id_boxbas);
 	
 // 	shared_ptr<BodyContainer> bodies = ncb->bodies;
@@ -145,7 +144,7 @@
 void CinemKNCEngine::computeDu(Scene* ncb)
 {
 
-	ncb->forces.sync(); Vector3r F_sup=ncb->forces.getForce(id_boxhaut);
+	ncb->forces.sync(); Vector3r F_sup=ncb->forces.getForce(id_topbox);
 	
 	if(firstRun)
 	{
@@ -168,7 +167,6 @@
 		Y0 = topbox->state->pos.Y();
 		cout << "Y0 initialise à : " << Y0 << endl;
 		F_0 = F_sup.Y();
-		prevF_sup=F_sup;
 		firstRun=false;
 	}
 		
@@ -200,7 +198,6 @@
 		deltaH = ( F_sup.Y() - ( Fdesired ))/(stiffness+KnC* 1.0e9 * Scontact);
 	}
 
-	if(LOG) cout << "PrevF_sup : " << prevF_sup << "	F sup : " << F_sup.Y() << endl;
 	if(LOG) cout << "Alors q je veux KnC = " << KnC << " depuis F_0 = " << F_0 << " et Y0 = " << Y0 << endl;
 	if(LOG) cout << "deltaH a permettre normalement :" << deltaH << endl;
 
@@ -213,7 +210,6 @@
 		if(LOG) cout << "Correction appliquee pour ne pas depasser vmax(comp)" << endl;
 	}
 
-	prevF_sup=F_sup;	// Now the value of prevF_sup is used for computing deltaH, it is actualized
 }
 
 void CinemKNCEngine::stopMovement()
@@ -246,7 +242,7 @@
 			if (fn!=0)
 			{
 				int id1 = contact->getId1(), id2 = contact->getId2();
-				if ( id_boxhaut==id1 || id_boxhaut==id2 )
+				if ( id_topbox==id1 || id_topbox==id2 )
 					{
 						FrictPhys* currentContactPhysics =
 						static_cast<FrictPhys*> ( contact->interactionPhysics.get() );

=== modified file 'pkg/common/Engine/PartialEngine/CinemKNCEngine.hpp'
--- pkg/common/Engine/PartialEngine/CinemKNCEngine.hpp	2010-02-09 20:22:04 +0000
+++ pkg/common/Engine/PartialEngine/CinemKNCEngine.hpp	2010-03-03 16:03:23 +0000
@@ -31,23 +31,15 @@
 {
 	private :
 		shared_ptr<NormalInelasticityLaw> myLdc;
-		Real	coeff_dech;	// the engine cares about it
 		Real	alpha	// angle from the lower plate to the left box (trigo wise), the Engine finds itself its value
 			,dalpha	// the increment over alpha
-			,gamma	// horizontal displacement done since the launch of the calcul
-			,Y0	// the height of the upper plate at the very first time step : the engine finds its value
 			,deltaH	// the vertical increment of displacement to allow on the upper plate on this time step to verify the normal rigidity
-			,F_0	// the (vertical) force acting on the upper plate on the very first time step : the engine finds its value
 			,stiffness	// the normal stifness on the sample acting below the upper plate
 			;
 
 		int	temoin,it_stop
-// 			,k		// plates are moved only all "k" iterations to let the sample relax
 			;
-		Vector3r prevF_sup;	// the force acting on the upper plate at the previous time step
-					
 
-		bool firstRun;		// set to true as soon as the engine has done its job one time : usefull to know if the force acting on the plate is known or not (and if F_0 and Y0 were initialized)
 		shared_ptr<Body> leftbox;
 		shared_ptr<Body> rightbox;
 		shared_ptr<Body> frontbox;
@@ -55,37 +47,41 @@
 		shared_ptr<Body> topbox;
 		shared_ptr<Body> boxbas;
 	public :
-		CinemKNCEngine();
 		void 	applyCondition(Scene * ncb)
 			,computeAlpha()
 			;
 
-		Real	 shearSpeed	// to be defined in the PreProcessor
-			,gammalim 	// the maximum value of the horizontal displacemt
-			,KnC		// the normal rigidity choosen by the user, in MPa/mm
-			,max_vel	// to compute the maximum correction displacement that could be imposed in one time step to the upper plate
-			,wallDamping
-			;
-
-		bool LOG;		//controls messages output on screen
-
-		body_id_t 	id_boxhaut,	// the id of the upper wall : defined in the constructor
-				id_boxbas,	// the id of the lower wall : defined in the constructor
-				id_boxleft,
-				id_boxright,
-				id_boxfront,
-				id_boxback;
-		string Key;
-		
-
-	REGISTER_ATTRIBUTES(PartialEngine,(shearSpeed)(gammalim)(prevF_sup)(firstRun)(id_boxhaut)(id_boxbas)(id_boxleft)(id_boxright)(id_boxfront)(id_boxback)(Y0)(F_0)(KnC)(max_vel)(Key)(LOG)(coeff_dech)(wallDamping));
+
 	protected :
 		void letMove(Scene* ncb);
 		void computeDu(Scene* ncb);
 		void stopMovement();		// to cancel all the velocities when gammalim is reached
 		void computeStiffness(Scene* ncb);
-	REGISTER_CLASS_NAME(CinemKNCEngine);
-	REGISTER_BASE_CLASS_NAME(PartialEngine);
+
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR(CinemKNCEngine,PartialEngine,
+		"To apply a constant normal rigidity shear for a parallelogram box (simple shear)\n\nThis engine, useable in simulations implying one deformable parallelepipedic box (e.g. :yref:`SimpleShear` Preprocessor), allows to translate horizontally the upper plate while the lateral ones rotate so that they always keep contact with the lower and upper walls. The upper plate can move not only horizontally but also vertically, so that the normal rigidity defined by DeltaF(upper plate)/DeltaU(upper plate) = constant (= *KnC* defined by the user).\n The movement is moreover controlled by the user via a *shearSpeed* which is the horizontal speed of the upper wall, and by a maximum value of horizontal displacement *gammalim* (of the upper plate), after which the shear stops.\n\n Nota : not only the positions of walls are updated but also their speeds, which is all but useless considering the fact that in the contact laws these velocities of bodies are used to compute values of tangential relative displacements. \n!!WARNING!! : But, because of this last point, if you want to use later saves of simulations executed with this Engine, but without that stopMovement was executed, your boxes will keep their speeds => you will have to cancel them by hand in the .xml",
+		((Real,shearSpeed,0.0,"the speed at wich the shearing is performed : speed of the upper plate [m/s]"))
+		((Real,gammalim,0.0,"the value of tangential displacement (of upper plate) at wich the shearing is stopped [m]"))
+		((Real,gamma,0.0,"current value of tangential displacement [m]"))
+		((bool,firstRun,true,"boolean set to false as soon as the engine has done its job one time : usefull to know if the force acting on the plate is known or not (and if F_0 has to be initialized)"))
+		((body_id_t,id_topbox,3,"the id of the upper wall"))
+		((body_id_t,id_boxbas,1,"the id of the lower wall"))
+		((body_id_t,id_boxleft,0,"the id of the left wall"))
+		((body_id_t,id_boxright,2,"the id of the right wall"))
+		((body_id_t,id_boxfront,5,"the id of the wall in front of the sample"))
+		((body_id_t,id_boxback,4,"the id of the wall at the back of the sample"))
+		((Real,Y0,0.0,"the height of the upper plate at the very first time step : the engine finds its value"))
+		((Real,F_0,0.0,"the (vertical) force acting on the upper plate on the very first time step (determined by the Engine) [N]"))
+		((Real,KnC,10.0e6,"the normal rigidity choosen by the user [MPa/mm]"))
+		((Real,max_vel,1.0,"to limit the speed of the vertical displacements applied to control upper plate [m/s]"))
+		((string,Key,"","string to add at the names of the saved files"))
+		((bool,LOG,false,"boolean controling the output of messages on the screen"))
+		((Real,coeff_dech,1.0,"in the case of the use of 'NormalInelasticityLaw' for ex, where kn(unload)#kn(load). The engine cares to find the value at the first run"))
+		((Real,wallDamping,0.2,"the vertical displacements done to maintain F equal to F_0 are in fact damped, through this wallDamping")),
+		alpha=Mathr::PI/2.0;
+		temoin=0;
+	);
+
 };
 
 REGISTER_SERIALIZABLE(CinemKNCEngine);