← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1868: committing files which were not uploaded in last commit

 

------------------------------------------------------------
revno: 1868
committer: CWBoon <booncw@xxxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-12-07 18:55:16 -0500
message:
  committing files which were not uploaded in last commit
added:
  pkg/dem/Engine/StandAloneEngine/CundallStrack.cpp
  pkg/dem/Engine/StandAloneEngine/CundallStrack.hpp
  scripts/test/CundallStrackTest.py


--
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.
=== added file 'pkg/dem/Engine/StandAloneEngine/CundallStrack.cpp'
--- pkg/dem/Engine/StandAloneEngine/CundallStrack.cpp	1970-01-01 00:00:00 +0000
+++ pkg/dem/Engine/StandAloneEngine/CundallStrack.cpp	2009-12-07 23:55:16 +0000
@@ -0,0 +1,75 @@
+//CWBoon@2009 booncw@xxxxxxxxxxx //
+
+#include"CundallStrack.hpp"
+#include<yade/core/Scene.hpp>
+#include<yade/pkg-dem/DemXDofGeom.hpp>
+//! tested in scripts/test/CundallStrack.py
+
+YADE_PLUGIN((Law2_Dem3Dof_CSPhys_CundallStrack)(Ip2_BMP_BMP_CSPhys)(CSPhys));
+
+
+
+/********************** Law2_Dem3DofGeom_RockPMPhys_Rpm ****************************/
+CREATE_LOGGER(Law2_Dem3Dof_CSPhys_CundallStrack);
+
+void Law2_Dem3Dof_CSPhys_CundallStrack::go(shared_ptr<InteractionGeometry>& ig, shared_ptr<InteractionPhysics>& ip, Interaction* contact, Scene* rootBody){
+	Dem3DofGeom* geom=static_cast<Dem3DofGeom*>(ig.get());
+	CSPhys* phys=static_cast<CSPhys*>(ip.get());
+	
+	/*NormalForce */
+	Real displN=geom->displacementN();
+	if (displN>0){rootBody->interactions->requestErase(contact->getId1(),contact->getId2()); return;}
+	phys->normalForce=phys->kn*displN*geom->normal;
+
+	/*ShearForce*/
+	Real maxFsSq=phys->normalForce.SquaredLength()*pow(phys->tanFrictionAngle,2);
+	Vector3r trialFs=phys->ks*geom->displacementT();
+	if(trialFs.SquaredLength()>maxFsSq){ geom->slipToDisplacementTMax(sqrt(maxFsSq)); 
+	trialFs*=sqrt(maxFsSq/(trialFs.SquaredLength()));}
+	phys->shearForce = trialFs;
+
+	applyForceAtContactPoint(phys->normalForce + trialFs, geom->contactPoint, contact->getId1(), geom->se31.position, contact->getId2(), geom->se32.position, rootBody);
+	return;				
+	
+}
+
+CREATE_LOGGER(Ip2_BMP_BMP_CSPhys);
+
+void Ip2_BMP_BMP_CSPhys::go(const shared_ptr<Material>& b1, const shared_ptr<Material>& b2, const shared_ptr<Interaction>& interaction){
+	
+	if(interaction->interactionPhysics) return; 
+
+	Dem3DofGeom* d3dg=dynamic_cast<Dem3DofGeom*>(interaction->interactionGeometry.get());
+			
+	assert(d3dg);
+
+	const shared_ptr<GranularMat>& sdec1 = YADE_PTR_CAST<GranularMat>(b1);
+	const shared_ptr<GranularMat>& sdec2 = YADE_PTR_CAST<GranularMat>(b2);
+			
+	shared_ptr<CSPhys> contactPhysics(new CSPhys()); 
+			
+	/* From interaction physics */
+	Real Ea 	= sdec1->young;
+	Real Eb 	= sdec2->young;
+	Real Va 	= sdec1->poisson;
+	Real Vb 	= sdec2->poisson;
+	Real fa 	= sdec1->frictionAngle;
+	Real fb 	= sdec2->frictionAngle;
+
+	/* From interaction geometry */
+	Real Da=d3dg->refR1>0?d3dg->refR1:d3dg->refR2; 
+	Real Db=d3dg->refR2>0?d3dg->refR2:d3dg->refR1; 		  			
+	Real Kn = 2*Ea*Da*Eb*Db/(Ea*Da+Eb*Db);//harmonic average of two stiffnesses
+	Real Ks = 2*Ea*Da*Va*Eb*Db*Vb/(Ea*Da*Va+Eb*Db*Va);//harmonic average of two stiffnesses with ks=V*kn for each sphere
+
+	/* Pass values calculated from above to CSPhys */
+	contactPhysics->kn = Kn;
+	contactPhysics->ks = Ks;
+	contactPhysics->frictionAngle			= std::min(fa,fb); 
+	contactPhysics->tanFrictionAngle		= std::tan(contactPhysics->frictionAngle); 
+			
+	interaction->interactionPhysics = contactPhysics;
+}
+
+CSPhys::~CSPhys(){};
+

=== added file 'pkg/dem/Engine/StandAloneEngine/CundallStrack.hpp'
--- pkg/dem/Engine/StandAloneEngine/CundallStrack.hpp	1970-01-01 00:00:00 +0000
+++ pkg/dem/Engine/StandAloneEngine/CundallStrack.hpp	2009-12-07 23:55:16 +0000
@@ -0,0 +1,48 @@
+// CWBoon@2009  booncw@xxxxxxxxxxx //
+
+#pragma once
+#include<yade/pkg-common/ElasticMat.hpp>
+#include<yade/pkg-common/InteractionPhysicsFunctor.hpp>
+#include<yade/pkg-common/NormalShearInteractions.hpp>
+#include<yade/pkg-common/LawFunctor.hpp>
+#include<yade/pkg-dem/DemXDofGeom.hpp>
+#include <set>
+#include <boost/tuple/tuple.hpp>
+
+//! This is the simplest law with Kn, Ks and Coulomb.  It is a duplication of Law2_Dem3Dof_Elastic_Elastic, but it is cleaner.
+//! It also shows clearly to a beginner on how to write a Constitutive Law.  In a sense, it is similar to RockPM
+
+class Law2_Dem3Dof_CSPhys_CundallStrack: public LawFunctor{
+	public:
+		virtual void go(shared_ptr<InteractionGeometry>& _geom, shared_ptr<InteractionPhysics>& _phys, Interaction* I, Scene* rootBody);
+		FUNCTOR2D(Dem3DofGeom,CSPhys);
+		REGISTER_CLASS_AND_BASE(Law2_Dem3Dof_CSPhys_CundallStrack,LawFunctor);
+		REGISTER_ATTRIBUTES(LawFunctor,/*nothing here*/);
+		DECLARE_LOGGER;	
+};
+REGISTER_SERIALIZABLE(Law2_Dem3Dof_CSPhys_CundallStrack);
+
+class Ip2_BMP_BMP_CSPhys: public InteractionPhysicsFunctor{
+	public:
+
+		virtual void go(const shared_ptr<Material>& pp1, const shared_ptr<Material>& pp2, const shared_ptr<Interaction>& interaction);
+		REGISTER_ATTRIBUTES(InteractionPhysicsFunctor,);
+		FUNCTOR2D(GranularMat,GranularMat);
+		REGISTER_CLASS_AND_BASE(Ip2_BMP_BMP_CSPhys,InteractionPhysicsFunctor);
+		DECLARE_LOGGER;
+};
+REGISTER_SERIALIZABLE(Ip2_BMP_BMP_CSPhys);
+
+
+class CSPhys: public NormalShearInteraction {
+	private:
+	public:
+		Real frictionAngle, tanFrictionAngle; 
+		CSPhys(): NormalShearInteraction(), frictionAngle(0),tanFrictionAngle(0){ createIndex(); }
+	virtual ~CSPhys();
+
+	REGISTER_ATTRIBUTES(NormalShearInteraction,(tanFrictionAngle) (frictionAngle));
+	REGISTER_CLASS_AND_BASE(CSPhys,NormalShearInteraction);
+	REGISTER_CLASS_INDEX(CSPhys,NormalShearInteraction);
+};
+REGISTER_SERIALIZABLE(CSPhys);

=== added file 'scripts/test/CundallStrackTest.py'
--- scripts/test/CundallStrackTest.py	1970-01-01 00:00:00 +0000
+++ scripts/test/CundallStrackTest.py	2009-12-07 23:55:16 +0000
@@ -0,0 +1,55 @@
+#!/usr/local/bin/yade-trunk -x
+# -*- coding: utf-8 -*-
+# -*- encoding=utf-8 -*-
+
+
+
+o=Omega() 
+
+o.initializers=[
+	
+	BoundDispatcher([InteractingSphere2AABB(),MetaInteractingGeometry2AABB()])
+]
+
+
+o.engines=[
+	
+	BexResetter(),
+	
+	BoundDispatcher([
+		InteractingSphere2AABB(),
+		MetaInteractingGeometry2AABB()
+	]),
+	
+	InsertionSortCollider(),
+	
+	InteractionGeometryDispatcher([
+		Ig2_Sphere_Sphere_Dem3DofGeom()
+	]),
+	InteractionPhysicsDispatcher(
+		[Ip2_BMP_BMP_CSPhys()]
+	),
+
+	LawDispatcher([Law2_Dem3Dof_CSPhys_CundallStrack()]),
+	
+	GravityEngine(gravity=[0,0,-9.81]),
+	
+	NewtonsDampedLaw(damping = 0.01)
+]
+
+
+
+from yade import utils
+
+
+o.bodies.append(utils.sphere([0,0,6],1,dynamic=True, color=[0,1,0]))
+
+o.bodies.append(utils.sphere([0,0,0],1,dynamic = False, color=[0,0,1]))
+
+o.dt=.2*utils.PWaveTimeStep()
+
+
+
+from yade import qt
+qt.Controller()
+qt.View()