← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3759: Consider massMultiply-parameter, calculating parameters in

 

------------------------------------------------------------
revno: 3759
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2013-12-04 20:25:29 +0100
message:
  Consider massMultiply-parameter, calculating parameters in
  ViscoElasticPM.
  
  Fixes the problem with --check, introduced in 6d4bd0
modified:
  pkg/dem/ViscoelasticPM.cpp
  pkg/dem/ViscoelasticPM.hpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp	2013-12-04 09:56:32 +0000
+++ pkg/dem/ViscoelasticPM.cpp	2013-12-04 19:25:29 +0000
@@ -15,8 +15,16 @@
 ViscElPhys::~ViscElPhys(){}
 
 /* Contact parameter calculation function */
-Real Ip2_ViscElMat_ViscElMat_ViscElPhys::contactParameterCalculation(Real l1,Real l2){
-	return (l1>0 or l2>0)?l1*l2/(l1+l2):0;
+Real Ip2_ViscElMat_ViscElMat_ViscElPhys::contactParameterCalculation(const Real& l1, const Real& l2, const bool& massMultiply){
+	if (massMultiply) {
+		// If one of paramaters > 0. we DO NOT return 0
+    Real a = (l1?1/l1:0) + (l2?1/l2:0);
+    if (a) return 1/a;
+    else return 0;
+	} else {
+		// If one of paramaters > 0, we return 0
+		return (l1>0 or l2>0)?l1*l2/(l1+l2):0;
+	}
 }
 
 /* Ip2_ViscElMat_ViscElMat_ViscElPhys */
@@ -43,10 +51,10 @@
 		
 	ViscElPhys* phys = new ViscElPhys();
 
-	phys->kn = contactParameterCalculation(kn1,kn2);
-	phys->ks = contactParameterCalculation(ks1,ks2);
-	phys->cn = contactParameterCalculation(cn1,cn2);
-	phys->cs = contactParameterCalculation(cs1,cs2);
+	phys->kn = contactParameterCalculation(kn1,kn2, mat1->massMultiply&&mat2->massMultiply);
+	phys->ks = contactParameterCalculation(ks1,ks2, mat1->massMultiply&&mat2->massMultiply);
+	phys->cn = contactParameterCalculation(cn1,cn2, mat1->massMultiply&&mat2->massMultiply);
+	phys->cs = contactParameterCalculation(cs1,cs2, mat1->massMultiply&&mat2->massMultiply);
 
  	if ((mR1>0) or (mR2>0)) {
 		phys->mR = 2.0/( ((mR1>0)?1/mR1:0) + ((mR2>0)?1/mR2:0) );

=== modified file 'pkg/dem/ViscoelasticPM.hpp'
--- pkg/dem/ViscoelasticPM.hpp	2013-12-04 09:56:32 +0000
+++ pkg/dem/ViscoelasticPM.hpp	2013-12-04 19:25:29 +0000
@@ -66,7 +66,7 @@
 					const shared_ptr<Material>& b2,
 					const shared_ptr<Interaction>& interaction);
 	private :
-		Real contactParameterCalculation(Real l1,Real l2);
+		Real contactParameterCalculation(const Real& l1,const Real& l2, const bool& massMultiply);
 	YADE_CLASS_BASE_DOC(Ip2_ViscElMat_ViscElMat_ViscElPhys,IPhysFunctor,"Convert 2 instances of :yref:`ViscElMat` to :yref:`ViscElPhys` using the rule of consecutive connection.");
 	FUNCTOR2D(ViscElMat,ViscElMat);