← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3531: Move Vf and Vmin from Body`s parameter to Body->state.

 

------------------------------------------------------------
revno: 3531
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-11-17 10:21:14 +0100
message:
  Move Vf and Vmin from Body`s parameter to Body->state.
  
  Only for compilation, where YADE_LIQMIGRATION is enabled.
modified:
  core/Body.hpp
  core/State.hpp
  examples/capillary/liquidmigration/showcase.py
  pkg/dem/VTKRecorder.cpp
  pkg/dem/ViscoelasticCapillarPM.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 'core/Body.hpp'
--- core/Body.hpp	2014-10-23 13:46:20 +0000
+++ core/Body.hpp	2014-11-17 09:21:14 +0000
@@ -95,10 +95,6 @@
 		((long,chain,-1,,"Id of chain to which the body belongs."))
 		((long,iterBorn,-1,,"Step number at which the body was added to simulation."))
 		((Real,timeBorn,-1,,"Time at which the body was added to simulation."))
-#ifdef YADE_LIQMIGRATION
-		((Real,Vf, 0.0,,   "Individual amount of liquid"))
-		((Real,Vmin, 0.0,, "Minimal amount of liquid"))
-#endif
 		,
 		/* ctor */,
 		/* py */

=== modified file 'core/State.hpp'
--- core/State.hpp	2014-10-23 13:46:20 +0000
+++ core/State.hpp	2014-11-17 09:21:14 +0000
@@ -67,6 +67,10 @@
 		((Real,rho0,-1.0,, "Rest density (only for SPH-model)"))         // [Mueller2003], (12)
 		((Real,press,0.0,, "Pressure (only for SPH-model)"))             // [Mueller2003], (12)
 #endif
+#ifdef YADE_LIQMIGRATION
+		((Real,Vf, 0.0,,   "Individual amount of liquid"))
+		((Real,Vmin, 0.0,, "Minimal amount of liquid"))
+#endif
 		,
 		/* additional initializers */
 			((pos,se3.position))

=== modified file 'examples/capillary/liquidmigration/showcase.py'
--- examples/capillary/liquidmigration/showcase.py	2014-06-18 07:35:57 +0000
+++ examples/capillary/liquidmigration/showcase.py	2014-11-17 09:21:14 +0000
@@ -32,20 +32,20 @@
 Vf = 0.0e-1
 Vfmin = 0.0e-1
 
-O.bodies[id1].Vf = Vf
-O.bodies[id1].Vmin = Vfmin
-
-O.bodies[id2].Vf = Vf
-O.bodies[id2].Vmin = Vfmin
-
-O.bodies[id3].Vf = Vf
-O.bodies[id3].Vmin = Vfmin
-
-O.bodies[id4].Vf = Vf
-O.bodies[id4].Vmin = Vfmin
-
-O.bodies[id5].Vf = Vf
-O.bodies[id5].Vmin = Vfmin
+O.bodies[id1].state.Vf = Vf
+O.bodies[id1].state.Vmin = Vfmin
+
+O.bodies[id2].state.Vf = Vf
+O.bodies[id2].state.Vmin = Vfmin
+
+O.bodies[id3].state.Vf = Vf
+O.bodies[id3].state.Vmin = Vfmin
+
+O.bodies[id4].state.Vf = Vf
+O.bodies[id4].state.Vmin = Vfmin
+
+O.bodies[id5].state.Vf = Vf
+O.bodies[id5].state.Vmin = Vfmin
 
 vel = 0.0
 O.bodies[id1].state.vel=[0,0,vel]
@@ -69,11 +69,11 @@
 
 def showData():
   print "Step %d"%O.iter
-  print "idB=%d, Vf=%s, Vmin=%s;"%(id1, O.bodies[id1].Vf, O.bodies[id1].Vmin)
-  print "idB=%d, Vf=%s, Vmin=%s;"%(id2, O.bodies[id2].Vf, O.bodies[id2].Vmin)
-  print "idB=%d, Vf=%s, Vmin=%s;"%(id3, O.bodies[id3].Vf, O.bodies[id3].Vmin)
-  print "idB=%d, Vf=%s, Vmin=%s;"%(id4, O.bodies[id4].Vf, O.bodies[id4].Vmin)
-  print "idB=%d, Vf=%s, Vmin=%s;"%(id5, O.bodies[id5].Vf, O.bodies[id5].Vmin)
+  print "idB=%d, Vf=%s, Vmin=%s;"%(id1, O.bodies[id1].state.Vf, O.bodies[id1].state.Vmin)
+  print "idB=%d, Vf=%s, Vmin=%s;"%(id2, O.bodies[id2].state.Vf, O.bodies[id2].state.Vmin)
+  print "idB=%d, Vf=%s, Vmin=%s;"%(id3, O.bodies[id3].state.Vf, O.bodies[id3].state.Vmin)
+  print "idB=%d, Vf=%s, Vmin=%s;"%(id4, O.bodies[id4].state.Vf, O.bodies[id4].state.Vmin)
+  print "idB=%d, Vf=%s, Vmin=%s;"%(id5, O.bodies[id5].state.Vf, O.bodies[id5].state.Vmin)
   
   try:
     print "Interaction[1, 2].Vb=%s"%(O.interactions[id1,id2].phys.Vb)
@@ -102,8 +102,8 @@
 O.run(1, True)
 
 for i in range(5):
-  O.bodies[i].Vf = 0
-  O.bodies[i].Vmin = 0
+  O.bodies[i].state.Vf = 0
+  O.bodies[i].state.Vmin = 0
 
 O.interactions[id1,id2].phys.Vmax = 5.0
 lqc.addLiqInter(id1, id2, 1.0)

=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp	2014-11-03 10:05:14 +0000
+++ pkg/dem/VTKRecorder.cpp	2014-11-17 09:21:14 +0000
@@ -600,10 +600,10 @@
 #endif
 #ifdef YADE_LIQMIGRATION
 				if (recActive[REC_LIQ]) {
-					spheresLiqVol->InsertNextValue(b->Vf);
+					spheresLiqVol->InsertNextValue(b->state->Vf);
 					const Real tmpVolIter = liqVolIterBody(b);
 					spheresLiqVolIter->InsertNextValue(tmpVolIter);
-					spheresLiqVolTotal->InsertNextValue(tmpVolIter + b->Vf);
+					spheresLiqVolTotal->InsertNextValue(tmpVolIter + b->state->Vf);
 				}
 #endif
 				if (recActive[REC_MATERIALID]) spheresMaterialId->InsertNextValue(b->material->id);

=== modified file 'pkg/dem/ViscoelasticCapillarPM.cpp'
--- pkg/dem/ViscoelasticCapillarPM.cpp	2014-10-15 06:44:01 +0000
+++ pkg/dem/ViscoelasticCapillarPM.cpp	2014-11-17 09:21:14 +0000
@@ -376,7 +376,7 @@
   // Update volume water at each deleted interaction for each body
   for (unsigned int i=0; i<scene->delIntrs.size(); i++) {
     shared_ptr<Body> b = Body::byId(scene->delIntrs[i].id,scene);
-    b->Vf += scene->delIntrs[i].Vol;
+    b->state->Vf += scene->delIntrs[i].Vol;
     addBodyMapInt(bodyNeedUpdate, scene->delIntrs[i].id);
     liqVolRup += scene->delIntrs[i].Vol;
   }
@@ -405,8 +405,8 @@
       Real Vf1 = 0.0;
       Real Vf2 = 0.0;
       
-      if ((b1->Vmin)<b1->Vf) { Vf1 = (b1->Vf - b1->Vmin)/bI[id1]; }
-      if ((b2->Vmin)<b2->Vf) { Vf2 = (b2->Vf - b2->Vmin)/bI[id2]; }
+      if ((b1->state->Vmin)<b1->state->Vf) { Vf1 = (b1->state->Vf - b1->state->Vmin)/bI[id1]; }
+      if ((b2->state->Vmin)<b2->state->Vf) { Vf2 = (b2->state->Vf - b2->state->Vmin)/bI[id2]; }
       
       Real Vrup = Vf1+Vf2;
       
@@ -435,7 +435,7 @@
   
   // Update water volume in body
   for (mapBodyReal::const_iterator it = bodyUpdateLiquid.begin(); it != bodyUpdateLiquid.end(); ++it) {
-    Body::byId(it->first)->Vf += it->second;
+    Body::byId(it->first)->state->Vf += it->second;
   }
   
   // Update contacts around body
@@ -445,11 +445,11 @@
 }
 
 void LiqControl::updateLiquid(shared_ptr<Body> b){
-  if (b->Vf<=b->Vmin) {
+  if (b->state->Vf<=b->state->Vmin) {
     return;
   } else {
     // How much liquid can body share
-    const Real LiqCanBeShared = b->Vf - b->Vmin;
+    const Real LiqCanBeShared = b->state->Vf - b->state->Vmin;
     
     // Check how much liquid can accept contacts 
     Real LiqContactsAccept = 0.0;
@@ -467,11 +467,11 @@
       //There are some contacts, which can be filled
       Real FillLevel = 0.0;
       if (LiqContactsAccept > LiqCanBeShared) {   // Share all available liquid from body to contacts
-        const Real LiquidWillBeShared = b->Vf - b->Vmin;
-        b->Vf = b->Vmin;
+        const Real LiquidWillBeShared = b->state->Vf - b->state->Vmin;
+        b->state->Vf = b->state->Vmin;
         FillLevel = LiquidWillBeShared/LiqContactsAccept;
       } else {                                    // Not all available liquid from body can be shared
-        b->Vf -= LiqContactsAccept;
+        b->state->Vf -= LiqContactsAccept;
         FillLevel = 1.0;
       }
       
@@ -567,8 +567,8 @@
   Scene* scene=Omega::instance().getScene().get();
   const BodyContainer& bodies = *scene->bodies;
   if (id >=0 and bodies[id]) {
-    if (bodies[id]->Vf > 0) {
-      return bodies[id]->Vf + liqVolIterBody(bodies[id]);
+    if (bodies[id]->state->Vf > 0) {
+      return bodies[id]->state->Vf + liqVolIterBody(bodies[id]);
     } else {
       return liqVolIterBody(bodies[id]);
     }
@@ -582,7 +582,7 @@
   FOREACH(const shared_ptr<Body>& b, *scene->bodies){
     if((mask>0 && (b->groupMask & mask)==0) or (!b)) continue;
     totalLiqVol += liqVolIterBody(b);
-    if (b->Vf > 0) {totalLiqVol +=b->Vf;}
+    if (b->state->Vf > 0) {totalLiqVol +=b->state->Vf;}
   }
   return totalLiqVol;
 }