Author: gladky_anton
Date: 2009-07-14 17:41:54 +0200 (Tue, 14 Jul 2009)
New Revision: 1864

Modified:
   trunk/pkg/dem/RockPM.cpp
   trunk/pkg/dem/RockPM.hpp
Log:
1. RockPM, first variant of "destruction mechanism"



Modified: trunk/pkg/dem/RockPM.cpp
===================================================================
--- trunk/pkg/dem/RockPM.cpp    2009-07-13 21:39:27 UTC (rev 1863)
+++ trunk/pkg/dem/RockPM.cpp    2009-07-14 15:41:54 UTC (rev 1864)
@@ -34,7 +34,20 @@
        Dem3DofGeom* geom=static_cast<Dem3DofGeom*>(ig.get());
        RpmPhys* phys=static_cast<RpmPhys*>(ip.get());
 
-       Real displN=geom->displacementN();
+       Real displN=geom->displacementN();      
+       const shared_ptr<Body>& body1=Body::byId(contact->getId1(),rootBody);
+       const shared_ptr<Body>& body2=Body::byId(contact->getId2(),rootBody);
+       assert(body1);
+       assert(body2);
+       const shared_ptr<RpmMat>& 
rbp1=YADE_PTR_CAST<RpmMat>(body1->physicalParameters);
+       const shared_ptr<RpmMat>& 
rbp2=YADE_PTR_CAST<RpmMat>(body2->physicalParameters);
+
+       //check, whether one of bodies is damaged
+       if ((rbp1->isDamaged) || (rbp2->isDamaged)) {
+               phys->isCohesive = false;
+       }
+                               
+                               
        if(displN<=0){
                /*Normal Interaction*/
                phys->normalForce=phys->kn*displN*geom->normal;
@@ -43,14 +56,24 @@
                if(trialFs.SquaredLength()>maxFsSq){ 
geom->slipToDisplacementTMax(sqrt(maxFsSq)); 
trialFs*=sqrt(maxFsSq/(trialFs.SquaredLength()));} 
                
applyForceAtContactPoint(phys->normalForce+trialFs,geom->contactPoint,contact->getId1(),geom->se31.position,contact->getId2(),geom->se32.position,rootBody);
                /*Normal Interaction_____*/
+               
                if ((phys->isCohesive)&&(displN<(-phys->lengthMaxCompression))) 
{
-                       LOG_WARN(displN<<"____"<<phys->normalForce);
+                       //LOG_WARN(displN<<"__COMRESS!!!__");
+                       phys->isCohesive = false;
+                       rbp1->isDamaged=true;
+                       rbp2->isDamaged=true;
                }
        } else {
                if (phys->isCohesive) {
                        phys->normalForce=phys->kn*displN*geom->normal;
-                       //LOG_WARN(displN<<"____"<<phys->normalForce);
-                       
applyForceAtContactPoint(phys->normalForce,geom->contactPoint,contact->getId1(),geom->se31.position,contact->getId2(),geom->se32.position,rootBody);
+                       if (displN>(phys->lengthMaxTension)) {
+                               //LOG_WARN(displN<<"__TENSION!!!__");
+                               phys->isCohesive = false;
+                               rbp1->isDamaged=true;
+                               rbp2->isDamaged=true;
+                       } else {
+                               
applyForceAtContactPoint(phys->normalForce,geom->contactPoint,contact->getId1(),geom->se31.position,contact->getId2(),geom->se32.position,rootBody);
+                       }
                        return;
                } else {
                        
rootBody->interactions->requestErase(contact->getId1(),contact->getId2());

Modified: trunk/pkg/dem/RockPM.hpp
===================================================================
--- trunk/pkg/dem/RockPM.hpp    2009-07-13 21:39:27 UTC (rev 1863)
+++ trunk/pkg/dem/RockPM.hpp    2009-07-14 15:41:54 UTC (rev 1864)
@@ -47,11 +47,16 @@
 class RpmMat: public BodyMacroParameters {
        public:
                int exampleNumber; //Number of "stone"
-               bool initCohesive;
+               bool initCohesive, isDamaged;
                Real stressCompressMax, stressTensionMax; //Parameters for 
damaging
 
-               RpmMat(): exampleNumber(0.), initCohesive(false), 
stressCompressMax(0), stressTensionMax(0) {createIndex();};
-               REGISTER_ATTRIBUTES(BodyMacroParameters, (exampleNumber) 
(initCohesive) (stressCompressMax) (stressTensionMax));
+               RpmMat(): exampleNumber(0.), initCohesive(false), 
isDamaged(false), stressCompressMax(0), stressTensionMax(0) {createIndex();};
+               REGISTER_ATTRIBUTES(BodyMacroParameters, 
+                       (exampleNumber)
+                       (initCohesive)
+                       (isDamaged)
+                       (stressCompressMax)
+                       (stressTensionMax));
                REGISTER_CLASS_AND_BASE(RpmMat,BodyMacroParameters);
 };
 REGISTER_SERIALIZABLE(RpmMat);


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to