yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10973
[Branch ~yade-pkg/yade/git-trunk] Rev 4026: Add addLiqInter function to set liquid "properly"
------------------------------------------------------------
revno: 4026
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Fri 2014-06-13 15:58:12 +0200
message:
Add addLiqInter function to set liquid "properly"
modified:
pkg/dem/ViscoelasticCapillarPM.cpp
pkg/dem/ViscoelasticCapillarPM.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/ViscoelasticCapillarPM.cpp'
--- pkg/dem/ViscoelasticCapillarPM.cpp 2014-06-11 12:06:47 +0000
+++ pkg/dem/ViscoelasticCapillarPM.cpp 2014-06-13 13:58:12 +0000
@@ -568,4 +568,22 @@
}
return totalLiqVol;
}
+
+bool LiqControl::addLiqInter(id_t id1, id_t id2, Real liq) {
+ if (id1<0 or id2<0 or id1==id2 or liq<=0) return false;
+
+ Scene* scene=Omega::instance().getScene().get();
+ shared_ptr<InteractionContainer>& intrs=scene->interactions;
+ const shared_ptr<Interaction>& I=intrs->find(id1,id2);
+ if (I->isReal()) {
+ ViscElCapPhys* physT=dynamic_cast<ViscElCapPhys*>(I->phys.get());
+ if (physT and physT->Vb <= physT->Vmax and liq <= (physT->Vmax - physT->Vb)) {
+ physT->Vb += liq;
+ physT->Vf1 += liq/2.0;
+ physT->Vf2 += liq/2.0;
+ return true;
+ }
+ }
+ return false;
+}
#endif
=== modified file 'pkg/dem/ViscoelasticCapillarPM.hpp'
--- pkg/dem/ViscoelasticCapillarPM.hpp 2014-05-27 14:20:39 +0000
+++ pkg/dem/ViscoelasticCapillarPM.hpp 2014-06-13 13:58:12 +0000
@@ -92,6 +92,7 @@
Real vMax(shared_ptr<Body> b1, shared_ptr<Body> b2);
Real totalLiqVol(int mask) const;
Real liqVolBody(id_t id) const;
+ bool addLiqInter(id_t id1, id_t id2, Real liq);
void updateLiquid(shared_ptr<Body> b);
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(LiqControl,PartialEngine,"This engine implements liquid migration model, introduced here [Mani2013]_ . ",
((int,mask,0,, "Bitmask for liquid creation."))
@@ -103,6 +104,7 @@
,/* py */
.def("totalLiq",&LiqControl::totalLiqVol,(boost::python::arg("mask")=0),"Return total volume of water in simulation.")
.def("liqBody",&LiqControl::liqVolBody,(boost::python::arg("id")=-1),"Return total volume of water in body.")
+ .def("addLiqInter",&LiqControl::addLiqInter,(boost::python::arg("id1")=-1, boost::python::arg("id2")=-1, boost::python::arg("liq")=-1),"Add liquid into the interaction.")
);
};