← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2994: 1. fix some typos

 

------------------------------------------------------------
revno: 2994
committer: Klaus Thoeni <klaus.thoeni@xxxxxxxxx>
branch nick: yade
timestamp: Mon 2012-01-16 08:00:38 +1100
message:
  1. fix some typos
  2. derive WirePhys from FrictPhys
  3. compute limitFactor for WirePM
  4. add limitFactor and normal force of wires to wpm in VTKRecorder
modified:
  pkg/dem/FrictPhys.hpp
  pkg/dem/VTKRecorder.cpp
  pkg/dem/WirePM.cpp
  pkg/dem/WirePM.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/FrictPhys.hpp'
--- pkg/dem/FrictPhys.hpp	2011-01-31 16:39:11 +0000
+++ pkg/dem/FrictPhys.hpp	2012-01-15 21:00:38 +0000
@@ -13,7 +13,7 @@
 {
 	public :
 		virtual ~FrictPhys();
-	YADE_CLASS_BASE_DOC_ATTRS_CTOR(FrictPhys,NormShearPhys,"The simple linear elastip-plastic interaction with friction angle, like in the traditional [CundallStrack1979]_",
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR(FrictPhys,NormShearPhys,"The simple linear elasto-plastic interaction with friction angle, like in the traditional [CundallStrack1979]_",
 		((Real,tangensOfFrictionAngle,NaN,,"tan of angle of friction")),
 		createIndex()
 	);

=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp	2011-12-01 12:52:20 +0000
+++ pkg/dem/VTKRecorder.cpp	2012-01-15 21:00:38 +0000
@@ -182,9 +182,12 @@
 	rpmSpecDiam->SetName("rpmSpecDiam");
 	
 	// extras for WireMatPM
-	vtkSmartPointer<vtkFloatArray> wpmLimitNormalFactor = vtkSmartPointer<vtkFloatArray>::New();
-	wpmLimitNormalFactor->SetNumberOfComponents(1);
-	wpmLimitNormalFactor->SetName("wpmLimitNormalFactor");
+	vtkSmartPointer<vtkFloatArray> wpmNormalForce = vtkSmartPointer<vtkFloatArray>::New();
+	wpmNormalForce->SetNumberOfComponents(1);
+	wpmNormalForce->SetName("wpmNormalForce");
+	vtkSmartPointer<vtkFloatArray> wpmLimitFactor = vtkSmartPointer<vtkFloatArray>::New();
+	wpmLimitFactor->SetNumberOfComponents(1);
+	wpmLimitFactor->SetName("wpmLimitFactor");
 
 	if(recActive[REC_INTR]){
 		// holds information about cell distance between spatial and displayed position of each particle
@@ -249,11 +252,22 @@
 			float fs[3]={abs(phys->shearForce[0]),abs(phys->shearForce[1]),abs(phys->shearForce[2])};
 			// add the value once for each interaction object that we created (might be 2 for the periodic boundary)
 			for(int i=0; i<numAddValues; i++){
-				intrForceN->InsertNextValue(fn);
 				intrAbsForceT->InsertNextTupleValue(fs);
 				if(recActive[REC_WPM]) {
-					const WirePhys* wirephys = YADE_CAST<WirePhys*>(I->phys.get());
-					wpmLimitNormalFactor->InsertNextValue(wirephys->limitNormalFactor);
+					const WirePhys* wirephys = dynamic_cast<WirePhys*>(I->phys.get());
+					if (wirephys!=NULL && wirephys->isLinked) {
+						wpmLimitFactor->InsertNextValue(wirephys->limitFactor);
+						wpmNormalForce->InsertNextValue(fn);
+						intrForceN->InsertNextValue(NaN);
+					}
+					else {
+						intrForceN->InsertNextValue(fn);
+						wpmNormalForce->InsertNextValue(NaN);
+						wpmLimitFactor->InsertNextValue(NaN);
+					}
+				}
+				else {
+					intrForceN->InsertNextValue(fn);
 				}
 			}
 		}
@@ -433,7 +447,8 @@
 		intrPd->GetCellData()->AddArray(intrForceN);
 		intrPd->GetCellData()->AddArray(intrAbsForceT);
 		if (recActive[REC_WPM]){
-			intrPd->GetCellData()->AddArray(wpmLimitNormalFactor);
+			intrPd->GetCellData()->AddArray(wpmNormalForce);
+			intrPd->GetCellData()->AddArray(wpmLimitFactor);
 		}
 		#ifdef YADE_VTK_MULTIBLOCK
 			if(!multiblock)

=== modified file 'pkg/dem/WirePM.cpp'
--- pkg/dem/WirePM.cpp	2011-11-02 00:40:29 +0000
+++ pkg/dem/WirePM.cpp	2012-01-15 21:00:38 +0000
@@ -1,4 +1,10 @@
-/* Klaus Thoeni 2010 */
+/*************************************************************************
+*  Copyright (C) 2010 by Klaus Thoeni                                    *
+*  klaus.thoeni@xxxxxxxxxxxxxxxx                                         *
+*                                                                        *
+*  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"WirePM.hpp"
 #include<yade/core/Scene.hpp>
@@ -15,14 +21,15 @@
 
 	//BUG: ????? postLoad is called twice,
 	LOG_TRACE( "WireMat::postLoad - update material parameters" );
+	
+	// compute cross-section area
+	as = pow(diameter*0.5,2)*Mathr::PI;
 
 	if(strainStressValues.empty()) return; // uninitialized object, don't do nothing at all
 	if(strainStressValues.size() < 2)
 		throw invalid_argument("WireMat.strainStressValues: at least two points must be given.");
 	if(strainStressValues[0](0) == 0. && strainStressValues[0](1) == 0.)
 		throw invalid_argument("WireMat.strainStressValues: Definition must start with values greather then zero (strain>0,stress>0)");
-	// compute cross-section area
-	as = pow(diameter*0.5,2)*Mathr::PI;
 
 }
 
@@ -43,7 +50,7 @@
 	
 	Real displN = geom->penetrationDepth; // NOTE: ScGeom -> penetrationDepth>0 when spheres interpenetrate, and therefore, for wire always negative
 
-	/* get reference to values since values are updated for unloading */
+	/* get reference to values since values are updated/changed in order to take unloading into account */
 	vector<Vector2r> &DFValues = phys->displForceValues;
 	vector<Real> &kValues = phys->stiffnessValues;
 
@@ -93,10 +100,9 @@
 	phys->normalForce = Fn*geom->normal; // NOTE: normal is position2-position1 - It is directed from particle1 to particle2
 
 	/* compute a limit value to check how far the interaction is from failing */
-	Real limitNormalFactor = 0.;
-	if (Fn < 0.) limitNormalFactor = fabs(D/(DFValues.back()(0)));
-	limitNormalFactor *= fabs(Fn/(DFValues.back()(1)));
-	phys->limitNormalFactor = limitNormalFactor;
+	Real limitFactor = 0.;
+	if (Fn < 0.) limitFactor = fabs(D/(DFValues.back()(0)));
+	phys->limitFactor = limitFactor;
 
 	State* st1 = Body::byId(id1,scene)->state.get();
 	State* st2 = Body::byId(id2,scene)->state.get();
@@ -116,6 +122,7 @@
 
 }
 
+/********************** Ip2_WireMat_WireMat_WirePhys ****************************/
 CREATE_LOGGER(Ip2_WireMat_WireMat_WirePhys);
 
 void Ip2_WireMat_WireMat_WirePhys::go(const shared_ptr<Material>& b1, const shared_ptr<Material>& b2, const shared_ptr<Interaction>& interaction){

=== modified file 'pkg/dem/WirePM.hpp'
--- pkg/dem/WirePM.hpp	2011-11-02 00:40:29 +0000
+++ pkg/dem/WirePM.hpp	2012-01-15 21:00:38 +0000
@@ -1,4 +1,10 @@
-/* Klaus Thoeni 2010 */
+/*************************************************************************
+*  Copyright (C) 2010 by Klaus Thoeni                                    *
+*  klaus.thoeni@xxxxxxxxxxxxxxxx                                         *
+*                                                                        *
+*  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. *
+*************************************************************************/
 
 /**
 === OVERVIEW OF WirePM ===
@@ -21,7 +27,7 @@
 
 #include<yade/pkg/common/ElastMat.hpp>
 #include<yade/pkg/common/Dispatching.hpp>
-#include<yade/pkg/common/NormShearPhys.hpp>
+#include<yade/pkg/dem/FrictPhys.hpp>
 #include<yade/pkg/dem/ScGeom.hpp>
 
 /** This class holds information associated with each body state*/
@@ -41,7 +47,6 @@
 		virtual shared_ptr<State> newAssocState() const { return shared_ptr<State>(new WireState); }
 		virtual bool stateTypeOk(State* s) const { return (bool)dynamic_cast<WireState*>(s); }
 		void postLoad(WireMat&);
-	DECLARE_LOGGER;
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(WireMat,FrictMat,"Material for use with the Wire classes",
 		((Real,diameter,0.0027,,"Diameter of the single wire in [m] (the diameter is used to compute the cross-section area of the wire)."))
 		((vector<Vector2r>,strainStressValues,,Attr::triggerPostLoad,"Piecewise linear definition of the stress-strain curve by set of points (strain[-]>0,stress[Pa]>0) for one single wire. Tension only is considered and the point (0,0) is not needed!"))
@@ -52,30 +57,31 @@
 		,
 		createIndex();
 	);
+	DECLARE_LOGGER;
 	REGISTER_CLASS_INDEX(WireMat,FrictMat);
 };
 REGISTER_SERIALIZABLE(WireMat);
 
 /** This class holds information associated with each interaction */
-// NOTE: even if WirePhys has no shear force it is derived from NormShearPhys since all implemented functions work properly for NormShearPhys only
-class WirePhys: public NormShearPhys {
+// NOTE: even if WirePhys has no shear force it is derived from FrictPhys since all implemented functions (e.g. unbalancedForce) work properly for FrictPhys only
+class WirePhys: public FrictPhys {
 	public:
 		virtual ~WirePhys();
 	
-		YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(WirePhys,NormShearPhys,"Representation of a single interaction of the WirePM type, storage for relevant parameters",
+		YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(WirePhys,FrictPhys,"Representation of a single interaction of the WirePM type, storage for relevant parameters",
 			((Real,initD,0,,"Equilibrium distance for particles. Computed as the initial inter-particular distance when particle are linked."))
 			((bool,isLinked,false,,"If true particles are linked and will interact. Interactions are linked automatically by the definition of the corresponding interaction radius. The value is false if the wire breaks (no more interaction)."))
 			((bool,isDoubleTwist,false,,"If true the properties of the interaction will be defined as a double-twisted wire."))
 			((vector<Vector2r>,displForceValues,,Attr::readonly,"Defines the values for force-displacement curve."))
 			((vector<Real>,stiffnessValues,,Attr::readonly,"Defines the values for the different stiffness (first value corresponds to elastic stiffness kn)."))
 			((Real,plastD,0,Attr::readonly,"Plastic part of the inter-particular distance of the previous step. \n\n.. note::\n\t Only elastic displacements are reversible (the elastic stiffness is used for unloading) and compressive forces are inadmissible. The compressive stiffness is assumed to be equal to zero (see [Bertrand2005]_).\n\n.."))
-			((Real,limitNormalFactor,0.,,"This value indicates on how far from failing the wire is, e.g. actual normal displacement divided by admissible normal displacement multiplied by actual normal force divided by admissible normal force."))
+			((Real,limitFactor,0.,Attr::readonly,"This value indicates on how far from failing the wire is, e.g. actual normal displacement divided by admissible normal displacement multiplied by actual normal force divided by admissible normal force."))
 			,
 			createIndex();
 			,
 		);
 	DECLARE_LOGGER;
-	REGISTER_CLASS_INDEX(WirePhys,NormShearPhys);
+	REGISTER_CLASS_INDEX(WirePhys,FrictPhys);
 };
 REGISTER_SERIALIZABLE(WirePhys);
 
@@ -85,11 +91,11 @@
 		virtual void go(const shared_ptr<Material>& pp1, const shared_ptr<Material>& pp2, const shared_ptr<Interaction>& interaction);
 		
 		FUNCTOR2D(WireMat,WireMat);
+		
+		YADE_CLASS_BASE_DOC_ATTRS(Ip2_WireMat_WireMat_WirePhys,IPhysFunctor,"Converts 2 :yref:`WireMat` instances to :yref:`WirePhys` with corresponding parameters.",
+			((int,linkThresholdIteration,1,,"Iteration to create the link."))
+		);
 		DECLARE_LOGGER;
-		
-		YADE_CLASS_BASE_DOC_ATTRS(Ip2_WireMat_WireMat_WirePhys,IPhysFunctor,"Converts 2 :yref:`WireMat` instances to :yref:`WirePhys` with corresponding parameters.",
-			((int,linkThresholdIteration,1,,"Iteration to create the link."))
-		);
 };
 REGISTER_SERIALIZABLE(Ip2_WireMat_WireMat_WirePhys);