← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2643: 1. ViscoelasticPM: release from prevNormal; 2.Small fixes

 

------------------------------------------------------------
revno: 2643
committer: Sergei D. sj2001@xxxxxxxxx
branch nick: trunk_http
timestamp: Tue 2011-01-11 17:09:30 +0300
message:
  1. ViscoelasticPM: release from prevNormal; 2.Small fixes
modified:
  examples/ring2d/ringSimpleViscoelastic.py
  pkg/dem/ViscoelasticPM.cpp
  pkg/dem/ViscoelasticPM.hpp
  py/ymport.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
=== modified file 'examples/ring2d/ringSimpleViscoelastic.py'
--- examples/ring2d/ringSimpleViscoelastic.py	2010-12-26 15:42:43 +0000
+++ examples/ring2d/ringSimpleViscoelastic.py	2011-01-11 14:09:30 +0000
@@ -71,15 +71,9 @@
 
 ]
 
-# FIXME: why this not worked properly?
-#for b in O.bodies:
-    #if isinstance(b.shape.name,Sphere):
-		 #b.state.blockedDOFs=['z']
-
-for b in o.bodies:
-	if b.shape.name=='Sphere':
-		b.state.blockedDOFs='zXY'\
-
+for b in O.bodies:
+	if isinstance(b.shape,Sphere):
+		 b.state.blockedDOFs='zXY'
 
 O.dt=0.02*tc
 

=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp	2010-11-07 11:46:20 +0000
+++ pkg/dem/ViscoelasticPM.cpp	2011-01-11 14:09:30 +0000
@@ -32,7 +32,7 @@
 	phys->cs = (cs1?1/cs1:0) + (cs2?1/cs2:0); phys->cs = phys->cs?1/phys->cs:0;
 	phys->tangensOfFrictionAngle = std::tan(std::min(mat1->frictionAngle, mat2->frictionAngle)); 
 	phys->shearForce = Vector3r(0,0,0);
-	phys->prevNormal = Vector3r(0,0,0);
+	//phys->prevNormal = Vector3r(0,0,0);
 	interaction->phys = shared_ptr<ViscElPhys>(phys);
 }
 
@@ -56,16 +56,15 @@
 	const State& de2 = *static_cast<State*>(bodies[id2]->state.get());
 
 	Vector3r& shearForce = phys.shearForce;
-
 	if (I->isFresh(scene)) shearForce=Vector3r(0,0,0);
-
 	const Real& dt = scene->dt;
-
-	Vector3r axis = phys.prevNormal.cross(geom.normal);
-	shearForce -= shearForce.cross(axis);
-	const Real angle = dt*0.5*geom.normal.dot(de1.angVel + de2.angVel);
-	axis = angle*geom.normal;
-	shearForce -= shearForce.cross(axis);
+	//Vector3r axis = phys.prevNormal.cross(geom.normal);
+	//shearForce -= shearForce.cross(axis);
+	//const Real angle = dt*0.5*geom.normal.dot(de1.angVel + de2.angVel);
+	//axis = angle*geom.normal;
+	//shearForce -= shearForce.cross(axis);
+	shearForce = geom.rotate(shearForce);
+	
 
 	// Handle periodicity.
 	const Vector3r shift2 = scene->isPeriodic ? scene->cell->intrShiftPos(I->cellDist): Vector3r::Zero(); 
@@ -85,7 +84,7 @@
 	Vector3r shearForceVisc = Vector3r::Zero(); // the viscous shear damping haven't a history because it is a function of the instant velocity 
 
 	phys.normalForce = ( phys.kn * geom.penetrationDepth + phys.cn * normalVelocity ) * geom.normal;
-	phys.prevNormal = geom.normal;
+	//phys.prevNormal = geom.normal;
 
 	const Real maxFs = phys.normalForce.squaredNorm() * std::pow(phys.tangensOfFrictionAngle,2);
 	if( shearForce.squaredNorm() > maxFs )

=== modified file 'pkg/dem/ViscoelasticPM.hpp'
--- pkg/dem/ViscoelasticPM.hpp	2011-01-10 08:08:23 +0000
+++ pkg/dem/ViscoelasticPM.hpp	2011-01-11 14:09:30 +0000
@@ -29,10 +29,10 @@
 REGISTER_SERIALIZABLE(ViscElMat);
 
 /// Interaction physics
-class ViscElPhys : public FrictPhysTransitory {
+class ViscElPhys : public FrictPhys{
 	public:
 		virtual ~ViscElPhys();
-	YADE_CLASS_BASE_DOC_ATTRS_CTOR(ViscElPhys,FrictPhysTransitory,"IPhys created from :yref:`ViscElMat`, for use with :yref:`Law2_ScGeom_ViscElPhys_Basic`.",
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR(ViscElPhys,FrictPhys,"IPhys created from :yref:`ViscElMat`, for use with :yref:`Law2_ScGeom_ViscElPhys_Basic`.",
 		((Real,cn,NaN,,"Normal viscous constant"))
 		((Real,cs,NaN,,"Shear viscous constant")),
 		createIndex();

=== modified file 'py/ymport.py'
--- py/ymport.py	2010-12-19 15:59:14 +0000
+++ py/ymport.py	2011-01-11 14:09:30 +0000
@@ -63,7 +63,7 @@
 	
 	return textExt(fileName=fileName,format='x_y_z_r',shift=shift,scale=scale,**kw)
 	
-def stl(file, dynamic=False,wire=True,color=None,highlight=False,noBound=False,material=-1):
+def stl(file, dynamic=None,fixed=True,wire=True,color=None,highlight=False,noBound=False,material=-1):
 	""" Import geometry from stl file, return list of created facets."""
 	imp = STLImporter()
 	facets=imp.ymport(file)
@@ -72,10 +72,11 @@
 		b.shape.wire=wire
 		b.shape.highlight=highlight
 		pos,ori=b.state.pos,b.state.ori
-		utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBound,material=material)
-		b.state.pos,b.state.ori=pos,ori
-		b.aspherical=False # FIXME: is it  reasonably for a facets?
-		b.dynamic=dynamic
+		utils._commonBodySetup(b,0,Vector3(0,0,0),material=material,pos=pos,noBound=noBound,dynamic=dynamic,fixed=fixed)
+		#b.state.pos,b.state.ori=pos,ori
+		b.state.ori=ori
+		b.aspherical=False 
+		#b.dynamic=dynamic
 	return facets
 
 def gts(meshfile,shift=(0,0,0),scale=1.0,**kw):