Advertisement
lingran

cpp_diff_for_cohesiveLaw

Aug 27th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.20 KB | None | 0 0
  1. --- /home/lingran/YadeCodes/compare/old_CohesiveFrictionalContactLaw.cpp    2013-01-16 14:58:08.859546000 +0100
  2. +++ /home/lingran/YadeCodes/compare/new_CohesiveFrictionalContactLaw.cpp    2013-08-26 10:40:56.821407000 +0200
  3. @@ -41,6 +41,32 @@
  4.     return shearEnergy;
  5.  }
  6.  
  7. +Real Law2_ScGeom6D_CohFrictPhys_CohesionMoment::bendingElastEnergy()
  8. +{
  9. +   Real bendingEnergy=0;
  10. +   FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
  11. +       if(!I->isReal()) continue;
  12. +       CohFrictPhys* phys = YADE_CAST<CohFrictPhys*>(I->phys.get());
  13. +       if (phys) {
  14. +           bendingEnergy += 0.5*(phys->moment_bending.squaredNorm()/phys->kr);
  15. +       }
  16. +   }
  17. +   return bendingEnergy;
  18. +}
  19. +
  20. +Real Law2_ScGeom6D_CohFrictPhys_CohesionMoment::twistElastEnergy()
  21. +{
  22. +   Real twistEnergy=0;
  23. +   FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
  24. +       if(!I->isReal()) continue;
  25. +       CohFrictPhys* phys = YADE_CAST<CohFrictPhys*>(I->phys.get());
  26. +       if (phys) {
  27. +           twistEnergy += 0.5*(phys->moment_twist.squaredNorm()/phys->ktw);
  28. +       }
  29. +   }
  30. +   return twistEnergy;
  31. +}
  32. +
  33.  void CohesiveFrictionalContactLaw::action()
  34.  {
  35.     if(!functor) functor=shared_ptr<Law2_ScGeom6D_CohFrictPhys_CohesionMoment>(new Law2_ScGeom6D_CohFrictPhys_CohesionMoment);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement