← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3737: a function to increase the size of a single sphere (~>Thomas swelling)

 

------------------------------------------------------------
revno: 3737
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Thu 2013-10-31 00:25:56 +0100
message:
  a function to increase the size of a single sphere (~>Thomas swelling)
modified:
  pkg/dem/Shop.hpp
  pkg/dem/Shop_02.cpp
  py/_utils.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/Shop.hpp'
--- pkg/dem/Shop.hpp	2013-10-22 21:04:04 +0000
+++ pkg/dem/Shop.hpp	2013-10-30 23:25:56 +0000
@@ -146,6 +146,6 @@
 
 		//! Homothetic change of sizes of spheres and clumps
 		static void growParticles(Real multiplier, bool updateMass, bool dynamicOnly, unsigned int discretization, bool integrateInertia);
-
-
+		//! Change of size of a single sphere or a clump
+		static void growParticle(Body::id_t bodyID, Real multiplier, bool updateMass);
 };

=== modified file 'pkg/dem/Shop_02.cpp'
--- pkg/dem/Shop_02.cpp	2013-10-22 21:04:04 +0000
+++ pkg/dem/Shop_02.cpp	2013-10-30 23:25:56 +0000
@@ -511,3 +511,16 @@
 	}
 }
 
+void Shop::growParticle(Body::id_t bodyID, Real multiplier, bool updateMass)
+{
+	const shared_ptr<Body>& b = Body::byId(bodyID);
+	Real& rad = YADE_CAST<Sphere*>(b->shape.get())->radius;	
+	rad *= multiplier;
+	if (updateMass) {b->state->mass*=pow(multiplier,3); b->state->inertia*=pow(multiplier,5);}
+	for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {  //Iterate over all bodie's interactions
+		if(!(*it).second->isReal()) continue;
+		GenericSpheresContact* contact = YADE_CAST<GenericSpheresContact*>((*it).second->geom.get());
+		if (bodyID==it->second->getId1()) contact->refR1 = rad;
+		else contact->refR2 = rad;
+	}
+}

=== modified file 'py/_utils.cpp'
--- py/_utils.cpp	2013-10-04 11:41:10 +0000
+++ py/_utils.cpp	2013-10-30 23:25:56 +0000
@@ -543,7 +543,8 @@
 	py::def("calm",Shop__calm,(py::arg("mask")=-1),"Set translational and rotational velocities of all bodies to zero.");
 	py::def("setNewVerticesOfFacet",setNewVerticesOfFacet,(py::arg("b"),py::arg("v1"),py::arg("v2"),py::arg("v3")),"Sets new vertices (in global coordinates) to given facet.");
 	py::def("setContactFriction",Shop::setContactFriction,py::arg("angleRad"),"Modify the friction angle (in radians) inside the material classes and existing contacts. The friction for non-dynamic bodies is not modified.");
-	py::def("growParticles",Shop::growParticles,(py::args("multiplier"), py::args("updateMass")=true, py::args("dynamicOnly")=true, py::args("discretization")=15, py::args("integrateInertia")=true), "Change the size of spheres and sphere clumps by the multiplier. If updateMass=True, then the mass is updated. dynamicOnly=True is mandatory in many cases since in current implementation the function would crash on the non-spherical and non-dynamic bodies (e.g. facets, boxes, etc.). For clumps the masses and inertias are adapted automatically (for details of inertia tensor integration scheme see :yref:`clump()<BodyContainer.clump>`).");
+	py::def("growParticles",Shop::growParticles,(py::args("multiplier"), py::args("updateMass")=true, py::args("dynamicOnly")=true), "Change the size of spheres and sphere clumps by the multiplier. If updateMass=True, then the mass is updated. dynamicOnly=True is mandatory in many cases since in current implementation the function would crash on the non-spherical and non-dynamic bodies (e.g. facets, boxes, etc.)");
+	py::def("growParticle",Shop::growParticle,(py::args("bodyID"),py::args("multiplier"), py::args("updateMass")=true), "Change the size of a single sphere (to be implemented: single clump). If updateMass=True, then the mass is updated.");
 	py::def("intrsOfEachBody",intrsOfEachBody,"returns list of lists of interactions of each body");
 	py::def("numIntrsOfEachBody",numIntrsOfEachBody,"returns list of number of interactions of each body");
 	py::def("TetrahedronSignedVolume",static_cast<Real (*)(const vector<Vector3r>&)>(&TetrahedronSignedVolume),"TODO");