← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4074: Move Ip2_*_MindlinCapillaryPhys into HertzMindlin

 

------------------------------------------------------------
revno: 4074
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-07-14 22:08:33 +0200
message:
  Move Ip2_*_MindlinCapillaryPhys into HertzMindlin
removed:
  pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.cpp
  pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp
modified:
  pkg/dem/HertzMindlin.cpp
  pkg/dem/HertzMindlin.hpp
  pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp


--
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/HertzMindlin.cpp'
--- pkg/dem/HertzMindlin.cpp	2013-09-23 17:17:34 +0000
+++ pkg/dem/HertzMindlin.cpp	2014-07-14 20:08:33 +0000
@@ -1,18 +1,18 @@
 // 2010 © Chiara Modenese <c.modenese@xxxxxxxxx> 
 
-
 #include"HertzMindlin.hpp"
 #include<yade/pkg/dem/ScGeom.hpp>
 #include<yade/core/Omega.hpp>
 #include<yade/core/Scene.hpp>
 
-
 YADE_PLUGIN(
 	(MindlinPhys)
 	(Ip2_FrictMat_FrictMat_MindlinPhys)
 	(Law2_ScGeom_MindlinPhys_MindlinDeresiewitz)
 	(Law2_ScGeom_MindlinPhys_HertzWithLinearShear)
 	(Law2_ScGeom_MindlinPhys_Mindlin)
+	(MindlinCapillaryPhys)
+	(Ip2_FrictMat_FrictMat_MindlinCapillaryPhys)
 );
 
 Real Law2_ScGeom_MindlinPhys_Mindlin::getfrictionDissipation() {return (Real) frictionDissipation;}
@@ -20,12 +20,6 @@
 Real Law2_ScGeom_MindlinPhys_Mindlin::getnormDampDissip() {return (Real) normDampDissip;}
 Real Law2_ScGeom_MindlinPhys_Mindlin::getshearDampDissip() {return (Real) shearDampDissip;}
 
-/******************** MindlinPhys *****************************/
-CREATE_LOGGER(MindlinPhys);
-
-MindlinPhys::~MindlinPhys(){}; // destructor
-
-
 /******************** Ip2_FrictMat_FrictMat_MindlinPhys *******/
 CREATE_LOGGER(Ip2_FrictMat_FrictMat_MindlinPhys);
 
@@ -36,8 +30,6 @@
 	FrictMat* mat1 = YADE_CAST<FrictMat*>(b1.get());
 	FrictMat* mat2 = YADE_CAST<FrictMat*>(b2.get());
 	
-
-	
 	/* from interaction physics */
 	Real Ea = mat1->young;
 	Real Eb = mat2->young;
@@ -154,7 +146,6 @@
 	return adhesionEnergy;
 }
 
-
 void Law2_ScGeom_MindlinPhys_MindlinDeresiewitz::go(shared_ptr<IGeom>& ig, shared_ptr<IPhys>& ip, Interaction* contact){
 	Body::id_t id1(contact->getId1()), id2(contact->getId2());
 	ScGeom* geom = static_cast<ScGeom*>(ig.get());
@@ -532,5 +523,74 @@
 	//phys->prevNormal = scg->normal;
 }
 
+// The following code was moved from Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.cpp
+
+void Ip2_FrictMat_FrictMat_MindlinCapillaryPhys::go( const shared_ptr<Material>& b1 //FrictMat
+					, const shared_ptr<Material>& b2 // FrictMat
+					, const shared_ptr<Interaction>& interaction)
+{
+	if(interaction->phys) return; // no updates of an already existing contact necessary
+
+	shared_ptr<MindlinCapillaryPhys> contactPhysics(new MindlinCapillaryPhys());
+	interaction->phys = contactPhysics;
+
+	FrictMat* mat1 = YADE_CAST<FrictMat*>(b1.get());
+	FrictMat* mat2 = YADE_CAST<FrictMat*>(b2.get());
+	
+	/* from interaction physics */
+	Real Ea = mat1->young;
+	Real Eb = mat2->young;
+	Real Va = mat1->poisson;
+	Real Vb = mat2->poisson;
+	Real fa = mat1->frictionAngle;
+	Real fb = mat2->frictionAngle;
+
+	/* from interaction geometry */
+	GenericSpheresContact* scg = YADE_CAST<GenericSpheresContact*>(interaction->geom.get());		
+	Real Da = scg->refR1>0 ? scg->refR1 : scg->refR2; 
+	Real Db = scg->refR2; 
+	//Vector3r normal=scg->normal;  //The variable set but not used
+
+	/* calculate stiffness coefficients */
+	Real Ga = Ea/(2*(1+Va));
+	Real Gb = Eb/(2*(1+Vb));
+	Real G = (Ga+Gb)/2; // average of shear modulus
+	Real V = (Va+Vb)/2; // average of poisson's ratio
+	Real E = Ea*Eb/((1.-std::pow(Va,2))*Eb+(1.-std::pow(Vb,2))*Ea); // Young modulus
+	Real R = Da*Db/(Da+Db); // equivalent radius
+	Real Rmean = (Da+Db)/2.; // mean radius
+	Real Kno = 4./3.*E*sqrt(R); // coefficient for normal stiffness
+	Real Kso = 2*sqrt(4*R)*G/(2-V); // coefficient for shear stiffness
+	Real frictionAngle = std::min(fa,fb);
+
+	Real Adhesion = 4.*Mathr::PI*R*gamma; // calculate adhesion force as predicted by DMT theory
+
+	/* pass values calculated from above to MindlinCapillaryPhys */
+	contactPhysics->tangensOfFrictionAngle = std::tan(frictionAngle); 
+	//mindlinPhys->prevNormal = scg->normal; // used to compute relative rotation
+	contactPhysics->kno = Kno; // this is just a coeff
+	contactPhysics->kso = Kso; // this is just a coeff
+	contactPhysics->adhesionForce = Adhesion;
+	
+	contactPhysics->kr = krot;
+	contactPhysics->ktw = ktwist;
+	contactPhysics->maxBendPl = eta*Rmean; // does this make sense? why do we take Rmean?
+
+	/* compute viscous coefficients */
+	if(en && betan) throw std::invalid_argument("Ip2_FrictMat_FrictMat_MindlinCapillaryPhys: only one of en, betan can be specified.");
+	if(es && betas) throw std::invalid_argument("Ip2_FrictMat_FrictMat_MindlinCapillaryPhys: only one of es, betas can be specified.");
+
+	// en or es specified, just compute alpha, otherwise alpha remains 0
+	if(en || es){
+		Real logE = log((*en)(mat1->id,mat2->id));
+		contactPhysics->alpha = -sqrt(5/6.)*2*logE/sqrt(pow(logE,2)+pow(Mathr::PI,2))*sqrt(2*E*sqrt(R)); // (see Tsuji, 1992)
+	}
+	
+	// betan specified, use that value directly; otherwise give zero
+	else{	
+		contactPhysics->betan=betan ? (*betan)(mat1->id,mat2->id) : 0; 
+		contactPhysics->betas=betas ? (*betas)(mat1->id,mat2->id) : contactPhysics->betan;
+	}
+};
 
 

=== modified file 'pkg/dem/HertzMindlin.hpp'
--- pkg/dem/HertzMindlin.hpp	2013-09-07 19:40:12 +0000
+++ pkg/dem/HertzMindlin.hpp	2014-07-14 20:08:33 +0000
@@ -18,7 +18,6 @@
 #include<yade/pkg/common/NormShearPhys.hpp>
 #include<yade/pkg/common/MatchMaker.hpp>
 
-
 #include <set>
 #include <boost/tuple/tuple.hpp>
 #include<yade/lib/base/openmp-accu.hpp>
@@ -27,7 +26,7 @@
 /******************** MindlinPhys *********************************/
 class MindlinPhys: public FrictPhys{
 	public:
-	virtual ~MindlinPhys();
+	virtual ~MindlinPhys() {};
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(MindlinPhys,FrictPhys,"Representation of an interaction of the Hertz-Mindlin type.",
 			((Real,kno,0.0,,"Constant value in the formulation of the normal stiffness"))
 			((Real,kso,0.0,,"Constant value in the formulation of the tangential stiffness"))
@@ -158,11 +157,53 @@
 };
 REGISTER_SERIALIZABLE(Law2_ScGeom_MindlinPhys_Mindlin);
 
-
-
-
-
-
-
-
-
+// The following code was moved from Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp
+
+class MindlinCapillaryPhys : public MindlinPhys
+{
+	public :
+		int currentIndexes [4]; // used for faster interpolation (stores previous positions in tables)
+		
+		virtual ~MindlinCapillaryPhys() {};
+
+	YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(MindlinCapillaryPhys,MindlinPhys,"Adds capillary physics to Mindlin's interaction physics.",
+				((bool,meniscus,false,,"Presence of a meniscus if true"))
+				((bool,isBroken,false,,"If true, capillary force is zero and liquid bridge is inactive."))
+				((Real,capillaryPressure,0.,,"Value of the capillary pressure Uc defines as Ugas-Uliquid"))
+				((Real,vMeniscus,0.,,"Volume of the menicus"))
+				((Real,Delta1,0.,,"Defines the surface area wetted by the meniscus on the smallest grains of radius R1 (R1<R2)"))
+				((Real,Delta2,0.,,"Defines the surface area wetted by the meniscus on the biggest grains of radius R2 (R1<R2)"))
+				((Vector3r,fCap,Vector3r::Zero(),,"Capillary Force produces by the presence of the meniscus"))
+				((short int,fusionNumber,0.,,"Indicates the number of meniscii that overlap with this one"))
+				,/*deprec*/
+				((Fcap,fCap,"naming convention"))
+				((CapillaryPressure,capillaryPressure,"naming convention"))
+				,,createIndex();currentIndexes[0]=currentIndexes[1]=currentIndexes[2]=currentIndexes[3]=0;
+				,
+				);
+	REGISTER_CLASS_INDEX(MindlinCapillaryPhys,MindlinPhys);
+};
+REGISTER_SERIALIZABLE(MindlinCapillaryPhys);
+
+
+class Ip2_FrictMat_FrictMat_MindlinCapillaryPhys : public IPhysFunctor
+{
+	public :
+		virtual void go(	const shared_ptr<Material>& b1,
+					const shared_ptr<Material>& b2,
+					const shared_ptr<Interaction>& interaction);
+
+	FUNCTOR2D(FrictMat,FrictMat);
+	YADE_CLASS_BASE_DOC_ATTRS(Ip2_FrictMat_FrictMat_MindlinCapillaryPhys,IPhysFunctor, "RelationShips to use with Law2_ScGeom_CapillaryPhys_Capillarity\n\n In these RelationShips all the interaction attributes are computed. \n\n.. warning::\n\tas in the others :yref:`Ip2 functors<IPhysFunctor>`, most of the attributes are computed only once, when the interaction is new.",
+	            ((Real,gamma,0.0,,"Surface energy parameter [J/m^2] per each unit contact surface, to derive DMT formulation from HM"))
+				((Real,eta,0.0,,"Coefficient to determine the plastic bending moment"))
+				((Real,krot,0.0,,"Rotational stiffness for moment contact law"))
+				((Real,ktwist,0.0,,"Torsional stiffness for moment contact law"))
+				((shared_ptr<MatchMaker>,en,,,"Normal coefficient of restitution $e_n$."))
+				((shared_ptr<MatchMaker>,es,,,"Shear coefficient of restitution $e_s$."))
+				((shared_ptr<MatchMaker>,betan,,,"Normal viscous damping coefficient $\\beta_n$."))
+				((shared_ptr<MatchMaker>,betas,,,"Shear viscous damping coefficient $\\beta_s$."))
+		);
+		DECLARE_LOGGER;
+};
+REGISTER_SERIALIZABLE(Ip2_FrictMat_FrictMat_MindlinCapillaryPhys);

=== removed file 'pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.cpp'
--- pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.cpp	2012-02-16 16:05:15 +0000
+++ pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.cpp	1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2007 by Bruno CHAREYRE                                 *
-*  bruno.chareyre@xxxxxxxxxxx                                        *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#include"Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp"
-#include<yade/pkg/dem/ScGeom.hpp>
-#include<yade/pkg/dem/HertzMindlin.hpp>
-#include<yade/pkg/common/ElastMat.hpp>
-#include<yade/pkg/common/Dispatching.hpp>
-
-#include<yade/core/Omega.hpp>
-#include<yade/core/Scene.hpp>
-
-YADE_PLUGIN(
-            (MindlinCapillaryPhys)
-            (Ip2_FrictMat_FrictMat_MindlinCapillaryPhys)
-);
-
-MindlinCapillaryPhys::~MindlinCapillaryPhys(){};// destructor
-
-void Ip2_FrictMat_FrictMat_MindlinCapillaryPhys::go( const shared_ptr<Material>& b1 //FrictMat
-					, const shared_ptr<Material>& b2 // FrictMat
-					, const shared_ptr<Interaction>& interaction)
-{
-	if(interaction->phys) return; // no updates of an already existing contact necessary
-
-	shared_ptr<MindlinCapillaryPhys> contactPhysics(new MindlinCapillaryPhys());
-	interaction->phys = contactPhysics;
-
-	FrictMat* mat1 = YADE_CAST<FrictMat*>(b1.get());
-	FrictMat* mat2 = YADE_CAST<FrictMat*>(b2.get());
-	
-	/* from interaction physics */
-	Real Ea = mat1->young;
-	Real Eb = mat2->young;
-	Real Va = mat1->poisson;
-	Real Vb = mat2->poisson;
-	Real fa = mat1->frictionAngle;
-	Real fb = mat2->frictionAngle;
-
-	/* from interaction geometry */
-	GenericSpheresContact* scg = YADE_CAST<GenericSpheresContact*>(interaction->geom.get());		
-	Real Da = scg->refR1>0 ? scg->refR1 : scg->refR2; 
-	Real Db = scg->refR2; 
-	//Vector3r normal=scg->normal;  //The variable set but not used
-
-	/* calculate stiffness coefficients */
-	Real Ga = Ea/(2*(1+Va));
-	Real Gb = Eb/(2*(1+Vb));
-	Real G = (Ga+Gb)/2; // average of shear modulus
-	Real V = (Va+Vb)/2; // average of poisson's ratio
-	Real E = Ea*Eb/((1.-std::pow(Va,2))*Eb+(1.-std::pow(Vb,2))*Ea); // Young modulus
-	Real R = Da*Db/(Da+Db); // equivalent radius
-	Real Rmean = (Da+Db)/2.; // mean radius
-	Real Kno = 4./3.*E*sqrt(R); // coefficient for normal stiffness
-	Real Kso = 2*sqrt(4*R)*G/(2-V); // coefficient for shear stiffness
-	Real frictionAngle = std::min(fa,fb);
-
-	Real Adhesion = 4.*Mathr::PI*R*gamma; // calculate adhesion force as predicted by DMT theory
-
-	/* pass values calculated from above to MindlinCapillaryPhys */
-	contactPhysics->tangensOfFrictionAngle = std::tan(frictionAngle); 
-	//mindlinPhys->prevNormal = scg->normal; // used to compute relative rotation
-	contactPhysics->kno = Kno; // this is just a coeff
-	contactPhysics->kso = Kso; // this is just a coeff
-	contactPhysics->adhesionForce = Adhesion;
-	
-	contactPhysics->kr = krot;
-	contactPhysics->ktw = ktwist;
-	contactPhysics->maxBendPl = eta*Rmean; // does this make sense? why do we take Rmean?
-
-	/* compute viscous coefficients */
-	if(en && betan) throw std::invalid_argument("Ip2_FrictMat_FrictMat_MindlinCapillaryPhys: only one of en, betan can be specified.");
-	if(es && betas) throw std::invalid_argument("Ip2_FrictMat_FrictMat_MindlinCapillaryPhys: only one of es, betas can be specified.");
-
-	// en or es specified, just compute alpha, otherwise alpha remains 0
-	if(en || es){
-		Real logE = log((*en)(mat1->id,mat2->id));
-		contactPhysics->alpha = -sqrt(5/6.)*2*logE/sqrt(pow(logE,2)+pow(Mathr::PI,2))*sqrt(2*E*sqrt(R)); // (see Tsuji, 1992)
-	}
-	
-	// betan specified, use that value directly; otherwise give zero
-	else{	
-		contactPhysics->betan=betan ? (*betan)(mat1->id,mat2->id) : 0; 
-		contactPhysics->betas=betas ? (*betas)(mat1->id,mat2->id) : contactPhysics->betan;
-	}
-};
-
-
-
-

=== removed file 'pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp'
--- pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp	2013-05-30 20:17:45 +0000
+++ pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2007 by Bruno CHAREYRE                                  *
-*  bruno.chareyre@xxxxxxxxxxx                                            *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include<yade/pkg/common/Dispatching.hpp>
-#include<yade/pkg/common/ElastMat.hpp>
-#include<yade/pkg/dem/HertzMindlin.hpp>
-
-class MindlinCapillaryPhys : public MindlinPhys
-{
-	public :
-		int currentIndexes [4]; // used for faster interpolation (stores previous positions in tables)
-		
-		virtual ~MindlinCapillaryPhys();
-
-	YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(MindlinCapillaryPhys,MindlinPhys,"Adds capillary physics to Mindlin's interaction physics.",
-				((bool,meniscus,false,,"Presence of a meniscus if true"))
-				((bool,isBroken,false,,"If true, capillary force is zero and liquid bridge is inactive."))
-				((Real,capillaryPressure,0.,,"Value of the capillary pressure Uc defines as Ugas-Uliquid"))
-				((Real,vMeniscus,0.,,"Volume of the menicus"))
-				((Real,Delta1,0.,,"Defines the surface area wetted by the meniscus on the smallest grains of radius R1 (R1<R2)"))
-				((Real,Delta2,0.,,"Defines the surface area wetted by the meniscus on the biggest grains of radius R2 (R1<R2)"))
-				((Vector3r,fCap,Vector3r::Zero(),,"Capillary Force produces by the presence of the meniscus"))
-				((short int,fusionNumber,0.,,"Indicates the number of meniscii that overlap with this one"))
-				,/*deprec*/
-				((Fcap,fCap,"naming convention"))
-				((CapillaryPressure,capillaryPressure,"naming convention"))
-				,,createIndex();currentIndexes[0]=currentIndexes[1]=currentIndexes[2]=currentIndexes[3]=0;
-				,
-				);
-	REGISTER_CLASS_INDEX(MindlinCapillaryPhys,MindlinPhys);
-};
-REGISTER_SERIALIZABLE(MindlinCapillaryPhys);
-
-
-class Ip2_FrictMat_FrictMat_MindlinCapillaryPhys : public IPhysFunctor
-{
-	public :
-		virtual void go(	const shared_ptr<Material>& b1,
-					const shared_ptr<Material>& b2,
-					const shared_ptr<Interaction>& interaction);
-
-	FUNCTOR2D(FrictMat,FrictMat);
-	YADE_CLASS_BASE_DOC_ATTRS(Ip2_FrictMat_FrictMat_MindlinCapillaryPhys,IPhysFunctor, "RelationShips to use with Law2_ScGeom_CapillaryPhys_Capillarity\n\n In these RelationShips all the interaction attributes are computed. \n\n.. warning::\n\tas in the others :yref:`Ip2 functors<IPhysFunctor>`, most of the attributes are computed only once, when the interaction is new.",
-	            ((Real,gamma,0.0,,"Surface energy parameter [J/m^2] per each unit contact surface, to derive DMT formulation from HM"))
-				((Real,eta,0.0,,"Coefficient to determine the plastic bending moment"))
-				((Real,krot,0.0,,"Rotational stiffness for moment contact law"))
-				((Real,ktwist,0.0,,"Torsional stiffness for moment contact law"))
-				((shared_ptr<MatchMaker>,en,,,"Normal coefficient of restitution $e_n$."))
-				((shared_ptr<MatchMaker>,es,,,"Shear coefficient of restitution $e_s$."))
-				((shared_ptr<MatchMaker>,betan,,,"Normal viscous damping coefficient $\\beta_n$."))
-				((shared_ptr<MatchMaker>,betas,,,"Shear viscous damping coefficient $\\beta_s$."))
-		);
-		DECLARE_LOGGER;
-};
-REGISTER_SERIALIZABLE(Ip2_FrictMat_FrictMat_MindlinCapillaryPhys);
-
-
-

=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp	2014-07-03 17:20:40 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp	2014-07-14 20:08:33 +0000
@@ -16,7 +16,7 @@
 #include <yade/pkg/dem/ScGeom.hpp>
 
 #include <yade/pkg/dem/CapillaryPhys.hpp>
-#include <yade/pkg/dem/Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.hpp>
+#include <yade/pkg/dem/HertzMindlin.hpp>
 #include <yade/core/Omega.hpp>
 #include <yade/core/Scene.hpp>
 #include <yade/lib/base/Math.hpp>