← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2081: - Correct writing of Disp2DPropLoadEngine : in order to perform tests on a shear box, piloted by ...

 

------------------------------------------------------------
revno: 2081
committer: jduriez <jduriez@c1solimara-l>
branch nick: trunk
timestamp: Tue 2010-03-16 13:36:54 +0100
message:
  - Correct writing of Disp2DPropLoadEngine : in order to perform tests on a shear box, piloted by dispNormal + k*dispTangential = 0
  Compilation enabled by the way.
  - Minor syntax changes of doc of KinemCNSEngine
modified:
  pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.cpp
  pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.hpp
  pkg/dem/Engine/PartialEngine/KinemCNSEngine.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/Disp2DPropLoadEngine.cpp'
--- pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.cpp	2010-03-10 11:37:28 +0000
+++ pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.cpp	2010-03-16 12:36:54 +0000
@@ -9,28 +9,11 @@
 
 #include "Disp2DPropLoadEngine.hpp"
 #include<yade/core/State.hpp>
-#include<yade/pkg-common/Force.hpp>
 #include<yade/pkg-common/Box.hpp>
 #include<yade/core/Scene.hpp>
-// #include<yade/lib-base/yadeWm3Extra.hpp>
 #include <yade/lib-miniWm3/Wm3Math.h>
 
 
-YADE_REQUIRE_FEATURE(PHYSPAR);
-
-Disp2DPropLoadEngine::Disp2DPropLoadEngine() : actionForce(new Force), leftbox(new Body), rightbox(new Body), frontbox(new Body), backbox(new Body), topbox(new Body), boxbas(new Body)
-{
-	firstIt=true;
-	v=0.0;
-	alpha=Mathr::PI/2.0;;
-	id_topbox=3;
-	id_boxbas=1;
-	id_boxleft=0;
-	id_boxright=2;
-	id_boxfront=5;
-	id_boxback=4;
-	Key="";
-}
 
 void Disp2DPropLoadEngine::postProcessAttributes(bool deserializing)
 {
@@ -39,26 +22,11 @@
 		std::string outputFile="DirSearch" + Key + "Yade";
 		bool file_exists = std::ifstream (outputFile.c_str()); //if file does not exist, we will write colums titles
 		ofile.open(outputFile.c_str(), std::ios::app);
-		if (!file_exists) ofile<<"theta (!angle ds plan (gamma,-du) )dtau (kPa) dsigma (kPa) dgamma (m) du (m) tau0 (kPa) sigma0 (kPa) d2W coordSs0 coordTot0 coordSsF coordTotF (Yade)" << endl;
+		if (!file_exists) ofile<<"theta (!angle in plane (gamma,-du) ) dtau (kPa) dsigma (kPa) dgamma (m) du (m) tau0 (kPa) sigma0 (kPa) d2W coordSs0 coordTot0 coordSsF coordTotF (Yade)" << endl;
 	}
 }
 
 
-void Disp2DPropLoadEngine::registerAttributes()
-{
-	DeusExMachina::registerAttributes();
-	REGISTER_ATTRIBUTE(id_topbox);
-	REGISTER_ATTRIBUTE(id_boxbas);
-	REGISTER_ATTRIBUTE(id_boxleft);
-	REGISTER_ATTRIBUTE(id_boxright);
-	REGISTER_ATTRIBUTE(id_boxfront);
-	REGISTER_ATTRIBUTE(id_boxback);
-	REGISTER_ATTRIBUTE(v);
-	REGISTER_ATTRIBUTE(theta);
-	REGISTER_ATTRIBUTE(nbre_iter);
-	REGISTER_ATTRIBUTE(Key);
-	REGISTER_ATTRIBUTE(LOG);
-}
 
 
 void Disp2DPropLoadEngine::applyCondition(Scene* ncb)
@@ -88,7 +56,7 @@
 		InteractionContainer::iterator iiEnd = ncb->interactions->end();
         	for(  ; ii!=iiEnd ; ++ii ) 
         	{
-        		if ((*ii)->isReal)
+        		if ((*ii)->isReal())
                 	{
 				TotInt++;
 				const shared_ptr<Body>& b1 = Body::byId( (*ii)->getId1() );
@@ -119,7 +87,6 @@
 
 void Disp2DPropLoadEngine::letDisturb(Scene* ncb)
 {
-// 	shared_ptr<BodyContainer> bodies = ncb->bodies;
 
 	Real dt = Omega::instance().getTimeStep();
 	dgamma=cos(theta*Mathr::PI/180.0)*v*dt;
@@ -129,7 +96,6 @@
 	Real Ylat = leftbox->state->pos.Y();
 
 // 	Changes in vertical and horizontal position :
-
 	topbox->state->pos += Vector3r(dgamma,dh,0);
 
 	leftbox->state->pos += Vector3r(dgamma/2.0,dh/2.0,0);
@@ -163,13 +129,9 @@
 		cout << "Quaternion associe a la rotation incrementale : " << qcorr.W() << " " << qcorr.X() << " " << qcorr.Y() << " " << qcorr.Z() << endl;
 
 // On applique la rotation en changeant l'orientation des plaques, leurs vang et en affectant donc alpha
-/*	rb = dynamic_cast<RigidBodyParameters*>(leftbox->physicalParameters.get());
-	rb->se3.orientation	= qcorr*rb->se3.orientation;*/
 	leftbox->state->ori = qcorr*leftbox->state->ori;
 	leftbox->state->angVel = Vector3r(0,0,1)*dalpha/dt;
 
-
-	rb = dynamic_cast<RigidBodyParameters*>(rightbox->physicalParameters.get());
 	rightbox->state->ori = qcorr*leftbox->state->ori;
 	rightbox->state->angVel = Vector3r(0,0,1)*dalpha/dt;
 
@@ -196,11 +158,9 @@
 void Disp2DPropLoadEngine::stopMovement()
 {
 	// annulation de la vitesse de la plaque du haut
-// 	RigidBodyParameters * rb = YADE_CAST<RigidBodyParameters*>(topbox->physicalParameters.get());
 	topbox->state->vel	=  Vector3r(0,0,0);
 
 	// de la plaque gauche
-// 	rb = YADE_CAST<RigidBodyParameters*>(leftbox->physicalParameters.get());
 	leftbox->state->vel	=  Vector3r(0,0,0);
 	leftbox->state->angVel	=  Vector3r(0,0,0);
 
@@ -212,7 +172,7 @@
 
 void Disp2DPropLoadEngine::saveData(Scene* ncb)
 {
-	Real Xleft = leftbox->state->position.X() + (YADE_CAST<Box*>(leftbox->shape.get()))->extents.X();
+	Real Xleft = leftbox->state->pos.X() + (YADE_CAST<Box*>(leftbox->shape.get()))->extents.X();
 
 	Real Xright = rightbox->state->pos.X() - (YADE_CAST<Box*>(rightbox->shape.get()))->extents.X();
 
@@ -229,7 +189,7 @@
 		;
         for(  ; ii!=iiEnd ; ++ii ) 
         {
-        	if ((*ii)->isReal)
+        	if ((*ii)->isReal())
                 {
 			TotInt++;
 			const shared_ptr<Body>& b1 = Body::byId( (*ii)->getId1() );
@@ -242,7 +202,7 @@
 	Real	coordSs = OnlySsInt/8590,	// 8590 is the number of spheres in the CURRENT case
 		coordTot = TotInt / 8596;	// 8596 is the number of bodies in the CURRENT case
 
-	Vector3r& F_sup = ncb->forces.getForce(id_topbox);
+	Vector3r F_sup = ncb->forces.getForce(id_topbox);
 
 	Real	dFn=F_sup.Y()-Fn0	// OK pour le signe
 		,dFt=(F_sup.X()-Ft0)

=== modified file 'pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.hpp'
--- pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.hpp	2010-03-10 11:37:28 +0000
+++ pkg/dem/Engine/PartialEngine/Disp2DPropLoadEngine.hpp	2010-03-16 12:36:54 +0000
@@ -15,22 +15,11 @@
 #include <Wm3Vector3.h>
 // #include<yade/lib-base/yadeWm3.hpp>
 
-/*! \brief To disturb a sample in a given direction (initial aim : directionnal research for d²w)
-
-The aim of this engine is to perform what is called a "directionnal research" over a sample. That is to say : considering a sample in a given state, disturbing it in all the directions (directions in the stresses plane for example)
-
-In fact this Engine disturbs in only one direction
-The control will be done in displacements in fact since it is much more easier
-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
-
-!!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
-*/
-
-
-class Disp2DPropLoadEngine : public DeusExMachina
+
+
+class Disp2DPropLoadEngine : public PartialEngine
 {
 	private :
-		shared_ptr<PhysicalAction> actionForce;
 		Real	dgamma	// the increment of horizontal displacement in one timestep, part of the disturbation
 			,dh	// the increment of vertical displacement in one timestep, part of the disturbation
 			,H0	// the height of the top box, at the beginnig of the application of the disturbation
@@ -61,38 +50,34 @@
 
 
 	public :
-		Disp2DPropLoadEngine();
 		void 	applyCondition(Scene* ncb)
 			,computeAlpha()
 			;
-
-		Real	v	// the speed at which the perturbation is imposed
-			,theta	// the angle, in a (gamma,h) plane from the gamma - axis to the perturbation vector (trigo wise), in degrees For example v = 0.3 - | (0.3-0.04)*sin(theta) | => 0.3 in shear; 0.04 in compression (for 18/11)
-			;
-
-		int	nbre_iter	// the number of iterations of disturbation to perform
-			;
-		bool LOG;		//controls messages output on screen
-
-		body_id_t 	id_topbox,	// 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
-			;
-		
-
-
-	protected :
 		virtual void postProcessAttributes(bool deserializing);
-		void registerAttributes();
-	REGISTER_CLASS_NAME(Disp2DPropLoadEngine);
-	REGISTER_BASE_CLASS_NAME(DeusExMachina);
+
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR(Disp2DPropLoadEngine,PartialEngine,
+		"Disturbs a simple shear sample in a given displacement direction \n \n This engine allows to apply, on a simple shear sample, a loading controlled by du/dgamma = cste, which is equivalent to du + cste' * dgamma = 0 (proportionnal path loadings).\n To do so, the upper plate of the simple shear box is moved in a given direction (corresponding to a given du/dgamma), whereas lateral plates are moved so that the box remains closed.\n This engine can easily be used to perform directionnal probes, with a python script launching successivly the same .xml which contains this engine, after having modified the direction of loading (see *theta* attribute). That's why this Engine contains a *saveData* procedure which can save data on the state of the sample at the end of the loading (in case of successive loadings - for successive directions - through a python script, each line would correspond to one direction of loading).",
+		((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,theta,0.0,"the angle, in a (gamma,h=-u) plane from the gamma - axis to the perturbation vector (trigo wise) [degrees]"))
+		((Real,v,0.0,"the speed at which the perturbation is imposed. In case of samples which are more sensitive to normal loadings than tangential ones, one possibility is to take v = V_shear - | (V_shear-V_comp)*sin(theta) | => v=V_shear in shear; V_comp in compression [m/s]"))
+		((int,nbre_iter,0,"the number of iterations of loading to perform"))
+		((string,Key,"","string to add at the names of the saved files, and of the output file filled by *saveData*"))
+		((bool,LOG,false,"boolean controling the output of messages on the screen")),
+		firstIt=true;
+		alpha=Mathr::PI/2.0;
+	)
+
+
+
+
 };
 
-REGISTER_SERIALIZABLE(Disp2DPropLoadEngine,false);
+REGISTER_SERIALIZABLE(Disp2DPropLoadEngine);
 
-#endif // DIRECRESEARCHENGINE_HPP
+#endif
 

=== modified file 'pkg/dem/Engine/PartialEngine/KinemCNSEngine.hpp'
--- pkg/dem/Engine/PartialEngine/KinemCNSEngine.hpp	2010-03-10 11:37:28 +0000
+++ pkg/dem/Engine/PartialEngine/KinemCNSEngine.hpp	2010-03-16 12:36:54 +0000
@@ -48,7 +48,7 @@
 		void computeStiffness(Scene* ncb);
 
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(KinemCNSEngine,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",
+		"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 note::\n\t 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::\n\tBut, 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]"))